func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, v[100010], c[100010], l[100010], r, mx = 0;   map<long long, long long> dp, path, acp;   vector<long long> ans, vt[3 * 100010];   void getdp(long long x) {     long long i, ss;     dp.clear();     path.clear();     acp.clear();     for (i = 0; i < vt[x].size(); i++) {       dp[l[vt[x][i]]] = dp[l[vt[x][i]] + c[vt[x][i]]] = -1000000000000000000;       path[l[vt[x][i]]] = path[l[vt[x][i]] + c[vt[x][i]]] = -1;       acp[vt[x][i]] = -1;     }     dp[0] = 0;     for (ss = 0; ss < vt[x].size(); ss++) {       i = vt[x][ss];       if (l[i] == 0) {         if (v[i] > dp[l[i] + c[i]] || path[l[i] + c[i]] == -1) {           dp[l[i] + c[i]] = v[i];           path[l[i] + c[i]] = i;           acp[i] = -1;         }       } else {         if (path[l[i]] == -1) {           continue;         }         if (dp[l[i]] + v[i] > dp[l[i] + c[i]] || path[l[i] + c[i]] == -1) {           dp[l[i] + c[i]] = dp[l[i]] + v[i];           path[l[i] + c[i]] = i;           acp[i] = path[l[i]];         }       }     }     i = path[x];     if (dp[x] > mx) {       mx = dp[x];       ans.clear();       while (i != -1) {         ans.push_back(i);         i = acp[i];       }     }     return;   }   int main() {     long long i, j, mx = 0;     scanf( %lld , &n);     for (i = 0; i < n; i++) {       scanf( %lld%lld%lld%lld , &v[i], &c[i], &l[i], &r);       vt[c[i] + l[i] + r].push_back(i);     }     for (i = 0; i <= 300000; i++) {       if (vt[i].empty()) {         continue;       }       getdp(i);     }     sort(ans.begin(), ans.end());     printf( %lld n , (long long)ans.size());     for (i = 0; i < ans.size(); i++) {       printf( %lld  , ans[i] + 1);     }     puts(  );     return 0;   }   