func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     long long n, k;     cin >> n >> k;     vector<long long> ans(n);     set<pair<long long, long long>> demid;     for (int i = 0; i < k; i++) {       long long s, m;       cin >> s >> m;       demid.insert({s + m, i});     }     for (int i = 0; i < n - k; i++) {       long long s, m;       pair<long long, long long> now;       cin >> s >> m;       now = *demid.begin();       demid.erase(demid.begin());       ans[now.second] = now.first;       demid.insert({max(s, now.first) + m, i + k});     }     while (demid.size()) {       pair<long long, long long> now;       now = *demid.begin();       demid.erase(demid.begin());       ans[now.second] = now.first;     }     for (int i = 0; i < n; i++) {       cout << ans[i] << endl;     }     return 0;   }   