func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize(2)   #pragma GCC optimize(3)   #pragma GCC optimize( Ofast )   #pragma GCC optimize( inline )   using std::pair;   using std::set;   using std::vector;   template <class T>   inline void read(T &x) {     T f = 1;     x = 0;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s >=  0  && s <=  9 ) {       x = (x << 1) + (x << 3) + (s & 15);       s = getchar();     }     x *= f;   }   template <class T>   inline T fabs(T a) {     return a > 0 ? a : -a;   }   template <class T>   inline T max(T a, T b) {     return a > b ? a : b;   }   template <class T>   inline T min(T a, T b) {     return a < b ? a : b;   }   template <class T>   inline T po(T a) {     return a * a;   }   const long long maxn = 1e6 + 5;   struct Edge {     long long u, v, w;   } e[maxn];   inline bool cmp(Edge a, Edge b) { return a.w > b.w; }   long long fa[maxn], m, n, cnt, fx, fy, ans, siz[maxn], MAX, val[maxn];   inline long long find(long long x) {     return (fa[x] == x) ? x : fa[x] = find(fa[x]);   }   signed main() {     read(n);     read(m);     for (long long i = 1; i <= n; i++) fa[i] = i, siz[i] = 1, read(val[i]);     for (long long i = 1; i <= m; i++)       read(e[i].u), read(e[i].v), e[i].w = min(val[e[i].u], val[e[i].v]);     std::sort(e + 1, e + m + 1, cmp);     for (long long i = 1; i <= m; i++) {       fx = find(e[i].u);       fy = find(e[i].v);       if (fx == fy) continue;       ans += siz[fx] * siz[fy] * e[i].w;       fa[fx] = fy;       siz[fy] += siz[fx];       cnt++;       if (cnt == (n - 1)) break;     }     MAX = ((n * (n - 1)) >> 1);     printf( %.6Lf , ((long double)(ans)) / ((long double)(MAX)));   }   