func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long base = 1e9 + 7;   const long long MAX_N = 2e5 + 7;   long long dd2[MAX_N];   void Solves() {     long long n, k;     cin >> n >> k;     long long l[n + 1];     long long r[n + 1];     priority_queue<pair<long long, long long>,                    vector<pair<long long, long long> > >         pq1;     priority_queue<pair<long long, long long>,                    vector<pair<long long, long long> >,                    greater<pair<long long, long long> > >         pq2;     vector<pair<long long, long long> > dd[MAX_N];     for (int i = 1; i <= n; i++) {       cin >> l[i] >> r[i];       dd[l[i]].push_back(pair<long long, long long>(r[i], i));     }     int countt = 0;     int sum = 0;     vector<pair<long long, long long> > ans;     for (int i = 1; i <= 2e5; i++) {       for (auto j : dd[i]) {         pq1.push(j);         pq2.push(j);         sum++;       }       while (!pq2.empty()) {         pair<long long, long long> gg = pq2.top();         if (gg.first < i) {           pq2.pop();           if (dd2[gg.second] == 0) countt++;           dd2[gg.second]++;         } else           break;       }       while (sum - countt > k) {         pair<long long, long long> gg = pq1.top();         pq1.pop();         if (dd2[gg.second] == 0) countt++;         dd2[gg.second]++;         ans.push_back(gg);       }     }     cout << ans.size() <<   n ;     for (auto j : ans) cout << j.second <<    ;   }   int main() { Solves(); }   