func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, fwt[262144];   vector<int> a1, b1, c1, d1, e1, ans;   void add(int x, int k) {     for (; x < 262144; x += x & -x) {       fwt[x] += k;     }   }   int sum(int x) {     int res = 0;     for (; x; x -= x & -x) {       res += fwt[x];     }     return res;   }   int findSidx(int sum) {     int x = 0;     for (int j = 262144 / 2; j; j /= 2) {       if (sum >= fwt[x + j]) {         sum -= fwt[x + j];         x += j;       }     }     return x;   }   vector<int> deB(vector<int>& a) {     memset(fwt, 0, sizeof fwt);     vector<int> res;     for (int i = 0; i < n; ++i) {       add(i + 1, 1);     }     for (int i = 0; i < n; ++i) {       add(a[i] + 1, -1);       res.push_back(sum(a[i] + 1));     }     return res;   }   void makeA() {     memset(fwt, 0, sizeof fwt);     ans.resize(n, 0);     for (int i = 0; i < n; ++i) {       add(i + 1, 1);     }     for (int i = 0; i < n; ++i) {       ans[i] = findSidx(e1[i]);       add(ans[i] + 1, -1);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     a1.resize(n);     b1.resize(n);     e1.resize(n, 0);     for (int i = 0; i < n; ++i) {       cin >> a1[i];     }     for (int j = 0; j < n; ++j) {       cin >> b1[j];     }     c1 = deB(a1), d1 = deB(b1);     for (int i = n - 1; i >= 0; --i) {       e1[i] += c1[i] + d1[i];       if (i) {         e1[i - 1] += e1[i] / (n - i);       }       e1[i] %= (n - i);     }     makeA();     for (int i = 0; i < n; ++i) {       cout << ans[i] <<    ;     }     return 0;   }   