malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct pt {     long long x;     long long y;   };   pt u;   bool cmp(pt a, pt b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }   bool cw(pt a, pt b, pt c) {     return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < 0;   }   bool ccw(pt a, pt b, pt c) {     return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) > 0;   }   long long operator%(const pt &a, const pt &b) { return a.x * b.y - a.y * b.x; }   long long operator*(const pt &a, const pt &b) { return a.x * b.x + a.y * b.y; }   bool A(const pt &p) { return u % p > 0 || (u % p == 0 && u * p > 0); }   bool operator<(const pt &a, const pt &b) {     return (A(a) == A(b) && a % b > 0) || (A(a) && !A(b));   }   void convex_hull(vector<pt> &a) {     if (a.size() == 1) return;     sort(a.begin(), a.end(), &cmp);     pt p1 = a[0], p2 = a.back();     vector<pt> up, down;     up.push_back(p1);     down.push_back(p1);     for (int i = 1; i < (int)a.size(); i++) {       if (i == a.size() - 1 || cw(p1, a[i], p2)) {         while (up.size() >= 2 && !cw(up[up.size() - 2], up[up.size() - 1], a[i]))           up.pop_back();         up.push_back(a[i]);       }       if (i == a.size() - 1 || ccw(p1, a[i], p2)) {         while (down.size() >= 2 &&                !ccw(down[down.size() - 2], down[down.size() - 1], a[i]))           down.pop_back();         down.push_back(a[i]);       }     }     a.clear();     for (int i = 0; i < (int)up.size(); i++) a.push_back(up[i]);     for (int i = down.size() - 2; i > 0; i--) a.push_back(down[i]);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     u.x = 0;     u.y = 0;     long long n;     cin >> n;     map<pair<long long, long long>, long long> cont;     vector<pt> points, points2;     points.push_back({0, 0});     for (int i = 0; i < n; i++) {       long long x, y;       cin >> x >> y;       pt a;       a.x = x;       a.y = y;       points.push_back(a);       points2.push_back(a);     }     vector<pt> white;     vector<pt> black;     convex_hull(points);     long long vez = 1;     sort(points.begin(), points.end());     for (auto e : points) {       cont[{e.x, e.y}] = 1;       if (e.x == 0 && e.y == 0) {         white.push_back(e);         black.push_back(e);         continue;       }       vez = 1 - vez;       vez == 1 ? white.push_back(e) : black.push_back(e);     }     for (auto e : points2) {       if (cont[{e.x, e.y}] == 0) {         white.push_back(e);         black.push_back(e);       }     }     convex_hull(white);     convex_hull(black);     bool can = false;     for (auto e : points) {       if (e.x & 1 || e.y & 1) can = true;     }     for (auto e : black) {       if (e.x & 1 || e.y & 1) can = true;     }     for (auto e : white) {       if (e.x & 1 || e.y & 1) can = true;     }     if (can)       cout <<  Ani  << endl;     else       cout <<  Borna  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   char s[50001];   int last[26][50001];   int best[51][50001];   bool prv[51][50001];   void print(int i, int j, int k) {     int len = 2 * i + (k != -1 ? 1 : 0);     char ans[101];     ans[len] =   0 ;     if (k != -1) ans[i] = s[k];     while (j != 0) {       if (!prv[i][j]) {         --j;         continue;       }       --i, --j;       ans[i] = ans[len - i - 1] = s[j];     }     printf( %s n , ans);   }   void run(int casenr) {     scanf( %s , s);     n = strlen(s);     memset(last, -1, sizeof(last));     for (int j = (0); j < (n); ++j) {       int x = s[j] -  a ;       for (int xx = (0); xx < (26); ++xx) last[xx][j + 1] = last[xx][j];       last[x][j + 1] = j;     }     memset(best, -1, sizeof(best));     best[0][0] = n;     prv[0][0] = true;     for (int i = (0); i < (50); ++i)       for (int j = (0); j < (n); ++j)         if (best[i][j] != -1) {           if (j + 1 <= best[i][j] && best[i][j] > best[i][j + 1]) {             best[i][j + 1] = best[i][j];             prv[i][j + 1] = false;           }           int x = s[j] -  a ;           if (last[x][best[i][j]] != -1 && last[x][best[i][j]] >= j + 1 &&               last[x][best[i][j]] > best[i + 1][j + 1]) {             best[i + 1][j + 1] = last[x][best[i][j]];             prv[i + 1][j + 1] = true;           }         }     for (int i = 50; i >= 0; --i) {       if (i != 50)         for (int j = (0); j < (n); ++j)           if (best[i][j] != -1 && j < best[i][j]) {             print(i, j, j);             return;           }       for (int j = (0); j < (n); ++j)         if (best[i][j] != -1) {           print(i, j, -1);           return;         }     }     assert(false);   }   int main() {     run(1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 13 * 16, Mod = 1e9 + 7;   struct Matrix {     int n, m, A[N][N];     inline Matrix(int _n, int _m) : n(_n), m(_m) { memset(A, 0, sizeof(A)); }     inline Matrix operator*(Matrix &X) {       Matrix R(n, X.m);       for (int i = 0; i < n; i++)         for (int j = 0; j < X.m; j++)           for (int k = 0; k < m; k++)             R.A[i][j] = (R.A[i][j] + 1LL * A[i][k] * X.A[k][j]) % Mod;       return R;     }     inline Matrix operator^(long long pw) {       Matrix R(n, n), T = *this;       for (int i = 0; i < n; i++) R.A[i][i] = 1;       for (; pw; pw >>= 1, T = T * T)         if (pw & 1) R = R * T;       return R;     }     inline int *operator[](int id) { return A[id]; }   };   int n, k, m;   inline int Getid(int i, int j) { return (i + j * (k + 1)); }   int main() {     scanf( %d%d%d , &n, &k, &m);     Matrix A((k + 1) << m, (k + 1) << m);     for (int i = 0; i <= k; i++)       for (int j = 0; j < (1 << m); j++) {         A[Getid(i, j)][Getid(i, j >> 1)] = 1;         if (i < k)           A[Getid(i, j)][Getid(i + 1, (j >> 1) | (1 << m - 1))] =               __builtin_popcount(j) + 1;       }     A = A ^ n;     int tot = 0;     for (int j = 0; j < (1 << m); j++)       tot = (tot + A[Getid(0, 0)][Getid(k, j)]) % Mod;     return !printf( %d , tot);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int s, x1, x2, t1, t2, p, d;     cin >> s >> x1 >> x2 >> t1 >> t2 >> p >> d;     swap(t1, t2);     int sol = abs(x1 - x2) * t1;     int tram = 0;     int p1 = p;     int p2 = x1;     if (d == -1) {       if (p2 <= p1) {         tram += t2 * (p1 - p2);       } else {         tram += t2 * (p1 + p2);         d = 1;       }     } else {       if (p1 <= p2) {         tram += t2 * (p2 - p1);       } else {         tram += t2 * (s - p1 + s - p2);         d = -1;       }     }     p1 = x1;     p2 = x2;     if (d == -1) {       if (p2 <= p1) {         tram += t2 * (p1 - p2);       } else {         tram += t2 * (p1 + p2);         d = 1;       }     } else {       if (p1 <= p2) {         tram += t2 * (p2 - p1);       } else {         tram += t2 * (s - p1 + s - p2);         d = -1;       }     }     sol = min(sol, tram);     cout << sol <<   n ;   }
#include <bits/stdc++.h>   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unroll-loops )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   const long long inf = 1e18 + 9;   long long ans = inf;   long long ans1 = 0, ans2 = 0;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, a, b;     cin >> n >> a >> b;     long long need = n * 6;     if (a * b >= need) {       cout << a * b <<   n ;       cout << a <<     << b;       return 0;     }     for (long long i = 0; i <= 1e7; i++) {       long long new_x = a + i;       long long new_y = need / new_x;       if (need % new_x != 0) new_y++;       new_y = max(new_y, b);       new_x = max(new_x, a);       if (new_x * new_y < ans) ans = new_x * new_y, ans1 = new_x, ans2 = new_y;     }     for (long long i = 0; i <= 1e7; i++) {       long long new_y = b + i;       long long new_x = need / new_y;       if (need % new_y != 0) new_x++;       new_y = max(new_y, b);       new_x = max(new_x, a);       if (new_x * new_y < ans) ans = new_x * new_y, ans1 = new_x, ans2 = new_y;     }     cout << ans <<   n ;     cout << ans1 <<     << ans2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int x, y, l, r;     cin >> x >> y >> l >> r;     vector<long long int> vec(0);     long long int xa = 1;     long long int cap = 0;     long long int r1 = r;     while (r1 > 0) {       r1 /= x;       ++cap;     }     for (long long int i = 0; i < cap; ++i) {       long long int ya = 1;       long long int diff = r - xa;       long long int cap2 = 0;       while (diff > 0) {         diff /= y;         ++cap2;       }       for (long long int j = 0; j < cap2; ++j) {         if (xa + ya >= l && xa + ya <= r) {           vec.push_back(xa + ya);         }         ya *= y;       }       xa *= x;     }     if (vec.size() == 0) {       cout << r - l + 1;       return 0;     }     sort(vec.begin(), vec.end());     long long int answer = vec[0] - l;     for (int i = 1; i < vec.size(); ++i) {       if (vec[i] - vec[i - 1] - 1 > answer) answer = vec[i] - vec[i - 1] - 1;     }     if (r - vec[vec.size() - 1] > answer) answer = r - vec[vec.size() - 1];     cout << answer;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x;     vector<pair<int, int>> v;     cin >> n;     for (int i = 1; i <= n && cin >> x; i++) v.push_back({x, i});     sort(v.begin(), v.end());     cout << v[n - 1].second <<     << v[n - 2].first;   }
#include <bits/stdc++.h>   using namespace std;   int z[1005];   string a[1005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int j = 0; j < m; ++j) {       for (int i = 1; i < n; ++i)         for (int i1 = 0; i1 < i; ++i1) {           bool ok = false;           for (int k = 0; k < j; ++k)             if (z[k] == 0 && a[i][k] > a[i1][k]) {               ok = true;               break;             }           if (!ok && a[i][j] < a[i1][j]) z[j] = 1;         }     }     int ans = 0;     for (int i = 0; i < m; ++i)       if (z[i]) ++ans;     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int mark[123456];   int main() {     int n, t;     scanf( %d , &n);     for (int i = 0; i < n - 1; i++) {       scanf( %d , &t);       mark[t]++;     }     int ans = 0;     for (int i = 1; i <= n; i++) {       if (!mark[i]) {         ans = i;         break;       }     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int a[500009], posin[500009];   vector<int> pairs[500009];   int main() {     int n, m, x, y, c = 0;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       posin[a[i]] = i;     }     for (int i = 0; i < m; i++) {       scanf( %d %d , &x, &y);       pairs[x].push_back(posin[y]);       pairs[y].push_back(posin[x]);     }     x = -1, y = 0;     long long int sol = 0;     while (y < n && x < y) {       if (c) {         x++;         for (int i = 0; i < pairs[a[x]].size(); i++)           if (pairs[a[x]][i] > x && pairs[a[x]][i] <= y) {             c--;           }       } else {         sol += (y - x);         y++;         for (int i = 0; i < pairs[a[y]].size(); i++)           if (pairs[a[y]][i] > x && pairs[a[y]][i] <= y) {             c++;           }       }     }     printf( %I64d n , sol);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, sum = 0, hours = 0;     cin >> a >> b;     for (int i = 0; i < a; i++) {       hours += 1;       sum += 1;       if (sum == b) {         a += 1;         sum = 0;       }     }     cout << hours;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     pair<int, int> a[101];     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i].first >> a[i].second;     }     int t;     cin >> t;     for (int i = n - 1; i >= 0; i--) {       if (a[i].first <= t) {         cout << n - i << endl;         break;       }     }     return 0;   }
#include <bits/stdc++.h>   int p, v, n, s, t;   int main(int argc, char** argv) {     scanf( %d%d%d , &p, &v, &n);     int aux = v;     s = 0;     t = 0;     while (aux >= n) {       int i;       i = (aux / 50) % 475;       for (int j = 0; j < 25; j++) {         i = (i * 96 + 42) % 475;         if (i + 26 == p) {           printf( 0 n );           return 0;         }       }       aux -= 50;     }     aux = v;     t = 0;     s = 0;     while (aux <= 1000000) {       int i;       i = (aux / 50) % 475;       for (int j = 0; j < 25; j++) {         i = (i * 96 + 42) % 475;         if (i + 26 == p) {           printf( %d n , s);           return 0;         }       }       aux += 50;       t++;       t = t % 2;       if (t == 1) {         s++;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int q, n;   bool ok(long long edg) {     long long b = (edg + 1) >> 1, o = (n - b) * (n - b - 1) >> 1;     return (b + min(edg >> 1, o)) == edg && b < n;   }   long long bs() {     long long beg = 0, end = 2LL * n, mid;     while (beg < end) {       mid = (beg + end + 1) >> 1;       if (ok(mid))         beg = mid;       else         end = mid - 1;     }     return beg;   }   int main() {     for (scanf( %d , &q); q--;) {       scanf( %d , &n);       long long ans = bs();       printf( %lld n , ans);     }   }
#include <bits/stdc++.h>   using std::cin;   using std::cout;   const int N = 500054;   int n, Z, Hz;   int a[N], z[N];   std::vector<int> r[N];   std::pair<int, int> w[N];   std::priority_queue<int, std::vector<int>, std::greater<int>> pq;   inline void up(int &x, const int y) { x < y ? x = y : 0; }   inline void down(int &x, const int y) { x > y ? x = y : 0; }   inline int min(const int x, const int y) { return x < y ? x : y; }   void work() {     int i, ans = 0, x = 0, M = 0;     cin >> n;     for (Z = i = 0; i < n; ++i)       if (cin >> a[i], !a[i]) z[Z++] = i;     if (Z < 2) {       cout <<  0  <<   n ;       return;     }     Hz = Z / 2, std::fill(w + 1, w + (n + 1), std::pair<int, int>(0, Hz + 1));     for (i = 0; i < n; ++i)       if (a[i])         i < z[Hz] ? up(w[a[i]].first, x) : down(w[a[i]].second, x);       else if (i == z[Hz])         x = 2 - (Z & 1);       else         ++x;     for (i = 1; i <= n; ++i)       if (w[i].first + 1 >= w[i].second)         ++ans;       else if (0 < w[i].first || w[i].second <= Hz)         r[w[i].first].emplace_back(w[i].second);     memset(z, 0, (Hz + 1) << 2);     for (x = 0; x <= Hz; r[x].clear(), ++x)       for (int y : r[x])         if (pq.emplace(y), M < x)           ++M;         else           ++z[pq.top()], pq.pop();     ans += M;     for (i = 1, x = Hz; x >= 0; --x, ++i) M = min(z[x], i), ans += M, i -= M;     for (; !pq.empty(); pq.pop())       ;     cout << min(ans + M, Hz) <<   n ;   }   int main() {     int T;     std::ios::sync_with_stdio(false), cin.tie(NULL);     for (cin >> T; T; --T) work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a[100010], i, x, val;     cin >> n >> x;     int cnt[100010] = {0};     int cnt2[100010] = {0};     for (i = 0; i < n; i++) {       cin >> a[i];       cnt[a[i]]++;     }     for (i = 0; i < 100010; i++) {       if (cnt[i] > 1) {         cout <<  0 n ;         return 0;       }     }     for (i = 0; i < n; i++) {       val = a[i] & x;       if (cnt[val] > 0 && val != a[i]) {         cout <<  1 n ;         return 0;       }     }     for (i = 0; i < n; i++) {       val = a[i] & x;       cnt2[val]++;     }     for (i = 0; i < 100010; i++) {       if (cnt2[i] > 1) {         cout <<  2 n ;         return 0;       }     }     cout <<  -1 n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, a[20000], p[20000], i, l, j, mx, ans[20000], mxi;   int main() {     cin >> n;     for (i = 0; i < n; i++) {       cin >> a[i];     }     for (i = 0; i < n; i++) {       mx = 0;       for (j = i; j < n; j++) {         p[a[j]]++;         if (p[a[j]] > mx or (p[a[j]] == mx and a[j] < mxi)) {           mx = p[a[j]];           mxi = a[j];         }         ans[mxi]++;       }       for (j = i + 1; j <= n; j++) p[a[j]] = 0;     }     for (i = 1; i <= n; i++) {       cout << ans[i] <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, A, B, X, Ans = 0, C = 0;   int main() {     cin >> N >> A >> B;     for (int i = 1; i <= N; i++) {       cin >> X;       if (X == 1) {         if (A > 0)           A--;         else if (B > 0)           C++, B--;         else if (C > 0)           C--;         else           Ans++;       } else {         if (B > 0)           B--;         else           Ans += 2;       }     }     cout << Ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 10;   long long n, m, k, ki[maxn], d[maxn], par[maxn];   long long ans;   vector<pair<int, int>> veci[maxn];   bool mark[maxn], fu;   set<pair<long long, pair<int, int>>> st;   vector<pair<long long, pair<int, int>>> yal;   int get(int u) { return par[u] = par[u] == u ? u : get(par[u]); }   int main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < m; i++) {       int u, v, w;       cin >> u >> v >> w;       veci[v].push_back({u, w});       veci[u].push_back({v, w});       yal.push_back({w, {u, v}});     }     cin >> k;     for (int i = 0; i < k; i++) {       int a;       cin >> a;       mark[a] = 1;       ki[a] = a;       for (auto x : veci[a])         if (mark[x.first] == 0) st.insert({x.second, {a, x.first}});       par[a] = a;       if (a == 1) fu = 1;     }     while (st.size()) {       auto y = *st.begin();       int u = y.second.second;       st.erase(y);       if (mark[u] == 1) continue;       mark[u] = 1;       ki[u] = y.second.first;       d[u] = y.first;       for (auto x : veci[u])         if (mark[x.first] == 0) st.insert({d[u] + x.second, {ki[u], x.first}});     }     st.clear();     for (auto x : yal)       st.insert({d[x.second.first] + d[x.second.second] + x.first,                  {ki[x.second.first], ki[x.second.second]}});     while (st.size()) {       auto x = *st.begin();       long long u = x.second.first, v = x.second.second, w = x.first;       st.erase(x);       u = get(u);       v = get(v);       if (u != v) {         par[u] = v;         ans += w;       }     }     if (fu == 1)       cout << ans;     else       cout << (long long)ans + d[1];   }
#include <bits/stdc++.h>   using namespace std;   int n, M[2002][2002];   bool V[2002];   vector<int> L, L_;   void dfs(int inicial, vector<int> &Li) {     Li.push_back(inicial);     V[inicial] = 1;     for (int i = 0; i < n; ++i)       if (!V[i] && M[inicial][i]) dfs(i, Li);   }   bool Conexo() {     dfs(0, L);     for (int i = 0; i < n; ++i)       for (int j = 0; j <= i; ++j) swap(M[i][j], M[j][i]);     memset(V, 0, sizeof V);     dfs(0, L_);     return L.size() == n && L_.size() == n;   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i)       for (int j = 0; j < n; ++j) scanf( %d , &M[i][j]);     if (Conexo())       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   const int N = 8;   int n, x;   double p[1 << N];   void fwt(int l, int r) {     if (l + 1 == r) return;     int mid = (l + r) >> 1;     fwt(l, mid);     fwt(mid, r);     int t = mid - l;     for (int i = l; i < mid; ++i) {       double x = p[i], y = p[i + t];       p[i] = x + y;       p[i + t] = x - y;     }   }   void ifwt(int l, int r) {     if (l + 1 == r) return;     int mid = (l + r) >> 1;     ifwt(l, mid);     ifwt(mid, r);     int t = mid - l;     for (int i = l; i < mid; ++i) {       double x = p[i], y = p[i + t];       p[i] = (x + y) / 2.;       p[i + t] = (x - y) / 2.;     }   }   int main() {     scanf( %d%d , &n, &x);     for (int i = 0; i <= x; ++i) scanf( %lf , &p[i]);     fwt(0, 1 << N);     for (int i = 0; i < (1 << N); ++i) p[i] = pow(p[i], n);     ifwt(0, 1 << N);     double ans = 0.;     for (int i = 1; i < (1 << N); ++i) ans += p[i];     printf( %.12f n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     vector<int> res(n);     for (auto &v : res) cin >> v;     int sum = 0, mini = INT_MAX, index = -1, i;     for (i = 0; i < n; i++) {       if (i < k) {         sum += res[i];         continue;       } else {         if (mini > sum) {           mini = sum;           index = i;         }         sum -= res[i - k];         sum += res[i];       }     }     if (mini > sum) index = i;     mini == INT_MAX ? cout << 1 : cout << (index - k + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int prime[100005 + 5000];   int a2[10005];   map<int, int> M;   int f[100005];   int Gcd[50005];   int sum[50005];   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   int main() {     int i, j, k = 0;     for (i = 2; i <= 100000; i++) {       if (a[i] == 0) {         prime[k++] = i;         for (j = i + i; j <= 100000; j += i) a[j] = 1;       }     }     int n, m;     while (cin >> n >> m) {       M.clear();       for (i = 1; i <= n; i++) {         cin >> a2[i];         j = a2[i];         for (int t = 0; t < k; t++) {           if (j == 1) break;           if (j % prime[t] == 0) {             while (j % prime[t] == 0) j /= prime[t];           }         }         if (j > 1) prime[k++] = j;       }       for (i = 0; i < m; i++) {         cin >> j;         M[j] = 1;       }       int ans = 0;       for (i = 1; i <= n; i++) Gcd[i] = 1;       for (i = 0; i < k; i++) {         int f = 0;         if (M[prime[i]]) f = 1;         int X = 1;         for (j = 1; j <= n; j++) {           int tmp = 0;           int Y = 1;           if (a2[j] % prime[i] == 0) {             while (a2[j] % prime[i] == 0) {               a2[j] /= prime[i];               tmp++;               Y *= prime[i];             }           }           if (f)             ans -= tmp;           else             ans += tmp;           if (j == 1)             X = Y;           else if (X > Y)             X = Y;           Gcd[j] *= X;         }       }       int de = 0;       for (i = n; i >= 1; i--) {         int tmp = Gcd[i];         if (Gcd[i] == Gcd[i + 1]) continue;         int s = 0;         for (j = 0; j < k; j++) {           int tmp2 = 0;           if (tmp == 1) break;           if (tmp % prime[j] == 0) {             while (tmp % prime[j] == 0) {               tmp /= prime[j];               tmp2++;             }           }           if (M[prime[j]])             s -= tmp2;           else             s += tmp2;         }         if (s - de < 0) {           ans -= i * (s - de);           de += s - de;         }       }       cout << ans << endl;     }   }