func_code_string: #include <bits/stdc++.h>   using namespace std;   struct comp {     bool operator()(long long int a, long long int b) { return a > b; }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int n, k;     cin >> n >> k;     vector<pair<long long int, long long int> > pow(n);     vector<long long int> mon(n);     vector<long long int> res(n);     priority_queue<long long int, vector<long long int>, comp> least;     for (int(i) = (0); (i) < (n); (i)++) {       long long int power;       cin >> power;       pow[i] = make_pair(power, i);     }     sort(pow.begin(), pow.end());     for (int(i) = (0); (i) < (n); (i)++) {       cin >> mon[i];     }     if (k == 0) {       for (int(i) = (0); (i) < (n); (i)++) {         if (i)           cout <<     << mon[i];         else           cout << mon[i];       }       return 0;     }     least.push(mon[pow[0].second]);     res[pow[0].second] = mon[pow[0].second];     for (int(i) = (1); (i) < (min(n, k + 1)); (i)++) {       res[pow[i].second] = res[pow[i - 1].second] + mon[pow[i].second];       least.push(mon[pow[i].second]);     }     for (int(i) = (k + 1); (i) < (n); (i)++) {       long long int toremove = least.top();       least.pop();       res[pow[i].second] = res[pow[i - 1].second] + mon[pow[i].second] - toremove;       least.push(mon[pow[i].second]);     }     for (int(i) = (0); (i) < (n); (i)++) {       if (i)         cout <<     << res[i];       else         cout << res[i];     }     return 0;   }   