func_code_string: #include <bits/stdc++.h>   template <typename A, typename B>   inline char smax(A &a, const B &b) {     return a < b ? a = b, 1 : 0;   }   template <typename A, typename B>   inline char smin(A &a, const B &b) {     return b < a ? a = b, 1 : 0;   }   template <typename I>   inline void read(I &x) {     int f = 0, c;     while (!isdigit(c = getchar())) c ==  -  ? f = 1 : 0;     x = c & 15;     while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);     f ? x = -x : 0;   }   const int N = 1e5 + 7;   int n;   int b[N], s[N], id[N << 1], pre[N << 1];   struct wph {     int d, id;   } a[N];   inline void add(int x, int fa, int tag = 1) {     if (tag) s[x] = s[fa] + 1, b[s[x]] = x;     printf( %d %d n , x, fa);   }   inline void work() {     std::sort(a + 1, a + n + 1,               [](const wph &a, const wph &b) { return a.d > b.d; });     for (int i = 1; i < n; ++i)       printf( %d %d n , a[i].id * 2 - 1, a[i + 1].id * 2 - 1);     for (int i = 1; i <= n; ++i) id[i] = a[i].id * 2 - 1;     int nn = n;     for (int i = 1; i <= n; ++i)       if (i + a[i].d - 1 < nn)         printf( %d %d n , id[i] + 1, id[i + a[i].d - 1]);       else         id[++nn] = id[i] + 1, printf( %d %d n , id[nn], id[nn - 1]);   }   inline void init() {     read(n);     for (int i = 1; i <= n; ++i) read(a[i].d), a[i].id = i;   }   int main() {     init();     work();     fclose(stdin), fclose(stdout);     return 0;   }   