func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, pair<int, int> > a[200020];   int f[200020];   int v[200020];   int n, m;   int F(int x) {     if (f[x] == x) {       return x;     }     f[x] = F(f[x]);     v[f[x]] |= v[x];     return f[x];   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       f[i] = i;       v[i] = 0;     }     for (int i = 0; i < m; i++) {       scanf( %d%d%d , &a[i].second.first, &a[i].second.second, &a[i].first);     }     sort(a, a + m);     reverse(a, a + m);     long long ans = 0;     for (int i = 0; i < m; i++) {       int x = a[i].second.first;       int y = a[i].second.second;       x = F(x);       y = F(y);       if (x == y && v[x] == 0) {         v[x] = 1;         ans += a[i].first;       } else if (x != y && (v[x] == 0 || v[y] == 0)) {         v[y] |= v[x];         f[x] = y;         ans += a[i].first;       }     }     cout << ans << endl;     return 0;   }   