func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline int size(const T& c) {     return c.size();   }   using namespace std;   const int maxn = 100000 + 10;   struct student {     int a;     int b;     int cs;   } a[maxn];   int n, p, k, k2;   long long f[maxn];   long long sumgrey, sumplease, resgrey, resplease;   struct cmp {     bool operator()(int u, int v) {       return make_pair(make_pair(a[u].a, a[u].b), u) <              make_pair(make_pair(a[v].a, a[v].b), v);     }   };   set<int, cmp> s;   int vt;   bool mycmp1(student a, student b) {     if (a.b == b.b) {       return a.a < b.a;     }     return a.b < b.b;   }   bool mycmp2(student a, student b) {     if (a.b == b.b) {       return a.a > b.a;     }     return a.b < b.b;   }   void update(int sep) {     if (resgrey < sumgrey || (resgrey == sumgrey && resplease < sumplease)) {       resgrey = sumgrey;       resplease = sumplease;       vt = sep;     }   }   void process() {     for (int i = (1), _b = (n); i <= _b; i++) f[i] = f[i - 1] + a[i].b;     s.clear();     for (int i = (n), _a = (n - k + 1); i >= _a; i--) {       s.insert(i);       sumgrey += a[i].a;       sumplease = f[i - 1] - f[i - k2 - 1];     }     update(n - k + 1);     for (int i = (n - k), _a = (k2 + 1); i >= _a; i--) {       int u = *s.begin();       sumplease = f[i - 1] - f[i - k2 - 1];       if (a[i].a > a[u].a || (a[i].a == a[u].a && a[i].b > a[u].b)) {         s.erase(u);         sumgrey -= a[u].a;         s.insert(i);         sumgrey += a[i].a;       }       update(i);     }   }   void trace() {     s.clear();     for (int i = (n), _a = (n - k + 1); i >= _a; i--) s.insert(i);     for (int i = (n - k), _a = (vt); i >= _a; i--) {       int u = *s.begin();       if (a[i].a > a[u].a || (a[i].a == a[u].a && a[i].b > a[u].b)) {         s.erase(u);         s.insert(i);       }     }     set<int, cmp>::iterator it;     for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); it++)       cout << a[*it].cs <<    ;     for (int i = (vt - k2), _b = (vt - 1); i <= _b; i++) cout << a[i].cs <<    ;   }   int main() {     cin >> n >> p >> k;     for (int i = (1), _b = (n); i <= _b; i++)       cin >> a[i].a >> a[i].b, a[i].cs = i;     k2 = p - k;     sort(a + 1, a + 1 + n, mycmp2);     process();     trace();     fclose(stdin);     fclose(stdout);     return 0;   }   