malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int mas[n];     for (int i = 0; i < n; i++) {       cin >> mas[i];     }     int d = 0;     int t = 0;     for (int i = 0; i < n; i++) {       if (mas[i] - d == 1) {         t++;         d = mas[i];       }     }     if (!d) {       cout <<  0 ;       return 0;     }     cout << t << endl;     d = 0;     for (int i = 0; i < n; i++) {       if (mas[i] - d == 1) {         d = mas[i];         cout << 2000 + i + 1 <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s = to_string(n);     int m = s.size();     vector<int> v;     for (int i = 9 * m; i >= 0; i--) {       int j = n - i;       int sum = 0;       for (sum = 0; j > 0; j /= 10) sum += j % 10;       if (sum == i) v.push_back(n - i);     }     cout << v.size() << endl;     for (auto i : v) cout << i << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 1303;   long long solve() {     long long n;     string s;     cin >> s;     map<char, string> mp;     mp[ > ] =  1000 ;     mp[ < ] =  1001 ;     mp[ + ] =  1010 ;     mp[ - ] =  1011 ;     mp[ . ] =  1100 ;     mp[ , ] =  1101 ;     mp[ [ ] =  1110 ;     mp[ ] ] =  1111 ;     n = s.size();     string tmp =   ;     for (long long i = 0; i < n; ++i) tmp += mp[s[i]];     reverse((tmp).begin(), (tmp).end());     long long ans = 0;     long long p = 1;     for (auto x : tmp)       ans = (ans + ((x -  0 ) % 1000003 * (p % 1000003)) % 1000003) % 1000003,       p <<= 1, p %= 1000003;     cout << ans;     return 0;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve(), cout << endl;     cerr << (float)clock() / CLOCKS_PER_SEC <<   secs n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     char s[100005] = {0};     int i, j;     int panjang;     int banyak[27] = {0};     gets(s);     scanf( %d , &n);     panjang = strlen(s);     if (panjang <= n) {       printf( 0 n );       return 0;     }     for (i = 0; i < panjang; i++) {       ++banyak[s[i] -  a ];     }     int hasil = 0;     for (i = 0; i < 26; i++)       if (banyak[i] > 0) ++hasil;     int min = 100005;     int indeks;     while (1) {       min = 100005;       for (i = 0; i < 26; i++) {         if (banyak[i] > 0 && banyak[i] < min) {           min = banyak[i];           indeks = i;         }       }       if (banyak[indeks] > n) break;       --hasil;       n -= banyak[indeks];       banyak[indeks] = 0;     }     printf( %d n , hasil);     for (i = 0; i < panjang; i++) {       if (banyak[s[i] -  a ] > 0) printf( %c , s[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     if (n % 2 == 1)       cout <<  -1 ;     else {       for (int i = 1; i <= n / 2; i++) {         cout << 2 * i <<    ;         cout << 2 * i - 1 <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   constexpr int N = 1e5 + 5;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     string x;     cin >> x;     int H = 0;     for (char &c : x)       if (c ==  H ) H++;     int result = n;     for (int i = 0; i < n; i++) {       int now = 0;       for (int j = 0; j < H; j++) {         if (x[(i + j) % n] !=  H ) now++;       }       result = min(result, now);     }     cout << result << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7, abc = 864197532, N = 1000001, logN = 17;   vector<int> a;   vector<int> d, lp;   struct Seg {     int l, r, m;     long long int val = 0;     Seg* ch[2];     Seg(int _l, int _r) : l(_l), r(_r), m(l + r >> 1) {       if (r - l > 1) {         ch[0] = new Seg(l, m);         ch[1] = new Seg(m, r);         pull();       } else {         val = a[l];       }     }     void pull() { val = ch[0]->val + ch[1]->val; }     void set(int p) {       if (r - l == 1)         val = d[val];       else         ch[p >= m]->set(p), pull();     }     long long int query(int a, int b) {       if (a <= l && r <= b) return val;       long long int ans = 0;       if (a < m) ans += ch[0]->query(a, b);       if (m < b) ans += ch[1]->query(a, b);       return ans;     }   };   void build() {     d.assign(N, 1);     lp.assign(N, 0);     for (int i = 2; i < N; ++i)       if (lp[i] == 0) {         for (int j = i; j < N; j += i) lp[j] = i;       }     for (int i = 2; i < N; ++i) {       int p = lp[i], tmp = i, cnt = 0;       while (tmp % p == 0) tmp /= p, cnt++;       d[i] = d[tmp] * (cnt + 1);     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     build();     int n, q, t, l, r;     cin >> n >> q;     a.resize(n);     for (int i = 0; i < n; ++i) cin >> a[i];     Seg root(0, n);     set<int> s;     for (int i = 0; i < n; ++i)       if (a[i] > 2) s.insert(i);     vector<int> eras;     while (q--) {       cin >> t >> l >> r, l--;       if (t == 1) {         for (auto it = s.lower_bound(l); it != s.end() && *it < r; ++it) {           int p = *it;           root.set(p);           a[p] = d[a[p]];           if (a[p] <= 2) eras.push_back(p);         }         while (eras.size()) {           s.erase(eras.back());           eras.pop_back();         }       } else {         cout << root.query(l, r) <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T, class L>   bool smax(T &x, L y) {     return x < y ? (x = y, 1) : 0;   }   template <class T, class L>   bool smin(T &x, L y) {     return y < x ? (x = y, 1) : 0;   }   const int maxn = 1e5 + 17, S = 1e9 + 1, maxfen = S * 2;   map<int, vector<pair<int, int>>> xs, ys;   int n;   unordered_map<int, int> iman;   struct eve {     int x, y, v;   };   vector<eve> event;   void make(vector<pair<int, int>> &vec) {     vector<pair<int, int>> ans;     sort(vec.begin(), vec.end());     int mxr = vec[0].second;     ans.push_back({vec[0].first, -1});     for (int i = 1; i < vec.size(); i++) {       if (mxr < vec[i].first)         ans.back().second = mxr + 1, ans.push_back({vec[i].first, -1});       smax(mxr, vec[i].second);     }     ans.back().second = mxr + 1;     vec = ans;   }   void majid(long long p, int v) {     for (p += S; p < maxfen; p += p & -p) iman[p] += v;   }   int hamid(int p) {     int ans = 0;     for (p += S; p; p ^= p & -p) ans += iman[p];     return ans;   }   int hamid(int l, int r) { return hamid(r - 1) - hamid(l - 1); }   int main() {     ios::sync_with_stdio(0), cin.tie(0);     cin >> n;     for (int x1, y1, x2, y2, i = 0; i < n; i++) {       cin >> x1 >> y1 >> x2 >> y2;       if (x1 == x2)         xs[x1].push_back(minmax(y1, y2));       else         ys[y1].push_back(minmax(x1, x2));     }     long long ans = 0;     for (auto &v : ys) {       make(v.second);       for (auto x : v.second) {         ans += x.second - x.first;         event.push_back({v.first, x.first, 1});         event.push_back({v.first, x.second, -1});       }     }     sort(event.begin(), event.end(), [](eve &a, eve &b) { return a.y < b.y; });     int ptr = 0;     for (auto &v : xs) {       make(v.second);       while (ptr < event.size() && event[ptr].y <= v.first)         majid(event[ptr].x, event[ptr].v), ptr++;       for (auto x : v.second) {         ans += x.second - x.first;         ans -= hamid(x.first, x.second);       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const float pi = acos(-1.0);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       long long int n;       cin >> n;       cout << 0 <<     << 0 <<     << n;     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T inline sqr(T x) {     return x * x;   }   const int mlen = 303;   int p[6];   char s[6][mlen];   char res[mlen][mlen];   vector<vector<string> > x;   void draw(int sx, int sy, const char *s, int dx, int dy) {     while (*s) res[sy][sx] = *s++, sx += dx, sy += dy;   }   int main() {     for (int i = 0; i < (int)(6); i++) gets(s[i]), p[i] = i;     do {       int H = strlen(s[p[0]]) - 1;       int W = strlen(s[p[1]]) - 1;       int h = strlen(s[p[2]]) - 1;       int w = strlen(s[p[3]]) - 1;       int bad = 0;       bad |= (strlen(s[p[0]]) != strlen(s[p[2]]) + strlen(s[p[4]]) - 1);       bad |= (strlen(s[p[1]]) != strlen(s[p[3]]) + strlen(s[p[5]]) - 1);       bad |= (s[p[0]][0] != s[p[3]][w]);       bad |= (s[p[0]][h] != s[p[1]][w]);       bad |= (s[p[0]][H] != s[p[5]][0]);       bad |= (s[p[2]][0] != s[p[3]][0]);       bad |= (s[p[2]][h] != s[p[1]][0]);       bad |= (s[p[4]][0] != s[p[1]][W]);       bad |= (s[p[4]][H - h] != s[p[5]][W - w]);       if (bad) continue;       memset(res,  . , sizeof(res));       draw(0, 0, s[p[2]], 0, 1);       draw(w, 0, s[p[0]], 0, 1);       draw(W, h, s[p[4]], 0, 1);       draw(0, 0, s[p[3]], 1, 0);       draw(0, h, s[p[1]], 1, 0);       draw(w, H, s[p[5]], 1, 0);       vector<string> R;       for (int i = 0; i < (int)(H + 1); i++)         res[i][W + 1] = 0, R.push_back(res[i]);       x.push_back(R);     } while (next_permutation(p, p + 6));     sort((x).begin(), (x).end());     if (!x.size())       puts( Impossible );     else {       for (int i = 0; i < (int)(x[0].size()); i++) {         for (int j = 0; j < (int)(x[0][0].size()); j++) printf( %c , x[0][i][j]);         puts(  );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000009;   long long poww(long long base, long long power) {     long long ret = 1;     for (long long i = 0; i < power; i++) {       ret *= base;       ret %= mod;     }     return ret;   }   int main() {     long long ans;     long long n, m;     while (~scanf( %I64d%I64d , &n, &m)) {       ans = 1;       long long sum = poww(2, m);       for (long long i = 1; i <= n; i++) {         ans *= (sum - i);         ans %= mod;       }       printf( %I64d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   int search(int a[], int j, int n) {     int i;     for (i = 0; i < n; i++) {       if (a[i] == j) {         a[i] = 0;         return (i + 1);       }     }     return 0;   }   int main() {     int t, n, i, j, k, m, x, y, z;     scanf( %d , &n);     int a[n];     int f[3] = {0};     for (i = 0; i < n; i++) {       scanf( %d , &a[i]);       if (a[i] == 1) {         f[0]++;       }       if (a[i] == 2) {         f[1]++;       }       if (a[i] == 3) {         f[2]++;       }     }     m = 50000;     for (i = 0; i < 3; i++) {       if (f[i] < m) {         m = f[i];       }     }     printf( %d n , m);     for (i = 0; i < m; i++) {       x = search(a, 1, n);       y = search(a, 2, n);       z = search(a, 3, n);       if (x * y * z) {         printf( %d %d %d n , x, y, z);       } else {         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   int dist[200002];   vector<pair<int, int>> v[200002];   vector<int> nes[200002];   char s[200002];   vector<string> ans;   void dfs(int d) {     if (ans.size() >= k) return;     if (d > n) {       ans.push_back(s);       return;     }     for (auto i : nes[d]) {       s[i] =  1 ;       dfs(d + 1);       s[i] =  0 ;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m >> k;     for (int i = 0; i < m; ++i) {       int a, b;       cin >> a >> b;       v[a].push_back({b, i});       v[b].push_back({a, i});     }     queue<int> q;     q.push(1);     dist[1] = 1;     while (q.size()) {       int x = q.front();       q.pop();       for (auto i : v[x]) {         if (dist[i.first]) continue;         dist[i.first] = dist[x] + 1;         q.push(i.first);       }     }     for (int i = 2; i <= n; ++i) {       for (auto j : v[i]) {         if (dist[j.first] + 1 == dist[i]) nes[i].push_back(j.second);       }     }     fill(s, s + m,  0 );     dfs(2);     cout << ans.size() <<   n ;     for (auto i : ans) cout << i <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t = 1;     while (t--) {       long long int n, m, c = 0;       cin >> n >> m;       vector<set<long long int>> v(n + 1);       long long int x, y;       for (int i = 0; i < m; i++) {         cin >> x >> y;         v[x].insert(y);         v[y].insert(x);       }       while (1) {         vector<long long int> q;         for (int i = 1; i <= n; i++)           if (v[i].size() == 1) q.push_back(i);         for (int i = 0; i < q.size(); i++) {           auto it = v[q[i]].begin();           v[q[i]].clear();           v[*it].erase(q[i]);         }         if (q.size() > 0)           c++;         else           break;       }       cout << c;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long geti() {     long long ret = 0;     char ch = getchar(), k = 1;     while ((ch <  0  || ch >  9 ) && ch !=  - ) ch = getchar();     if (ch ==  - ) k = 0, ch = getchar();     while (ch >=  0  && ch <=  9 ) ret = ret * 10 + ch -  0 , ch = getchar();     return k ? ret : -ret;   }   const int N = 1000010;   const int mo = 1000000007;   int n, t, mx;   long long f[N], g[N], mi2[N], ans = 0;   int main() {     n = geti();     for (int i = 1; i <= n; i += 1) {       t = geti();       mx = max(mx, t);       for (int j = 1; j * j <= t; j += 1) {         if (t % j != 0) continue;         f[j] += 1;         if (j != t / j) f[t / j] += 1;       }     }     mi2[0] = 1;     for (int i = 1; i <= mx; i += 1) mi2[i] = mi2[i - 1] * 2 % mo;     for (int i = mx; i > 1; i -= 1) {       g[i] = f[i] * mi2[f[i] - 1] % mo;       for (int j = 2 * i; j <= mx; j += i) {         g[i] -= g[j];         g[i] %= mo;       }       ans += i * g[i] % mo;       ans %= mo;     }     cout << (ans + mo) % mo;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100000 + 5;   int b[maxn];   int g[maxn];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &b[i]);     for (int i = 1; i <= m; i++) scanf( %d , &g[i]);     long long sum = 0;     sort(b + 1, b + n + 1);     sort(g + 1, g + m + 1);     if (b[n] > g[1])       printf( -1 n );     else {       int cur = m;       for (int i = n; i >= 1; i--) {         sum += (long long)b[i] * m;         int k = m;         if (cur == m) {           while (k > 0 && cur >= 2 && g[cur] > b[i]) {             k--;             sum += g[cur] - b[i];             cur--;           }         } else {           while (k > 0 && cur >= 1 && g[cur] > b[i]) {             k--;             sum += g[cur] - b[i];             cur--;           }         }         while (cur >= 1 && g[cur] == b[i]) cur--;       }       if (cur >= 1)         printf( -1 n );       else         printf( %I64d n , sum);     }     return 0;   }
//Be Name Khoda      #include<bits/stdc++.h>      using namespace std;      typedef long long ll;      #define pb push_back   #define pp pop_back   #define all(x) x.begin(), x.end()      const ll mxn = 3e5 + 5;   ll t, n = 0, k, q;   ll cnt[mxn];   vector<ll> v, v2;      void input() {          for(int i = 0; i <= n; i++) {           cnt[i] = 0;       }          v.clear(), v2.clear();          cin >> n;          for(int i = 0; i < n; i++) {           cin >> q;            v.pb(q);           cnt[q]++;       }      }         void solve() {          ll l = 0, r = n - 1;          if(cnt[1] > 0) {           v2.pb(1);       }          for(int i = 2; i < n; i++) {           if(cnt[1] == 0 || cnt[i] == 0 || cnt[i - 1] > 1) {               break;           }           if(v[l] == i - 1) {               v2.pb(1);               l++;           }           else if(v[r] == i - 1) {               v2.pb(1);               r--;           }           else {               break;           }       }          while(v2.size() < n - 1) {           v2.pb(0);       }          bool check = 1;          for(int i = 1; i <= n; i++) {           if(cnt[i] != 1) {               check = 0;               break;           }       }          if(n > 1) {           if(!check) {               v2.pb(0);           }           else {               v2.pb(1);           }       }          for(int i = v2.size() - 1; i > -1; i--) {           cout << v2[i];       }       cout << endl;      }      int main() {          ios::sync_with_stdio(false);          cin >> t;          while(t--) {           input(), solve();       }              return 0;          }
#include <bits/stdc++.h>   using namespace std;   int I, len[500005], las[500005];   string second, ans[500005];   char fi[500005], se[500005];   string get(int raod, char c, int ind) {     len[I] = raod + len[ind];     raod = min(raod, 10);     string ret =   ;     for (int i = 0; i < raod; i++) ret += c;     ret = ret + ans[ind];     if (ret.size() <= 10) return ret;     string ne;     for (int i = 0; i < 5; i++) ne += ret[i];     ne +=  ... ;     for (int i = (int)ret.size() - 2; i < ret.size(); i++) ne += ret[i];     return ne;   }   int main() {     ios::sync_with_stdio(false);     cin >> second;     int n = (int)second.size();     ans[n - 1] += second[n - 1];     len[n - 1] = 1;     las[n - 1] = n;     fi[n - 1] = second[n - 1];     se[n - 1] =  % ;     fi[n] =  % ;     se[n] =  % ;     for (int i = (int)second.size() - 2; i >= 0; i--) {       I = i;       int raod;       if (second[i] == second[i + 1]) {         las[i] = las[i + 1];       } else {         las[i] = i + 1;       }       int ind = las[i];       if (fi[ind] ==  % ) {         raod = (ind - i) % 2;         ans[i] = get(raod, second[i], ind);         if (raod) {           fi[i] = second[i];         } else           fi[i] =  % ;         se[i] =  % ;         continue;       }       if (fi[ind] == second[i]) {         if (se[ind] ==  % ) {           raod = (ind - i) % 2;           ans[i] = get(raod, second[i], ind);           fi[i] = second[i];           se[i] =  % ;           continue;         } else {           if (se[ind] > second[i]) {             ans[i] = get(ind - i, second[i], ind);             fi[i] = second[i];             se[i] = se[ind];           } else {             raod = (ind - i) % 2;             ans[i] = get(raod, second[i], ind);             fi[i] = second[i];             se[i] = se[i];           }         }       } else {         if (fi[ind] > second[i]) {           ans[i] = get(ind - i, second[i], ind);           fi[i] = second[i];           se[i] = fi[ind];         } else {           raod = (ind - i) % 2;           ans[i] = get(raod, second[i], ind);           if (raod) {             fi[i] = second[i];             se[i] = fi[ind];           } else {             fi[i] = fi[ind];             se[i] = se[ind];           }         }       }     }     for (int i = 0; i < n; i++) cout << len[i] <<     << ans[i] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int in() {     int x, y;     y = scanf( %d , &x);     return x;   }   const int N = 100 * 1000 + 5;   const long long INF = 10LL * 1000 * 1000 * 1000 * 1000;   long long a[N];   pair<long long, long long> next(long long x, long long c) {     pair<long long, long long> res = {-1, -1};     for (long long d = 1; d * d <= c; d++)       if (c % d == 0 && (d + c / d) % 2 == 0) {         long long x2 = (d + c / d) / 2;         long long x1 = c / d - x2;         if (x1 > x && x2 > x1 && x1 * x1 - x * x <= INF &&             (res.second == -1 || x2 < res.second))           res = {x1, x2};       }     return res;   }   int main() {     int n = in();     long long x = 0;     for (int i = 0; i < n / 2; i++) {       long long c = in();       a[2 * i + 1] = c;       pair<long long, long long> nx = next(x, c);       if (nx.first == -1) return (cout <<  No n ), 0;       a[2 * i] = nx.first * nx.first - x * x;       x = nx.second;     }     cout <<  Yes n ;     for (int i = 0; i < n; i++) cout << a[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a, b, p[100000], la[100000], lb[100000];   int party[100000];   bool pass, assigned[100000];   map<int, int> m;   inline int deg(int i) { return (la[i] != -1) + (lb[i] != -1); }   int dfs(int i) {     if (deg(i) == 0) {       return 1;     }     if (~la[i]) {       int t = la[i];       la[t] = la[i] = lb[i] = -1;       if (!assigned[i] && (assigned[i] = assigned[t] = 1))         party[i] = party[t] = 0;       if (t == i) pass = 1;       return 1 + dfs(t);     } else {       int t = lb[i];       lb[t] = la[i] = lb[i] = -1;       if (!assigned[i] && (assigned[i] = assigned[t] = 1))         party[i] = party[t] = 1;       if (t == i) pass = 1;       return 1 + dfs(t);     }   }   int main() {     scanf( %d%d%d , &n, &a, &b);     for (int i = 0; i < n; ++i) scanf( %d , p + i), m[p[i]] = i;     auto fd = [](int x) {       auto it = m.find(x);       return it == m.end() ? -1 : it->second;     };     for (int i = 0; i < n; ++i) {       la[i] = fd(a - p[i]);       lb[i] = fd(b - p[i]);       if (deg(i) == 0) {         puts( NO );         return 0;       }     }     for (int i = 0; i < n; ++i) {       if (deg(i) == 1) {         pass = 0;         if (dfs(i) & 1 && !pass) {           puts( NO );           return 0;         }       }     }     for (int i = 0; i < n; ++i) {       if (deg(i) == 2) {         dfs(i);       }     }     puts( YES );     for (int i = 0; i < n; ++i) printf( %d  , party[i]);   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 5;   long long n;   long long deg[N], ans[N];   vector<pair<long long, long long> > g[N];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t = 1;     while (t--) {       long long x1, x2, y1, y2, z1, z2;       cin >> x1 >> y1 >> z1;       cin >> x2 >> y2 >> z2;       bool x = x1 ^ x2;       x = !x;       bool y = y1 ^ y2;       y = !y;       bool z = z1 ^ z2;       z = !z;       if (x || y || z)         cout <<  YES               <<   n ;       else         cout <<  NO               <<   n ;     }     return 0;   }
#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;   }