func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxm = 2e6 + 5;   struct task {     int t, k, d;   } tasks[maxm];   int times[110];   int main() {     for (int i = 0; i < 110; ++i) {       times[i] = 0;     }     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       scanf( %d%d%d , &tasks[i].t, &tasks[i].k, &tasks[i].d);     }     for (int i = 0; i < m; ++i) {       int num = 0, j = 1, res = 0;       if (tasks[i].k > n) {         printf( -1 n );         continue;       }       while (j <= n) {         if (times[j] <= tasks[i].t) {           num++;         }         if (num == tasks[i].k) break;         j++;       }       j = 1;       if (num == tasks[i].k) {         int cnt = 0;         while (j <= n) {           if (times[j] <= tasks[i].t) {             res += j;             times[j] = tasks[i].t + tasks[i].d;             cnt++;           }           if (cnt == tasks[i].k) break;           j++;         }         printf( %d n , res);       } else {         printf( -1 n );         continue;       }     }   }   