func_code_string: #include <bits/stdc++.h>   using namespace std;   struct fenwick_tree_t {     vector<int> t;     void init(int n) { t.assign(n, 0); }     void inc(int pos, int x = 1) {       while (pos < (int)t.size()) {         t[pos] += x;         pos = pos | (pos + 1);       }     }     int get(int pos) const {       int ret = 0;       while (pos >= 0) {         ret += t[pos];         pos = (pos & (pos + 1)) - 1;       }       return ret;     }   };   vector<int> ord(vector<int> const &a) {     fenwick_tree_t tree;     tree.init(a.size() + 1);     vector<int> ret(a.size(), 0);     for (int i = (int)ret.size() - 1; i >= 0; --i) {       ret[i] = tree.get(a[i]);       tree.inc(a[i]);     }     return ret;   }   ostream &operator<<(ostream &out, vector<int> const &a) {     for (int x : a) out << x <<    ;     return out;   }   vector<int> solve(vector<int> const &a, vector<int> const &b) {     vector<int> ord_a = ord(a);     vector<int> ord_b = ord(b);     vector<int> ord_ans(ord_a.size(), 0);     for (int i = 0; i < (int)ord_ans.size(); ++i)       ord_ans[i] = ord_a[i] + ord_b[i];     reverse(ord_ans.begin(), ord_ans.end());     for (int i = 0; i < (int)ord_ans.size(); ++i) {       if (ord_ans[i] >= i + 1) {         if (i + 1 < (int)ord_ans.size()) ++ord_ans[i + 1];         ord_ans[i] -= i + 1;       }     }     reverse(ord_ans.begin(), ord_ans.end());     vector<int> ans(ord_ans.size(), 0);     fenwick_tree_t t;     t.init(ord_ans.size() + 1);     for (int i = 0; i < (int)ans.size(); ++i) t.inc(i);     for (int i = 0; i < (int)ans.size(); ++i) {       int l = -1, r = ans.size() - 1;       while (r - l > 1) {         int m = (l + r) / 2;         if (t.get(m) < ord_ans[i] + 1) {           l = m;         } else {           r = m;         }       }       t.inc(r, -1);       ans[i] = r;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     vector<int> a(n), b(n);     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     cout << solve(a, b) << endl;     return 0;   }   