func_code_string: #include <bits/stdc++.h>   long long v[4000 + 1], c[4000 + 1], d[4000 + 1], done[4000 + 1], sol[4000 + 1],       stiva[4000 + 1];   int main() {     int n, i, j, vf;     long long sum, sc;     fscanf(stdin,  %d , &n);     for (i = 1; i <= n; i++) {       fscanf(stdin,  %I64d%I64d%I64d , &v[i], &d[i], &c[i]);     }     i = 1;     while (i <= n) {       if (done[i] == 0) {         sol[++sol[0]] = i;         sum = 0;         j = i + 1;         vf = 0;         while ((v[i] > 0) && (j <= n)) {           if (done[j] == 0) {             c[j] -= v[i];             if (c[j] < 0) {               done[j] = 1;               stiva[++vf] = j;             }             v[i]--;           }           j++;         }         while (vf > 0) {           sum = d[stiva[vf]];           vf--;           for (j = stiva[vf + 1] + 1; j <= n; j++) {             if (done[j] == 0) {               c[j] -= sum;               if (c[j] < 0) {                 done[j] = 1;                 stiva[++vf] = j;               }             }           }         }       }       i++;     }     fprintf(stdout,  %I64d n , sol[0]);     for (i = 1; i <= sol[0]; i++) {       fprintf(stdout,  %I64d  , sol[i]);     }     fclose(stdin);     fclose(stdout);     return 0;   }   