func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   struct P {     int x, y;     bool operator<(const P &a) const { return x > a.x; }   } a[N];   int main() {     static int n, b[N * 2];     cin >> n;     for (int i = 1; i <= n; i++) scanf( %d , (int *)(a + i)), a[i].y = i * 2 - 1;     sort(a + 1, a + 1 + n);     for (int i = 1; i < n; i++) printf( %d %d n , a[i].y, a[i + 1].y);     for (int i = 1; i <= n; i++) b[i] = a[i].y;     for (int i = 1, aid, *bid; i <= n; i++) {       aid = a[i].y + 1, bid = b + i + a[i].x;       if (!*bid)         printf( %d %d n , aid, *(bid - 1)), *bid = aid;       else         printf( %d %d n , aid, *--bid);     }     return 0;   }   