malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, p;     long long int cost;     bool na;     string line;     vector<int> a, b;     pair<int, int> t;     priority_queue<pair<int, int> > q;     getline(cin, line);     n = line.length();     a.resize(n);     b.resize(n);     m = 0;     for (int i = 0; i < n; i++) {       if (line[i] ==  ? ) {         cin >> a[i] >> b[i];         ++m;       }     }     p = 0;     cost = 0LL;     if (n & 1) {       na = true;     } else {       na = false;       for (int i = 0; i < n; i++) {         if (line[i] ==  ( ) {           ++p;         } else if (line[i] ==  ) ) {           --p;         } else {           --p;           q.push(make_pair(b[i] - a[i], i));           line[i] =  ) ;           cost += b[i];         }         if (p < 0) {           if (q.empty()) {             na = true;             break;           }           t = q.top();           q.pop();           cost -= t.first;           line[t.second] =  ( ;           p += 2;         }       }       if (p) {         na = true;       }     }     if (na) {       cout <<  -1  << endl;     } else {       cout << cost << endl;       cout << line << endl;     }     return 0;   }
#include<cstdio>   #include<iostream>   #include<queue>   #include<algorithm>   #include<cstring>   #include<set>   #include<vector>   #include<cmath>   #define PII pair<int,int>   #define pb push_back   #define ep emplace_back   #define mp make_pair   #define fi first   #define se second   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^48);c=getchar();}    return f==1?x:~x+1;   }   inline void print(int x){    if(x<0) putchar( - ),x=~x+1;    if(x>=10) print(x/10);    putchar((x%10)|48);   }   int n;   int a[100010];   char str[10];   bool add,fminus,times;   char ans[100010];   const int mxn=131072;   void solve(int l,int r){    if(l>r) return ;    int sum=1;    int cnt=0;    vector<int>pos;    pos.pb(l-1);    for(int i=l;i<=r;++i){     if(sum<=mxn) sum*=a[i];     if(a[i]>1){      ++cnt;      pos.pb(i);     }    }    ++cnt;pos.pb(r+1);    if(sum>mxn){     for(int i=l;i<r;++i) ans[i]= + ;     for(int i=pos[1];i<pos[cnt-1];++i) ans[i]= * ;      return ;    }    vector<int>dp(cnt+1),pre(cnt+1);dp[0]=0;    for(int i=0;i<cnt;++i){     int s=dp[i]+pos[i+1]-pos[i]-1,t=1;     for(int j=i+1;j<=cnt;++j){      t=t*a[pos[j]];      int r=s+t;      if(r>dp[j]){       pre[j]=i;dp[j]=r;      }     }    }    int ps=cnt;    while(ps){     int t=ps;     ps=pre[ps];     for(int i=max(l,pos[ps]);i<pos[ps+1];++i) ans[i]= + ;     for(int i=pos[ps+1];i<pos[t];++i) ans[i]= * ;    }   }    int main(){    n=read();    for(int i=1;i<=n;++i) a[i]=read();    scanf( %s ,str+1);    for(int i=1;i<=strlen(str+1);++i){     switch(str[i]){      case  + :{add=1; break;}      case  - :fminus=1;break ;      case  * :times=1;break ;     }    }    if(!times){     if(add) for(int i=1;i<n;++i) printf( %d+ ,a[i]);     else for(int i=1;i<n;++i) printf( %d- ,a[i]);printf( %d n ,a[n]);     return 0;    }    if(!add){     if(fminus){      int p=n+1;      for(int i=1;i<=n;++i) if(a[i]==0){p=i;break ;}      if(p==n+1){        for(int i=1;i<n;++i) printf( %d* ,a[i]);printf( %d n ,a[n]);       return 0;      }      for(int i=1;i<p-1;++i) printf( %d* ,a[i]);      if(p!=1) printf( %d- ,a[p-1]);      for(int i=p;i<n;++i) printf( %d* ,a[i]);printf( %d n ,a[n]);     }     else{   //   if(n==67878) printf( 43423423 n );      for(int i=1;i<n;++i) printf( %d* ,a[i]);printf( %d n ,a[n]);     }     return 0;    }    int l=1,r=l;    while(l<=n){     while(a[r]!=0) ++r;     ans[r-1]= + ,ans[r]= + ;     solve(l,r-1);l=r+1;r=l;    }    for(int i=1;i<n;++i) printf( %d%c ,a[i],ans[i]);printf( %d n ,a[n]);    return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int singles, doubles, n;     cin >> n >> singles >> doubles;     int refused = 0, partlyOccDoubles = 0;     for (int i = 0; i < n; i++) {       int cur;       cin >> cur;       if (cur == 1) {         if (singles > 0) {           singles--;         } else if (doubles > 0) {           doubles--;           partlyOccDoubles++;         } else if (partlyOccDoubles > 0) {           partlyOccDoubles--;         } else {           refused += cur;         }       } else {         if (doubles == 0)           refused += cur;         else           doubles--;       }     }     cout << refused;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int f[1001000];   int dp[22][1001000];   int get(int x, int k) {     for (int i = 21; i >= 0; i--)       if (k & (1 << i)) x = dp[i][x];     return x;   }   int dist[1001000];   int foi[1001000];   vector<int> L[1001000];   char str[1001000];   char nova[1001000];   void bfs(int x, int dc) {     queue<pair<int, int> > Q;     Q.push(pair<int, int>(x, 0));     while (Q.size()) {       pair<int, int> u = Q.front();       Q.pop();       for (vector<int>::iterator it = L[u.first].begin(); it < L[u.first].end();            it++)         if (!foi[*it]) {           foi[*it] = 1;           dist[*it] = 1 + u.second;           Q.push(pair<int, int>(*it, dist[*it]));         }     }   }   char debugs[1001000];   int main() {     int n, m;     scanf(  %s , str);     n = strlen(str);     scanf( %d , &m);     while (m--) {       int d, k;       scanf( %d%d , &k, &d);       for (int i = 0; i <= n; i++) {         L[i].clear();         dist[i] = 9999999;         foi[i] = 0;       }       int cont = 0;       for (int r = 0; r < d; r++)         for (int i = r; i < k; i += d) {           L[i + 1].push_back(cont);           f[cont] = i + 1;           ;           cont++;         }       f[k] = k;       bfs(k, 0);       for (int i = 0; i < k; i++) dp[0][i] = f[i];       dp[0][k] = k;       for (int j = 1; j < 22; j++) {         for (int i = 0; i < k; i++) {           dp[j][i] = dp[j - 1][dp[j - 1][i]];           ;         }         dp[j][k] = k;       }       for (int i = 0; i < k; i++)         ;       for (int i = 0; i < n; i++) {         int y0 = 0;         int p0 = i;         int u = get(0, i + 1) - 1;         if (i + k > n) y0 = i - n + k, p0 = n - k;         u = get(y0, p0 + 1) - 1;         ;         if (dist[y0] > p0) {           nova[i] = str[u];           continue;         }         int p = dist[y0];         nova[i] = str[p0 - p + k];         debugs[i] = str[p0 - p + k];         if (debugs[i] <  a  || debugs[i] >  z ) debugs[i] =  ? ;       }       for (int i = 0; i < n; i++) str[i] = nova[i];       printf( %s n , str);       for (int i = 0; i < n; i++)         ;       ;     }   }
#include <bits/stdc++.h>   using namespace std;   int dp[10][10][10][10], pres_path;   void dfs(int x, int y, int u, int v, int p);   void dfs_next(int x, int y, int u, int v, int p) {     int &t = dp[x][y][u][v];     if (t == 0 or t > pres_path + 1) {       t = ++pres_path;       if (p < 10) dfs(x, y, u, v, p + 1);       --pres_path;     }   }   void dfs(int x, int y, int u, int v, int p) {     dfs_next(x, y, u, (v + x) % 10, p), dfs_next(x, y, u, (v + y) % 10, p);   }   int main() {     string s;     ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr), cin >> s;     for (int x = 0; x < int(10); ++x)       for (int y = 0; y < int(10); ++y)         for (int u = 0; u < int(10); ++u) dfs(x, y, u, u, 1);     for (int x = 0; x < int(10); ++x) {       for (int y = 0; y < int(10); ++y) {         bool valid = true;         int count = 0;         for (int l, i = 0, j = 1, k = s.size(); j < k and valid; i = j++)           if ((l = dp[x][y][s[i] -  0 ][s[j] -  0 ]))             count += l - 1;           else             count = -1, valid = false;         cout << count <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000007;   char s[maxn];   int n, cnt, a[maxn];   bool check(int p, bool need_touch) {     int x = 0, maxv = 0;     bool touched = 0;     for (int i = 1, _c = cnt; i <= _c; i++) {       maxv = max(maxv, x);       x += a[i];       if (x <= p) {         x = p + 1;         touched = 1;       }     }     return (x > maxv) && (!need_touch || touched);   }   int main() {     cnt = 0;     gets(s + 1);     n = strlen(s + 1);     int x = 1;     while (x <= n) {       int y = x;       while (y < n && s[y + 1] == s[x]) ++y;       a[++cnt] = y - x + 1;       if (s[x] ==  L ) a[cnt] *= -1;       x = y + 1;     }     if (a[cnt] < 0)       for (int i = 1, _c = cnt; i <= _c; i++) a[i] *= -1;     if (check(-n - 1, 0)) {       puts( 1 );       return 0;     }     int res = 0;     int l = -n, r = -1, mid, pos = 0;     while (l <= r) {       mid = (l + r) / 2;       if (check(mid, 1)) {         pos = mid;         r = mid - 1;       } else         l = mid + 1;     }     res -= pos;     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int x = 0;     int sign = 0;     char c = getchar();     for (; !isdigit(c); c = getchar()) {       sign |= c ==  - ;     }     for (; isdigit(c); c = getchar()) {       x = x * 10 + c -  0 ;     }     return sign ? -x : x;   }   const int ms = 1 << 22;   const int lim = (1 << 22) - 1;   int arr[ms], pai[ms], comps;   bool hav[ms];   bool vis[ms];   int find(int x) {     if (x == pai[x]) return x;     return pai[x] = find(pai[x]);   }   void unite(int x, int y) {     x = find(x);     y = find(y);     if (x != y) {       --comps;       pai[x] = y;     }   }   void dfs(int u, int mask) {     if (hav[mask]) unite(u, mask);     if (vis[mask]) return;     vis[mask] = true;     if (mask == 0) return;     int last_bit = 31 - __builtin_clz(mask);     for (int i = last_bit; i >= 0; --i) {       int nmask = mask & (~(1 << i));       dfs(u, nmask);     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     iota(pai, pai + ms, 0);     int n = read(), m = read();     comps = m;     for (int i = 0; i < m; ++i) {       arr[i] = read();       hav[arr[i]] = true;     }     for (int i = 0; i < m; ++i) {       dfs(arr[i], ~arr[i] & lim);     }     cout << comps <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     if (k > (n % 2 == 0 ? n * n / 2 : (n * n + 1) / 2)) {       cout <<  NO  << endl;       return 0;     }     cout <<  YES  << endl;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (k && (i + j) % 2 == 0) {           cout <<  L ;           k--;         } else {           cout <<  S ;         }       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000000 + 10;   int tot;   vector<int> primes;   int notP[N];   vector<long long> divisors[N];   map<pair<long long, int>, int> dp;   int isP(long long x) {     for (int i = 0; (long long)primes[i] * primes[i] <= x; ++i) {       if (x % primes[i] == 0) return false;     }     return true;   }   int dfs(long long x, int cur) {     if (dp.count(make_pair(x, cur))) {       return dp[make_pair(x, cur)];     }     int &ret = dp[make_pair(x, cur)];     if (cur == tot) {       if (x == 1) {         ret++;       } else if (x > N) {         ret += isP(x - 1);       }       return ret;     }     ret += dfs(x, cur + 1);     for (int i = 0; i < divisors[cur].size(); ++i) {       if (x % divisors[cur][i] == 0) {         ret += dfs(x / divisors[cur][i], cur + 1);       }     }     return ret;   }   void solve() {     long long n;     cin >> n;     tot = 0;     for (int i = 0; i < primes.size(); ++i) {       int prime = primes[i];       int flag = false;       for (long long tmp = prime; tmp < n; tmp *= prime) {         if (n % (tmp + 1) == 0) {           if (!flag) {             flag = true;             ++tot;           }           divisors[tot - 1].push_back(tmp + 1);         }       }     }     cout << dfs(n, 0) << endl;   }   int main() {     for (int i = 2; i < N; ++i) {       if (notP[i]) continue;       primes.push_back(i);       for (long long j = (long long)i * i; j < N; j += i) {         notP[j] = true;       }     }     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     int i, j, k;     int ag[101], a[101][101];     int g = 0, dr[101], dl[101];     for (i = 1; i <= n; i++) {       scanf( %d , &ag[i]);       g += ag[i];       dl[i] = 1;       dr[i] = ag[i];       for (j = 1; j <= ag[i]; j++) scanf( %d , &a[i][j]);     }     int m[10001], mg = 0;     int s1 = 0, s2 = 0;     for (i = 1; i <= n; i++) {       if (ag[i] % 2 == 1) {         m[mg] = a[i][(ag[i] + 1) / 2];         mg++;       }       for (j = 1; j <= ag[i]; j++) {         if (j <= ag[i] / 2) s1 += a[i][j];         if (j > (ag[i] + 1) / 2) s2 += a[i][j];       }     }     sort(m, m + mg);     for (i = mg - 1; i >= 0; i--) {       if ((mg - i) % 2 == 1)         s1 += m[i];       else         s2 += m[i];     }     printf( %d %d , s1, s2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string ls[] = {  ,      one ,  two ,    three ,  four ,                   five ,  six ,  seven ,  eight ,  nine };   string fr[] = {  ,        ,       twenty ,   thirty ,  forty ,                   fifty ,  sixty ,  seventy ,  eighty ,  ninety };   int main() {     ios_base::sync_with_stdio(false);     int n;     cin >> n;     int first = n / 10, second = n % 10;     switch (n) {       case 0:         cout <<  zero  << endl;         break;       case 10:         cout <<  ten  << endl;         break;       case 11:         cout <<  eleven  << endl;         break;       case 12:         cout <<  twelve  << endl;         break;       case 13:         cout <<  thirteen  << endl;         break;       case 14:         cout <<  fourteen  << endl;         break;       case 15:         cout <<  fifteen  << endl;         break;       case 16:         cout <<  sixteen  << endl;         break;       case 17:         cout <<  seventeen  << endl;         break;       case 18:         cout <<  eighteen  << endl;         break;       case 19:         cout <<  nineteen  << endl;         break;       default: {         if (!first)           cout << ls[second] << endl;         else if (!second)           cout << fr[first] << endl;         else           cout << fr[first] <<  -  << ls[second] << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       double n, m, k;       cin >> n >> m >> k;       if (m == 0)         cout << 0 << endl;       else if (n / k >= m) {         cout << (int)m << endl;       } else {         double zz = (m - (n / k));         int tt;         tt = ceil(zz / (k - 1));         cout <<    << (int)(n / k) - tt << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int r, h, sum, n;     float k, l;     cin >> r >> h;     n = h / r;     h -= n * r;     l = r / 2.0;     k = sqrt(3) / 2 * r;     if (h < l) sum = n * 2 + 1;     if (h >= l && h < k) sum = n * 2 + 2;     if (h >= k) sum = n * 2 + 3;     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   namespace IO {   const unsigned int Buffsize = 1 << 15, Output = 1 << 23;   static char Ch_[Buffsize], *S_ = Ch_, *T_ = Ch_;   static char Out[Output], *nowps = Out;   inline void flush() {     fwrite(Out, 1, nowps - Out, stdout);     nowps = Out;   }   template <typename T>   inline T Read() {     T _ = 0;     static char __;     T ___ = 1;     for (__ = ((S_ == T_) && (T_ = (S_ = Ch_) + fread(Ch_, 1, Buffsize, stdin),                              S_ == T_)                    ? 0                    : *S_++);          !isdigit(__);          __ = ((S_ == T_) && (T_ = (S_ = Ch_) + fread(Ch_, 1, Buffsize, stdin),                              S_ == T_)                    ? 0                    : *S_++))       if (__ ==  - ) ___ = -1;     for (; isdigit(__);          __ = ((S_ == T_) && (T_ = (S_ = Ch_) + fread(Ch_, 1, Buffsize, stdin),                              S_ == T_)                    ? 0                    : *S_++))       _ = (_ << 3) + (_ << 1) + (__ ^ 48);     return _ *= ___;   }   template <typename T>   inline void write(T _, char __ =   n ) {     if (!_) *nowps++ =  0 ;     if (_ < 0) *nowps++ =  - , _ = -_;     static unsigned int sta[111], tp;     for (tp = 0; _; _ /= 10) sta[++tp] = _ % 10;     for (; tp; *nowps++ = sta[tp--] ^ 48)       ;     (*nowps++) = __;   }   template <class T>   inline bool chkmax(T &_, T __) {     return _ < __ ? _ = __, 1 : 0;   }   template <class T>   inline bool chkmin(T &_, T __) {     return _ > __ ? _ = __, 1 : 0;   }   }  // namespace IO   using namespace std;   using namespace IO;   const int N = 2e5 + 10, Mod = 1e9 + 7;   int n;   int fa[N], sz[N], flag[N], ans;   int find(int first) {     return first == fa[first] ? first : fa[first] = find(fa[first]);   }   void merge(int first, int second) {     int fx = find(first), fy = find(second);     if (fx != fy) {       fa[fx] = fy;       sz[fy] += sz[fx];       flag[fy] |= flag[fx];     } else       flag[fy] = 1;   }   int main() {     n = Read<int>();     for (int i = 1; i <= 2 * n; ++i) fa[i] = i, sz[i] = 1, flag[i] = 0;     for (register int i = (1), i_end_ = (n); i <= i_end_; ++i) {       int u = Read<int>(), v = Read<int>();       if (u != v)         merge(u, v);       else         flag[u] = 2;     }     ans = 1;     for (register int i = (1), i_end_ = (2 * n); i <= i_end_; ++i)       if (find(i) == i) {         if (flag[i] == 0)           ans = (1ll * ans * sz[i]) % Mod;         else if (flag[i] == 1)           ans = (ans * 2ll) % Mod;       }     printf( %d n , ans);     return flush(), 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     vector<int> v(n);     vector<pair<int, int>> vv(n);     for (int i = 0; i < n; i++) {       scanf( %d , &v[i]);     }     sort(v.begin(), v.end());     reverse(v.begin(), v.end());     for (int i = 0; i < n; i++) {       scanf( %d , &vv[i].first);       vv[i].second = i;     }     sort(vv.begin(), vv.end());     vector<int> ans(n);     for (int i = 0; i < n; i++) {       ans[vv[i].second] = v[i];     }     for (int i = 0; i < ans.size(); i++) cout << ans[i] <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     string s;     cin >> n >> s;     int a1[n], a2[n];     for (int i = 0; i < n; i++) a1[i] = s[i] -  0 ;     for (int i = n; i < 2 * n; i++) a2[i - n] = s[i] -  0 ;     for (int i = 0; i < n; i++) {       int s1(i), s2(i);       for (int j = i + 1; j < n; j++) {         if (a1[j] < a1[s1]) s1 = j;         if (a2[j] < a2[s2]) s2 = j;       }       swap(a1[i], a1[s1]);       swap(a2[i], a2[s2]);     }     int l(0), m(0);     for (int i = 0; i < n; i++)       if (a1[i] < a2[i])         l += 1;       else if (a1[i] > a2[i])         m += 1;       else if (a1[i] == a2[i]) {         cout <<  NO  << endl;         return 0;       }     if ((l == n) || (m == n))       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = int(1e9);   long long n, m;   pair<long long, long long> p = make_pair(0, 0);   long long b[222222];   long long c[222222];   long long ans;   map<long long, long long> mp;   int main() {     ios_base::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       mp[x]++;     }     cin >> m;     for (int i = 1; i <= m; i++) cin >> b[i];     for (int i = 1; i <= m; i++) cin >> c[i];     for (int i = 1; i <= m; i++)       if (p <= make_pair(mp[b[i]], mp[c[i]]))         ans = i, p = make_pair(mp[b[i]], mp[c[i]]);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<long long> heros(n);     for (auto& x : heros) cin >> x;     sort(heros.begin(), heros.end());     long long sum = accumulate(heros.begin(), heros.end(), 0ll);     int m;     cin >> m;     while (m--) {       long long atk, dfns;       cin >> atk >> dfns;       int id = lower_bound(heros.begin(), heros.end(), atk) - heros.begin();       long long ans = 2e18 + 5;       if (id > 0) {         ans = min(ans,                   atk - heros[id - 1] + max(0ll, dfns - (sum - heros[id - 1])));       }       if (id < n) {         ans = min(ans, max(0ll, dfns - (sum - heros[id])));       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 3;   int last[22][22];   int a[maxn], dp[20][maxn];   int main() {     ios_base::sync_with_stdio(false);     int n, q;     cin >> n >> q;     for (int i = 1; i <= n; i++) cin >> a[i];     int l = 19;     memset(last, 63, sizeof last);     memset(dp, 63, sizeof dp);     for (int i = n; i >= 1; i--) {       for (int fb = 0; fb < l; fb++)         for (int sb = 0; sb < l; sb++)           if (a[i] & (1 << fb) and a[i] & (1 << sb)) last[fb][sb] = i;       for (int fb = 0; fb < l; fb++)         for (int sb = 0; sb < l; sb++)           if (a[i] & (1 << sb)) dp[fb][i] = min(dp[fb][i], last[fb][sb]);       for (int fb = 0; fb < l; fb++)         for (int sb = 0; sb < l; sb++)           if (dp[sb][i] <= n) dp[fb][i] = min(dp[fb][i], dp[fb][dp[sb][i]]);     }     while (q--) {       int x, y;       cin >> x >> y;       bool ret = 0;       for (int i = 0; i < l; i++)         if (a[y] & (1 << i) and dp[i][x] <= y) ret |= 1;       if (ret == 1)         cout <<  Shi n ;       else         cout <<  Fou n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int a[100005];   int b[100005];   bool ok(long long x) {     long long s = k;     for (int i = 0; i < n; i++) {       if (x * a[i] >= b[i]) {         s -= (x * a[i] - b[i]);       }       if (s < 0) {         return false;       }     }     return true;   }   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int j = 0; j < n; j++) {       cin >> b[j];     }     if (n == 1) {       cout << (b[0] + k) / a[0] << endl;     } else {       int sum = 0;       long long l = 0, r = 0xffffffff;       long long mid;       while (l <= r) {         mid = (l + r) >> 1;         if (ok(mid)) {           l = mid + 1;           sum = mid;         } else {           r = mid - 1;         }       }       cout << sum << endl;     }     return 0;   }