func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     static int r, sign;     static char c;     r = 0, sign = 1;     do c = getchar();     while (c !=  -  && (c <  0  || c >  9 ));     if (c ==  - ) sign = -1, c = getchar();     while (c >=  0  && c <=  9 ) r = r * 10 + (int)(c -  0 ), c = getchar();     return sign * r;   }   template <typename T>   inline void print(T *a, int n) {     for (int i = 1; i < n; ++i) cout << a[i] <<    ;     cout << a[n] << endl;   }   struct inedge {     int a, b, w;     inline bool operator<(const inedge &x) const { return w < x.w; }   } ie[100000 + 1], p[100000 + 1];   struct edge {     int next, node;   } e[100000 << 1 | 1];   int head[100000 + 1], tot = 0;   inline void addedge(int a, int b) {     e[++tot].next = head[a];     head[a] = tot, e[tot].node = b;   }   int n, m, a[100000 + 1];   int f[100000 + 1], size[100000 + 1];   int find(int x) {     if (f[x] == x) return x;     int fa = f[x];     f[x] = find(fa);     return f[x];   }   void fusion(int a, int b) {     a = find(a), b = find(b);     f[a] = b, size[b] += size[a];   }   int main(int argc, char *argv[]) {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     for (int i = 1; i <= m; ++i) {       int x, y;       scanf( %d%d , &x, &y);       ie[i].a = x, ie[i].b = y, ie[i].w = min(a[x], a[y]);     }     sort(ie + 1, ie + m + 1);     for (int i = 1; i <= n; ++i) f[i] = i;     int cnt = 0;     for (int i = m; i > 0; --i)       if (find(ie[i].a) != find(ie[i].b)) {         f[find(ie[i].a)] = find(ie[i].b);         addedge(ie[i].a, ie[i].b);         addedge(ie[i].b, ie[i].a);         p[++cnt] = ie[i];       }     long long ans = 0LL;     for (int i = 1; i <= n; ++i) f[i] = i, size[i] = 1;     for (int i = 1; i <= cnt; ++i) {       ans += (long long)p[i].w * size[find(p[i].a)] * size[find(p[i].b)];       fusion(p[i].a, p[i].b);     }     cout << fixed << setprecision(10) << (double)ans * 2LL / n / (n - 1) << endl;     fclose(stdin);     fclose(stdout);     return 0;   }   