func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<long long, pair<long long, long long> > > edges;   vector<long long> wt(100005);   long long sz[100005], parent[100005];   long long ans = 0;   long long n, m;   void make_set() {     for (long long i = 1; i <= n; i++) {       sz[i] = 1;       parent[i] = i;     }   }   long long findParent(long long x) {     if (x == parent[x]) return x;     return findParent(parent[x]);   }   void merge_sets(long long x, long long y, long long w) {     x = findParent(x);     y = findParent(y);     if (x == y) return;     ans += w * sz[x] * sz[y];     if (sz[x] > sz[y]) {       parent[y] = x;       sz[x] += sz[y];     } else {       parent[x] = y;       sz[y] += sz[x];     }   }   int main() {     cin >> n >> m;     for (long long i = 1; i <= n; i++) cin >> wt[i];     for (long long i = 1; i <= m; i++) {       long long x, y;       cin >> x >> y;       edges.push_back(make_pair(min(wt[x], wt[y]), make_pair(x, y)));     }     sort(edges.begin(), edges.end());     reverse(edges.begin(), edges.end());     make_set();     for (long long i = 0; i < m; i++) {       merge_sets(edges[i].second.first, edges[i].second.second, edges[i].first);     }     double anss = (double)ans;     anss /= (double)n;     anss /= (double)(n - 1);     anss *= 2.00;     cout << fixed << setprecision(10) << anss << endl;     return 0;   }   