func_code_string: #include <bits/stdc++.h>   using namespace std;   struct second {     int l, r, x, id;     bool operator<(const second a) const {       if (r < a.r) return 1;       if (r > a.r) return 0;       return id < a.id;     }   } s[10005];   int cmp(const second a, const second b) {     if (a.l != b.l) return a.l < b.l;     return a.r < b.r;   }   set<second> st;   int a[10005];   int dp1[10005], dp2[10005];   bool ans[10005];   int main(void) {     int n, q;     scanf( %d%d , &n, &q);     int i;     for (i = 0; i < q; i++) {       scanf( %d%d%d , &s[i].l, &s[i].r, &s[i].x);       s[i].id = i;     }     sort(s, s + q, cmp);     int j = 0;     dp1[0] = dp2[0] = 1;     for (i = 1; i <= n; i++) {       bool modi = false;       while (j < q && s[j].l <= i) {         st.insert(s[j]);         int x = s[j].x;         for (int l = n; l >= x; l--) {           dp1[l] += dp1[l - x];           dp1[l] %= 19950527;           dp2[l] += dp2[l - x];         }         modi = true;         j++;       }       while (!st.empty()) {         auto it = st.begin();         if (it->r < i) {           int x = it->x;           for (int l = x; l <= n; l++) {             dp1[l] -= dp1[l - x];             dp1[l] %= 19950527;             dp2[l] -= dp2[l - x];           }           st.erase(it);           modi = true;         } else {           break;         }       }       if (!modi) continue;       for (int l = 1; l <= n; l++)         if (dp1[l] || dp2[l]) ans[l] = true;     }     int cnt = 0;     for (i = 1; i <= n; i++)       if (ans[i]) cnt++;     printf( %d n , cnt);     for (i = 1; i <= n; i++)       if (ans[i]) printf( %d  , i);     return 0;   }   