func_code_string: #include <bits/stdc++.h>   using namespace std;   long long parent[200001];   long long urank[200001];   void create(long long x) {     parent[x] = x;     urank[x] = 1;   }   long long find(long long x) {     if (parent[x] != x) {       parent[x] = find(parent[x]);     }     return parent[x];   }   void merge(long long x, long long y) {     long long xroot = find(x);     long long yroot = find(y);     if (urank[xroot] <= urank[yroot]) {       parent[xroot] = yroot;       urank[yroot] = urank[yroot] + urank[xroot];     } else {       parent[yroot] = xroot;       urank[xroot] = urank[xroot] + urank[yroot];     }   }   int main() {     std::ios::sync_with_stdio(false);     int T;     T = 1;     while (T--) {       int n, i, j, m;       cin >> n >> m;       long long ar[n + 1], a, b, c;       vector<pair<long long, int> > v;       vector<pair<long long, pair<int, int> > > v2;       for (i = 1; i <= n; ++i) {         create(i);         cin >> ar[i];         v.push_back({ar[i], i});       }       sort(v.begin(), v.end());       long long ans = 0;       for (i = 1; i < n; ++i) {         v2.push_back({v[0].first + v[i].first, {v[0].second, v[i].second}});       }       while (m--) {         cin >> a >> b >> c;         v2.push_back({c, {a, b}});       }       sort(v2.begin(), v2.end());       for (i = 0; i < v2.size(); ++i) {         a = find(v2[i].second.first);         b = find(v2[i].second.second);         if (a == b) continue;         ans = ans + v2[i].first;         merge(a, b);       }       cout << ans << endl;     }     return 0;   }   