malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 51;   int n, x;   int res[MAXN];   inline int read() {     register int num = 0, neg = 1;     register char ch = getchar();     while (!isdigit(ch) && ch !=  - ) {       ch = getchar();     }     if (ch ==  - ) {       neg = -1;       ch = getchar();     }     while (isdigit(ch)) {       num = (num << 3) + (num << 1) + (ch -  0 );       ch = getchar();     }     return num * neg;   }   inline void calc1(int n) {     if (n <= 0) {       return;     }     int x = 31 - __builtin_clz(n);     reverse(res + (1 << x + 1) - n - 1, res + n + 1);     calc1((1 << x + 1) - n - 2);   }   inline void solve1() {     if (n & 1) {       return (void)puts( NO );     }     puts( YES );     for (register int i = 1; i <= n; i++) {       res[i] = i;     }     calc1(n);     for (register int i = 1; i <= n; i++) {       printf( %d  , res[i]);     }     puts(  );   }   inline void solve2() {     if (n == 3 || n == 5 || n == (n & -n)) {       return (void)puts( NO );     }     puts( YES );     for (register int i = 1; i <= n; i++) {       res[i] = i;     }     if (n & 1) {       printf( 3 6 1 5 7 2 4  );       for (register int i = 8; i <= n; i += 2) {         swap(res[i], res[i ^ 1]);       }       for (register int i = 8; i <= n; i++) {         printf( %d  , res[i]);       }     } else {       for (register int i = 2; i <= n - 3; i += 2) {         swap(res[i], res[i + 1]);       }       swap(res[1], res[n - 1]), swap(res[n], res[n - 2]);       for (register int i = 1; i <= n; i++) {         printf( %d  , res[i]);       }     }     puts(  );   }   int main() { n = read(), solve1(), solve2(); }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     long long sum = 0, sum2 = 0;     scanf( %d , &n);     int nav[200005];     for (int i = 0; i < n; i++) scanf( %d , &nav[i]), sum += nav[i];     for (int i = 0; i < n; i++) {       sum2 += nav[i];       if (sum2 >= (sum + 1) / 2) {         printf( %d , i + 1);         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353, N = 3e5 + 6;   long long n, k, t;   void solve() {     cin >> n >> k;     long long t = 1;     while (t * 10 <= n) t *= 10;     while (k > 1) {       t = 1;       while (t * 10 <= n) t *= 10;       while (n - t < k - 1) t /= 10;       cout << t <<    ;       n -= t;       k--;     }     cout << n;   }   int main() {     long long tt = 1;     cin >> tt;     while (tt--) {       solve();       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int sa = 0, sb = 0;     int ca, cb;     char* c;     int i = 0;     scanf( %d , &n);     c = (char*)malloc(sizeof(char) * n);     while (n--) {       scanf( %d %d , &ca, &cb);       if (sb + cb > sa + 500) {         sa = sa + ca;         c[i++] =  A ;       } else {         sb += cb;         c[i++] =  G ;       }     }     c[i] =   0 ;     if (abs(sb - sa) <= 500)       printf( %s n , c);     else       printf( -1 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void pause() {}   bool sortbysecdesc(const pair<int, int> &a, const pair<int, int> &b) {     return a.second > b.second;   }   int rec(int n, int i, int a[], int c) {     c++;     if (n == i) return c;     rec(a[n - 1], i, a, c);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n, a[1005], c = 0;       cin >> n;       for (int i = 0; i < n; i++) {         cin >> a[i];       }       sort(a, a + n);       for (int i = n - 1; i >= 0; i--) {         c++;         if (c == a[i]) {           cout << c;           break;         } else if (c > a[i]) {           cout << c - 1;           break;         }       }       cout <<   n ;     }     pause();   }
#include <bits/stdc++.h>   using namespace std;   int xx[8] = {0, 0, 1, -1, 1, -1, 1, -1};   int yy[8] = {-1, 1, 0, 0, 1, -1, -1, 1};   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long int n;     cin >> n;     bool flag = true;     vector<long long int> v(n);     for (long long int i = 0; i < n; i++) cin >> v[i];     long long int pos1 = -1, pos2 = -1;     for (long long int i = 0; i < n; i++) {       if (v[i] == 1) {         pos1 = i;         break;       }     }     if (pos1 == -1) {       cout <<  0 ;       return 0;     }     for (int j = n - 1; j >= 0; j--) {       if (v[j] == 1) {         pos2 = j;         break;       }     }     long long int c = 1, ans = 1;     if (pos1 == pos2) {       cout << 1 <<   n ;       return 0;     } else {       for (long long int i = pos1; i < pos2 + 1; i++) {         if (v[i] == 0) {           c++;         } else {           ans *= c;           c = 1;         }       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int c, v0, v1, a, l;     cin >> c >> v0 >> v1 >> a >> l;     int d = 1;     int r = v0;     int tmp = v0;     while (1) {       if (r >= c) break;       tmp = tmp + a;       if (tmp > v1) tmp = v1;       r += (tmp - l);       d++;     }     cout << d << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2010;   int n, a[N], m;   double f[N][N], p, ans;   inline int read() {     int x = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) x = (x << 3) + (x << 1) + ch - 48, ch = getchar();     return x;   }   int main() {     scanf( %d%lf%d , &n, &p, &m);     f[0][0] = 1;     for (int i = 1; i <= m; i++) {       f[i][0] = (1 - p) * f[i - 1][0];       for (int j = 1; j <= n - 1; j++)         f[i][j] = f[i - 1][j] * (1 - p) + f[i - 1][j - 1] * p;       f[i][n] = f[i - 1][n] + f[i - 1][n - 1] * p;     }     for (int i = 1; i <= n; i++) ans += f[m][i] * i;     printf( %lf , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2200;   char s[MAXN], t[MAXN];   int l[MAXN], r[MAXN];   int main() {     int T;     scanf( %d , &T);     while (T--) {       int n, k, m = 0;       scanf( %d%d%s , &n, &k, s + 1);       for (int i = 1; i < k; i++) t[2 * i - 1] =  ( , t[2 * i] =  ) ;       for (int i = 2 * k - 1; i < k + n / 2; i++) t[i] =  ( ;       for (int i = k + n / 2; i <= n; i++) t[i] =  ) ;       for (int i = 1; i <= n; i++)         if (s[i] != t[i]) {           int k;           for (int j = i + 1; j <= n; j++)             if (s[j] == t[i]) {               k = j;               break;             }           l[++m] = i;           r[m] = k;           reverse(s + i, s + k + 1);         }       printf( %d n , m);       for (int i = 1; i <= m; i++) printf( %d %d n , l[i], r[i]);     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   long long mulmod(long long a, long long b, long long MOD) {     if (b == 0) return 0;     long long res = mulmod(a, b >> 1, MOD);     res += res;     res %= MOD;     return (b & 1) ? (a + res) % MOD : res;   }   int main() {     ios::sync_with_stdio(0);     long long t1, t2, x1, x2, t0;     cin >> t1 >> t2 >> x1 >> x2 >> t0;     long long ans1 = 3000000000000ll, ans2 = 1, ii = 0, jj = 0;     if (t1 == t0) {       if (t2 == t0) {         cout << x1 <<     << x2 << endl;         return 0;       } else {         cout << x1 <<     << 0 << endl;         return 0;       }     }     if (t2 == t0) {       cout << 0 <<     << x2 << endl;       return 0;     }     if (t0 <= t1) {       ii = x1;       jj = 0;       ans1 = x1 * t1;       ans2 = x1;     }     if (t0 <= t2 &&         (ans1 == 3000000000000ll || (t2 < t1 || (t2 == t1 && x2 > x1)))) {       ii = 0;       jj = x2;       ans1 = x2 * t2;       ans2 = x2;     }     for (long long i = 0; i <= x1; i++) {       long long j = (i * (t0 - t1)) / (t2 - t0);       if ((i * (t0 - t1)) % (t2 - t0) != 0) {         j++;       }       if (i == 0 && j == 0) continue;       if (j < 0 || j > x2) {         continue;       }       if (ans1 * (i + j) > (i * t1 + j * t2) * ans2) {         ans1 = (i * t1 + j * t2);         ans2 = (i + j);         ii = i;         jj = j;       } else {         if (ans1 * (i + j) == (i * t1 + j * t2) * ans2 && ans2 < (i + j)) {           ans1 = (i * t1 + j * t2);           ans2 = (i + j);           ii = i;           jj = j;         }       }     }     cout << ii <<     << jj << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k;     cin >> n >> k;     map<long long, long long> row, col;     row.clear();     col.clear();     long long aRow = 0, aCol = 0, res = n * n;     while (k--) {       long long x, y;       cin >> x >> y;       if (!row[x] && !col[y]) {         row[x] = 1;         col[y] = 1;         res -= (2 * n - 1 - aRow - aCol);         aRow++;         aCol++;         cout << res;       } else if (row[x] && col[y]) {         cout << res;       } else if (row[x]) {         res -= (n - aRow);         col[y] = 1;         aCol++;         cout << res;       } else if (col[y]) {         res -= (n - aCol);         row[x] = 1;         aRow++;         cout << res;       }       if (k)         cout <<    ;       else         cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int l, r;     cin >> l >> r;     int a{r}, b{max(r / 2 + 1, l)};     cout << a % b <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int t{1};     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, d, start = 0;     cin >> n >> d;     vector<string> s(d);     for (string &e : s) cin >> e;     vector<int> win(d);     for (int i = 0; i < s.size(); i++) {       string q = s[i];       if (q.find( 0 ) <= q.length()) {         win[start]++;       } else {         start++;       }     }     sort(win.begin(), win.end(), greater<int>());     cout << win[0] << endl;   }
#include <bits/stdc++.h>   using namespace std;   struct arra {     long long int d = 0, idx;   } arr[200008];   bool comp(struct arra a, struct arra b) { return a.d > b.d; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, k, a, temp, ans;     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> a;       arr[a].d++;       arr[a].idx = a;     }     sort(arr, arr + 200005, comp);     long long int l = 1, r = 200008, mid;     while (l <= r) {       mid = (l + r) / 2;       temp = 0;       for (int i = 0; i < n; i++) {         temp += arr[i].d / mid;       }       if (temp >= k) {         ans = mid;         l = mid + 1;       } else         r = mid - 1;     }     vector<long long> v;     for (int i = 0; i < n; i++) {       for (int j = 0; j < arr[i].d / ans; j++) {         v.push_back(arr[i].idx);       }     }     for (int i = 0; i < k; i++) cout << v[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool solve(int cn) {     int n, k;     cin >> n >> k;     vector<int> soldiers(n);     for (int i = (0); i < (n); i++) cin >> soldiers[i];     soldiers.push_back(1 << 30);     int coins = 0;     while (soldiers[0] < k) {       coins++;       for (int i = (0); i < (n); i++) {         while (soldiers[i] == soldiers[i + 1]) i++;         soldiers[i]++;       }     }     cout << coins << endl;     return 0;   }   int main() {     int cases = 1 << 30;     if (!cases) cin >> cases;     for (int cn = 1; cn <= cases && solve(cn); ++cn)       ;     return 0;   }
#include <iostream>   #include <vector>   #include <set>   #include <algorithm>   using namespace std;   typedef long long ll;   typedef pair<ll, ll> P;   const int maxn = 105;   int n, m, k;   vector<set<int>> mp(maxn);   vector<int> g, ans;   int vis[maxn], pre[maxn], pres[maxn][maxn*maxn];   ll dp[maxn][maxn*maxn];   P query[maxn];   int c = 0;   bool found(int u, int t){       vis[u] = t;       for(set<int>::iterator i = mp[u].begin(); i != mp[u].end(); i++){           int v = *i;           if(vis[v] == t)    continue;           vis[v] = t;           if(pre[v] == 0 || found(pre[v], t)){               pre[v] = u;               return true;           }       }       return false;   }   int main(){    scanf( %d%d%d , &n, &m, &k);    for(int i = 1; i <= m; i++){     int u, v;     scanf( %d%d , &u, &v);     mp[u].insert(v+n);    }    for(int i = 1; i <= k; i++){     scanf( %lld%lld , &query[i].first, &query[i].second);    }    for(int i = 1; i <= n; i++){     if(found(i, i)) c++;     }    for(int i = c; i >= 1; i--){     if(i == 1)       int a = 1;     int now;     static vector<set<int>> _mp;     _mp = mp;          for(int j = 1; j <= n; j++){      int cnt = 0;      mp = _mp;      mp[j].clear();      if(i == 1 && j == 1){       int a = 1;      }      for(int i = 1; i <= 2*n; i++) vis[i] = pre[i] = 0;      for(int k = 1; k <= n; k++){       if(found(k, k)) cnt++;       }      if(cnt < i) now = j;      mp = _mp, cnt = 0;      for(int k = 1; k <= n; k++){       mp[k].erase(j+n);      }      for(int i = 1; i <= 2*n; i++) vis[i] = pre[n+i] = 0;      for(int k = 1; k <= n; k++){       if(found(k, k)) cnt++;       }      if(cnt < i) now = -j;     }     mp = _mp;     if(now < 0){      for(int k = 1; k <= n; k++){       mp[k].erase(-now+n);      }     }else{      mp[now].clear();     }     g.push_back(now);    }    reverse(g.begin(), g.end());    for(int i = 0; i <= c; i++) dp[0][i] = -1e9-7;    dp[0][c] = 0;    for(int i = 0; i < k; i++){     for(int j = 0; j <= c; j++) dp[i+1][j] = -1e9-7;     for(int j = 0; j <= c; j++){      if(dp[i][j] == -1e18-7) continue;      for(int h = 0; h <= j; h++){       if(i + 1 + h >= n) break;       int t = j - h;       ll add = max(0ll, query[i+1].first - t * query[i+1].second);       if(dp[i+1][h] < dp[i][j] + add){        dp[i+1][h] = dp[i][j] + add;        pres[i+1][h] = j;       }      }     }    }    int index = max_element(dp[k], dp[k]+c+1) - dp[k];    for(int i = k; i >= 1; i--){     int cnt = pres[i][index];     ans.push_back(0);     for(int j = index; j < cnt; j++){      ans.push_back(g.back());       g.pop_back();      }     index = cnt;    }    printf( %d n , ans.size());    for(int i = ans.size() - 1; i >= 0; i--){     printf( %d  , ans[i]);    }    return 0;   }
#include <bits/stdc++.h>   int CH, NEG;   template <typename TP>   inline void read(TP& ret) {     ret = NEG = 0;     while (CH = getchar(), CH <  ! )       ;     if (CH ==  - ) NEG = true, CH = getchar();     while (ret = ret * 10 + CH -  0 , CH = getchar(), CH >  ! )       ;     if (NEG) ret = -ret;   }   int n, data[200010LL], id[200010LL], rank[200010LL], val[200010LL];   inline bool cmp(const int& a, const int& b) { return data[a] < data[b]; }   int main() {     int m, i, p, q, l, d, r;     bool unord;     read(n), read(m);     unord = false, data[0] = -2000000001LL;     for (i = (1); i <= (n); i++)       if (read(data[i]), id[i] = i, data[i - 1] > data[i]) unord = true;     if (unord) std::sort(id + 1, id + n + 1, cmp);     for (i = (1); i <= (n); i++) rank[id[i]] = i, val[i] = data[id[i]];     val[n + 1] = 2000000001LL;     while (m-- > 0) {       read(p), read(l), p = rank[p];       q = std::upper_bound(val, val + n + 2, val[p] + l) - val - 1;       l -= val[q] - val[p], p = q, d = -1;       while (true) {         if (d == 1)           q = std::upper_bound(val + 1, val + n + 2, val[p] + l * d) - val - 1;         else           q = std::lower_bound(val + 1, val + n + 2, val[p] + l * d) - val;         if (p == q) break;         if (r = std::abs(val[p] - val[q]), (l / r) & 1) p = q, d = -d;         l %= r;       }       printf( %d n , id[p]);     }     getchar(), getchar();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long s[100001];   int main() {     int n, c = 1;     long long sum = 0;     cin >> n;     for (int i = 0; i < n; i++) cin >> s[i];     sort(s, s + n);     sum += s[0];     for (int i = 1; i < n; i++) {       if (sum <= s[i]) {         c++;         sum += s[i];       }     }     cout << c;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, tlen = 0, dir, i;     string temp;     cin >> n >> m >> k;     cin >> temp >> temp;     if (temp ==  head )       dir = -1;     else       dir = 1;     cin >> temp;     if (m < k)       m = 1;     else       m = n;     for (i = 0; i < temp.size(); ++i) {       if (k == 1)         dir = 1;       else if (k == n)         dir = -1;       k += dir;       if (temp[i] !=  1 ) {         if (k == m) {           cout <<  Controller   << i + 1;           return 0;         }       } else {         if (dir == -1)           m = n;         else           m = 1;       }     }     cout <<  Stowaway ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> factors(long long n) {     vector<long long> first;     long long tem = 1;     for (long long x = 2; x * x <= n; x++) {       while (n % x == 0) {         first.push_back(x);         n /= x;       }     }     if (n > 1) first.push_back(n);     return first;   }   long long stringToint(string str) {     int num = stoi(str);     return num;   }   int hamming(int a, int b) { return __builtin_popcount(a ^ b); }   bool cmp(int a, int b) { return a > b; }   void reset() {     for (int i = 0; i < 200000 + 100; i++) {     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n, d;     while (cin >> n >> d) {       int m;       cin >> m;       for (int i = 0, x, y; i < m; i++) {         cin >> x >> y;         if (abs(x - y) >= 0 && abs(x - y) <= d && x + y <= n + n - d &&             x + y >= d && (x + y != 0 || x - y != 0))           cout <<  YES n ;         else           cout <<  NO n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int gcd(long long int a, long long int b) {     return b ? gcd(b, a % b) : a;   }   long long int lcm(long long int a, long long int b) {     return a * b / gcd(a, b);   }   int n, cnt[100010];   int main() {     scanf( %d , &n);     set<int> s;     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       s.insert(x);       auto itr = s.find(x);       itr++;       if (itr == s.end())         cnt[x]--;       else {         x = *itr;         itr++;         if (itr == s.end()) cnt[x]++;       }     }     int ans = 1;     for (int i = 1; i <= n; i++)       if (cnt[i] > cnt[ans]) ans = i;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[200200];   int main() {     int i, j;     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (i = 1; i < n; i++) {       if (a[i] % 2) {         a[i] = 1;         if (a[i + 1] == 0) {           cout <<  NO ;           return 0;         } else {           a[i + 1]--;         }       }     }     if (a[n] % 2) {       cout <<  NO ;       return 0;     }     cout <<  YES ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100000 + 10;   const int M = 1000000007;   const double PI = atan(1) * 4;   const int oo = 1000000000;   long long A, B, n, x;   long long pw(long long x, long long p) {     if (!p) return 1;     long long d = pw(x, p / 2);     d = (d * d) % M;     if (p % 2) d = (d * x) % M;     assert(x <= M);     assert(d <= M);     return d;   }   int main() {     cin >> A >> B >> n >> x;     if (A == 1) return cout << (n % M * B % M + x) % M, 0;     long long one = x * pw(A, n) % M;     long long dom = pw(A, n) - 1;     long long den = pw(A - 1, M - 2);     cout << (one + B * ((dom * den) % M) % M) % M << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = M_PI;   const int INF = -1 * 1e9;   const long long limit = 1 * 1e12;   const int MOD1 = 1e9 + 711;   const int MOD2 = 1e9 + 933;   const int MOD3 = 1e9 + 993;   const int maxn = 1e6 + 100;   int main() {     cout.tie(0);     cin.tie(0);     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<int> a(n), b(n);     for (int i = 0; i < n; ++i) {       cin >> a[i];       b[i] = a[i];     }     sort(b.begin(), b.end());     int cnt = 0;     for (int i = 0; i < n; ++i) {       if (a[i] != b[i]) {         ++cnt;       }     }     if (cnt <= 2) {       cout <<  YES ;     } else {       cout <<  NO ;     }     cerr <<   n nTime elapsed:   << 1.0 * clock() / CLOCKS_PER_SEC <<   s. n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ax, ay, bx, by, cx, cy;   int solve(long long x2, long long y2) {     if (cx == 0 && cy == 0) {       if (x2 == 0 && y2 == 0) return 1;       return 0;     } else if (cx == 0) {       long long g, h;       g = x2 / cy;       h = y2 / cy;       if (g * cy == x2 && h * cy == y2) return 1;       return 0;     } else if (cy == 0) {       long long g, h;       g = x2 / cx;       h = y2 / cx;       if (g * cx == x2 && h * cx == y2) return 1;       return 0;     } else {       long long a, b;       if ((cx * cy + cx * cx) == 0) return 0;       b = (x2 * cy - y2 * cx) / (cy * cy + cx * cx);       a = (x2 - b * cy) / cx;       if (b * (cy * cy + cx * cx) == (x2 * cy - y2 * cx) &&           (a * cx == x2 - b * cy)) {         return 1;       }       return 0;     }     return 0;   }   int main() {     scanf( %lld%lld , &ax, &ay);     scanf( %lld%lld , &bx, &by);     scanf( %lld%lld , &cx, &cy);     if (solve(bx - ax, by - ay)) {       puts( YES );       return 0;     }     if (solve(bx + ax, by + ay)) {       puts( YES );       return 0;     }     if (solve(bx - ay, by + ax)) {       puts( YES );       return 0;     }     if (solve(bx + ay, by - ax)) {       puts( YES );       return 0;     }     puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int g[100100];   int suff[100100];   char S[1024];   set<int> crim;   char T[100100];   int R[100100], neg[100100];   int main() {     int n, m, tot = 0;     scanf( %d , &n);     scanf( %d , &m);     for (int i = 0; i < n; i++) {       scanf( %s , S);       int l = strlen(S);       char sign = S[0];       int pos = 1, num = 0;       while (pos < l) {         num = num * 10 + S[pos] -  0 ;         pos++;       }       num--;       if (S[0] ==  + )         g[num]++;       else {         tot++;         neg[num]++;       }       T[i] = S[0];       R[i] = num;     }     for (int i = 0; i < n; i++) {       g[i] += tot;       g[i] -= neg[i];     }     for (int i = 0; i < n; i++) {       if (g[i] == m) crim.insert(i);     }     int prob = crim.size();     for (int i = 0; i < n; i++) {       if (T[i] ==  + ) {         if (crim.find(R[i]) == crim.end()) {           puts( Lie );         } else {           if (prob == 1)             puts( Truth );           else             puts( Not defined );         }       } else {         if (crim.find(R[i]) == crim.end()) {           puts( Truth );         } else {           if (prob == 1)             puts( Lie );           else             puts( Not defined );         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int su[3000000];   vector<int> vec;   int vv[3000010];   int main() {     memset(su, 0, sizeof(su));     memset(vv, 0, sizeof(vv));     vec.push_back(2);     for (int i = 3; i <= 2750131; i++) {       for (int j = 0; j < vec.size(); j++) {         if (vec[j] * vec[j] > i) break;         if (i % vec[j] == 0) {           su[i] = i / vec[j];           break;         }       }       if (su[i] == 0) vec.push_back(i);     }     int n;     scanf( %d , &n);     int h_sum = 2 * n;     for (int i = 1; i <= 2 * n; i++) {       int x;       scanf( %d , &x);       vv[x]++;     }     for (int i = 2750131; i >= 2; i--) {       while (su[i] && vv[i]) {         printf( %d  , i);         vv[i]--;         vv[su[i]]--;         h_sum -= 2;       }     }     for (int i = 2750131; i >= 2; i--) {       if (h_sum == 0) break;       while (vv[i]) {         int k = lower_bound(vec.begin(), vec.end(), i) - vec.begin() + 1;         printf( %d  , k);         vv[i]--;         vv[k]--;         h_sum -= 2;         if (h_sum == 0) break;       }     }     printf(  n );     return 0;   }