func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     vector<int> vec(n + 1, 0);     vector<pair<int, pair<int, int>>> arr;     for (int i = 0; i < m; i++) {       int si, di, ci;       scanf( %d %d %d , &si, &di, &ci);       arr.push_back(make_pair(di, make_pair(si, ci)));     }     bool is_possible = true;     for (int i = 1; i <= n; i++) {       bool exam_time = false;       for (int j = 0; j < m; j++) {         if (arr[j].first == i) {           exam_time = true;           if (arr[j].second.second != 0) {             is_possible = false;           } else {             vec[i] = m + 1;           }           break;         }       }       if (exam_time) continue;       int best = -1, mini = (int)1e9;       for (int j = 0; j < m; j++) {         if (arr[j].first > i && arr[j].second.first <= i &&             arr[j].second.second != 0) {           if (arr[j].first < mini) {             mini = arr[j].first;             best = j;           }         }       }       if (best != -1) {         vec[i] = best + 1;         arr[best].second.second--;       }     }     if (is_possible) {       for (int i = 1; i <= n; i++) {         printf( %d  , vec[i]);       }     } else {       printf( -1 n );     }     return 0;   }   