malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int vis[50005];   long long int dp[50005][505];   int k;   vector<int> v[50005];   long long ans;   void dfs(int i) {     vis[i] = 1;     dp[i][0] = 1;     for (auto j : v[i]) {       if (!vis[j]) {         vis[j] = 1;         dfs(j);         for (int w = 0; w <= k; w++) ans += dp[i][w] * dp[j][k - w - 1];         for (int w = 0; w <= k; w++) dp[i][w + 1] += dp[j][w];       }     }   }   int main() {     int n, a, b;     cin >> n >> k;     for (int i = 0; i < n - 1; i++) {       cin >> a >> b;       v[a].push_back(b);       v[b].push_back(a);     }     dfs(1);     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100100;   int n, a[N], b[N], p[N];   int main() {     if (fopen( 180F.in ,  r )) freopen( 180F.in ,  r , stdin);     scanf( %d n , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);     }     for (int i = 1; i <= n; i++) {       scanf( %d , b + i);     }     for (int i = 1; i <= n; i++) {       p[a[i]] = b[i];     }     for (int i = 1; i <= n; i++) {       printf( %d  , p[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     long long int n, i, k, ans = -1, x, l, sum;     cin >> n;     long long int a[n + 2];     a[0] = 0;     long long int ca[n + 2];     ca[0] = 0;     l = (n + 1) / 2;     for (i = 1; i <= n; i++) {       if (i <= l) {         cin >> a[i];       } else {         a[i] = x;       }       ca[i] = ca[i - 1] + a[i];       if (i == l) cin >> x;     }     long long int mn[n + 2];     mn[0] = 0;     for (i = 1; i <= l; i++) {       sum = i * x - ca[i];       mn[i] = min(mn[i - 1], sum);     }     for (i = l; i <= n; i++) {       sum = ca[i];       k = n - i;       sum += mn[k];       if (sum > 0) {         ans = i;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int pkt;     int start = 0;     int lr = 0;     cin >> pkt;     if (pkt < 0) pkt = pkt / -1;     for (int a = 1; start != pkt; a++) {       start = start + a;       lr++;       if (start > pkt) {         if ((start - pkt) % 2 == 1)           ;         else           break;       }     }     cout << lr << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double h = 1e-6;   const int MAX_ = 200005;   inline long long int mul(long long int a, long long int b) {     return (a * 1ll * b) % 1000000007;   }   inline long long int sub(long long int a, long long int b) {     long long int c = a - b;     if (c < 0) c += 1000000007;     return c;   }   inline long long int add(long long int a, long long int b) {     long long int c = a + b;     if (c > 1000000007) c -= 1000000007;     return c;   }   long long int sqr(long long int x) { return x * x; }   long long int ncr[3050][3050];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     for (int i = 0; i < 3050; i++) {       for (int j = 0; j <= i; j++) {         if (i == 0 || j == 0)           ncr[i][j] = 1;         else           ncr[i][j] = add(ncr[i - 1][j - 1], ncr[i - 1][j]);       }     }     int k;     cin >> k;     long long int val;     long long int ans = 1;     int count = 0;     for (long long int i = 0; i < k; i++) {       cin >> val;       ans = mul(ans, ncr[count + val - 1][val - 1]);       ans %= 1000000007;       count += val;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   char s[100 + 5], ans[100 + 5][250 + 5];   int main() {     int n, i, j, p, l, r;     scanf( %d%s , &n, s);     for (i = l = r = 0; i<n; ++i, r = l> r ? l : r) l += s[i] ==  [  ? 2 : -2;     for (i = p = 0; i < n; ++i, ++p) {       ans[l][p] = ans[r][p] =  + ;       for (j = l + 1; j < r; ++j) ans[j][p] =  | ;       if (s[i] ==  [ ) ans[l][p + 1] = ans[r][p + 1] =  - ;       if (s[i] ==  ] ) ans[l][p - 1] = ans[r][p - 1] =  - ;       if (s[i] ==  [  && s[i + 1] ==  [ ) ++l, --r;       if (s[i] ==  [  && s[i + 1] ==  ] ) p += 3;       if (s[i] ==  ]  && s[i + 1] ==  ] ) --l, ++r;     }     for (i = 0; i <= r; ++i, puts(  ))       for (j = 0; j < p; ++j) putchar(ans[i][j] ? ans[i][j] :    );   }
#include <bits/stdc++.h>   using namespace std;   long n, m, dx, dy, qx, qy, ps[1 << 20];   long t, ans[1 << 20];   long a, b;   long bst, bp;   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> m >> dx >> dy;     qx = qy = 0;     for (int i = 0; i < n; i++) {       ps[qx] = qy;       qy += dy;       qx += dx;       qx %= n;       qy %= n;     }     for (int i = 1; i <= m; i++) {       cin >> a >> b;       t = b - ps[a] + n;       t %= n;       ans[t]++;     }     bst = -1;     for (int i = 0; i < n; i++)       if (ans[i] > bst) bst = ans[i], bp = i;     cout << 0 <<     << bp << endl;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long p = 1000000007ll;   int main(void) {     long long n;     cin >> n;     vector<pair<long long, long long> > loops;     long long tmp = 0;     for (long long i = (0); i < (n); ++i) {       string com;       cin >> com;       if (com ==  for ) {         long long x;         cin >> x;         loops.emplace_back(x, tmp);         tmp = 0;       } else if (com ==  end ) {         tmp = tmp * loops.back().first + loops.back().second;         if (tmp >= (1ll << 32)) {           cout <<  OVERFLOW!!!  << endl;           return 0;         }         loops.pop_back();       } else {         ++tmp;       }     }     if (tmp >= (1ll << 32)) {       cout <<  OVERFLOW!!!  << endl;       return 0;     }     cout << tmp << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nmax = 5e5 + 42;   struct info {     int u, v, cost;   };   info inp[nmax];   pair<int, int> my[nmax];   int n, k, m;   int parent[nmax];   int root(int node) {     if (parent[node] == node) return node;     parent[node] = root(parent[node]);     return parent[node];   }   long long outp;   set<int> seen[nmax];   vector<int> adj[nmax];   set<pair<int, int> > my_edge;   void solve(int node, int par) {     int biggest = -1;     for (auto k : adj[node])       if (k != par) {         solve(k, node);         if (biggest == -1)           biggest = k;         else if (seen[biggest].size() < seen[k].size())           biggest = k;       }     if (biggest != -1) {       swap(seen[biggest], seen[node]);       for (auto w : seen[biggest])         if (seen[node].count(w))           seen[node].erase(w);         else           seen[node].insert(w);     }     for (auto k : adj[node])       if (k != par && k != biggest) {         for (auto w : seen[k])           if (seen[node].count(w))             seen[node].erase(w);           else             seen[node].insert(w);       }     if (my_edge.count({node, par}) || my_edge.count({par, node})) {       if (seen[node].size() == 0) {         printf( -1 n );         exit(0);       }       outp += inp[*seen[node].begin()].cost;     }   }   int main() {     scanf( %i%i%i , &n, &k, &m);     for (int i = 1; i <= n; i++) parent[i] = i;     for (int i = 1; i <= k; i++) {       scanf( %i%i , &my[i].first, &my[i].second);       adj[my[i].first].push_back(my[i].second);       adj[my[i].second].push_back(my[i].first);       parent[root(my[i].first)] = root(my[i].second);       my_edge.insert({my[i].first, my[i].second});     }     for (int i = 1; i <= m; i++) {       scanf( %i%i%i , &inp[i].u, &inp[i].v, &inp[i].cost);       if (root(inp[i].u) != root(inp[i].v)) {         parent[root(inp[i].u)] = root(inp[i].v);         adj[inp[i].u].push_back(inp[i].v);         adj[inp[i].v].push_back(inp[i].u);       } else {         seen[inp[i].u].insert(i);         seen[inp[i].v].insert(i);       }     }     solve(1, 0);     printf( %lld n , outp);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ld = long double;   using ll = long long;   using ull = unsigned long long;   const ll mod = 1004535809, mod_g = 3;   const int N = int(1e5 + 10);   template <typename T>   inline T read() {     T x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   template <typename T>   inline T print(T x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x > 9) print(x / 10);     putchar(x % 10 +  0 );   }   const ld pi = acos(-1.0);   struct Complex {     ld r, i;     Complex(ld _r = 0, ld _i = 0) : r(_r), i(_i) {}     Complex operator+(const Complex &b) const {       return Complex(r + b.r, i + b.i);     }     Complex operator-(const Complex &b) const {       return Complex(r - b.r, i - b.i);     }     Complex operator*(const Complex &b) const {       return Complex(r * b.r - i * b.i, r * b.i + i * b.r);     }     Complex operator/(const Complex &b) const {       return Complex((r * b.r + i * b.i) / (b.r * b.r + b.i * b.i),                      (i * b.r - r * b.i) / (b.r * b.r + b.i * b.i));     }   };   int R[int(1e6 + 10000)];   Complex x[int(1e6 + 10000)], y[int(1e6 + 10000)];   void get_R(int lim) {     for (int i = 0; i < lim; i++) {       R[i] = (i & 1) * (lim >> 1) + (R[i >> 1] >> 1);     }   }   void FFT(Complex *f, int lim, int rev) {     for (int i = 0; i < lim; i++) {       if (i < R[i]) swap(f[i], f[R[i]]);     }     for (int mid = 1; mid < lim; mid <<= 1) {       Complex wn = Complex(cos(pi / mid), rev * sin(pi / mid));       for (int len = mid << 1, cur = 0; cur < lim; cur += len) {         Complex w = Complex(1, 0);         for (int k = 0; k < mid; k++, w = w * wn) {           Complex x = f[cur + k], y = w * f[cur + mid + k];           f[cur + k] = x + y, f[cur + mid + k] = x - y;         }       }     }     if (rev == -1) {       for (int i = 0; i < lim; i++) {         f[i].r /= lim;       }     }   }   ll quick_pow(ll ans, ll p, ll res = 1) {     for (; p; p >>= 1, ans = ans * ans % mod)       if (p & 1) res = res * ans % mod;     return res % mod;   }   ll ans[200010];   inline void solve() {     int n, X;     cin >> n >> X;     for (int i = 1; i <= n; ++i) {       int xx;       cin >> xx;       ans[i] = ans[i - 1] + (xx < X);       x[ans[i]].r++;       y[200000 - ans[i]].r++;       x[i].i = y[i].i = 0;     }     x[0].r++, y[200000].r++;     int lim = 1;     while (lim <= 400000) lim <<= 1;     get_R(lim);     FFT(x, lim, 1);     FFT(y, lim, 1);     for (int i = 0; i <= lim - 1; ++i) x[i] = x[i] * y[i];     FFT(x, lim, -1);     cout << (ll(x[200000].r + 0.5) - n - 1) / 2;     for (int i = 1; i <= n; ++i) cout <<     << ll(x[200000 + i].r + 0.5);     cout <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int MOD = (long long int)1e9 + 7;   long long int powmod(long long int a, long long int b) {     long long int res = 1;     while (b > 0) {       if (b & 1) res = (res * a) % MOD;       a = (a * a) % MOD;       b = b >> 1;     }     return res % MOD;   }   void solve(long long int testnum) {     long long int n, k;     cin >> n >> k;     string s;     cin >> s;     string t;     cin >> t;     long long int ans = 0;     long long int tmpmn = 0;     long long int tmpmx = 0;     long long int check = 0;     for (long long int i = 0; i < n; i++) {       if (s[i] ==  b ) {         tmpmn++;       }       if (t[i] ==  b ) {         tmpmx++;       }       long long int ort = tmpmx - tmpmn + 1;       if (ort >= k) {         check = 1;       }       if (check == 0) {         ans += min(k, ort);       } else {         ans += k;       }       if (tmpmn == tmpmx) {         tmpmn = 0;         tmpmx = 0;       }       if (check == 0) {         tmpmn *= 2;         tmpmx *= 2;       }     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t = 1;     for (long long int i = 1; i <= t; i++) {       solve(i);     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 10000;   const int MAXK = 20;   int V[MAXK + 3][MAXN + 3], Ans[MAXK + 3][MAXN + 3];   int main() {     V[0][1] = 0;     for (int j = 2; j <= MAXN; j++) {       V[0][j] = 1;     }     for (int i = 1; i <= MAXK; i++) {       int k = 1;       for (int j = 1; j <= MAXN; j++) {         if (k < MAXN && V[i - 1][k] < V[i - 1][k + 1] &&             V[i - 1][j] + V[i - 1][k] < j - 1)           k++;         V[i][j] = V[i - 1][j] + V[i - 1][k];         Ans[i][j] = k;       }     }     int N, K;     while (~scanf( %d%d , &N, &K)) {       for (int i = 1; i <= K; i++) {         for (int j = N; j > 1; j--) printf( %d  , N - Ans[i][j] + 1);         printf( %d n , N - Ans[i][1] + 1);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   void solve() {     int n;     cin >> n;     int a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     for (auto i : a) {       cout << i <<    ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     { solve(); }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int maxN = 1e5 + 10;   long long int n, i, a[maxN], mx, cnt, nxt;   stack<pair<long long int, long long int> > st;   int main() {     cin >> n;     for (long long int i = 0; i < n; i++) cin >> a[i];     for (long long int i = n - 1; i >= 0; i--) {       while (!st.empty()) {         if (a[i] < st.top().first) break;         cnt++;         cnt = max(cnt, st.top().second);         st.pop();       }       mx = max(mx, cnt);       st.push(make_pair(a[i], cnt));       cnt = 0;     }     cout << mx << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a, b, c, d, x, y, p, q, t, ans[400009], res, mi, T, lca[22][400009],       sub[400009];   vector<int> v[400009];   int ma[2];   void dfs(int id, int par) {     lca[1][id] = par;     lca[0][id] = id;     for (int i = 0; i < v[id].size(); i++) {       int u = v[id][i];       if (u == par) continue;       dfs(u, id);       sub[id] += sub[u];     }     sub[id]++;   }   int centroid(int id, int par) {     int f = 0, s = 0;     for (int i = 0; i < v[id].size(); i++) {       int u = v[id][i];       if (u == par) continue;       if (sub[u] > T)         return centroid(u, id);       else         s += sub[u];     }     if (f == 0 && n - 1 - s <= T) return id;   }   int lim;   void init_lca() {     lim = log(n) / log(2) + 1;     for (int i = 2; i <= lim; i++) {       for (int j = 1; j <= n; j++) {         lca[i][j] = lca[1][lca[i - 1][lca[i - 1][j]]];       }     }   }   void calc(int id, int par, int branch = 0) {     for (int i = 0; i < v[id].size(); i++) {       int u = v[id][i];       if (u == par) continue;       int branch2 = (branch == 0 ? u : branch);       if (branch2 != ma[0]) {         if (n - sub[ma[0]] - sub[u] <= T) ans[u] = 1;       } else {         if (n - sub[ma[1]] - sub[u] <= T) ans[u] = 1;       }       if (n - sub[branch2] <= T) ans[u] = 1;       calc(u, id, branch2);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int i = 1; i < n; i++) {       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     if (n <= 4) {       for (int i = 1; i <= n; i++) cout << 1 <<    ;       return 0;     }     dfs(1, 0);     T = n / 2;     c = centroid(1, 0);     memset(sub, 0, sizeof(sub));     dfs(c, 0);     ans[c] = 1;     for (int i = 0; i < v[c].size(); i++) {       int u = v[c][i];       if (sub[u] >= sub[ma[0]]) {         ma[1] = ma[0];         ma[0] = u;       } else if (sub[u] > sub[ma[1]])         ma[1] = u;     }     calc(c, 0);     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   template <class T1, class T2>   inline bool cmin(T1 &a, const T2 &b) {     return b < a ? (a = b, true) : false;   }   template <class T1, class T2>   inline bool cmax(T1 &a, const T2 &b) {     return a < b ? (a = b, true) : false;   }   template <class Type>   Type read() {     Type a;     bool b;     unsigned char c;     while (c = getchar() - 48, (c > 9) & (c != 253))       ;     for (a = (b = c == 253) ? 0 : c; (c = getchar() - 48) <= 9; a = a * 10 + c)       ;     return b ? -a : a;   }   int (*rd)() = read<int>;   const int N = 2e5;   std::vector<int> b[N], g[N];   int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }   std::pair<int, int> exgcd(int x, int y) {     if (y == 0) return {1, 0};     int a, b;     std::tie(b, a) = exgcd(y, x % y);     return {a, b - x / y * a};   }   void gg() {     puts( -1 );     exit(0);   }   long long solve(int n, int m, const std::vector<int> &b,                   const std::vector<int> &g) {     long long ans = -1;     std::vector<std::pair<int, int>> pos;     int inv = exgcd(n, m).second % n;     if (inv < 0) inv += n;     for (int i : b) pos.emplace_back((long long)i * inv % n, 0);     for (int i : g) pos.emplace_back((long long)i * inv % n, 1);     std::sort(pos.begin(), pos.end());     pos.resize(std::unique(pos.begin(), pos.end(),                            [](std::pair<int, int> p, std::pair<int, int> q) {                              return p.first == q.first;                            }) -                pos.begin());     int i = pos.back().first;     for (auto p : pos) {       if ((p.first - 1 + n) % n != i)         cmax(ans,              (long long)(p.first - i - 1 + n) % n * m + (long long)i * m % n);       if (p.second) cmax(ans, (long long)i * m % n);       i = p.first;     }     return ans;   }   int main() {     int n, m, d;     long long ans = 0;     std::vector<int> glob, glog;     n = rd(), m = rd(), d = gcd(n, m);     glob.resize(rd());     for (int &i : glob) i = rd();     glog.resize(rd());     for (int &i : glog) i = rd();     if (glob.size() + glog.size() < d) gg();     for (int i : glob) b[i % d].push_back(i / d);     for (int i : glog) g[i % d].push_back(i / d);     n /= d, m /= d;     for (int i = 0; i < d; ++i) {       if (b[i].empty() && g[i].empty()) gg();       cmax(ans,            std::max(solve(n, m, b[i], g[i]), solve(m, n, g[i], b[i])) * d + i);     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N;   pair<pair<int, int>, int> arr[2050];   int vis[2050];   char s[2050];   double angle(pair<int, int> x, pair<int, int> y, pair<int, int> z) {     pair<int, int> xy = {y.first - x.first, y.second - x.second};     pair<int, int> xz = {y.first - z.first, y.second - z.second};     double angyx = 1.0 * xy.first * xz.first + 1.0 * xy.second * xz.second;     double angyz = 1.0 * xy.first * xz.second - 1.0 * xy.second * xz.first;     return atan2(angyz, angyx);   }   int main() {     scanf( %d , &N);     for (int i = 0; i < N; i++) {       int x, y;       scanf( %d%d , &x, &y);       arr[i] = {{x, y}, i + 1};     }     scanf( %s , s);     sort(arr, arr + N,          [](const pair<pair<int, int>, int> &a,             const pair<pair<int, int>, int> &b) {            if (a.first.second == b.first.second)              return a.first.first < b.first.first;            return a.first.second < b.first.second;          });     pair<int, int> tmp1 = {arr[0].first.first - 1, arr[0].first.second};     pair<int, int> tmp2 = arr[0].first;     vis[0] = 1;     pair<int, int> a = {-1, -1};     pair<int, int> b = {1, -1};     pair<int, int> c = {2, -1};     printf( %d  , arr[0].second);     for (int i = 0; i < N - 2; i++) {       double max = -1234567.0, min = 1234567.0;       int maxi, mini;       for (int j = 0; j < N; j++) {         if (vis[j] == 1) continue;         double ang = angle(tmp1, tmp2, arr[j].first);         if (i == 0) {         }         if (i == 0 && arr[j].first.second == arr[0].first.second &&             arr[j].first.first > arr[0].first.first) {           min = -1234, mini = j;           continue;         }         if (i == 0 && arr[j].first.second == arr[0].first.second &&             arr[j].first.first < arr[0].first.first) {           max = 1234, maxi = j;           continue;         }         if (ang > max) max = ang, maxi = j;         if (ang < min) min = ang, mini = j;       }       if (s[i] ==  R ) {         tmp1 = tmp2;         tmp2 = arr[maxi].first;         vis[maxi] = 1;         printf( %d  , arr[maxi].second);       } else {         tmp1 = tmp2;         tmp2 = arr[mini].first;         vis[mini] = 1;         printf( %d  , arr[mini].second);       }     }     for (int i = 0; i < N; i++) {       if (vis[i] == 0) {         printf( %d n , arr[i].second);       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T1, class T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  {  << p.first <<  ,  << p.second <<  } ;     return os;   }   const int N = 3e5 + 5;   const int oo = 1e9 + 7;   vector<pair<int, pair<int, int> > > g[N];   int f[N];   int ans[N];   int x[N];   int y[N];   bool vis[N];   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 1; i <= m; i++) {       int w;       cin >> x[i] >> y[i] >> w;       g[x[i]].push_back({i, {y[i], w}});       g[y[i]].push_back({i, {x[i], w}});     }     for (int i = 2; i <= n - 1; i++) {       for (auto p : g[i]) {         f[i] += p.second.second;       }       assert(f[i] % 2 == 0);       f[i] /= 2;     }     queue<int> q;     q.push(1);     vis[1] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       for (auto p : g[u]) {         int i = p.first;         int v = p.second.first;         int w = p.second.second;         if (vis[v]) continue;         if (x[i] == u)           ans[i] = 0;         else           ans[i] = 1;         if (v == n) continue;         f[v] -= w;         if (f[v] == 0) {           vis[v] = 1;           q.push(v);         }       }     }     for (int i = 1; i <= m; i++) cout << ans[i] <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int n;   string queue_[6] = {  ,  Sheldon ,  Leonard ,  Penny ,  Rajesh ,  Howard };   int main() {     cin >> n;     double count = 1;     bool used = false;     while (count * 5 < n) {       n -= count * 5;       count *= 2;       used = true;     }     int x = ceil(n / count);     cout << queue_[x];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long k, res, a[1111], n;   set<long long> s;   int main() {     cin >> n >> k;     for (long long i = 1; i <= sqrt(n); i++) {       if (n % i == 0) s.insert(i), s.insert(n / i);     }     for (long long i : s) {       res++;       if (res == k) {         cout << i;         return 0;       }     }     cout << -1;   }
#include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   const long long xx = 2e7;   const long long MOD = 1e9 + 7;   const long long inf = 1e18;   long long isprime(long long n) {     if (n == 2) return 1;     if (n % 2 == 0) return 0;     for (long long i = 3; i * i <= n; i += 2) {       if (n % i == 0) return 0;     }     return 1;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     if (isprime(n)) {       cout << 1 <<   n ;     } else if (n % 2 == 0 || isprime(n - 2)) {       cout << 2 <<   n ;     } else       cout << 3 <<   n ;   }