malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int conversion(string p) {     int o;     o = atoi(p.c_str());     return o;   }   string toString(int h) {     stringstream ss;     ss << h;     return ss.str();   }   long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }   long long lcm(long long a, long long b) { return (a * (b / gcd(a, b))); }   long long toi(string p) {     long long x;     istringstream in(p);     in >> x;     return x;   }   long long square(long long n) { return n * n; }   long long fastexp(long base, long power) {     if (power == 0)       return 1;     else if (power % 2 == 0)       return square(fastexp(base, power / 2));     else       return base * (fastexp(base, power - 1));   }   bool is_prime(int n) {     for (int i = 2; i * i <= n; i++)       if (n % i == 0) return 0;     return 1;   }   int logba(int a, int b) { return log(a) / log(b); }   long long sum(long long x) { return ((x) * (x - 1)) / 2; }   int main() {     long long n, x, y, res = 0;     cin >> n;     map<long long, long long> M, N;     map<pair<long long, long long>, long long> R;     set<pair<long long, long long> > S;     for (int i = 0; i < n; i++) {       cin >> x >> y;       M[x]++;       N[y]++;       S.insert(make_pair(x, y));       R[make_pair(x, y)]++;     }     if (S.size() == 1) {       cout << ((n) * (n - 1)) / 2 << endl;       return 0;     }     for (map<long long, long long>::iterator it = M.begin(); it != M.end();          it++) {       res += sum(it->second);     }     for (map<long long, long long>::iterator it = N.begin(); it != N.end();          it++) {       res += sum(it->second);     }     for (map<pair<long long, long long>, long long>::iterator it = R.begin();          it != R.end(); it++) {       res -= sum(it->second);     }     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long v2[34];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     cin >> t;     for (int i = 0; i <= 33; ++i) {       if (i == 0) {         v2[i] = 1;       } else {         v2[i] = 2 * v2[i - 1];       }     }     while (t--) {       int n;       cin >> n;       vector<long long> v(n);       for (int i = 0; i < n; ++i) {         cin >> v[i];       }       int ans = 0;       for (int i = 1; i < n; ++i) {         if (v[i] < v[i - 1]) {           long long aux = 0;           int k = 0;           long long dif = v[i - 1] - v[i];           for (int j = 0; j < 34; ++j) {             aux += v2[j];             if (aux >= dif) {               ans = max(ans, j + 1);               k = j;               break;             }           }           v[i] += dif;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   const int N = 1000005;   using namespace std;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   int a[N];   int main() {     long long n;     cin >> n;     long long d, d1, ans;     for (long long i = 0; i < n; i++) cin >> a[i];     d1 = gcd(a[0], a[1]);     ans = a[0] / d1 * a[1];     for (long long i = 2; i < n; i++) {       ans = gcd(ans, a[i]);       long long gg = gcd(d1, ans);       ans = d1 / gg * ans;       d1 = gg;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + (c ^ 48);       c = getchar();     }     return f == 1 ? x : -x;   }   inline void print(long long x) {     if (x < 0) putchar( - ), x = ~x + 1;     if (x >= 10) print(x / 10);     putchar((x % 10) | 48);   }   long long n;   struct node {     long long x, y;   } a[2510], v[5010];   long long xiangxian(node x) {     if (x.x >= 0) {       if (x.y >= 0)         return 1;       else         return 4;     } else {       if (x.y >= 0)         return 2;       else         return 3;     }   }   long long cross(node x, node y) { return x.x * y.y - y.x * x.y; }   bool cmp(node x, node y) {     long long x1 = xiangxian(x);     long long x2 = xiangxian(y);     if (x1 != x2)       return x1 < x2;     else       return cross(x, y) > 0;   }   long long ans;   long long C(long long x, long long y) {     if (x < 0) return 0;     long long res = 1;     for (long long i = 1; i <= y; ++i) res *= (x - i + 1);     for (long long i = 1; i <= y; ++i) res /= i;     return res;   }   signed main() {     n = read();     for (long long i = 1; i <= n; ++i) a[i].x = read(), a[i].y = read();     for (long long i = 1; i <= n; ++i) {       long long cnt = 0;       for (long long j = 1; j <= n; ++j) {         if (j == i) continue;         v[++cnt].x = a[j].x - a[i].x;         v[cnt].y = a[j].y - a[i].y;       }       sort(v + 1, v + cnt + 1, cmp);       for (long long j = 1; j <= cnt; ++j) v[j + cnt] = v[j];       long long lst = 1;       for (long long j = cnt + 1; j <= 2 * cnt; ++j) {         while (lst + cnt < j || cross(v[j], v[lst + 1]) >= 0) {           ++lst;           if (lst + 1 == j) break;         }         ans += C(j - lst - 1, 3);       }     }     print(5 * C(n, 5) - ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, m, k;       cin >> n >> m >> k;       vector<int> a(n);       for (int i = 0; i < n; i++) {         cin >> a[i];       }       vector<int> what(m);       for (int x = 0; x < m; x++) {         int y = m - 1 - x;         what[x] = max(a[x], a[n - 1 - y]);       }       k = min(k, m - 1);       int ans = 0;       for (int fix = 0; fix <= k; fix++) {         int fiy = k - fix;         int mn = (int)2e9;         for (int i = fix; i <= m - 1 - fiy; i++) {           mn = min(mn, what[i]);         }         ans = max(ans, mn);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:60777216 )   using namespace std;   int err;   vector<char> best;   vector<char> curr;   int n, r;   int it;   void go(int pos, int f1, int f2, int errors) {     if (err <= errors) return;     if (pos == -1) {       err = errors;       best = curr;     } else {       if (f1 == f2) {         curr[pos] =  T ;         go(-1, 0, 0, errors + (pos + 1 < n && curr[pos + 1] == curr[pos]));       } else if (f1 > f2) {         curr[pos] =  T ;         go(pos - 1, f1 - f2, f2,            errors + (pos + 1 < n && curr[pos + 1] == curr[pos]));       } else {         curr[pos] =  B ;         go(pos - 1, f1, f2 - f1,            errors + (pos + 1 < n && curr[pos + 1] == curr[pos]));       }     }   }   int gcd(int a, int b) {     while (a && b)       if (a > b)         a %= b;       else         b %= a;     return a + b;   }   int ngcd(int a, int b) {     int res = 0;     while (a && b)       if (a > b)         res += a / b, a %= b;       else         res += b / a, b %= a;     return res;   }   int main() {     cin >> n >> r;     vector<int> nm;     for (int other = 1; other <= r; other++) {       int g = gcd(other, r);       if (g == 1) {         int t = ngcd(other, r);         if (t == n) {           nm.push_back(other);         }       }     }     if (nm.size() == 0)       puts( IMPOSSIBLE );     else {       err = n + 1;       curr.resize(n);       for (int i = (0); i < (nm.size()); i++) {         go(n - 1, r, nm[i], 0);         go(n - 1, nm[i], r, 0);       }       cout << err << endl;       for (int i = (0); i < (best.size()); i++) printf( %c , best[i]);       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rnnnd(chrono::steady_clock::now().time_since_epoch().count());   inline int read() {     int x = 0, f = 1, c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) {       x = (x << 1) + (x << 3) + (c ^ 48);       c = getchar();     }     return f == 1 ? x : -x;   }   const int N = 1e5 + 4;   int n, m, c[N], vis[N], dep[N], up1[N], up2[N];   vector<int> e[N], ans;   void upd(int x, int v) {     if (!v || dep[v] >= dep[x]) return;     if (!up1[x] || dep[v] < dep[up1[x]]) {       up2[x] = up1[x];       up1[x] = v;     } else if (!up2[x] || dep[v] < dep[up2[x]])       up2[x] = v;   }   bool dfs_1(int x) {     vis[x] = 2;     for (auto v : e[x]) {       if (!vis[v]) {         dep[v] = dep[x] + 1;         if (dfs_1(v)) return 1;         upd(x, up1[v]);         upd(x, up2[v]);       } else if (vis[v] == 1)         return 1;       else         upd(x, v);     }     vis[x] = 1;     return 0;   }   void dfs_3(int x) {     vis[x] = 3;     if (!up1[x] || (!up2[x] && up1[up1[x]])) {       up1[x] = 1;       ans.push_back(x);     } else       up1[x] = 0;     for (auto v : e[x])       if (vis[v] != 3) dfs_3(v);   }   inline void solve() {     for (int i = 1; i <= n; i++) e[i].clear();     n = read();     m = read();     for (int i = 1, u, v; i <= m; i++) {       u = read();       v = read();       e[u].push_back(v);     }     for (int i = 1; i <= n; i++) c[i] = i;     shuffle(c + 1, c + n + 1, rnnnd);     for (int i = 1; i <= min(n, 100); i++) {       memset(vis, 0, sizeof(int) * (n + 1));       memset(up1, 0, sizeof(int) * (n + 1));       memset(up2, 0, sizeof(int) * (n + 1));       memset(dep, 0, sizeof(int) * (n + 1));       if (dfs_1(c[i])) continue;       dfs_3(c[i]);       if (ans.size() * 5 >= n) {         sort(ans.begin(), ans.end());         for (auto v : ans) cout << v <<    ;         puts(  );       } else         puts( -1 );       ans.clear();       return;     }     puts( -1 );   }   int main() {     for (int T = read(); T--;) solve();     return (0 - 0);   }
#include <bits/stdc++.h>   using namespace std;   int b[105];   int main() {     int n, t, m, k;     cin >> t;     while (t--) {       cin >> n >> m >> k;       for (int i = 0; i < n; i++) cin >> b[i];       for (int i = 0; i < n - 1; i++) {         if (b[i] + k < b[i + 1])           m -= (b[i + 1] - b[i] - k);         else           m += min(b[i] - b[i + 1] + k, b[i]);         if (m < 0) {           puts( NO );           goto end;         }       }       puts( YES );     end:       continue;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 500;   const pair<double, double> inf = make_pair(-1, -1);   pair<double, double> T[N << 2];   double f[N];   int n, m;   inline int read() {     int n = 0;     char c;     for (c = getchar(); c <  0  || c >  9 ; c = getchar())       ;     for (; c >=  0  && c <=  9 ; c = getchar()) n = n * 10 + c -  0 ;     return n;   }   pair<double, double> merg(pair<double, double> t1, pair<double, double> t2) {     double l1 = t1.first, r1 = t1.second, l2 = t2.first, r2 = t2.second;     return make_pair(l1 * l2 / (1 + (l2 - 1) * r1),                      r2 + l2 * (1 - r2) * r1 / (1 - (1 - l2) * r1));   }   void up(int x) { T[x] = merg(T[x << 1], T[x << 1 | 1]); }   void build(int x, int l, int r) {     if (l == r) {       T[x] = make_pair(f[l], f[l]);       return;     }     int mi = (l + r) >> 1;     build(x << 1, l, mi);     build(x << 1 | 1, mi + 1, r);     up(x);   }   void modify(int x, int l, int r, int pos) {     if (l == r) {       T[x] = make_pair(f[l], f[l]);       return;     }     int mi = (l + r) >> 1;     if (pos <= mi)       modify(x << 1, l, mi, pos);     else       modify(x << 1 | 1, mi + 1, r, pos);     up(x);   }   pair<double, double> qry(int x, int l, int r, int L, int R) {     if (L <= l && r <= R) return T[x];     int mi = (l + r) >> 1;     pair<double, double> t1 = inf, t2 = inf;     if (L <= mi) t1 = qry(x << 1, l, mi, L, R);     if (mi < R) t2 = qry(x << 1 | 1, mi + 1, r, L, R);     return t1 == inf ? t2 : (t2 == inf ? t1 : merg(t1, t2));   }   int main() {     n = read(), m = read();     for (int i = 1; i <= n; i++) {       int x = read(), y = read();       f[i] = x * 1.0 / y;     }     build(1, 1, n);     while (m--) {       int kd, x, y, z;       kd = read(), x = read(), y = read();       if (kd == 2) {         pair<double, double> ans = qry(1, 1, n, x, y);         printf( %.10lf n , ans.first);       } else {         z = read();         f[x] = y * 1.0 / z;         modify(1, 1, n, x);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool endline = false;   template <class T>   istream& operator>>(istream& inp, vector<T>& v) {     for (auto& it : v) inp >> it;     return inp;   }   template <class T>   ostream& operator<<(ostream& out, vector<T>& v) {     for (auto& it : v) out << it << (endline ?   n  :    );     return out;   }   template <class T, class U>   istream& operator>>(istream& inp, pair<T, U>& v) {     inp >> v.first >> v.second;     return inp;   }   template <class T, class U>   ostream& operator<<(ostream& out, pair<T, U>& v) {     out << v.first <<     << v.second;     return out;   }   const int mod1 = 998244353, mod = 1e9 + 7;   const int MAXN = 1e6 + 6, MAXM = 5e5 + 5;   const int inf = 2e9;   const long long linf = 1e18;   long long n, m, a[5050];   void Solve() {     cin >> n >> m;     long long tmp = 0, i;     for (i = 1; i <= n; i++) {       if (tmp + (i - 1) / 2 < m) {         a[i] = i;         tmp += (i - 1) / 2;       } else {         long long gap = m - tmp;         if (gap == 0) {           a[i] = i;         } else {           a[i] = a[i - 1] + a[i - 2 * gap];         }         tmp += gap;         i++;         break;       }     }     if (tmp < m) {       cout << -1;       return;     }     for (; i <= n; i++) {       a[i] = 1e8 + i * i;     }     for (i = 1; i <= n; i++) {       cout << a[i] <<    ;     }   }   signed main() {     if (fopen(                  .inp ,                r )) {       freopen(                         .inp ,            r , stdin);       freopen(                         .out ,            w , stdout);     };     std::ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long TC = 1;     while (TC--) Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     priority_queue<pair<int, int> > pq1, pq2;     int n, w;     cin >> n;     for (int i = 0; i < n; i++) cin >> w, pq1.push({-w, i});     n <<= 1;     for (int i = 0; i < n; i++) {       char ch;       cin >> ch;       pair<int, int> cur;       int ret;       if (ch ==  0 )         cur = pq1.top(), ret = cur.second, pq2.push({-cur.first, cur.second}),         pq1.pop();       else         ret = pq2.top().second, pq2.pop();       cout << ret + 1 <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const int inf = (1 << 30) - 1;   const long long inf64 = ((long long)1 << 62) - 1;   const long double pi = acos(-1);   template <class T>   T sqr(T x) {     return x * x;   }   template <class T>   T abs(T x) {     return x < 0 ? -x : x;   }   int main() {     ios_base::sync_with_stdio(0);     int n, t, k, d;     cin >> n >> t >> k >> d;     cout << ((d / t + 1) * k >= n ?  NO  :  YES ) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long val[100000], dp[100000][2];   vector<int> g[100000];   void dfs(int v, int p) {     long long c1 = 0, c2 = 0;     for (int i = 0; i < (g[v].size()); i++) {       int next = g[v][i];       if (next != p) {         dfs(next, v);         c1 = max(c1, dp[next][0]);         c2 = max(c2, dp[next][1]);       }     }     long long d = c1 - c2;     if (val[v] + d > 0)       c2 += val[v] + d;     else       c1 += -(val[v] + d);     dp[v][0] = c1, dp[v][1] = c2;   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     for (int i = 0; i < n - 1; i++) {       int a, b;       cin >> a >> b;       g[a - 1].push_back(b - 1);       g[b - 1].push_back(a - 1);     }     for (int i = 0; i < n; i++) cin >> val[i];     dfs(0, -1);     cout << dp[0][0] + dp[0][1];   }
#include <bits/stdc++.h>   const int inf = 0x3f3f3f3f;   using namespace std;   int yh() {     int ret = 0;     bool f = 0;     char c = getchar();     while (!isdigit(c)) {       if (c == EOF) return -1;       if (c ==  - ) f = 1;       c = getchar();     }     while (isdigit(c)) ret = (ret << 3) + (ret << 1) + (c ^ 48), c = getchar();     return f ? -ret : ret;   }   template <typename T>   void yh(T& ret) {     ret = 0;     bool f = 0;     char c = getchar();     while (!isdigit(c)) {       if (c == EOF) return ret = -1, void();       if (c ==  - ) f = 1;       c = getchar();     }     while (isdigit(c)) ret = (ret << 3) + (ret << 1) + (c ^ 48), c = getchar();     ret = f ? -ret : ret;   }   char s[200005];   int main() {     for (register int _ = (yh()); _ >= (1); _--) {       int n = yh();       queue<int> q;       scanf( %s , s + 1);       int bloc = 0;       for (register int i = (1); i <= (n); i++) {         if (s[i] == s[i - 1]) {           q.push(bloc);         } else           bloc++;       }       int opts = 0, dlt = 0;       for (register int i = (1); i <= (n); i++) {         if (q.empty()) break;         q.pop();         opts++;         dlt++;         while (!q.empty() && q.front() == i) {           q.pop();           dlt++;         }         dlt++;       }       opts += (n - dlt + 1) / 2;       cout << opts <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int last1[510][5010], last2[510][5100], pre[510][5100];   int main() {     int s, d;     cin >> s >> d;     memset(last1, -1, sizeof(last1));     memset(last2, -1, sizeof(last2));     memset(pre, -1, sizeof(pre));     queue<pair<int, int> > q;     q.push(make_pair(0, 0));     while (!q.empty()) {       pair<int, int> cur = q.front();       q.pop();       for (int i = 0; i < 10; i++) {         if (i == 0 && cur.first == 0 && cur.second == 0) continue;         int nx1 = (cur.first * 10 + i) % s, nx2 = cur.second + i;         if (nx2 > d) continue;         if (pre[nx1][nx2] != -1) continue;         last1[nx1][nx2] = cur.first, last2[nx1][nx2] = cur.second;         pre[nx1][nx2] = i;         q.push(make_pair(nx1, nx2));       }     }     if (pre[0][d] == -1) {       cout << -1;       return 0;     }     vector<int> ans;     int nx1 = 0, nx2 = d;     while (1) {       if (pre[nx1][nx2] == -1) break;       ans.push_back(pre[nx1][nx2]);       int tmp1 = last1[nx1][nx2];       int tmp2 = last2[nx1][nx2];       nx1 = tmp1, nx2 = tmp2;     }     for (int i = ans.size() - 1; i >= 0; i--) {       cout << ans[i];     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, Q;   vector<vector<int> > ad;   vector<int> val, par;   void fun(int c, int p) {     par[c] = p;     int i;     for (i = 0; i < ad[c].size(); i++) {       if (ad[c][i] != p) fun(ad[c][i], c);     }   }   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   int query(int c, int v) {     if (c == -1) return c;     if (gcd(val[c], v) > 1) return c + 1;     return query(par[c], v);   }   int main() {     int i, j, k;     cin >> N >> Q;     ad.resize(N);     val.resize(N);     par.resize(N);     for (i = 0; i < N; i++) cin >> val[i];     for (i = 1; i < N; i++) {       cin >> j >> k;       ad[j - 1].push_back(k - 1);       ad[k - 1].push_back(j - 1);     }     fun(0, -1);     while (Q) {       Q--;       cin >> k;       if (k == 2) {         cin >> j >> k;         val[j - 1] = k;       } else {         cin >> j;         cout << query(par[j - 1], val[j - 1]) << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m(0), a(0), b(0), c(0), x;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x;       if (i % 3 == 0)         a += x;       else if (i % 3 == 1)         b += x;       else         c += x;     }     m = max(max(a, b), c);     if (m == a)       cout <<  chest ;     else if (m == b)       cout <<  biceps ;     else       cout <<  back ;   }
#include<bits/stdc++.h>   using namespace std ;    #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    #define ll long long int      //////////////////////////////////////////////////////////////////////////////////////////////   void solve();   //////////////////////////////////////////////////////////////////////////////////////////////         int main ()   {    // fastio        ll  t;     cin>>t;     while(t--)     {    solve();        }   }   ///////////////////////////////////////////   void solve()   {       ll n,i,doit=0,a,b,check=0,j,k;    cin>>n>>k;    ll temp=0 ,count =0;    vector<pair<ll,ll>>pq;    for( i=0;i<n;i++){     cin>>a>>b;        pq.push_back({a,b});    }    doit=0;    for(ll i=0;i<n;i++){     check= 0;     a+=b;     for(ll j=0;j<n;j++){      if(i==j)      continue;      a++;      a++;      b++;      b++;      a+=b;      a++;       temp =  abs(pq[i].first-pq[j].first);      b++;      b++;      b+=a;      temp+=abs(pq[i].second-pq[j].second);      a++;      a++;      b++;      if(temp<=k)check++;           }           if(check==n-1)     doit= 1;     a++;     a++;       }    // (!doit)?cout<<-1<<  n :cout<<1<<  n ;    if(doit)      cout<<1<<endl;     else      cout<<-1<<endl;         }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       long long months, monthlen, weeklen;       cin >> months >> monthlen >> weeklen;       long long n2 = monthlen - 1;       long long n1 = weeklen / gcd(n2, weeklen);       long long lim = min(months, monthlen);       long long ini = lim - n1;       long long sum = 0;       long long len = (ini + n1 - 1) / n1;       sum = ini * len - n1 * ((len - 1) * (len - 1) + (len - 1)) / 2;       cout << sum << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const long long M = 1e9 + 7;   const long long INF = 1e9;   inline long long pwr(long long base, long long n, long long m) {     long long ans = 1;     while (n > 0) {       if (n % 2 == 1) ans = (ans * base) % m;       base = (base * base) % m;       n /= 2;     }     return ans;   }   const int N = 1e6 + 10;   int a[N], n, dp[1 << 22];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       dp[a[i]] = a[i];     }     for (int i = 0; i < 22; i++) {       for (int mask = 0; mask < 1 << 22; mask++) {         if ((mask & (1 << i))) dp[mask] = max(dp[mask], dp[mask ^ (1 << i)]);       }     }     for (int i = 0; i < n; i++) {       int temp = a[i];       a[i] = (((1 << 22) - 1) ^ a[i]);       if (!dp[a[i]]) dp[a[i]] = -1;       cout << dp[a[i]] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   void file() {     freopen( alost.in ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   bool ar[10000005];   void sieve() {     ar[0] = ar[1] = 1;     for (long long i = 2; i * i <= (int)1e7; i++)       if (!ar[i])         for (long long j = i * i; j <= (int)1e7; j += i) ar[j] = 1;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL), cout.tie(NULL);     ;     sieve();     int n;     cin >> n;     for (int i = 2; i <= (int)1e7 && n; i++)       if (!ar[i]) cout << i <<    , n--;     cout << endl;     return 0;   }