func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     std::cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     std::cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   template <typename T, typename U>   static inline void amin(T& x, U y) {     if (y < x) x = y;   }   template <typename T, typename U>   static inline void amax(T& x, U y) {     if (x < y) x = y;   }   long long max(long long a, long long b) { return (a > b) ? a : b; }   long long min(long long a, long long b) { return (a < b) ? a : b; }   const long long N = 1e5 + 10;   long long solve() {     long long n;     cin >> n;     long long l[n], d[n];     for (long long i = 0; i < n; ++i) cin >> l[i];     for (long long i = 0; i < n; ++i) cin >> d[i];     long long arr[210];     memset(arr, 0, sizeof(arr));     for (long long i = 0; i < n; i++) arr[d[i]]++;     vector<long long> len[N];     for (long long i = 0; i < n; i++) {       len[l[i]].push_back(d[i]);     }     long long ans = 1e9;     long long cnt = 0;     for (long long i = N - 1; i > 0; i--) {       if (len[i].size()) {         for (auto j : len[i]) arr[j]--;         long long z = len[i].size();         long long maxi = max(0, (n - z - (z - 1)));         long long sum = cnt;         for (long long j = 1; j <= 200; j++) {           if (maxi == 0) break;           if (arr[j]) {             sum += j * min(arr[j], maxi);             maxi -= min(maxi, arr[j]);           }         }         if (maxi == 0) {           amin(ans, sum);         }         n -= len[i].size();         for (auto j : len[i]) cnt += j;       }     }     cout << ans;     return 0;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       solve();     }     return 0;   }   