func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e4 + 5;   int n, f[N];   struct node {     int t, d, p, id;     bool operator<(const node& other) const { return d < other.d; }   } a[N];   vector<int> g[N];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++)       scanf( %d %d %d , &a[i].t, &a[i].d, &a[i].p), a[i].id = i;     sort(a + 1, a + 1 + n);     for (int i = 1; i <= n; i++) {       for (int j = a[i].d - 1; j >= a[i].t; j--) {         if (f[j - a[i].t] + a[i].p > f[j]) {           f[j] = f[j - a[i].t] + a[i].p;           g[j].clear();           g[j] = g[j - a[i].t];           g[j].push_back(a[i].id);         }       }     }     int ans = 0;     for (int i = 1; i <= 2000; i++)       if (f[i] > f[ans]) ans = i;     printf( %d n , f[ans]);     int len = g[ans].size();     printf( %d n , len);     for (int i = 0; i < len; i++) printf( %d  , g[ans][i]);     return 0;   }   