func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   vector<pair<long long, int> > vertices;   bool cmp(pair<long long, int> x, pair<long long, int> y) {     return x.first < y.first;   }   bool cmp2(pair<long long, pair<int, int> > x,             pair<long long, pair<int, int> > y) {     return x.first < y.first;   }   int lab[200010];   vector<pair<long long, pair<int, int> > > ed;   void uni(int r1, int r2) {     int x = lab[r1] + lab[r2];     if (lab[r1] < lab[r2]) {       lab[r1] = x;       lab[r2] = r1;     } else {       lab[r2] = x;       lab[r1] = r2;     }   }   int get(int x) {     if (lab[x] < 0) return x;     lab[x] = get(lab[x]);     return lab[x];   }   static int desyncIO = []() {     std::ios::sync_with_stdio(false);     std::cout.tie(nullptr);     std::cin.tie(nullptr);     return 0;   }();   int main() {     ios::sync_with_stdio(false);     memset(lab, -1, sizeof(lab));     cin >> n >> m;     for (int i = 1; i <= n; i++) {       long long x;       cin >> x;       vertices.push_back(make_pair(x, i));     }     sort(vertices.begin(), vertices.end(), cmp);     for (int i = 1; i < n; i++) {       int u = vertices[0].second;       int v = vertices[i].second;       long long w = vertices[0].first + vertices[i].first;       ed.push_back(make_pair(w, make_pair(u, v)));     }     for (int i = 1; i <= m; i++) {       int u, v;       long long w;       cin >> u >> v >> w;       ed.push_back(make_pair(w, make_pair(u, v)));     }     sort(ed.begin(), ed.end(), cmp2);     long long ret = 0;     for (int i = 0; i < ed.size(); i++) {       int u = ed[i].second.first;       int v = ed[i].second.second;       long long w = ed[i].first;       int r1 = get(u);       int r2 = get(v);       if (r1 != r2) {         ret += w;         uni(r1, r2);       }     }     cout << ret;     return 0;   }   