func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = (1 << 18);   struct segment {    private:     static const int maxn = (1 << 18);     int arr[2 * maxn];     int private_sum(int node, int first, int last, int a, int b) {       if (first >= a && last <= b) return arr[node];       if (a >= last || b <= first) return 0;       int mid = (first + last) / 2;       return private_sum(2 * node, first, mid, a, b) +              private_sum(2 * node + 1, mid, last, a, b);     }       public:     void add(int ja, int megh) {       ja += maxn;       while (ja > 0) {         arr[ja] += megh;         ja /= 2;       }     }     int sum(int first, int last) {       return private_sum(1, maxn, 2 * maxn, maxn + first, maxn + last);     }     int nth(int n) {       int node = 1, zir = maxn;       while (zir > 1) {         if (n < zir / 2 - arr[2 * node]) {           node *= 2;         } else {           n -= zir / 2 - arr[2 * node];           node = 2 * node + 1;         }         zir /= 2;       }       return node - maxn;     }   } p_fir, p_sec, s;   int a[maxn], b[maxn], out[maxn];   void find_ab(int x, int n) {     int fir = a[x], sec = b[x];     p_fir.add(fir, 1);     p_sec.add(sec, 1);     a[x] -= p_fir.sum(0, fir);     b[x] -= p_sec.sum(0, sec);   }   void find_out(int n) {     for (int i = 0; i < n; i++) {       find_ab(i, n);     }     int bgh = 0;     for (int i = n - 1; i >= 0; i--) {       out[i] = bgh + a[i] + b[i];       if (out[i] >= n - i) {         bgh = 1;         out[i] -= (n - i);       } else         bgh = 0;     }     for (int i = 0; i < n; i++) {       out[i] = s.nth(out[i]);       s.add(out[i], 1);     }   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) cin >> b[i];     find_out(n);     for (int i = 0; i < n; i++) cout << out[i] <<    ;     cout << endl;     return 0;   }   