func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e5 + 5;   char C[MAXN][20][20];   long long aans[MAXN];   struct node {     long long u, v, val, way;     node() {}     node(long long a, long long b, long long c) {       u = a;       v = b;       val = c;     }   };   vector<node> v;   vector<int> vv[MAXN];   long long fa[MAXN * 10];   bool cmp(node a, node b) { return a.val < b.val; }   long long getf(long long x) {     if (x == fa[x])       return x;     else       return fa[x] = getf(fa[x]);   }   void add(long long a, long long b) { fa[getf(a)] = getf(fa[b]); }   void dfs(long long x, long long fa) {     long long len = vv[x].size();     for (long long i = 0; i < len; i++) {       long long to = vv[x][i];       if (to != fa) {         cout << to <<     << x << endl;         dfs(to, x);       }     }   }   int main() {     long long n, m, k, w;     cin >> n >> m >> k >> w;     for (long long k1 = 1; k1 <= k; k1++) {       for (long long i = 1; i <= n; i++) {         cin >> C[k1][i] + 1;       }     }     for (long long k1 = 1; k1 <= k; k1++) {       for (long long k2 = k1 + 1; k2 <= k; k2++) {         long long num = 0;         for (long long i = 1; i <= n; i++) {           for (long long j = 1; j <= m; j++) {             if (C[k1][i][j] != C[k2][i][j]) num++;           }         }         v.push_back(node(k1, k2, num * w));       }     }     for (long long i = 1; i <= k; i++) {       v.push_back(node(0, i, n * m));     }     long long ans = 0;     for (long long i = 1; i <= k; i++) {       fa[i] = i;     }     sort(v.begin(), v.end(), cmp);     for (long long i = 0; i < v.size(); i++) {       long long aa = v[i].u, cc = v[i].val;       long long bb = v[i].v;       if (getf(aa) != getf(bb)) {         add(aa, bb);         ans += cc;         vv[aa].push_back(bb);         vv[bb].push_back(aa);       }     }     cout << ans << endl;     dfs(0, 0);   }   