func_code_string: #include <bits/stdc++.h>   struct node {     int a, b, w;   } p[200005];   int fa[200005];   bool d[200005];   bool cmp(node x, node y) { return x.w > y.w; }   int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }   int main() {     int n, m, ans = 0;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d%d , &p[i].a, &p[i].b, &p[i].w);     }     std::sort(p + 1, p + m + 1, cmp);     for (int i = 1; i <= n; i++) {       fa[i] = i;       d[i] = true;     }     for (int i = 1; i <= m; i++) {       int x = find(p[i].a);       int y = find(p[i].b);       if (x != y && (d[x] || d[y])) {         fa[y] = x;         ans += p[i].w;         d[x] = d[x] & d[y];       } else if (x == y && d[x]) {         d[x] = false;         ans += p[i].w;       }     }     printf( %d n , ans);     return 0;   }   