func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6, SZ = 800, INF = 1 << 29;   const long long LINF = (1LL << 60), mod = 1e9 + 7;   const long double eps = 1e-8, PI = acos(-1.0);   inline int dcmp(double x, double y = 0.0) { return abs(x - y) < eps; }   template <typename Type>   inline Type ru(Type &v) {     static char READ_DATA;     static int SIGNAL_INPUT = 1;     while ((READ_DATA = getchar()) <  0  || READ_DATA >  9 )       if (READ_DATA ==  - )         SIGNAL_INPUT = -1;       else if (READ_DATA == EOF)         return EOF;     v = READ_DATA -  0 ;     while ((READ_DATA = getchar()) >=  0  && READ_DATA <=  9 )       v = v * 10 + READ_DATA -  0 ;     v *= SIGNAL_INPUT;     return v;   }   template <typename A, typename B>   inline int ru(A &x, B &y) {     if (ru(x) == EOF) return EOF;     ru(y);     return 2;   }   template <typename A, typename B, typename C>   inline int ru(A &x, B &y, C &z) {     if (ru(x) == EOF) return EOF;     ru(y);     ru(z);     return 3;   }   long long gcd(long long a, long long b) {     a = abs(a);     b = abs(b);     while (b) {       a %= b;       swap(a, b);     }     return a;   }   const int maxn = 1e6 + 5;   int n, a[maxn], m, d[maxn], id[maxn];   int cmp(const int &i, const int &j) { return d[(i + 1) / 2] > d[(j + 1) / 2]; }   int main() {     ru(n);     for (int i = 1; i <= n; i++) {       ru(d[i]);     }     for (int i = 1; i < 2 * n; i += 2) {       a[++m] = i;     }     sort(a + 1, a + m + 1, cmp);     for (int i = 2; i <= m; i++) {       printf( %d %d n , a[i - 1], a[i]);     }     for (int i = 1; i <= n; i++) {       int j = (a[i] + 1) / 2;       if (i + d[j] - 1 <= m) {         printf( %d %d n , 2 * j, a[i + d[j] - 1]);         if (i + d[j] - 1 == m) {           a[++m] = 2 * j;         }       } else {         printf( %d %d n , 2 * j, a[i - d[j] + 1]);       }     }   }   