func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mx = 2e5 + 10;   int a[mx];   vector<int> g[mx];   vector<int> lyr[mx];   bool cmp(int i, int j) { return g[i].size() < g[j].size(); }   int main() {     int n, t, k;     scanf( %d %d %d , &n, &t, &k);     a[0] = 1;     for (int i = 1; i <= t; i++) scanf( %d , a + i);     int from = 0;     int leafs = a[t];     for (int i = 0; i < t; i++) {       int to = from + a[i] - 1;       int l = to + 1;       int r = l + a[i + 1] - 1;       for (int x = 0; x < min(a[i], a[i + 1]); x++) g[from + x].push_back(l + x);       if (a[i] < a[i + 1]) {         for (int x = 0; x < a[i + 1] - a[i]; x++) {           g[to].push_back(r - x);         }       } else         leafs += a[i] - a[i + 1];       for (int x = from; x <= to; x++) lyr[i].push_back(x);       sort(lyr[i].begin(), lyr[i].end(), cmp);       from = l;     }     for (int i = 1; i < t; i++) {       int to = lyr[i].back();       for (int u : lyr[i])         if (u != to && !g[u].empty() && leafs < k) {           for (int v : g[u]) g[to].push_back(v);           g[u].clear();           leafs++;         }     }     if (leafs != k) {       puts( -1 );       return 0;     }     printf( %d n , n);     for (int i = 0; i < n; i++)       for (int j : g[i]) printf( %d %d n , i + 1, j + 1);     return 0;   }   