func_code_string: #include <bits/stdc++.h>   using namespace std;   inline bool ig(char c) { return c >=  0  && c <=  9 ; }   inline void read(int &oi) {     char c;     int f = 1, res = 0;     while (c = getchar(), (!ig(c)) && c !=  - )       ;     c ==  -  ? f = -1 : res = (c ^ 48);     while (c = getchar(), ig(c)) res = res * 10 + (c ^ 48);     oi = f * res;   }   inline void print(int oi) {     if (oi < 0) putchar( - ), oi = ~oi + 1;     if (oi > 9) print(oi / 10);     putchar(oi % 10 + 48);   }   int n, m, ans;   struct Edge {     int x, y, z;     bool operator<(const Edge &b) const { return z > b.z; }   } e[200005];   int fa[200005];   bool s[200005];   inline int gfa(int u) { return u ^ fa[u] ? fa[u] = gfa(fa[u]) : u; }   int main() {     read(n);     read(m);     for (int i = 1; i <= m; ++i) read(e[i].x), read(e[i].y), read(e[i].z);     sort(e + 1, e + 1 + m);     for (int i = 1; i <= n; ++i) fa[i] = i, s[i] = true;     for (int i = 1; i <= m; ++i) {       int fx = gfa(e[i].x), fy = gfa(e[i].y);       if ((fx ^ fy) && (s[fx] || s[fy]))         ans += e[i].z, fa[fx] = fy, s[fy] = s[fy] & s[fx];       else if (!(fx ^ fy) && s[fx])         s[fx] = false, ans += e[i].z;     }     print(ans);     putchar(  n );     return 0;   }   