func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mN = 222222;   int n;   int a[mN], outa[mN], outb[mN], ge[mN];   vector<int> ans;   struct Bit {     int c[mN];     void clear() { memset(c, 0, sizeof(c)); }     int lob(int x) { return x & (-x); }     void add(int x, int dt) {       while (x <= n) {         c[x] += dt;         x += lob(x);       }     }     int sum(int x) {       int re = 0;       while (x > 0) {         re += c[x];         x -= lob(x);       }       return re;     }   } bit;   void calc(int o[]) {     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     bit.clear();     for (int i = n; i >= 1; i--) {       o[i] = bit.sum(a[i] + 1);       bit.add(a[i] + 1, 1);     }   }   int bins(int key) {     int l = 1, r = n;     key++;     while (l < r) {       int mid = (l + r) / 2;       if ((mid)-bit.sum(mid) >= key)         r = mid;       else         l = mid + 1;     }     return l - 1;   }   void out(int o[]) {     bit.clear();     for (int i = 1; i <= n; i++) {       int x = bins(o[i]);       ans.push_back(x);       bit.add(x + 1, 1);     }   }   int main() {     cin >> n;     calc(outa);     calc(outb);     for (int i = n - 1; i >= 1; i--) {       ge[i] += outa[i] + outb[i];       int mod = (n + 1) - i;       if (ge[i] >= mod) {         ge[i - 1] += ge[i] / mod;         ge[i] %= mod;       }     }     out(ge);     for (int i = 0, n_ = (ans.size()); i < n_; i++)       cout << ans[i] << ((i == ans.size() - 1) ?   n  :    );   }   