func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, t, k;   vector<int> g[200010];   int par[200010];   int nodeId;   int leaf;   vector<int> deep[200010];   int a[200010];   void createGraph(int x, int level) {     if (level > t) return;     for (int i = 1; i <= a[level]; i++) {       g[x].push_back(++nodeId);       par[nodeId] = x;       deep[level].push_back(nodeId);     }     leaf += a[level];     if (level != t) leaf--;     createGraph(nodeId, level + 1);   }   void adjust(int dp) {     queue<int> Q;     for (int i : deep[dp]) {       if (g[i].size() == 0) {         Q.push(i);       }     }     int size = deep[dp + 1].size();     for (int i = 0; i < size - 1; i++) {       if (Q.empty()) break;       if (leaf <= k) break;       int node = deep[dp + 1][i];       par[node] = Q.front();       Q.pop();       --leaf;     }   }   int main(int argc, char const *argv[]) {     nodeId = 1;     scanf( %d %d %d , &n, &t, &k);     for (int i = 1; i <= t; i++) {       scanf( %d , a + i);     }     createGraph(1, 1);     if (leaf < k) {       printf( -1 n );       exit(0);     }     for (int i = 1; i < t; i++) {       adjust(i);     }     if (leaf != k) {       printf( -1 n );       exit(0);     }     printf( %d n , n);     for (int i = 2; i <= n; i++) {       printf( %d %d n , par[i], i);     }     return 0;   }   