malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   unsigned long long int n, m, l;   unsigned long long int r, k, nn;   template <class T>   inline T min(T a, T b) {     return ((a < b) ? a : b);   }   char frac[9][500][500];   string p[500];   char isfrac(char a, char b, char c, char d) {     char mx = max(max(a, b), max(c, d));     return (         (((mx & 8) ? (a == mx) : (a == 0)) && ((mx & 4) ? (b == mx) : (b == 0)) &&          ((mx & 2) ? (c == mx) : (c == 0)) && ((mx & 1) ? (d == mx) : (d == 0)))             ? mx             : -1);   }   int main(int argc, char** argv) {     cin >> n >> m;     for (int i = 0; i < n; ++i) {       cin >> p[i];     }     char f = 0;     for (int i = 0; i < (n - 1); ++i) {       for (int j = 0; j < (m - 1); ++j) {         f = 0;         if (p[i][j] ==  . ) {           f += 8;         }         if (p[i][j + 1] ==  . ) {           f += 4;         }         if (p[i + 1][j] ==  . ) {           f += 2;         }         if (p[i + 1][j + 1] ==  . ) {           f += 1;         }         frac[0][i][j] = f;       }     }     int cnt = 0;     int l = 1;     int pw = 2;     while (((2 * pw) <= n) && ((2 * pw) <= m)) {       for (int i = 0; i <= (n - 2 * pw); ++i) {         for (int j = 0; j <= (m - 2 * pw); ++j) {           frac[l][i][j] =               isfrac(frac[l - 1][i][j], frac[l - 1][i][j + pw],                      frac[l - 1][i + pw][j], frac[l - 1][i + pw][j + pw]);           if (frac[l][i][j] >= 0) {             cnt++;           }         }       }       ++l;       pw *= 2;     }     cout << cnt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bitset<4001> g[4001];   int main() {     int n, m;     cin >> n >> m;     vector<pair<int, int> > v;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       g[a][b] = 1;       g[b][a] = 1;       v.push_back(pair<int, int>(a, b));     }     int minx = 100000000;     bool was = 0;     for (int i = 0; i < v.size(); i++) {       int a = v[i].first;       int b = v[i].second;       for (int j = 0; j < n; j++) {         if (g[a][j] && g[b][j]) {           minx = min(minx, (int)(g[a].count() + g[b].count() + g[j].count()) - 6);           was = true;         }       }     }     if (was)       cout << minx;     else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const int N = 1e5 + 4;   const long long MOD = 998244353;   bool ans[2 * N];   long long POW(long long base, long long exponent) {     long long result = 1;     while (exponent > 0) {       if (exponent % 2 == 1) result = (result * base) % MOD;       exponent = exponent >> 1;       base = (base * base) % MOD;     }     return result;   }   long long Inv(long long x) { return POW(x, MOD - 2); }   void BFS(int s, vector<int> &d, vector<int> edge[]) {     d[s] = 0;     queue<int> q;     q.push(s);     while (!q.empty()) {       int v = q.front();       q.pop();       for (auto to : edge[v]) {         if (d[to] == (int)1e9) {           d[to] = d[v] + 1;           q.push(to);         }       }     }   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int a[n];       for (int i = 0; i < n; i++) cin >> a[i];       int l = 0, r = n - 1, ls = 0, rs = 0, al = 0, b = 0, mv = 0;       while (l <= r) {         if (mv & 1) {           rs = 0;           while (rs <= ls and r >= l) rs += a[r--];           b += rs;           mv++;         } else {           ls = 0;           while (ls <= rs and l <= r) ls += a[l++];           al += ls;           mv++;         }       }       cout << mv <<     << al <<     << b <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dis[75][1 << 18];   bool mark[75][1 << 18];   int n, m, A, B;   vector<pair<int, int> > ve[75];   struct zzt {     pair<int, int> to;     int di;   };   bool operator<(zzt aa, zzt bb) { return aa.di > bb.di; }   priority_queue<zzt> q;   int fa[75];   int gf(int x) { return fa[x] == x ? x : fa[x] = gf(fa[x]); }   int sz[75];   void merge(int x, int y) {     x = gf(x);     y = gf(y);     if (x != y) fa[x] = y, sz[y] += sz[x];   }   int mk[75], mkid;   int ozt(int x) { return mk[x] ? (1 << (mk[x] - 1)) : 0; }   int main() {     scanf( %d%d%d%d , &n, &m, &A, &B);     for (int i = 1; i <= n; i++) fa[i] = i, sz[i] = 1;     for (int i = 1; i <= m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       ve[x].push_back(pair<int, int>(y, z));       ve[y].push_back(pair<int, int>(x, z));       if (z == A) merge(x, y);     }     mkid = 0;     for (int i = 1; i <= n; i++) {       if ((!mk[i]) && sz[gf(i)] > 3) {         ++mkid;         for (int j = i; j <= n; j++) {           if (gf(j) == gf(i)) mk[j] = mkid;         }       }     }     q.push((zzt){pair<int, int>(1, ozt(1)), 0});     memset(dis, 0x3f, sizeof dis);     dis[1][ozt(1)] = 0;     while (q.size()) {       int x = q.top().to.first;       int zt = q.top().to.second;       q.pop();       if (mark[x][zt]) continue;       mark[x][zt] = 1;       for (auto p : ve[x]) {         int y = p.first;         int le = p.second;         if (le == A) {           if (dis[y][zt] > dis[x][zt] + le) {             dis[y][zt] = dis[x][zt] + le;             q.push((zzt){pair<int, int>(y, zt), dis[y][zt]});           }         } else if (gf(y) != gf(x) && (ozt(y) & zt) == 0) {           if (dis[y][zt | ozt(y)] > dis[x][zt] + le) {             dis[y][zt | ozt(y)] = dis[x][zt] + le;             q.push((zzt){pair<int, int>(y, zt | ozt(y)), dis[y][zt | ozt(y)]});           }         }       }     }     for (int i = 1; i <= n; i++) {       int ans = 0x3f3f3f3f;       for (int j = 0; j <= (1 << mkid) - 1; j++) {         ans = min(ans, dis[i][j]);       }       cout << ans <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long i, j, k, l, m, n, t, x, y;     cin >> n;     if (n % 2 == 0)       cout << n + 4 <<     << 4 << endl;     else       cout << n + 9 <<     << 9 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline bool is_prime(int n) {     for (int i = 2; i * i <= n; ++i)       if (n % i == 0) return 0;     return 1;   }   inline int Exp(int a, int p, int mod) {     int res = 1;     while (p) {       if (p & 1) res = (long long)res * a % mod;       p >>= 1;       a = (long long)a * a % mod;     }     return res;   }   inline int get_root(int n) {     for (int i = 2; i < n; ++i) {       if (Exp(i, n - 1, n) != 1) continue;       bool ok = 1;       for (int j = 1; j < n - 1; ++j)         if (Exp(i, j, n) == 1) {           ok = 0;           break;         }       if (ok) return i;     }     return -1;   }   int main() {     int n;     scanf( %d , &n);     if (n == 1) {       puts( YES );       puts( 1 );       return 0;     }     if (n == 4) {       puts( YES );       puts( 1 );       puts( 3 );       puts( 2 );       puts( 4 );       return 0;     }     if (n == 2) {       puts( YES );       puts( 1 2 );       return 0;     }     if (is_prime(n)) {       puts( YES );       int g = get_root(n);       printf( %d n , Exp(g, n - 1, n));       for (int i = 1; i <= n - 2; ++i) {         if (i & 1)           printf( %d n , Exp(g, i, n));         else           printf( %d n , Exp(g, n - 1 - i, n));       }       printf( %d n , n);     } else       puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str[105];   int main() {     int n;     scanf( %d , &n);     scanf( %s , str);     vector<int> g;     int sum = 0;     for (int i = 0; i < n; i++) {       if (str[i] ==  B ) {         sum++;       } else {         if (sum) g.push_back(sum);         sum = 0;       }     }     if (sum) g.push_back(sum);     printf( %d n , g.size());     for (int i = 0; i < g.size(); i++) {       printf( %d  , g[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     scanf( %d , &T);     while (T--) {       long long s, n, k;       scanf( %lld%lld%lld , &s, &n, &k);       if (s < k)         printf( NO n );       else if (s == k)         printf( YES n );       else {         long long left_sum = s - n;         long long extra_sum = (n / k) * k;         if (left_sum < extra_sum)           printf( YES n );         else           printf( NO n );       }     }     return 0;   }
#include <bits/stdc++.h>   long long gcd(long long a, long long b) {     if (a == 0 || b == 0) return (a + b);     if (a > b) return (gcd(a % b, b));     return (gcd(a, b % a));   }   long long lcm(long long a, long long b) { return ((a * b / gcd(a, b))); }   int sqr(int x) { return (x * x); }   void out() {     puts( NO );     exit(0);   }   using namespace std;   int n;   int p[100008];   int main() {     cin >> n;     for (int i = (int)(1); i < (int)(n + 1); ++i) p[i] = i;     if (n % 2 == 1) {       cout <<  -1 n ;       return 0;     }     for (int i = (int)(1); i < (int)(n + 1); ++i) {       swap(p[i], p[i + 1]);       i++;     }     for (int i = (int)(n); i >= (int)(1); --i) cout << i <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   const int N = 1e5 + 5;   const int K = 655;   const int mod = 998244353;   int T;   int n, a[N];   int q[K], v[K], w[K], top = 0;   int q2[K], v2[K], w2[K], top2 = 0;   int MOD(int x) { return x >= mod ? x - mod : x; }   int u(int x, int y) { return (x + y - 1) / y; }   int main() {     scanf( %d , &T);     while (T--) {       scanf( %d , &n);       for (int i = 1; i <= n; ++i) scanf( %d , &a[i]);       q[top = 1] = a[n], v[1] = 0, w[1] = 1;       int ans = 0;       for (int i = n - 1; i >= 1; --i) {         top2 = 0;         for (int l = 1, r, j = 0; l <= a[i]; l = r + 1) {           r = a[i] / (a[i] / l);           q2[++top2] = a[i] / l;           v2[top2] = 0;           w2[top2] = (l == 1);           if (i == 1) {             int tmp = 1;           }           while (j < top && u(a[i], q[j + 1]) >= l && u(a[i], q[j + 1]) <= r) {             ++j;             v2[top2] = MOD(v2[top2] + MOD(v[j] + (long long)(u(a[i], q[j]) - 1) *                                                      w[j] % mod));             w2[top2] = w2[top2] + w[j];           }         }         for (int j = 1; j <= top2; ++j) {           q[j] = q2[j];           v[j] = v2[j];           w[j] = w2[j];         }         top = top2;         for (int j = 1; j <= top; ++j) ans = MOD(ans + v[j]);       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, min, max, i, t, f = 0;     cin >> n >> m;     cin >> min;     max = min;     for (i = 1; i < n; i++) {       cin >> t;       if (t > max)         max = t;       else if (t < min)         min = t;     }     if (2 * min > max) max = 2 * min;     for (i = 0; i < m; i++) {       cin >> t;       if (t <= max) f = 1;     }     if (f == 1)       cout <<  -1 n ;     else       cout << max << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void read(T& x) {     char c = getchar();     bool f = false;     for (x = 0; !isdigit(c); c = getchar()) {       if (c ==  - ) {         f = true;       }     }     for (; isdigit(c); c = getchar()) {       x = x * 10 + c -  0 ;     }     if (f) {       x = -x;     }   }   template <typename T, typename... U>   inline void read(T& x, U&... y) {     read(x), read(y...);   }   const int N = 5e1 + 10;   const double eps = 1e-6;   int n;   int ID[N];   double K;   double A[N], B[N], F[N][N];   double V(int a) { return A[a] - K * B[a]; }   bool cmp(int a, int b) { return A[a] == A[b] ? V(a) > V(b) : A[a] > A[b]; }   int main() {     read(n);     for (int i = 1; i <= n; ++i) scanf( %lf , &A[i]);     for (int i = 1; i <= n; ++i) scanf( %lf , &B[i]), ID[i] = i;     double L = 0.01, R = 5e9, res = 233;     while (R - L >= eps) {       double mid = (L + R) / 2.0;       K = mid;       sort(ID + 1, ID + n + 1, cmp);       for (int i = 0; i <= n; ++i)         for (int j = 0; j <= n; ++j) F[i][j] = 1e18;       F[0][0] = 0;       int cnt = 0;       for (int i = 1; i <= n; ++i) {         ++cnt;         double sum = V(ID[i]);         int p = i;         while (p != n && A[ID[p + 1]] == A[ID[i]]) sum += V(ID[++p]);         double g = 0;         int s = p - i + 1;         for (int j = 0; j <= s; ++j) {           if (j) g += V(ID[i + j - 1]);           for (int k = 0; k <= i - 1; ++k)             if (j <= k) {               F[cnt][k - j + s - j] =                   min(F[cnt][k - j + s - j], F[cnt - 1][k] + sum - g);             }         }         i = p;       }       double ANS = 1e18;       for (int i = 0; i <= n; ++i) ANS = min(ANS, F[cnt][i]);       if (ANS <= eps)         res = mid, R = mid - eps;       else         L = mid + eps;     }     printf( %lld n , (long long)(res * 100000 + 99) / 100);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 200005;   struct M {     int val, pos;   };   M a[Maxn], b[Maxn];   int idx[Maxn], idy[Maxn], Nx[Maxn], Ny[Maxn];   int read() {     int sum = 0, t = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) t = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       sum = sum * 10 + c -  0 ;       c = getchar();     }     return sum * t;   }   bool cmp(M x, M y) {     return (x.val < y.val || (x.val == y.val && b[x.pos].val < b[y.pos].val));   }   long long C2(long long x) { return 1ll * x * (x - 1) / 2; }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       a[i].val = read(), b[i].val = read();       a[i].pos = b[i].pos = i;     }     sort(a + 1, a + n + 1, cmp);     int cnt = 0, same = 1;     long long res = 0;     a[0].val = b[0].val = -0x3f3f3f3f;     cnt = 0;     for (int i = 1; i <= n; ++i) {       if (a[i].val != a[i - 1].val)         cnt++, res += C2(same), same = 1;       else {         if (b[a[i].pos].val == b[a[i - 1].pos].val)           same++;         else           res += C2(same), same = 1;       }       idx[a[i].pos] = cnt;     }     res += C2(same);     sort(b + 1, b + n + 1, cmp);     cnt = 0;     for (int i = 1; i <= n; ++i) {       if (b[i].val != b[i - 1].val) cnt++;       idy[b[i].pos] = cnt;     }     for (int i = 1; i <= n; ++i) {       Nx[idx[i]]++;       Ny[idy[i]]++;     }     long long ans = 0;     for (int i = 1; i <= n; ++i) {       ans += C2(Nx[i]) + C2(Ny[i]);     }     ans -= res;     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k, i, dis = 10000000, temp, a[1000];   int main() {     cin >> n >> m >> k;     for (i = 0; i < n; ++i) cin >> a[i];     for (i = 0; i < n; ++i) {       if (a[i] != 0 && a[i] <= k) {         if (m <= i)           temp = (i - m + 1) * 10;         else           temp = (m - i - 1) * 10;         if (dis > temp) dis = temp;       }     }     cout << dis;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long k, m = 9, x;     long long r = 1, n, j, d = 0;     cin >> k;     while (k - m * r > 0) {       k -= m * r;       ++r;       m = m * 10;     }     n = (k - 1) / r;     j = (k - 1) % r;     x = pow(10, r - 1) + n;     for (long i = 0; i < r - j - 1; ++i) x /= 10;     d = x % 10;     cout << d << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, count1 = 0, count2 = 0, sum = 0;     scanf( %d , &n);     vector<pair<int, int> > v1;     vector<pair<int, int> > v2;     for (int i = 0; i < n; i++) {       int x, a;       scanf( %d %d , &x, &a);       if (x < 0) {         v1.push_back(make_pair(x, a));         count1++;       } else {         v2.push_back(make_pair(x, a));         count2++;       }     }     sort(v1.begin(), v1.end());     reverse(v1.begin(), v1.end());     sort(v2.begin(), v2.end());     vector<pair<int, int> >::iterator it1 = v1.begin();     vector<pair<int, int> >::iterator it2 = v2.begin();     vector<pair<int, int> >::iterator it3 = v1.end();     vector<pair<int, int> >::iterator it4 = v2.end();     if (count1 > count2) {       while (it1 != v1.end()) {         sum += it1->second;         it1++;         if (it2 != v2.end()) {           sum += it2->second;           it2++;         } else           break;       }     } else if (count1 < count2) {       while (it2 != v2.end()) {         sum += it2->second;         it2++;         if (it1 != v1.end()) {           sum += it1->second;           it1++;         } else           break;       }     } else if (count1 == count2) {       if ((it3->second) > (it4->second)) {         while (it1 != v1.end()) {           sum += it1->second;           it1++;           sum += it2->second;           it2++;         }       } else {         while (it2 != v2.end()) {           sum += it2->second;           it2++;           sum += it1->second;           it1++;         }       }     }     printf( %d n , sum);   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int 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 -  0 ;       c = getchar();     }     return x * f;   }   const int MAX_N = 1e3 + 10;   int H[MAX_N][MAX_N], CM[MAX_N][MAX_N], TM[MAX_N][MAX_N], N, M, A, B, SUM = 0;   long long S[MAX_N][MAX_N];   bool vis[MAX_N][MAX_N];   vector<pair<long long, pair<int, int> > > V, Ans;   struct MY_QUEUE {     deque<pair<int, int> > Q;     inline void reset() { Q.clear(); }     inline void push(int val, int mark) {       pair<int, int> now = make_pair(val, mark);       while (Q.size() && Q.back().first > val) Q.pop_back();       Q.push_back(make_pair(val, mark));     }     inline void pop(int mark) {       if (Q.front().second == mark) Q.pop_front();     }     inline int get() { return Q.front().first; }   };   inline bool check_X(int x) { return x >= 0 && x < N; }   inline bool check_Y(int y) { return y >= 0 && y < M; }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     N = read();     M = read();     A = read();     B = read();     for (int i = 0; i < N; i++)       for (int j = 0; j < M; j++) H[i][j] = read();     for (int i = 0; i < M; i++) {       MY_QUEUE QUEUE;       for (int j = 0; j < N; j++) {         QUEUE.push(H[j][i], j);         if (j >= A) QUEUE.pop(j - A);         if (j >= A - 1) CM[j - A + 1][i] = QUEUE.get();       }     }     for (int i = 0; i < N; i++) {       MY_QUEUE QUEUE;       for (int j = 0; j < M; j++) {         QUEUE.push(CM[i][j], j);         if (j >= B) QUEUE.pop(j - B);         if (j >= B - 1) TM[i][j - B + 1] = QUEUE.get();       }     }     for (int i = 1; i <= N; i++)       for (int j = 1; j <= M; j++)         S[i][j] = (long long)S[i][j] + S[i][j - 1] + H[i - 1][j - 1];     for (int i = 1; i <= M; i++)       for (int j = 1; j <= N; j++) S[j][i] = (long long)S[j][i] + S[j - 1][i];     for (int i = 0; i <= N - A; i++)       for (int j = 0; j <= M - B; j++) {         long long sum = (long long)S[i + A][j + B] - S[i + A][j] - S[i][j + B] +                         S[i][j],                   dec = (long long)TM[i][j] * A * B;         V.push_back(make_pair(sum - dec, make_pair(i, j)));       }     sort(V.begin(), V.end());     for (int i = 0; i < V.size(); i++) {       long long val = V[i].first;       int X = V[i].second.first, Y = V[i].second.second;       if (vis[X][Y]) continue;       SUM++;       Ans.push_back(make_pair(val, make_pair(X + 1, Y + 1)));       for (int i = X - A + 1; i <= X + A - 1; i++)         for (int j = Y - B + 1; j <= Y + B - 1; j++)           if (check_X(i) && check_Y(j)) vis[i][j] = 1;     }     printf( %d n , SUM);     for (int i = 0; i < Ans.size(); i++)       printf( %d %d %I64d n , Ans[i].second.first, Ans[i].second.second,              Ans[i].first);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x, a, b, i, j, k, siz, cnt = 0, p, q, s, t, z, h, po;     string str;     cin >> str;     cin >> x;     siz = str.size();     for (i = 0; i < siz; i++) {       if (str[i] !=  *  && str[i] !=  ? ) cnt++;     }     p = siz - cnt;     q = cnt - p;     if (x < q)       cout <<  Impossible  << endl;     else if (x >= q && x <= cnt) {       s = 0;       t = cnt - x;       for (i = 0; i < siz; i++) {         if (s < t && (str[i + 1] ==  ?  || str[i + 1] ==  * )) {           s++;         } else {           if (str[i] >=  a  && str[i] <=  z ) cout << str[i];         }       }     } else {       z = x - cnt;       h = 0;       for (i = 0; i < siz; i++) {         if (str[i] ==  * ) {           h++;           po = i;           break;         }       }       if (h == 0)         cout <<  Impossible  << endl;       else {         for (i = 0; i < siz; i++) {           if (i == po) {             for (j = 1; j <= z; j++) {               cout << str[i - 1];             }           } else {             if (str[i] >=  a  && str[i] <=  z ) {               cout << str[i];             }           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 303333, inf = 1000111222;   int n, x, y;   pair<int, int> a[max_n];   void wa() {     printf( No n );     exit(0);   }   int main() {     scanf( %d%d%d , &n, &x, &y);     for (int i = 0; i < n; ++i) {       scanf( %d , &a[i].first);       a[i].second = i + 1;     }     sort(a, a + n);     int last = -1;     for (int i = n - 1; i >= 0; --i) {       if (1LL * a[i].first * (n - i) >= y) {         last = i;         break;       }     }     if (last == -1) {       wa();     }     for (int i = 0; i < n; ++i) {       int need = (x + a[i].first - 1) / a[i].first;       if (i + need <= last) {         printf( Yes n );         printf( %d %d n , need, n - last);         for (int j = i; j < i + need; ++j) {           printf( %d  , a[j].second);         }         printf(  n );         for (int j = last; j < n; ++j) {           printf( %d  , a[j].second);         }         printf(  n );         return 0;       }     }     swap(x, y);     last = -1;     for (int i = n - 1; i >= 0; --i) {       if (1LL * a[i].first * (n - i) >= y) {         last = i;         break;       }     }     if (last == -1) {       wa();     }     for (int i = 0; i < n; ++i) {       int need = (x + a[i].first - 1) / a[i].first;       if (i + need <= last) {         printf( Yes n );         printf( %d %d n , n - last, need);         for (int j = last; j < n; ++j) {           printf( %d  , a[j].second);         }         printf(  n );         for (int j = i; j < i + need; ++j) {           printf( %d  , a[j].second);         }         printf(  n );         return 0;       }     }     wa();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void prime(long long int n, set<long long int> &s) {     if (n % 2 == 0) {       s.insert(2);       n /= 2;     }     while (n % 2 == 0) {       n /= 2;     }     for (int i = 3; i <= sqrt(n); i += 2) {       if (n % i == 0) {         s.insert(i);         n /= i;       }       while (n % i == 0) {         n /= i;       }     }     if (n > 2) s.insert(n);   }   int main() {     long long int n;     cin >> n;     set<long long int> s;     prime(n, s);     if (s.size() == 1)       cout << *(s.begin()) << endl;     else       cout << 1 << endl;     return (0);   }