func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX = 2e5 + 10;   long long arr[MAX], arr2[MAX];   int n;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 0; i < n; ++i) cin >> arr[i];     for (int i = 0; i < n; ++i) cin >> arr2[i];     vector<pair<long long, long long> > vp;     for (int i = 0; i < n; ++i) vp.push_back({arr[i], arr2[i]});     sort(vp.begin(), vp.end());     for (int i = 0; i < n; ++i) arr[i] = vp[i].first, arr2[i] = vp[i].second;     int idx = 0;     int cur = arr[0];     long long ans = 0, sum = 0;     priority_queue<long long> q;     while (1) {       ans += sum;       while (idx < n && cur == arr[idx]) {         sum += arr2[idx];         q.push(arr2[idx]);         idx++;       }       if (q.size() == 0) {         if (idx == n) break;         cur = arr[idx];       } else {         long long x = q.top();         q.pop();         sum -= x;         cur++;       }     }     return cout << ans <<   n , 0;   }   