func_code_string: #include <bits/stdc++.h>   using namespace std;   int r[10005];   struct N {     int l, r, x;   } p[10005];   bool cmp(N a, N b) { return a.l < b.l; }   bool vis[10005];   int main() {     int n, q;     cin >> n >> q;     memset(vis, 0, sizeof vis);     for (int i = 0; i < q; i++) {       cin >> p[i].l >> p[i].r >> p[i].x;     }     sort(p, p + q, cmp);     for (int i = 0; i < q; i++) {       for (int j = n - p[i].x; j >= 0; j--) {         if (r[j] >= p[i].l)           vis[j + p[i].x] = 1,                   r[j + p[i].x] = max(r[j + p[i].x], min(p[i].r, r[j]));       }       r[p[i].x] = max(r[p[i].x], p[i].r);       vis[p[i].x] = 1;     }     int cnt = 0;     for (int i = 1; i <= n; i++)       if (vis[i]) cnt++;     cout << cnt << endl;     for (int i = 1; i <= n; i++) {       if (vis[i]) {         if (i == n)           cout << i << endl;         else           cout << i <<    ;       }     }     return 0;   }   