func_code_string: #include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   struct T {     int id, v, c, l, r, sum, prev;     void read(int ii) {       id = ii;       scanf( %d%d%d%d , &v, &c, &l, &r);     }     int total() { return c + l + r; }   };   int n;   map<int, vector<T> > gr;   vector<int> ans;   int res;   map<int, pair<int, int> > d;   int main() {     scanf( %d , &n);     for (int i = 0, _n = (n); i < _n; i++) {       T x;       x.read(i);       gr[x.total()].push_back(x);     }     res = 0;     for (map<int, vector<T> >::iterator git = gr.begin(); git != gr.end();          ++git) {       vector<T>& a = git->second;       d.clear();       d[0] = pair<int, int>(0, -1);       int n = (int)(a).size();       for (int i = 0, _n = (n); i < _n; i++) {         map<int, pair<int, int> >::iterator it = d.find(a[i].l);         if (it == d.end()) continue;         a[i].prev = it->second.second;         int newcost = it->second.first + a[i].v;         map<int, pair<int, int> >::iterator it2 = d.find(a[i].l + a[i].c);         if (it2 == d.end() || it2->second.first < newcost) {           d[a[i].l + a[i].c] = pair<int, int>(newcost, i);         }       }       int total = git->first;       if (d.count(total) == 0) continue;       if (d[total].first <= res) continue;       res = d[total].first;       int last = d[total].second;       ans.clear();       for (; last != -1; last = a[last].prev) ans.push_back(a[last].id);       reverse((ans).begin(), (ans).end());     }     printf( %d n , (int)(ans).size());     for (int i = 0, _n = ((int)(ans).size()); i < _n; i++)       printf(  %d  + (i == 0), ans[i] + 1);     printf(  n );     return 0;   }   