func_code_string: #include <bits/stdc++.h>   using namespace std;   multiset<long long> dd;   long long su;   long long revsum[100001];   struct tab {     long long l;     long long d;   } arr[100001];   long long findsumoftop(long long k) {     long long ans = 0;     multiset<long long>::iterator it = dd.begin();     while (k--) {       if (it == dd.end()) {         break;       } else {         ans += *it;         it++;       }     }     return -ans;   }   bool compare(const tab& t1, const tab& t2) { return t1.l < t2.l; }   int main() {     long long n;     cin >> n;     for (long long i = 0; i < n; ++i) cin >> arr[i].l;     for (long long i = 0; i < n; ++i) cin >> arr[i].d;     sort(arr, arr + n, compare);     for (long long i = n - 1; i >= 0; --i) revsum[i] = arr[i].d + revsum[i + 1];     long long st = 0;     long long en = 1;     long long ma = 300000000;     while (st < n) {       if (arr[st].l == arr[en].l)         en++;       else {         long long matmp = (su - findsumoftop(en - st - 1) + revsum[en]);         for (long long i = st; i < en; ++i) dd.insert(-arr[i].d), su += arr[i].d;         ma = min(ma, matmp);         st = en;         en++;       }     }     cout << ma << endl;     return 0;   }   