func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     for (; ch <  0  || ch >  9 ; ch = getchar())       if (ch ==  - ) f = -1;     for (; ch >=  0  && ch <=  9 ; ch = getchar())       x = (x << 1) + (x << 3) + ch -  0 ;     return x * f;   }   const int N = 2e5 + 5;   struct BIT {     int tree[N];     void add(int x) {       for (; x < N; x += x & -x) ++tree[x];     }     int query(int x) {       int res = 0;       for (; x; x -= x & -x) res += tree[x];       return res;     }   } bit;   struct SegmentTree {     int size[N << 2];     void build(int cur, int l, int r) {       if (l == r) {         size[cur] = 1;         return;       }       build((cur << 1), l, (l + r >> 1));       build((cur << 1 | 1), (l + r >> 1) + 1, r);       size[cur] = size[(cur << 1)] + size[(cur << 1 | 1)];     }     int kth(int cur, int l, int r, int k) {       if (l == r) {         size[cur] = 0;         return l;       }       int res = 0;       if (k <= size[(cur << 1)])         res = kth((cur << 1), l, (l + r >> 1), k);       else         res = kth((cur << 1 | 1), (l + r >> 1) + 1, r, k - size[(cur << 1)]);       size[cur] = size[(cur << 1)] + size[(cur << 1 | 1)];       return res;     }   } sgt;   int p[N];   int main() {     int n = read();     for (int i = 1; i <= n; ++i) {       int x = read();       p[i] += x - bit.query(x);       bit.add(x + 1);     }     memset(bit.tree, 0, sizeof(bit.tree));     for (int i = 1; i <= n; ++i) {       int x = read();       p[i] += x - bit.query(x);       bit.add(x + 1);     }     for (int i = n; i >= 1; --i) {       p[i - 1] += p[i] / (n - i + 1);       p[i] %= (n - i + 1);     }     sgt.build(1, 1, n);     for (int i = 1; i <= n; ++i) printf( %d  , sgt.kth(1, 1, n, p[i] + 1) - 1);     return 0;   }   