func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(nullptr);     int n, k, left = 0, i;     long long int temp;     cin >> n >> k;     vector<int> task(k, 0);     vector<pair<int, int>> idl(n, make_pair(0, 0));     for (i = 0; i < n; i++) {       cin >> temp;       task[temp - 1]++;       idl[i].first = temp;     }     for (i = 0; i < k; i++) left += (int)(task[i] == 0);     for (i = 0; i < n; i++) {       cin >> temp;       if (task[idl[i].first - 1] == 1) temp = INT_MAX;       idl[i].second = temp;     }     if (!left) {       cout << 0 << endl;       return 0;     }     sort(idl.begin(), idl.end(),          [](const pair<int, int> &left, const pair<int, int> &right) {            return left.second < right.second;          });     temp = 0;     for (i = 0; i < n && left; i++) {       if (task[idl[i].first - 1] > 1) {         temp += idl[i].second;         task[idl[i].first - 1]--;         left--;       }     }     cout << temp << endl;     return 0;   }   