func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long INF = 1e17;   struct item {     long long t, d, p;   };   long long n, dp[105][2100][2], ans;   item arr[200], arrc[200];   long long solve(long long pos, long long tim) {     if (pos > n) return 0;     if (dp[pos][tim][0]) return max(dp[pos][tim][0], dp[pos][tim][1]);     long long ts = tim + arr[pos].t;     dp[pos][tim][0] = solve(pos + 1, tim);     if (ts < arr[pos].d) dp[pos][tim][1] = solve(pos + 1, ts) + arr[pos].p;     return max(dp[pos][tim][0], dp[pos][tim][1]);   }   bool comp(item l, item r) {     if (l.d == r.d) {       if (l.t == r.t) return l.p > r.p;       return l.t < r.t;     }     return l.d < r.d;   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> arr[i].t >> arr[i].d >> arr[i].p;       arrc[i] = {arr[i].t, arr[i].d, arr[i].p};     }     sort(arr + 1, arr + n + 1, comp);     ans = solve(1, 0);     cout << ans << endl;     long long ansar[300], m = 0;     long long tim = 0;     for (int i = 1; i <= n && ans; i++) {       if (dp[i][tim][1] == ans) {         ansar[++m] = i;         tim += arr[i].t;         ans -= arr[i].p;       }     }     cout << m << endl;     for (int i = 1; i <= m; i++) {       long long first = ansar[i];       for (int j = 1; j <= n; j++) {         if (arr[first].t == arrc[j].t && arr[first].d == arrc[j].d &&             arr[first].p == arrc[j].p) {           cout << j <<    ;           arrc[j].t = 1000000000000;           break;         }       }     }     return 0;   }   