func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   int d[100005];   int pr[100005];   int cnt[100005];   int a[100005];   vector<int> g[100005];   int b[100005];   int main() {     int n, i, j;     scanf( %d , &n);     for (i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       ++cnt[a[i]];     }     for (i = 1; i <= n; ++i) {       int x;       scanf( %d , &x);       d[a[i]] += x;       g[a[i]].push_back(x);     }     for (i = 100000; i > 0; --i) {       pr[i] = pr[i + 1] + d[i];     }     int tot = 0;     int ans = 1000000000;     for (i = 1; i <= 100000; ++i) {       if (cnt[i] == 0) continue;       int cost = pr[i + 1];       int need = tot + cnt[i] - (cnt[i] * 2 - 1);       for (j = 1; j <= 200; ++j) {         if (need <= 0) break;         if (need - b[j] >= 0) {           need -= b[j];           cost += j * b[j];         } else {           cost += need * j;           need = 0;           break;         }       }       if (cost < ans) {         ans = cost;       }       for (j = 0; j < g[i].size(); ++j) {         ++b[g[i][j]];       }       tot += cnt[i];     }     cout << ans;     return 0;   }   