func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1000000000000000;   bool sortCct(pair<long long, long long> a, pair<long long, long long> b) {     return a.first > b.first;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, i, t, g, c = 0;     cin >> n;     vector<long long> ct(n);     vector<pair<long long, long long> > ctt(n);     map<long long, long long> fr;     for (i = 0; i < n; i++) cin >> ct[i];     for (i = 0; i < n; i++) {       cin >> t;       ctt[i] = pair<long long, long long>(t, ct[i]);     }     sort(ctt.begin(), ctt.end(), sortCct);     fr[INF] = 1;     for (i = 0; i < n; i++) {       pair<long long, long long> k = ctt[i];       auto it = fr.lower_bound(k.second);       g = max(k.second, it->second);       c += (g - k.second) * k.first;       if (g == it->second and g == it->first)         fr.erase(it);       else if (g == it->second)         it->second++;       else if (g == it->first) {         fr[it->first - 1] = it->second;         fr.erase(it);       } else {         fr[g - 1] = it->second;         it->second = g + 1;       }     }     cout << c <<   n ;     return 0;   }   