func_code_string: #include <bits/stdc++.h>   using namespace std;   int mark[2000010 * 2];   int tree[2000010 * 4];   bool emerged[2000010 * 2];   void insert(int l, int r, int i, int ind, int num) {     tree[ind] += num;     if (l == r) return;     int mid = (l + r) / 2;     if (i <= mid) insert(l, mid, i, ind * 2, num);     if (i > mid) insert(mid + 1, r, i, ind * 2 + 1, num);   }   int find(int l, int r, int y, int ind) {     if (l == r) return l;     int mid = (l + r) / 2;     if (tree[ind * 2] >= y) {       return find(l, mid, y, ind * 2);     } else {       return find(mid + 1, r, y - tree[ind * 2], ind * 2 + 1);     }   }   int main() {     memset(tree, 0, sizeof(tree));     memset(emerged, 0, sizeof(emerged));     memset(mark, 0, sizeof(mark));     int n, m;     scanf( %d%d , &n, &m);     for (int i = n + 1; i <= 2 * n; ++i) insert(1, 2 * n, i, 1, 1);     int x, y;     for (int i = 0; i < m; i++) {       scanf( %d%d , &x, &y);       int place = find(1, 2 * n, y, 1);       if (((mark[place] > 0) || emerged[x]) && (mark[place] != x)) {         cout << -1 << endl;         return 0;       }       insert(1, 2 * n, place, 1, -1);       insert(1, 2 * n, n - i, 1, 1);       mark[n - i] = mark[place] = x;       emerged[x] = true;     }     int j = 1;     for (int i = n + 1; i <= 2 * n; i++) {       int tmp;       if (mark[i] > 0)         tmp = mark[i];       else {         while (emerged[j]) j++;         tmp = j;         j++;       }       printf( %d  , tmp);     }     printf(  n );     return 0;   }   