func_code_string: #include <bits/stdc++.h>   using namespace std;   struct comp {     bool operator()(const vector<long long>& lhs,                     const vector<long long>& rhs) const {       return lhs[0] > rhs[0] || (lhs[0] == rhs[0] && lhs[2] > rhs[2]) ||              (lhs[0] == rhs[0] && lhs[2] == rhs[2] && lhs[1] > rhs[1]);     }   };   vector<long long> t;   vector<long long> ans;   priority_queue<vector<long long>, vector<vector<long long> >, comp> events;   queue<long long> q;   set<long long> inq;   priority_queue<long long, vector<long long>, greater<long long> > ready;   bool clear(long long index) {     auto it = inq.lower_bound(index);     if (it == inq.end()) return inq.empty();     return it == inq.begin();   }   int32_t main() {     ios::sync_with_stdio(false);     long long n, p;     cin >> n >> p;     t.resize(n);     ans.resize(n);     for (long long i = 0; i < n; i++) cin >> t[i];     for (long long i = 0; i < n; i++) events.push({t[i], i, 1});     while (!events.empty()) {       vector<long long> a = events.top();       events.pop();       long long status = a[2], index = a[1], time = a[0];       if (status == 1) {         if (clear(index)) {           if (q.empty()) events.push({time + p, index, 2});           q.push(index);           inq.insert(index);         } else           ready.push(index);       } else {         ans[index] = time;         q.pop();         inq.erase(index);         if (!ready.empty() && clear(ready.top())) {           long long nextIndex = ready.top();           ready.pop();           q.push(nextIndex);           inq.insert(nextIndex);         }         if (!q.empty()) {           long long nextIndex = q.front();           events.push({time + p, nextIndex, 2});         }       }     }     for (long long i = 0; i < n; i++) cout << ans[i] <<    ;   }   