func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     vector<pair<pair<long long, long long>, long long>> v;     long long n, k;     cin >> n >> k;     long long p[n], c[n], ans[n];     for (int i = 0; i < n; i++) cin >> p[i];     for (int i = 0; i < n; i++) {       cin >> c[i];       ans[i] = c[i];     }     for (int i = 0; i < n; i++) {       v.push_back({{p[i], c[i]}, i});     }     sort(v.begin(), v.end());     multiset<long long, greater<long long>> s;     for (int i = 0; i < n; i++) {       pair<long long, long long> x = v[i].first;       long long in = v[i].second;       long long coin = x.second;       int cnt = 0;       for (auto e : s) {         if (cnt >= k) break;         ans[in] += e;         cnt++;       }       s.insert(coin);     }     for (int i = 0; i < n; i++) cout << ans[i] <<    ;     return 0;   }   