malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int N, M;   int main() {     cin >> N >> M;     int putere = 1;     for (int i = 1; i <= M; i++) {       putere <<= 1;       if (putere >= 1000000009) putere -= 1000000009;     }     int val = 1;     for (int i = putere - 1; i >= putere - N; i--)       val = (1LL * val * i) % 1000000009;     cout << val;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long M = 4e5 + 10;   long long t, n, k, p, a[M], dp[M], s[M], ans;   long long bs(long long r, long long rem) {     long long l = 0, mid;     r++;     while (r - l > 1) {       mid = (r + l) / 2;       if (s[mid] > rem)         r = mid;       else         l = mid;     }     return l;   }   int32_t main() {     cin >> t;     while (t--) {       scanf( %lld%lld%lld , &n, &p, &k);       for (long long i = 1; i <= n; i++) {         scanf( %lld , a + i);       }       sort(a + 1, a + n + 1);       fill(s, s + n + 1, 0);       fill(dp, dp + n + 1, 0);       ans = 0;       for (long long i = 1; i <= n; i++) s[i] = s[i - 1] + a[i];       for (long long i = k; i < k + k; i++) dp[i] = a[i];       for (long long i = k + k; i <= n; i++) dp[i] = dp[i - k] + a[i];       for (long long i = n; i >= k; i--)         if (dp[i] <= p) ans = max(ans, i - (i % k) + bs(i % k, p - dp[i]));       ans = max(ans, bs(k - 1, p));       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[100001];   long long n, k;   int main() {     long long p = 0, no = 0;     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     p = 0;     for (int i = 0; i < n; i++) {       if (p != a[i]) {         no++;         cout << a[i] - p << endl;       }       p = a[i];       if (no == k) break;     }     for (int i = 0; i < (k - no); i++) cout <<  0  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[1001], m, cnt[1001];   set<int> S;   int main() {     cin >> n >> m;     for (int i = 1; i <= m; i++) {       cin >> a[i];       cnt[a[i]]++;     }     cout << *min_element(cnt + 1, cnt + n + 1);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int q;     cin >> q;     vector<int> ta(n, -1);     vector<int> payouts(q, 0);     for (int i = 0; i < q; i++) {       int k, p, x;       cin >> k;       if (k == 1) {         cin >> p >> x;         a[p - 1] = x;         ta[p - 1] = i;       } else {         cin >> x;         payouts[i] = x;       }     }     vector<int> maxpayouts(q, payouts[q - 1]);     for (int i = q - 2; i >= 0; i--) {       maxpayouts[i] = max(maxpayouts[i + 1], payouts[i]);     }     maxpayouts.push_back(0);     for (int i = 0; i < n; i++) {       int res = max(maxpayouts[ta[i] + 1], a[i]);       cout << res <<    ;     }     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int arr[300005], key[300005];   struct node {     int cnt;     struct node *zero, *one;     node() {       cnt = 0;       zero = NULL, one = NULL;     }   } * root;   void Insert(int pat) {     struct node *curr = root;     int on = 1;     for (int i = 30; i >= 0; i--) {       int bit = (pat & (on << i));       if (bit) {         if (curr->one == NULL) curr->one = new node();         curr = curr->one;         curr->cnt++;       } else {         if (curr->zero == NULL) curr->zero = new node();         curr = curr->zero;         curr->cnt++;       }     }   }   void Search(int val) {     struct node *curr = root;     int on = 1;     long long int ans = 0;     for (int i = 30; i >= 0; i--) {       int bit = (val & (on << i));       if (bit) {         if (curr->one != NULL && curr->one->cnt > 0) {           curr = curr->one;           curr->cnt--;         } else if (curr->zero != NULL && curr->zero->cnt > 0) {           curr = curr->zero;           curr->cnt--;           ans += (on << i);         }       } else {         if (curr->zero != NULL && curr->zero->cnt > 0) {           curr = curr->zero;           curr->cnt--;         } else if (curr->one != NULL && curr->one->cnt > 0) {           curr = curr->one;           curr->cnt--;           ans += (on << i);         }       }     }     cout << ans <<    ;   }   int main() {     int n;     cin >> n;     root = new node();     for (int i = 1; i <= n; i++) cin >> arr[i];     for (int i = 1; i <= n; i++) {       cin >> key[i];       Insert(key[i]);     }     for (int i = 1; i <= n; i++) {       Search(arr[i]);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int i, j, k, l, p, q, m = 1, a = 0, b = 0, c = 0;     char s[50001];     scanf( %s , s);     l = strlen(s);     i = 0;     if (s[i] ==  a  && l > 1) {       for (j = i + 1; j < l; j++) {         if (s[j] !=  a ) {           if (s[j] ==  b ) {             for (p = j + 1; p < l; p++) {               if (s[p] !=  b ) {                 if (s[p] ==  c ) {                   for (q = p + 1; q < l; q++) {                     if (s[q] !=  c ) {                       m = 0;                       break;                     }                   }                 } else {                   m = 0;                   break;                 }               } else {                 if (p == l - 1) {                   m = 0;                   break;                 }               }             }           } else {             m = 0;           }           break;         } else {           if (j == l - 1) {             m = 0;             break;           }         }       }     } else {       m = 0;     }     for (k = 0; s[k] !=   0 ; k++) {       if (s[k] ==  a )         a++;       else if (s[k] ==  b )         b++;       else         c++;     }     if (m == 1 && (a == c || b == c)) {       printf( YES );     } else {       printf( NO );     }   }
#include <bits/stdc++.h>   using namespace std;   int F[30030];   int n;   int mod;   int a[30030], id[30030];   int nxt[30030];   bool cmp(int i, int j) { return a[i] < a[j]; }   int m;   struct pnt {     int l, r, i;     pnt(int l = 0, int r = 0, int i = 0) : l(l), r(r), i(i){};   } q[30030];   bool operator<(pnt a, pnt b) { return b.l != a.l ? a.l < b.l : a.r < b.r; }   int answer[30030];   int calc(int l, int r) {     int s = 0, m = 0;     for (int j, i = 1; i <= n; i++) {       j = id[i];       if (j >= l && j <= r) {         s = (s + F[++m] * a[j]) % mod;         i = nxt[i];       }     }     return s;   }   int main() {     scanf( %d %d , &n, &mod);     F[1] = F[2] = 1 % mod;     for (int i = 3; i <= n; i++) {       F[i] = (F[i - 1] + F[i - 2]) % mod;     }     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       id[i] = i;     }     sort(id + 1, id + n + 1, cmp);     nxt[n] = n;     for (int j = n - 1; j >= 1; j--) {       if (a[id[j]] == a[id[j + 1]]) {         nxt[j] = nxt[j + 1];       } else {         nxt[j] = j;       }     }     for (int j = 1; j <= n; j++) {       a[j] %= mod;     }     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       scanf( %d %d , &q[i].l, &q[i].r);       q[i].i = i;     }     sort(q + 1, q + m + 1);     for (int i = 1; i <= m; i++) {       if (i > 1 && q[i].l == q[i - 1].l && q[i].r == q[i - 1].r) {         answer[q[i].i] = answer[q[i - 1].i];       } else {         answer[q[i].i] = calc(q[i].l, q[i].r);       }     }     for (int i = 1; i <= m; i++) {       printf( %d n , answer[i]);     }     return 0;   }
#include<bits/stdc++.h>   using namespace std;      #define ll          long long   #define int         ll   #define ld          long double   #define ff          first   #define ss          second   #define io          ios_base::sync_with_stdio(false); cin.tie(NULL);   #define yes         cout<< YES    #define no          cout<< NO    #define loop(i,a,n) for(int i=a;i<n;i++)   #define rloop(i,n,a)for(int i=n-1;i>=a;i--)   #define test        int tt=1; cin>>tt; while(tt--)   #define pb          push_back   #define pi          3.141592653589793238   #define all(v)      v.begin(),v.end()   #define vecl        vector<int>   #define pii         pair<int,int>   #define vpii        vector<pii>   const int MOD = 1e9 + 7;   int fast_expo(int x, int p) {       if (p == 0) return 1;       else if (p % 2 == 0) { int t = fast_expo(x, p / 2) % MOD; return (t * t) % MOD;}       else return (x * (fast_expo(x, p - 1)) % MOD) % MOD;   }   int gcd(int a, int b) {       if (a == 0 || b == 0) return a + b;       else return gcd(b % a, a);   }      int lcm(int a, int b)   {       return (a * b) / gcd(a, b);   }   vecl v;   void primeFactors(int n)   {       // Print the number of 2s that divide n       while (n % 2 == 0)       {           v.pb(2);           n = n / 2;       }          // n must be odd at this point. So we can skip       // one element (Note i = i +2)       for (int i = 3; i <= sqrt(n); i = i + 2)       {           // While i divides n, print i and divide n           while (n % i == 0)           {               v.pb(i);               n = n / i;           }       }          // This condition is to handle the case when n       // is a prime number greater than 2       if (n > 2)           v.pb(n);   }   //int t[101][101];   void calc(vecl &a, int l, int r, vecl &b, int d)   {       if (l >= r)           return;          int mx = 0, ans = 0;       loop(i, l, r)       {           mx = max(mx, a[i]);       }       loop(i, l, r)       {           if (mx == a[i])           {               ans = i; break;           }       }       b[ans] = d;       calc(a, ans + 1, r, b, d + 1);       calc(a, l, ans, b, d + 1);   }      void solve()   {       int n;       cin >> n;       vecl a(n);       loop(i, 0, n)       {           cin >> a[i];       }       //memset(t,-1, sizeof t);       int l = 0, r = n;       vecl ans(n + 1, 0);       int d = 0;       calc(a, l, r, ans, d);       loop(i, 0, n)       cout << ans[i] <<    ;   }      signed main() {          io   #ifndef ONLINE_JUDGE       freopen( inputf.in ,  r , stdin);       freopen( outputf.out ,  w , stdout);   #endif       //calc();       test       {           solve();           cout << endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long min(unsigned long long x, unsigned long long y) {     if (x < y) return x;     return y;   }   unsigned long long max(unsigned long long x, unsigned long long y) {     if (x < y) return y;     return x;   }   long long min(long long x, long long y) {     if (x < y) return x;     return y;   }   long long max(long long x, long long y) {     if (x < y) return y;     return x;   }   double min(double x, double y) {     if (x < y) return x;     return y;   }   double max(double x, double y) {     if (x < y) return y;     return x;   }   unsigned long long gcd(unsigned long long x, unsigned long long y) {     if (!x) return y;     if (!y) return x;     if (x > y) swap(x, y);     return gcd(x, y % x);   }   unsigned long long inv(unsigned long long a, unsigned long long c) {     if (a == 1) {       return 1;     }     return ((c - (c / a)) * inv(c % a, c)) % c;   }   int n, l[300005] = {0}, r[300005] = {0}, idx[300005] = {0};   int comp(int a, int b) {     if (l[a] == l[b]) return r[a] > r[b];     return l[a] < l[b];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> l[i] >> r[i];       idx[i] = i;     }     sort(idx, idx + n, comp);     int minr = r[idx[n - 1]], j = n - 1;     for (int i = n - 2; i >= 0; --i) {       if (minr <= r[idx[i]]) {         cout << (idx[j] + 1) <<     << (idx[i] + 1) <<   n ;         return 0;       }       if (r[idx[i]] < minr) {         j = i;         minr = r[idx[i]];       }     }     cout <<  -1 -1 n ;     return 0;   }
#include <bits/stdc++.h>   const int maxn = 200000;   using namespace std;   int a[maxn], b[maxn];   int l[maxn], r[maxn];   int main() {     int n, q;     scanf( %d%d , &n, &q);     a[0] = 0;     for (int i = 1; i <= n; i++)       scanf( %d , &a[i]), b[i - 1] = abs(a[i] - a[i - 1]);     for (int i = 1; i <= q; i++) {       int x, y;       long long ans = 0;       scanf( %d%d , &x, &y);       y--;       l[x] = x - 1;       r[y] = y + 1;       for (int j = x + 1; j <= y; j++) {         l[j] = j - 1;         while (l[j] >= x && b[l[j]] < b[j]) l[j] = l[l[j]];       }       for (int j = y - 1; j >= x; j--) {         r[j] = j + 1;         while (r[j] <= y && b[r[j]] <= b[j]) r[j] = r[r[j]];       }       for (int j = x; j <= y; j++)         ans += (long long)(l[j] - j) * (j - r[j]) * b[j];       printf( %I64d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       vector<long long> a(n);       long long mn = 1e5;       for (int i = 0; i < n; i++) {         cin >> a[i];         if (a[i] < mn) {           mn = a[i];         }       }       long long ans = 0;       bool is_mn = false;       for (int i = 0; i < n; i++) {         if (a[i] == mn && not is_mn) {           is_mn = true;           continue;         }         while (a[i] + mn <= k) {           a[i] += mn;           ans++;         }       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const string roman[] = { M ,   CM ,  D ,   CD ,  C ,   XC ,  L ,                            XL ,  X ,   IX ,  V ,   IV ,  I };   const int roman_num[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};   int a;   string b, c;   string ans;   long long toint(string s, int base) {     long long res = 0, add;     for (int i = 0; i < s.size(); i++) {       res = res * base;       if (isdigit(s[i]))         add = s[i] -  0 ;       else         add = s[i] -  A  + 10;       res += add;     }     return res;   }   string roman_convert(int num) {     int pos = 0;     string res =   ;     while (num > 0) {       while (roman_num[pos] <= num) {         num -= roman_num[pos];         res += roman[pos];       }       pos++;     }     return res;   }   string convert(string c, int from, int to) {     long long base_10 = 0LL;     string temp = c;     for (int i = 0; i < temp.size(); i++) {       int add;       if (isdigit(temp[i]))         add = temp[i] -  0 ;       else         add = temp[i] -  A  + 10;       base_10 = base_10 * from + add;     }     string res =   ;     while (base_10) {       int digit = base_10 % to;       if (digit >= 10)         res.push_back( A  + digit - 10);       else         res.push_back(digit +  0 );       base_10 /= to;     }     if (res.empty()) return  0 ;     reverse(res.begin(), res.end());     while (res.at(0) ==  0  && res.size() > 11) res.erase(0, 1);     return res;   }   int main() {     cin.sync_with_stdio(0);     cin >> a >> b >> c;     while (c[0] ==  0  && c.size() > 1) c.erase(0, 1);     if (b ==  R ) {       int temp = toint(c, a);       ans = roman_convert(temp);     } else {       int base = toint(b, 10);       ans = convert(c, a, base);     }     puts(ans.c_str());     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int main(void) {     int n, x, k;     scanf( %d %d %d , &n, &x, &k);     for (int i = 0; i < n; i++) {       scanf( %d , a + i);     }     sort(a, a + n);     long long sum = 0;     for (int i = 0; i < n; i++) {       long long p = (long long)ceil(a[i] * 1.0 / x) * x;       sum +=           lower_bound(a, a + n, p + (long long)k * x) -           lower_bound(a, a + n, max((long long)a[i], p + (long long)(k - 1) * x));     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int min_answer;   long long int max_answer = -1;   void test_this_order(long long int a, long long int b, long long int c) {     long long int new_n = (a + 1) * (b + 2) * (c + 2) - a * b * c;     min_answer = std::min(min_answer, new_n);     max_answer = std::max(max_answer, new_n);   }   void test(long long int a, long long int b, long long int c) {     test_this_order(a, b, c);     test_this_order(b, a, c);     test_this_order(c, b, a);   }   int main() {     long long int n;     cin >> n;     test(n, 1, 1);     min_answer = max_answer;     for (long long int i = 1; i * i <= n; ++i) {       if (n % i == 0) {         long long new_n = n / i;         for (long long int j = 1; j * j <= new_n; ++j) {           if (new_n % j == 0) {             test(i, j, new_n / j);           }         }       }     }     cout << min_answer <<     << max_answer << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   const int level = 20;   vector<int> adj[N];   bool checked[N];   int parent[N];   int sz[N];   int centroid;   int sparse[N][level];   int depth[N];   void subtree(int cur, int prev) {     sz[cur] = 1;     for (auto &child : adj[cur]) {       if (child != prev and !checked[child]) {         subtree(child, cur);         sz[cur] += sz[child];       }     }   }   void decompose(int cur, int prev, int total_size) {     for (auto &child : adj[cur]) {       if (child != prev and !checked[child]) {         decompose(child, cur, total_size);       }     }     if (centroid != -1) {       return;     }     if (2 * sz[cur] >= total_size) {       centroid = cur;       return;     }   }   int get_centroid(int cur) {     subtree(cur, 0);     centroid = -1;     decompose(cur, 0, sz[cur]);     return centroid;   }   void dfs(int cur, int prev) {     int root = get_centroid(cur);     parent[root] = prev;     checked[root] = true;     for (auto &child : adj[root]) {       if (!checked[child]) {         dfs(child, root);       }     }   }   void dfs_sparse(int cur, int prev) {     sparse[cur][0] = prev;     for (auto &child : adj[cur]) {       if (child != prev) {         depth[child] = depth[cur] + 1;         dfs_sparse(child, cur);       }     }   }   void solve() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n - 1; i++) {       int x, y;       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     dfs(1, 0);     dfs_sparse(1, -1);     for (int l = 1; l < level; l++) {       for (int node = 1; node <= n; node++) {         if (sparse[node][l - 1] != -1) {           sparse[node][l] = sparse[sparse[node][l - 1]][l - 1];         }       }     }     auto lca = [&](int u, int v) -> int {       if (depth[v] < depth[u]) {         swap(u, v);       }       int diff = depth[v] - depth[u];       for (int i = 0; i < level; i++) {         if ((diff >> i) & 1) {           v = sparse[v][i];         }       }       if (u == v) {         return u;       }       for (int i = level - 1; i >= 0; i--) {         if (sparse[u][i] != sparse[v][i]) {           u = sparse[u][i];           v = sparse[v][i];         }       }       return sparse[u][0];     };     auto get_dist = [&](int x, int y) {       int lc = lca(x, y);       return depth[x] + depth[y] - 2 * depth[lc];     };     vector<int> dist(n + 1, n);     int node = 1;     for (int i = node; i; i = parent[i]) {       dist[i] = get_dist(i, node);     }     for (int i = 1; i <= m; i++) {       int type, node;       cin >> type >> node;       if (type == 1) {         for (int i = node; i; i = parent[i]) {           dist[i] = min(dist[i], get_dist(i, node));         }       } else {         int ans = n;         for (int i = node; i; i = parent[i]) {           ans = min(ans, get_dist(i, node) + dist[i]);         }         cout << (dist[node] = ans) <<   n ;       }     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MX = 2000 + 1;   const int M = 1e9 + 7;   vector<pair<int, int>> adj[MX];   int dp[MX][MX];   int add(int a, int b) { return (a += b) < M ? a : a - M; }   int mul(int a, int b) { return 1LL * a * b % M; }   int floor_div(int a, int b) { return a / b - ((a ^ b) < 0 && a % b); }   int intersect(pair<int, int> p, pair<int, int> q) {     return floor_div(p.second - q.second, q.first - p.first);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m, q;     cin >> n >> m >> q;     for (int i = 0; i < m; ++i) {       int u, v, w;       cin >> u >> v >> w;       adj[u].emplace_back(v, w);       adj[v].emplace_back(u, w);     }     memset(dp, -1, sizeof dp);     dp[0][1] = 0;     for (int i = 0; i < m; ++i) {       for (int j = 1; j <= n; ++j) {         if (dp[i][j] != -1) {           for (auto [v, w] : adj[j]) {             dp[i + 1][v] = max(dp[i + 1][v], dp[i][j] + w);           }         }       }     }     vector<pair<int, int>> lns;     for (int i = 1; i <= n; ++i) {       if (dp[m][i] == -1) continue;       int mx = 0;       for (auto [_, w] : adj[i]) {         mx = max(mx, w);       }       lns.emplace_back(mx, dp[m][i]);     }     sort(lns.begin(), lns.end());     vector<pair<int, int>> hull;     for (auto i : lns) {       if (!hull.empty() && hull.back().first == i.first) {         hull.pop_back();       }       while (hull.size() >= 2u &&              intersect(i, hull.back()) <= intersect(i, hull[hull.size() - 2u])) {         hull.pop_back();       }       hull.push_back(i);     }     int ans = 0;     for (int i = 1; i <= m; ++i) {       ans = add(ans, *max_element(dp[i], dp[i] + n + 1) % M);     }     int left = 1;     for (int i = 0; i < int(hull.size()); ++i) {       int right = q - m;       if (i + 1 < int(hull.size())) {         right = min(right, intersect(hull[i], hull[i + 1]));       }       if (right < left) continue;       int len = right - left + 1;       ans = add(ans, mul(hull[i].second % M, len));       ans = add(ans, mul(hull[i].first % M,                          mul(mul(len, add(right, left)), (M + 1) / 2)));       left = right + 1;     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k;   long long read() {     long long s = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       s = s * 10 + ch -  0 ;       ch = getchar();     }     return s * f;   }   inline void print(long long *f, long long len) {     for (long long i = 0; i < len; i++) printf( %lld  , f[i]);     puts(  );   }   long long a[101010];   long long pw[101010];   long long cnt[101010];   long long dp[101010];   const long long mod = 1e9 + 7;   signed main() {     n = read();     pw[0] = 1;     for (long long i = 1, iend = n; i <= iend; ++i)       a[i] = read(), pw[i] = (pw[i - 1] * 2) % mod, cnt[a[i]]++;     for (long long i = 100000, iend = 1; i >= iend; --i) {       long long sum = 0;       for (long long j = i; j <= 100000; j += i) sum += cnt[j];       dp[i] = pw[sum] - 1;       for (long long j = i * 2; j <= 100000; j += i)         dp[i] += mod, dp[i] -= dp[j], dp[i] %= mod;     }     cout << dp[1];   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   const long long inf = 1e18;   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, b;     cin >> n >> b;     long long i = 2;     long long ans = inf;     while (i <= b) {       if (i * i > b) i = b;       long long cnt = 0;       while (b % i == 0) {         b /= i;         cnt++;       }       if (cnt == 0) {         i++;         continue;       }       long long tmp = 0;       long long j = 1;       while (j <= n / i) {         j *= i;         tmp += n / j;       }       ans = min(ans, tmp / cnt);       i++;     }     cout << ans;     return 0;   }