func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 50;   struct node {     int v, c, l, r, id;     void read() { scanf( %d%d%d%d , &v, &c, &l, &r); }   } car[N];   map<int, int> mp, MP;   inline int clr(int x) { return car[x].c + car[x].l + car[x].r; }   bool cmp(node a, node b) {     int ta = a.c + a.l + a.r;     int tb = b.c + b.l + b.r;     if (ta == tb)       return a.id < b.id;     else       return ta < tb;   }   int n, f[N], pre[N], c[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) car[i].read(), car[i].id = i;     sort(car + 1, car + n + 1, cmp);     int ans = 0, num = 0;     for (int i = 1; i <= n;) {       int j = i;       while (j <= n && clr(j) == clr(i)) ++j;       mp.clear();       MP.clear();       mp[0] = 0;       MP[0] = 0;       for (int k = i; k <= j - 1; k++) {         if (mp.count(car[k].l)) {           f[k] = mp[car[k].l] + car[k].v;           pre[k] = MP[car[k].l];         }         if (car[k].r == 0 && f[k] > ans) {           ans = f[k];           num = k;         }         int tmp = car[k].c + car[k].l;         if (!mp.count(tmp) || mp[tmp] < f[k]) {           mp[tmp] = f[k];           MP[tmp] = k;         }       }       i = j;     }     int tmp = num;     ans = 0;     while (tmp) c[++ans] = car[tmp].id, tmp = pre[tmp];     printf( %d n , ans);     for (int i = ans; i >= 1; i--) printf( %d%c , c[i], i == 1 ?   n  :    );     return 0;   }   