func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxx = 800010;   int t, n, m, k, b, u;   int ans = 0, total = 0, cnt = 0;   int a[maxx], sum[maxx];   struct no {     int num, l, r;     bool operator<(const no &X) const { return r < X.r; }   };   priority_queue<no> q;   struct node {     int num;     int l;     int r;   } s[maxx];   bool cmp(node a, node b) { return a.l < b.l; }   int main() {     scanf( %d%d , &n, &k);     for (register int i = 1; i <= n; i++) {       scanf( %d%d , &s[i].l, &s[i].r);       sum[s[i].l]++;       sum[s[i].r + 1]--;       s[i].num = i;     }     sort(s + 1, s + n + 1, cmp);     cnt = 1;     for (register int i = 1; i <= 200000; i++) {       while (cnt <= n && s[cnt].l <= i) {         q.push(no{s[cnt].num, s[cnt].l, s[cnt].r});         cnt++;       }       sum[i] += sum[i - 1];       while (sum[i] > k) {         a[++total] = q.top().num;         sum[i]--;         sum[q.top().r + 1]++;         q.pop();       }     }     sort(a + 1, a + total + 1);     printf( %d n , total);     for (register int i = 1; i <= total; i++) printf( %d  , a[i]);     return 0;   }   