func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int MAX_N = 200002;   int n;   int a[MAX_N], t[MAX_N];   void solve() {     vector<pair<int, int>> v;     for (int i = 0; i < n; ++i) v.emplace_back(a[i], t[i]);     sort(v.begin(), v.end());     ll cur = -1;     int idx = 0;     multiset<ll> eq;     ll ans = 0, sum = 0;     while (idx < n || !eq.empty()) {       if (eq.empty()) cur = v[idx].first;       while (idx < n && v[idx].first == cur) {         sum += v[idx].second;         eq.insert(-v[idx].second);         idx++;       }       sum += *eq.begin();       eq.erase(eq.begin());       ans += sum;       cur++;     }     cout << ans <<   n ;   }   int main() {     cin >> n;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> t[i];     solve();     return 0;   }   