#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double esp = 1e-8;   const int msz = 100000;   const int mod = 2015;   struct Child {     int v, d;     long long p;   };   Child c[4444];   bool vis[4444];   queue<int> q;   int n;   void cut(int id) {     long long v = c[id].v + 1;     long long d = 0;     for (int i = id + 1; i <= n; ++i) {       if (vis[i]) continue;       if (v > 0) v--;       c[i].p -= (d + v);       if (c[i].p < 0) {         vis[i] = 1;         d += c[i].d;       }     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d %d %lld , &c[i].v, &c[i].d, &c[i].p);     }     memset(vis, 0, sizeof(vis));     for (int i = 1; i <= n; ++i) {       if (vis[i]) continue;       cut(i);       q.push(i);     }     int sz = q.size();     printf( %d n , sz);     while (sz--) {       printf( %d , q.front());       q.pop();       if (sz) putchar(   );     }     return 0;   }   