func_code_string: #include <bits/stdc++.h>   using namespace std;   int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int n, t, k;   int a[200005], maxx, b[200005];   vector<int> v[200005];   int cnt = 1, tmp = 0;   int main() {     n = read();     t = read();     k = read();     for (int i = 1; i <= t; ++i) a[i] = read();     for (int i = t; i >= 1; --i) {       maxx += abs(min(0, a[i + 1] - a[i]));       if (i == t)         b[i] = a[i];       else         b[i] = b[i + 1] + a[i] - 1;     }     v[0].push_back(1);     if (k < maxx || k > n - t) {       printf( -1 n );       return 0;     } else {       printf( %d n , n);       for (int i = 1; i <= t; ++i) {         if (k < n - t - tmp) {           v[i].push_back(++cnt);           printf( %d %d n , v[i - 1][0], v[i][0]);           a[i]--;           for (int j = 1; j < v[i - 1].size() && a[i] && k < n - t - tmp; ++j) {             v[i].push_back(++cnt);             printf( %d %d n , v[i - 1][j], v[i][j]);             tmp++;             a[i]--;           }           if (a[i]) {             for (int j = 1; j <= a[i]; ++j) {               v[i].push_back(++cnt);               printf( %d %d n , cnt, v[i - 1][0]);             }           }         } else {           for (int j = 1; j <= a[i]; ++j) {             v[i].push_back(++cnt);             printf( %d %d n , cnt, v[i - 1][0]);           }         }       }     }   }   