malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 1010;   int n, m;   int fw[N][N], fb[N][N];   int dx[8] = {-2, -2, 2, 2, 1, 1, -1, -1};   int dy[8] = {1, -1, 1, -1, 2, -2, 2, -2};   queue<pair<int, int> > q;   void bfs(int x, int y, int f[][N]) {     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) f[i][j] = -1;     f[x][y] = 0;     q.push(pair<int, int>(x, y));     while (!q.empty()) {       pair<int, int> h = q.front();       q.pop();       int x = h.first, y = h.second;       for (int i = 0; i < 8; ++i) {         int xx = x + dx[i], yy = y + dy[i];         if (xx <= 0 || xx > n || yy <= 0 || yy > m) continue;         if (f[xx][yy] == -1) {           f[xx][yy] = f[x][y] + 1;           q.push(pair<int, int>(xx, yy));         }       }     }   }   void go(int x, int y, int f[][N]) {     while (f[x][y]) {       for (int i = 0; i < 8; ++i) {         int xx = x + dx[i], yy = y + dy[i];         if (xx <= 0 || xx > n || yy <= 0 || yy > m) continue;         if (f[xx][yy] != -1 && f[xx][yy] < f[x][y]) {           x = xx, y = yy;           printf( %d %d n , x, y);           fflush(stdout);           break;         }       }     }   }   int main() {     int xw, yw, xb, yb, hn, hm;     scanf( %d%d , &n, &m);     scanf( %d%d%d%d , &xw, &yw, &xb, &yb);     hn = n >> 1, hm = m >> 1;     bfs(hn, hm, fw);     bfs(hn + 1, hm, fb);     double tw = fw[xw][yw];     double tb = fb[xb][yb] + 0.5;     double twb = fb[xw][yw];     double tbb = fw[xb][yb] + 0.5;     if (((xw + yw) & 1) ^ ((xb + yb) & 1)) {       if (tw < tb) {         puts( WHITE );         go(xw, yw, fw);       } else if (twb < tb + 1) {         puts( WHITE );         if (fb[xw][yw]) {           go(xw, yw, fb);         } else {           printf( %d %d n , xw - 2, yw - 1);           printf( %d %d n , xw, yw);         }         go(hn + 1, hm, fw);       } else {         puts( BLACK );         go(xb, yb, fb);       }     } else {       if (tb < tw) {         puts( BLACK );         go(xb, yb, fb);       } else if (tbb < tw + 1) {         puts( BLACK );         if (fw[xb][yb]) {           go(xb, yb, fw);         } else {           printf( %d %d n , xb - 2, yb - 1);           printf( %d %d n , xb, yb);         }         go(hn, hm, fb);       } else {         puts( WHITE );         go(xw, yw, fw);       }     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int N;     std::cin >> N;     std::set<std::pair<int, int>> doubled;     std::set<std::pair<int, int>> pend;     int to_double = 0;     int f_doubled = 0;     int64_t total_damage = 0;     int t;     int d;     for (int i = 0; i < N; i++) {       std::cin >> t;       std::cin >> d;       total_damage += d;       to_double += t * (d > 0 ? 1 : -1);       if (d > 0) {         pend.insert({d, t});       } else {         auto search = doubled.find({-d, t});         if (search != doubled.end()) {           doubled.erase(search);           if (t == 0) f_doubled--;           total_damage += d;         } else {           pend.erase(pend.find({-d, t}));         }         if (t == 1) {           if (doubled.size() > 0) {             auto it_doubled = doubled.begin();             std::pair<int, int> max = *it_doubled;             doubled.erase(it_doubled);             pend.insert(max);             if (max.second == 0) f_doubled--;             total_damage -= max.first;           }         }       }       if (to_double > doubled.size()) {         if (pend.size() > 0) {           auto it_pend = --pend.end();           std::pair<int, int> max = *it_pend;           doubled.insert(max);           pend.erase(it_pend);           if (max.second == 0) f_doubled++;           total_damage += max.first;         }       } else if (doubled.size() == to_double) {         if (to_double > 0 && pend.size() > 0) {           auto it_doubled = doubled.begin();           auto it_pend = --pend.end();           std::pair<int, int> min = *it_doubled;           std::pair<int, int> max = *it_pend;           if (max.first > min.first) {             if (max.second == 0) f_doubled++;             if (min.second == 0) f_doubled--;             doubled.erase(it_doubled);             pend.erase(it_pend);             doubled.insert(max);             pend.insert(min);             total_damage += max.first - min.first;           }         }       }       if (doubled.size() > 0 && f_doubled == 0 && doubled.size() == to_double) {         auto it_doubled = doubled.begin();         doubled.erase(it_doubled);         std::pair<int, int> min = *it_doubled;         total_damage -= min.first;         if (pend.size() > 0) {           auto it_pend = --pend.end();           std::pair<int, int> max = *it_pend;           pend.erase(it_pend);           doubled.insert(max);           f_doubled++;           total_damage += max.first;         }         pend.insert(min);       }       printf( %lld n , total_damage);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 5005, MAXC = 1000005;   int a[MAXN], b[MAXC], c[MAXC];   int n, k, _max;   int main() {     if (0) {       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);     };     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]), _max = max(_max, a[i]);     for (int i = 1; i < n; i++)       for (int j = i + 1; j <= n; j++) b[abs(a[i] - a[j])]++;     for (int res = n - k; res <= 1000001; res++) {       int cnt = 0;       bool ok = true;       for (int i = res; i <= _max; i += res) {         cnt += b[i];         if (cnt > (k + 1) * k / 2) {           ok = false;           break;         }       }       if (!ok) continue;       int x = 0;       for (int i = 1; i <= n; i++) {         if (c[a[i] % res]) x++;         c[a[i] % res]++;       }       if (x <= k) {         cout << res << endl;         return 0;       }       for (int i = 1; i <= n; i++) c[a[i] % res] = 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxnum = 2005;   char str[maxnum][maxnum];   int state[maxnum];   int main() {     int m, n;     while (~scanf( %d%d , &n, &m)) {       memset(state, 0, sizeof(state));       for (int i = 0; i < n; ++i) {         scanf( %s , str[i]);         for (int j = 0; j < m; ++j) {           if (str[i][j] ==  1 ) state[j] +=  1 ;         }       }       bool ans = false;       for (int i = 0; i < n; ++i) {         bool judge = true;         for (int j = 0; j < m; ++j) {           if (judge == false) break;           if (str[i][j] ==  1 ) {             judge = state[j] -  1 ;           }           if (str[i][j] ==  0 ) {             judge = state[j];           }         }         if (judge) {           ans = true;           break;         }       }       if (ans)         printf( YES n );       else         printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct edge {     int to, next, w;     edge(int _to = 0, int _next = 0, int _w = 0) : to(_to), next(_next), w(_w) {}   } e[300010 << 1];   int n, m;   int g[300010], nume = 0;   int d[300010];   int f[300010][2];   vector<int> ans;   namespace LCT {   int f[300010];   void init() {     for (int i = 1; i <= n; i++) f[i] = i;   }   int getf(int x) {     if (f[x] == x) return x;     return f[x] = getf(f[x]);   }   int merge(int x, int y) { f[f[x]] = f[y]; }   }  // namespace LCT   void addEdge(int u, int v, int w) {     e[nume] = edge(v, g[u], w);     g[u] = nume++;   }   void dfs(int x, int p) {     for (int i = g[x]; ~i; i = e[i].next)       if (e[i].to ^ p) dfs(e[i].to, x);     int numch = 0;     static int ch[300010][2];     int c0 = 0, c1 = 0;     for (int i = g[x]; ~i; i = e[i].next)       if (e[i].to ^ p) {         ++numch;         ch[numch][0] = f[e[i].to][0];         ch[numch][1] = f[e[i].to][1];         if (!ch[numch][0] && !ch[numch][1]) {           f[x][0] = f[x][1] = 0;           return;         }         if (ch[numch][0] && ch[numch][1]) {           f[x][0] = f[x][1] = 1;           return;         }         if (ch[numch][0]) c0++;         if (ch[numch][1]) c1++;       }     if (d[x] == -1) {       f[x][0] = f[x][1] = 1;       return;     }     if (d[x] == 0) {       if (c1 & 1) {         f[x][1] = 1;         f[x][0] = 0;       } else {         f[x][1] = 0;         f[x][0] = 1;       }     } else {       if (c1 & 1) {         f[x][1] = 0;         f[x][0] = 1;       } else {         f[x][1] = 1;         f[x][0] = 0;       }     }   }   void dfs2(int x, int p, int fx) {     if (f[x][0] != f[x][1]) {       for (int i = g[x]; ~i; i = e[i].next)         if (e[i].to ^ p)           if (f[e[i].to][0]) {             dfs2(e[i].to, x, 0);           } else {             ans.push_back(e[i].w);             dfs2(e[i].to, x, 1);           }     } else {       int temp = -1, c1 = 0;       for (int i = g[x]; ~i; i = e[i].next)         if (e[i].to ^ p) {           if (f[e[i].to][0] == f[e[i].to][1] && temp == -1) {             temp = i;           } else {             if (f[e[i].to][0])               dfs2(e[i].to, x, 0);             else {               dfs2(e[i].to, x, 1);               ans.push_back(e[i].w);               c1++;             }           }         }       if (temp == -1) return;       if ((c1 & 1) == fx ^ d[x])         dfs2(e[temp].to, x, 0);       else {         dfs2(e[temp].to, x, 1);         ans.push_back(e[temp].w);       }     }   }   int main() {     memset(g, -1, sizeof g);     scanf( %d%d , &n, &m);     LCT::init();     for (int i = 1; i <= n; i++) scanf( %d , d + i);     for (int i = 1; i <= m; i++) {       int u, v;       scanf( %d%d , &u, &v);       if (LCT::getf(u) ^ LCT::getf(v)) {         addEdge(u, v, i);         addEdge(v, u, i);         LCT::merge(u, v);       }     }     dfs(1, 0);     if (!f[1][0]) {       puts( -1 );       return 0;     }     dfs2(1, 0, 0);     int numans = ans.size();     printf( %d n , numans);     for (int i = 0; i < numans; i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int dp[360361];   long long int k;   bool reach(long long int from, long long int to) {     if (from <= to) return false;     long long int d = from - to;     if (d == 1) return true;     for (long long int i = (long long int)(from - to + 1);          i < ((long long int)(k + 1)); i++)       if (to % i == 0 && to + i > from) return true;     return false;   }   long long int calc(long long int from, long long int to) {     for (long long int i = (long long int)(from); i < ((long long int)(to + 1));          i++)       dp[i] = 999999;     dp[from] = 0;     for (long long int i = (long long int)(from + 1);          i < ((long long int)(to + 1)); i++) {       for (long long int j = i - 1; j >= max(from, i - k + 1); j--) {         if (reach(i, j)) dp[i] = min(dp[i], dp[j] + 1);       }     }     return dp[to];   }   int main() {     long long int a, b;     cin >> a >> b >> k;     a -= 360360 * (b / 360360);     b = b % 360360;     if (a < 360360) {       cout << calc(b, a) << endl;     } else {       long long int res = 0;       res += calc(b, 360360);       long long int nums = (a - (a % 360360) - 360360) / 360360;       res += calc(0, 360360) * nums;       res += calc(0, a % 360360);       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 10000000000;   const int maxn = 5010;   long long a[maxn];   long long last[maxn];   int dp[maxn];   long long s[maxn];   int n;   int main(int argc, char *argv[]) {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     fill(last, last + maxn, INF);     fill(dp, dp + maxn, maxn);     s[0] = 0;     for (int i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];     dp[0] = 0;     last[0] = 0;     for (int i = 1; i <= n; i++) {       for (int j = 0; j < i; j++) {         if (s[i] - s[j] >= last[j]) {           if (dp[i] >= dp[j] + i - j - 1) {             dp[i] = dp[j] + i - j - 1;             last[i] = min(last[i], s[i] - s[j]);           }         }       }     }     cout << dp[n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int abso(int a, int b) {     if (a < b)       return b - a;     else       return a - b;   }   long long power(long long x, long long e) {     long long temp;     if (e == 0) return 1;     if (e % 2 == 0) {       temp = power(x, e / 2);       return temp * temp;     } else {       temp = power(x, e / 2);       return temp * temp * x;     }   }   bool cmp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {     if (x.first.first == y.first.first) {       if (x.first.second == y.first.second)         return x.second < y.second;       else         return x.first.second > y.first.second;     }     return x.first.first > y.first.first;   }   bool cmp1(pair<int, int> x, pair<int, int> y) {     if (x.second == y.second) return x.first < y.first;     return x.second < y.second;   }   int main() {     int n;     cin >> n;     string str;     cin >> str;     int arr[n + 1];     for (int i = 1; i <= n; i++) cin >> arr[i];     int cur = 1;     int visit[n + 1];     memset(visit, 0, sizeof visit);     int flag = 0, next;     visit[cur] = 1;     while (1) {       if (str[cur - 1] ==  < ) {         next = cur - arr[cur];         if (next < 1) {           flag = 1;           break;         } else {           if (visit[next] == 1) {             flag = 2;             break;           } else {             visit[next] = 1;             cur = next;           }         }       } else {         next = cur + arr[cur];         if (next > n) {           flag = 1;           break;         } else {           if (visit[next] == 1) {             flag = 2;             break;           } else {             visit[next] = 1;             cur = next;           }         }       }     }     if (flag == 1)       cout <<  FINITE  << endl;     else       cout <<  INFINITE  << endl;     return 0;   }
#include <bits/stdc++.h>   int n, m, q;   std::vector<int> dp;   std::vector<std::pair<int, int> > edges;   struct bip {     std::vector<int> pers;     std::stack<std::pair<int, int> > updates;     std::stack<int> change;     void update(int i, int j) {       updates.push({i, pers[i]});       pers[i] = j;     }     int root(int u) {       while (pers[(u + 1)] >= 0) u = pers[(u + 1)];       return u;     }     void merge(int u, int v) {       if (!pers[(0)]) {         change.push(0);         return;       }       u = root(u);       v = root(v);       if (pers[(n + 1 + u)] == v) {         change.push(0);         return;       }       if (u == v) {         update((0), 0);         change.push(1);         return;       }       int c = 0;       int eu = pers[(n + 1 + u)];       int ev = pers[(n + 1 + v)];       if (ev != -1) {         if (pers[(ev + 1)] < pers[(u + 1)]) u ^= ev ^= u ^= ev;         update((u + 1), pers[(ev + 1)] + pers[(u + 1)]);         c++;         update((ev + 1), u);         c++;       }       if (eu != -1) {         if (pers[(eu + 1)] < pers[(v + 1)]) v ^= eu ^= v ^= eu;         update((v + 1), pers[(eu + 1)] + pers[(v + 1)]);         c++;         update((eu + 1), v);         c++;       }       update((n + 1 + u), v);       c++;       update((n + 1 + v), u);       c++;       change.push(c);     }     void undo() {       int u = change.top();       change.pop();       while (u--) {         std::pair<int, int> next = updates.top();         updates.pop();         pers[next.first] = next.second;       }     }   } graph;   void solve(int l, int r, int tl, int tr) {     int mid = (l + r) / 2;     for (int i = l; i < mid; i++) {       graph.merge(edges[i].first, edges[i].second);     }     int opt = tr;     for (int i = tr; i > std::max(tl, mid); i--) {       graph.merge(edges[i].first, edges[i].second);       if (graph.pers[(0)]) opt = i - 1;     }     dp[mid] = opt;     for (int i = tr; i > std::max(tl, mid); i--) graph.undo();     dp[mid] = opt;     if (l == r) {       for (int i = l; i < mid; i++) graph.undo();       return;     }     graph.merge(edges[mid].first, edges[mid].second);     solve(mid + 1, r, opt, tr);     for (int i = mid; i >= l; i--) graph.undo();     if (l < mid) {       for (int i = tr; i > opt; i--) graph.merge(edges[i].first, edges[i].second);       solve(l, mid - 1, tl, opt);       for (int i = opt + 1; i <= tr; i++) graph.undo();     }   }   signed main() {     std::ios::sync_with_stdio(false);     std::cin.tie(0);     std::cin >> n >> m >> q;     graph.pers = std::vector<int>(2 * n + 1, -1);     graph.pers[(0)] = 1;     edges.resize(m);     int last = 0;     for (int i = 0; i < m; i++) {       std::cin >> edges[i].first >> edges[i].second;       edges[i].first--;       edges[i].second--;       if (graph.pers[(0)]) last = i;       graph.merge(edges[i].first, edges[i].second);     }     dp.resize(last + 1);     for (int i = 0; i < m; i++) graph.undo();     solve(0, last, 0, m - 1);     while (q--) {       int l, r;       std::cin >> l >> r;       l--;       r--;       if (l > last || r < dp[l])         std::cout <<  YES  << std::endl;       else         std::cout <<  NO  << std::endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, s = 0, k2 = 0, k1 = 0, z;     cin >> n >> m >> k;     z = k % 2;     while (true) {       if (s + 2 * m >= k) {         goto v;       } else {         s = s + 2 * m;         k2++;       }     }   v:;     cout << k2 + 1 <<    ;     while (true) {       if (s >= (k - 2))         goto z;       else {         s = s + 2;         k1++;       }     }   z:;     cout << k1 + 1 <<    ;     if (z == 0)       cout <<  R ;     else       cout <<  L ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j, r;     char str[] = { R ,  O ,  Y ,  B ,  G ,  I ,  V };     cin >> n;     r = n % 7;     n -= r;     for (i = 0; i < n; i++) cout << str[i % 7];     for (i = 0; i < r; i++) cout << str[3 + i % 4];   }
#include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, +1, -1};   int dy[] = {+1, -1, 0, 0};   int dxx[] = {+1, 0, -1, 0, +1, +1, -1, -1};   int dyy[] = {0, +1, 0, -1, +1, -1, +1, -1};   inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }   vector<pair<long long, long long> > ans;   int main() {     long long x, i, sz = 0, l, y;     scanf( %lld , &x);     l = min(x, 10000000LL);     for (i = 1; i <= l; i++) {       y = x * 6LL;       if (y % i) continue;       y /= i;       if (y % (i + 1)) continue;       y /= (i + 1);       y += (i - 1);       if (y % 3) continue;       y /= 3;       if (y < i) continue;       ans.push_back(make_pair(i, y));       if (i == y)         sz++;       else         sz += 2;     }     printf( %lld n , sz);     for (i = 0; i < ans.size(); i++)       printf( %lld %lld n , ans[i].first, ans[i].second);     for (i = ans.size() - 1; ~i; i--)       if (ans[i].first != ans[i].second)         printf( %lld %lld n , ans[i].second, ans[i].first);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAX = 4e6;   vector<long long> vec[1000000];   long long N, T, ok, cur = 2, arr[MAX], res[MAX], cnt[MAX], prime[MAX];   void cal() {     prime[0] = 1;     prime[1] = 1;     for (long long A = 2; A < MAX; A++)       if (!prime[A]) {         if (A < 1000000) vec[A].push_back(A);         for (long long B = A + A; B < MAX; B += A) {           prime[B] = 1;           if (B < 1000000) vec[B].push_back(A);         }       }     return;   }   signed main() {     ios_base::sync_with_stdio(false);     cal();     cin >> N;     for (long long A = 1; A <= N; A++) cin >> arr[A];     for (long long A = 1; A <= N; A++) {       if (ok == 0)         for (auto B : vec[arr[A]]) {           cnt[B]++;           if (cnt[B] > 1) ok = 1;         }       if (ok == 0)         res[A] = arr[A];       else if (ok == 1) {         for (auto B : vec[arr[A]]) cnt[B]--;         cur = arr[A] + 1;         while (true) {           T = 0;           for (auto B : vec[cur]) T += cnt[B];           if (T == 0) {             res[A] = cur;             for (auto B : vec[cur]) cnt[B]++;             break;           }           cur++;         }         cur = 2;         ok = 2;       } else {         while ((prime[cur]) or (cnt[cur])) cur++;         res[A] = cur++;       }     }     for (long long A = 1; A <= N; A++) cout << res[A] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool r[1010], c[1010];   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       r[a] = 1;       c[b] = 1;     }     int ans = 0;     for (int i = 1; i < n - 1; i++) {       if (!c[i]) ans++;       if (!r[i]) ans++;       if (!c[i] && !r[i] && !c[n - i] && !r[n - i] && (n - 1 - i) == i) ans--;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long int modinverse(long long int x, long long int y) {     if (y == 0) {       return 1;     }     long long int p = modinverse(x, y / 2) % 1000000007;     p = (p * p) % 1000000007;     return (y % 2 == 0) ? p : (x * p) % 1000000007;   }   long long int modexp(long long int a, long long int n) {     long long int ans = 1;     a = a % 1000000007;     while (n > 0) {       if (n % 2) {         ans = (ans * a) % 1000000007;       }       n /= 2;       a = (a * a) % 1000000007;     }     return ans;   }   long long int arr[300001], on[30], off[30];   void solve(vector<long long int> index, long long int k) {     if (k == -1 or index.size() <= 1) {       return;     }     vector<long long int> one, zero;     long long int cnt1 = 0, cnt2 = 0, inversion1 = 0, inversion2 = 0;     for (auto itr : index) {       if ((arr[itr] >> k) % 2 == 1) {         one.push_back(itr);         cnt1++;         inversion1 += cnt2;       } else {         zero.push_back(itr);         cnt2++;         inversion2 += cnt1;       }     }     on[k] += inversion1;     off[k] += inversion2;     solve(zero, k - 1);     solve(one, k - 1);   }   long long int countInversion(vector<long long int> index, long long int k) {     if (k == -1 or index.size() <= 1) {       return 0;     }     vector<long long int> zero, one;     long long int cnt = 0, inversion = 0;     for (auto itr : index) {       if ((arr[itr] >> k) % 2 == 1) {         one.push_back(itr);         cnt++;       } else {         zero.push_back(itr);         inversion += cnt;       }     }     inversion += countInversion(zero, k - 1);     inversion += countInversion(one, k - 1);     return inversion;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int tt = 1;     for (long long int tc = 1; tc <= tt; tc++) {       long long int n;       cin >> n;       for (long long int i = 0; i <= n - 1; i++) {         cin >> arr[i];       }       vector<long long int> v;       for (long long int i = 0; i <= n - 1; i++) {         v.push_back(i);       }       for (long long int i = 0; i <= 29; i++) {         on[i] = off[i] = 0;       }       solve(v, 29);       long long int x = 0;       for (long long int i = 0; i <= 29; i++) {         if (on[i] < off[i]) {           x += pow(2, i);         }       }       for (long long int i = 0; i <= n - 1; i++) {         arr[i] = (arr[i] ^ x);       }       long long int b = countInversion(v, 29);       cout << b <<     << x;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     for (int tmp = 0; tmp < t; tmp++) {       unsigned long long int n, k;       cin >> n >> k;       if (k >= n) {         cout << 1 <<   n ;         continue;       }       bool fl = false;       for (int i = 2; i * i <= n; i++) {         if (n % i == 0 && n / i <= k) {           cout << i <<   n ;           fl = true;           break;         }       }       if (!fl) {         for (int i = int(sqrt(n)); i >= 2; i--) {           if (n % i == 0 && i <= k) {             cout << n / i <<   n ;             fl = true;             break;           }         }       }       if (!fl) {         cout << n <<   n ;       }     }   }