func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, t, k, cnt = 0;   int a[200005], st[200005];   struct hehe {     int x, y;   } e[200005];   void add(int x, int y) {     cnt++;     e[cnt].x = x;     e[cnt].y = y;   }   void solve() {     int i, j;     int minn = 1, maxx = 1;     a[0] = 1;     st[0] = 1;     for (i = 1; i <= t; i++) {       maxx = maxx + a[i] - 1;       st[i] = st[i - 1] + a[i - 1];       if (a[i] >= a[i - 1]) minn += a[i] - a[i - 1];     }     if (minn > k || maxx < k) {       printf( -1 n );       return;     }     printf( %d n , n);     for (i = st[1]; i <= st[1] + a[1] - 1; i++) add(1, i);     for (i = 1; i <= t - 1; i++) {       if (minn < k) {         for (j = 1; j <= a[i + 1] - a[i] && j <= a[i + 1]; j++)           add(st[i], st[i + 1] + j - 1);         int zuida;         if (a[i + 1] >= a[i])           zuida = a[i] - 1;         else           zuida = a[i + 1] - 1;         if (minn + zuida < k) {           int delta = max(0, a[i + 1] - a[i]);           minn += zuida;           for (j = st[i + 1] + delta; j <= st[i + 1] + a[i + 1] - 1; j++)             add(st[i], j);         } else {           int delta = max(0, a[i + 1] - a[i]);           int xiaid;           int zhiqian;           if (a[i + 1] >= a[i])             zhiqian = 0;           else             zhiqian = a[i] - a[i + 1];           for (j = 1; j <= a[i] - (zhiqian + (k - minn)); j++) {             xiaid = st[i + 1] + delta + j - 1;             add(st[i] + j - 1, xiaid);           }           for (j = xiaid + 1; j <= st[i + 1] + a[i + 1] - 1; j++) add(st[i], j);           minn = k;         }       } else {         for (j = 1; j <= a[i + 1] - a[i]; j++) add(st[i], st[i + 1] + j - 1);         int id = st[i];         int delta = max(0, a[i + 1] - a[i]);         for (j = st[i + 1] + delta; j <= st[i + 1] + a[i + 1] - 1; j++) {           add(id, j);           id++;         }       }     }     for (i = 1; i <= cnt; i++) cout << e[i].x <<     << e[i].y << endl;   }   int main() {     while (scanf( %d%d%d , &n, &t, &k) != EOF) {       int i;       cnt = 0;       for (i = 1; i <= t; i++) scanf( %d , &a[i]);       solve();     }     return 0;   }   