func_code_string: #include <bits/stdc++.h>   class arr {     bool* marked;     int* nummarked;     int markednumber;       public:     arr() {       marked = new bool[1000000];       for (int i = 0; i < 1000000; i++) {         marked[i] = false;       }       nummarked = new int[1000];       for (int i = 0; i < 1000; i++) {         nummarked[i] = 0;       }       markednumber = 0;     }     void mark(int i) {       marked[i] = true;       nummarked[i / 1000]++;       markednumber++;     }     int position(int i) {       int pr = 0;       for (int j = 0; j < (i / 1000); j++) {         pr += 1000;         pr -= nummarked[j];       }       for (int j = (i / 1000 * 1000); j < i; j++) {         if (!marked[j]) {           pr++;         }       }       return pr;     }     int number(int i) {       int sh = 0;       int tek = 0;       while ((i - sh - (1000 - nummarked[tek / 1000])) >= 0) {         sh += (1000 - nummarked[tek / 1000]);         tek += 1000;       }       while (i > sh) {         if (!marked[tek]) {           sh++;         }         tek++;       }       while (marked[tek]) tek++;       return tek;     }   };   const int max = 200000;   int main() {     int n;     scanf( %d , &n);     int* p1 = new int[n];     int* p2 = new int[n];     for (int i = 0; i < n; i++) scanf( %d , (p1 + i));     for (int i = 0; i < n; i++) scanf( %d , (p2 + i));     int* i1 = new int[max];     {       arr ist;       for (int i = 0; i < (n - 1); i++) {         i1[i] = ist.position(p1[i]);         ist.mark(p1[i]);       }     }     int* i2 = new int[max];     {       arr ist2;       for (int i = 0; i < (n - 1); i++) {         i2[i] = ist2.position(p2[i]);         ist2.mark(p2[i]);       }     }     int* is = new int[max];     for (int i = 0; i < (n - 1); i++) {       is[i] = i1[i] + i2[i];     }     for (int j = (n - 2); j > 0; j--) {       while (is[j] > (n - 1 - j)) {         is[j] -= (n - j);         is[j - 1]++;       }     }     while (is[0] > (n - 1)) {       is[0] -= n;     }     int* ps = new int[n];     for (int i = 0; i < n; i++) {       ps[i] = 0;     }     arr ists;     for (int i = 0; i < (n - 1); i++) {       ps[i] = ists.number(is[i]);       ists.mark(ps[i]);     }     ps[n - 1] = ists.number(0);     for (int i = 0; i < n; i++) {       printf( %d  , ps[i]);     }     return 0;   }   