malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   int a[2513][2513];   bitset<2513> big[2513];   vector<int> comp;   vector<pair<int, int> > need[2513 * 2513];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         scanf( %d , &a[i][j]);         if (i == j && a[i][j] != 0) return printf( NOT MAGIC n ), 0;         if (i > j && a[i][j] != a[j][i]) return printf( NOT MAGIC n ), 0;         comp.push_back(a[i][j]);       }     sort(comp.begin(), comp.end());     comp.erase(unique(comp.begin(), comp.end()), comp.end());     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         need[lower_bound(comp.begin(), comp.end(), a[i][j]) - comp.begin()]             .push_back(make_pair(i, j));       }     for (int i = 0; i < n * n; i++) {       auto& v = need[i];       for (auto& p : v) {         if ((big[p.first] & big[p.second]).any()) return printf( NOT MAGIC n ), 0;       }       for (auto& p : v) big[p.first][p.second] = 1;     }     printf( MAGIC n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void print(int n) {     string x =   ;     if (n >= 5) {       x +=  -O| ;       n -= 5;     } else {       x +=  O-| ;     }     while (n--) {       x +=  O ;     }     x +=  - ;     while (x.size() < 8) x +=  O ;     cout << x << endl;   }   int main() {     int n;     cin >> n;     if (n == 0) cout <<  O-|-OOOO ;     while (n) {       print(n % 10);       n /= 10;     }   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n, m;     cin >> n >> m;     vector<vector<long long>> in(n);     vector<long long> deg(n);     long long a, b;     for (long long i = 0; i < m; ++i) {       cin >> a >> b;       --a;       --b;       if (a > b) {         swap(a, b);       }       ++deg[a];       ++deg[b];       in[a].push_back(b);     }     long long answ = 0;     for (long long i = 0; i < n; ++i) {       answ += ((deg[i] - in[i].size()) * in[i].size());     }     cout << answ <<   n ;     long long q;     cin >> q;     long long x;     for (long long i = 0; i < q; ++i) {       cin >> x;       --x;       answ -= ((deg[x] - in[x].size()) * in[x].size());       for (long long c : in[x]) {         answ -= ((deg[c] - in[c].size()) * in[c].size());         in[c].push_back(x);         answ += ((deg[c] - in[c].size()) * in[c].size());       }       in[x].clear();       cout << answ <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long cou = 0, ans = 0, mx = INT_MIN, mn = INT_MAX, sum = 0, modu = 1e9 + 7;   vector<vector<int>> from, to;   vector<bool> visited(1e3, false);   void dfs(int t) {     visited[t] = true;     for (int c = 0; c < from[t].size(); c++) {       if (!visited[from[t][c]]) dfs(from[t][c]);     }   }   void d(int t) {     dfs(t);     for (int z = 0; z < to[t].size(); z++) {       if (!visited[to[t][z]]) d(to[t][z]);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int t;     cin >> t;     vector<pair<int, int>> v(t);     for (long long i = 0; i < t; i++) cin >> v[i].first >> v[i].second;     sort(v.begin(), v.end());     if (t < 3) {       cout <<  YES ;       return 0;     }     int n1 = v[0].second, n2 = v[1].second;     for (int x = 2; x < t; x++) {       if (n1 >= v[x].first && n2 >= v[x].first) {         cout <<  NO ;         return 0;       } else {         if (n1 < n2)           n1 = v[x].second;         else           n2 = v[x].second;       }     }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[2048][2048];   int flagr[2048], flagc[2048];   int n, ans = 0;   void print() {     cout << endl;     cout <<  ==========  << endl;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) cout << a[i][j];       cout << endl;     }     cout << endl;   }   void solve() {     for (int i = 0; i < n; i++) {       for (int j = n - 1; j > i; j--) {         if ((a[i][j] -  0  + flagr[i] + flagc[j]) & 1) {           a[i][j] =  0 ;           flagc[j]++, flagr[i]++, ans++;         }         a[i][j] =  0 ;       }     }     for (int i = 0; i < n; i++) {       a[i][i] = (a[i][i] -  0  + flagr[i] + flagc[i]) % 2 + 48;     }     memset(flagr, 0, sizeof(flagr));     memset(flagc, 0, sizeof(flagc));     for (int i = n - 1; i >= 0; i--) {       for (int j = 0; j < i; j++) {         if ((a[i][j] -  0  + flagr[i] + flagc[j]) & 1) {           flagc[j]++, flagr[i]++, ans++;         }         a[i][j] =  0 ;       }     }     for (int i = 0; i < n; i++)       if ((a[i][i] -  0  + flagr[i] + flagc[i]) % 2) ans++;   }   int main() {     int i, j, k, l;     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %s , a[i]);     }     solve();     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, x, y;   string h;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> h >> x >> y;       if (x >= 2400 and y > x) {         cout <<  YES ;         return 0;       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, d;   vector<int> e[100000 + 5], lst[100000 + 5];   int dfn[100000 + 5], low[100000 + 5], cnt, tot, sta[100000 + 5], ptr,       scc[100000 + 5], cycle[100000 + 5];   char open[100000 + 5][55];   void tarjan(int now) {     dfn[now] = low[now] = ++cnt;     sta[++ptr] = now;     for (auto v : e[now]) {       if (!dfn[v]) {         tarjan(v);         low[now] = min(low[now], low[v]);       } else if (!scc[v])         low[now] = min(low[now], dfn[v]);     }     if (low[now] == dfn[now]) {       tot++;       while (sta[ptr] != now) scc[sta[ptr--]] = tot;       scc[sta[ptr--]] = tot;     }     return;   }   int gcd(int x, int y) { return x ? gcd(y % x, x) : y; }   int _gcd[55];   bool can[100000 + 5][55];   int off[100000 + 5];   pair<int, int> q[100000 * 50 + 5];   void bfs(int s, int id) {     int rear = 0;     q[rear].first = s;     q[rear].second = 0;     can[s][0] = 1;     for (int front = 0; front <= rear; front++) {       int now = q[front].first;       int day = q[front].second;       int nd = (day + 1) % d;       for (auto v : e[now])         if (scc[v] == id) {           if (can[v][nd] == 0) {             can[v][nd] = 1;             rear++;             q[rear].first = v;             q[rear].second = nd;           }         }     }     cycle[id] = d;     for (int i = 1; i <= d - 1; i++)       if (can[s][i]) {         cycle[id] = i;         break;       }     assert(d % cycle[id] == 0);   }   int dp[100000 + 5][55], dpscc[100000 + 5][55];   void upd(int &x, int y) {     if (y > x) x = y;   }   int main() {     scanf( %d%d%d , &n, &m, &d);     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       e[x].push_back(y);     }     for (int i = 1; i <= n; i++) scanf( %s , open[i]);     for (int i = 1; i <= n; i++)       if (!dfn[i]) tarjan(i);     for (int i = 1; i <= n; i++) lst[scc[i]].push_back(i);     for (int i = 1; i <= tot; i++) bfs(lst[i][0], i);     for (int i = 1; i <= n; i++) {       for (int j = 0; j <= d - 1; j++)         if (can[i][j]) {           off[i] = j;           break;         }     }     memset(dp, -1, sizeof dp);     memset(dpscc, -1, sizeof dpscc);     int ans = 0;     dpscc[scc[1]][0] = 0;     for (int id = tot; id >= 1; id--) {       int c = cycle[id];       int cnt[55] = {};       for (auto now : lst[id]) {         bool tmp[55] = {};         for (int i = 0; i <= d - 1; i++)           if (open[now][i] ==  1 ) tmp[(i - off[now] + c) % c] = 1;         for (int i = 0; i <= d - 1; i++) cnt[i] += tmp[i];       }       for (auto now : lst[id]) {         for (int i = 0; i <= d - 1; i++)           if (dpscc[id][(i - off[now] + c) % c] >= 0)             dp[now][i] =                 dpscc[id][(i - off[now] + c) % c] + cnt[(i - off[now] + c) % c];         for (int i = 0; i <= d - 1; i++) ans = max(ans, dp[now][i]);       }       for (auto now : lst[id])         for (auto v : e[now])           if (scc[v] != id) {             int nid = scc[v];             for (int i = 0; i <= d - 1; i++)               upd(dpscc[nid][(i + 1 - off[v] + cycle[nid]) % cycle[nid]],                   dp[now][i]);           }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100010;   string s;   int n;   int main() {     cin >> s;     n = s.length();     for (int i = 1; i < n - 1; i++) {       if (s[i - 1] ==  .  || s[i] ==  .  || s[i + 1] ==  . ) continue;       int c1 = s[i - 1] -  A  + 1;       int c2 = s[i] -  A  + 1;       int c3 = s[i + 1] -  A  + 1;       int t = 0;       if (c1 != c2 && c1 != c3) t++;       if (c2 != c1 && c2 != c3) t++;       if (c3 != c1 && c3 != c2) t++;       if (t == 3) {         cout <<  Yes ;         return 0;       }     }     cout <<  No ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = 3.1415926535897932384626433832795;   const double EPS = 1e-9;   const int MAX_NUMBER = 25 * 1000 * 1000;   const int ROOT = 10000;   bool isPrime[MAX_NUMBER];   int primesAmount;   bool canMult(int a, int b) {     if (b == 0) {       return true;     }     return a <= MAX_NUMBER / b;   }   void precalc() {     int op = 0;     memset(isPrime, true, sizeof(isPrime));     isPrime[0] = isPrime[1] = false;     primesAmount = 0;     double t = clock();     for (int i = 2; i < MAX_NUMBER; ++i) {       ++op;       if (isPrime[i]) {         ++primesAmount;         if (i < ROOT) {           for (int j = i * i; j < MAX_NUMBER; j += i) {             ++op;             isPrime[j] = false;           }         }       }     }     cerr <<  op   << op << endl;     cerr <<  amount primes   << primesAmount << endl;     t = clock() - t;     t /= CLOCKS_PER_SEC;     cerr <<  precalc time is   << t << endl;   }   int solve(int x, const vector<int>& a) {     if (x == 2) {       return 0;     }     vector<bool> haveNumber(MAX_NUMBER, false);     for (int i = 0; i < a.size(); ++i) {       if (a[i] < MAX_NUMBER) {         haveNumber[a[i]] = true;       }     }     if (haveNumber[1]) {       return 1;     }     int primesToX = 0;     for (int i = 2; i <= x - 1; ++i) {       if (isPrime[i]) {         ++primesToX;         if (!haveNumber[i]) {           return -1;         }       }     }     return primesToX;   }   int main() {     precalc();     int n, x;     while (cin >> n >> x) {       vector<int> a(n);       for (int i = 0; i < n; ++i) {         cin >> a[i];       }       int res = solve(x, a);       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e5 + 5, mod = 1e9 + 7;   struct pt {     long long x, y;     inline void in() { scanf( %lld%lld , &x, &y); }     inline long long operator*(const pt& rhs) const {       return x * rhs.y - rhs.x * y;     }     inline pt operator+(const pt& rhs) const {       return (pt){x + rhs.x, y + rhs.y};     }     inline pt operator-(const pt& rhs) const {       return (pt){x - rhs.x, y - rhs.y};     }     inline void mo() {       x %= mod;       y %= mod;     }   } a[N], s2[N];   int n, i, j, ans, s1[N];   long long s0[N], z, tot;   int main() {     scanf( %d , &n);     for (i = 1; i <= n; i++) a[i].in(), s2[i] = s2[i - 1] + a[i], s2[i].mo();     for (i = 2; i <= n; i++)       z = a[i - 1] * a[i], s0[i] = s0[i - 1] + z,       s1[i] = (s1[i - 1] + s0[i]) % mod;     tot = abs(s0[n + 1] = s0[n] + a[n] * a[1]);     for (i = 3, j = 1; i <= n; i++) {       for (; j < i - 1 && abs(s0[i] - s0[j] + a[i] * a[j]) > tot / 2.0; j++)         ;       ans = (ans + s0[i] % mod * (i - 1 - j) - (s1[i - 2] - s1[j - 1]) +              a[i] * (s2[i - 2] - s2[j - 1])) %             mod;       ans = (ans + s1[j - 1] + s2[j - 1] * a[i] +              (s0[n + 1] - s0[i]) % mod * (j - 1)) %             mod;     }     ans = ((tot % mod * (mod + 1 >> 2) % mod * n % mod * (n - 3) % mod + ans) %                mod +            mod) *           2 % mod;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 300 + 10;   const int MAXM = 1e5 + 10;   const int MOD = 1e9 + 7;   int T, n, q, t, a[MAXN], dp[MAXN][MAXM], deg[MAXN], cnt[MAXN];   vector<int> g[MAXN];   bool visited[MAXN];   void dfs(int v, int x) {     visited[v] = true;     cnt[v] = 0;     for (auto u : g[v]) {       if (!visited[u]) {         dfs(u, x + a[v]);         cnt[v] = cnt[u] + 1;       }     }     t -= a[v] * cnt[v];     a[v] += x;     if (t < 0) {       cout << 0 <<   n ;       exit(0);     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     T = 1;     while (T--) {       cin >> n >> q >> t;       for (int i = 1; i <= n; i++) {         cin >> a[i];       }       for (int i = 1; i <= q; i++) {         int u, v;         cin >> u >> v;         g[u].push_back(v);         deg[v]++;       }       for (int i = 1; i <= n; i++) {         if (!deg[i]) {           dfs(i, 0);         }       }       for (int i = 1; i <= n; i++) {         if (!visited[i]) {           cout << 0 <<   n ;           return 0;         }       }       for (int i = 1; i <= n; i++) {         dp[i][0] = 1;         for (int j = 1; j <= t; j++) {           dp[i][j] = dp[i - 1][j];           if (a[i] <= j) {             dp[i][j] = (dp[i][j] + dp[i][j - a[i]]) % MOD;           }         }       }       cout << dp[n][t] <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200000 + 123;   using LL = long long;   using PLL = pair<LL, LL>;   PLL lr[maxn], a[maxn];   LL ans[maxn];   deque<pair<LL, PLL>> itv;   priority_queue<PLL, vector<PLL>, greater<PLL>> Q;   LL n, m;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> lr[i].first >> lr[i].second;     sort(lr, lr + n);     for (int i = 0; i < n - 1; ++i)       itv.emplace_back(lr[i + 1].first - lr[i].second,                        make_pair(lr[i + 1].second - lr[i].first, i));     sort(itv.begin(), itv.end());     for (int i = 0; i < m; ++i) {       LL t;       cin >> t;       a[i] = {t, i + 1};     }     sort(a, a + m);     bool flag(true);     for (int i = 0; i < m; ++i) {       while (!itv.empty() && itv[0].first <= a[i].first) {         Q.push(itv[0].second);         itv.pop_front();       }       LL r, id;       if (Q.empty()) continue;       tie(r, id) = Q.top();       Q.pop();       if (r < a[i].first) {         flag = false;         break;       }       ans[id] = a[i].second;     }     if (itv.empty() && flag) {       cout <<  Yes  << endl;       cout << ans[0];       for (int i = 1; i < n - 1; ++i) cout <<     << ans[i];       cout << endl;     } else       cout <<  No  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k;     cin >> k;     char arr[4][4];     int i, j;     std::map<int, int> map;     for (i = 0; i < 4; i++) {       for (j = 0; j < 4; j++) {         cin >> arr[i][j];         if (arr[i][j] ==  . ) {           continue;         } else {           map[arr[i][j]]++;         }       }     }     for (i = 0; i < 4; i++) {       for (j = 0; j < 4; j++) {         if (map[arr[i][j]] > 2 * k) {           cout <<  NO ;           exit(0);         }       }     }     cout <<  YES ;   }
#include <bits/stdc++.h>   //#include <bits/extc++.h>   #define ll long long   #define endl   n    #define pb push_back   #define ms(v,x) memset(v,x,sizeof(v))   #define ff first   #define ss second   #define td(v) v.begin(),v.end()   #define rep(i,a,n) for (int i=(a);i<(n);i++)   #define per(i,a,n) for (int i=(n-1);i>=a;i--)   #define trav(a, x) for(auto& a : x)   #define re(v) {for(auto &_re : v) cin >> _re;}   #define pr(v) {for(auto _pr : v) cout << _pr <<    ; cout << endl;}   #define sz(x) (int)(x).size()   #define all(x) x.begin(), x.end()   #define pii pair<int,int>   #define pll pair<ll,ll>   #define vi vector<int>   #define vl vector<ll>   #define eb emplace_back   using namespace std;   using vvi = vector<vi>;   using vvl = vector<vl>;   const ll M = 1e9 + 7;   //const ll M = 998244353;   //const ll M = 1e6;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   ll binpow(ll a, ll b){    ll res = (a!=0);    while(b > 0){     if(b&1) res = res * a % M;     a = a * a % M;     b>>=1;    }    return res;   }   //#define double long double   //#define int long long   //#define tiii tuple<int,int,int>   //#define uint unsigned int   void solve(){    int n;    cin >> n;    vi a(n), c(n + 1);     re(a);    for(int i=0;i<n;i++){     int j = i;     while(j+1 < n && a[j + 1] == a[i]){      j++;     }     c[a[i]]++;     i = j;    }    int ans = n + 1;    for(int i=0;i<n;i++){     ans = min(ans, c[a[i]] + 1 - (a[i] == a[0]) - (a[i] == a.back()));    }    cout << ans << endl;   }   int32_t main(){     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);     //freopen( .in ,  r , stdin);    //freopen( .out ,  w , stdout);    int t = 1;    cin >> t;    while(t--){     solve();    }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m, s, a[101], b[101], x, y, i;     double c, d, e, f, g = 10000000, h, k = -1;     cin >> n >> m >> s;     for (i = 1; i <= n; i++) cin >> a[i];     cin >> x >> y;     for (i = 2; i <= n; i++) {       c = double(a[i]) / double(m);       d = (x - a[i]) * (x - a[i]);       e = y * y;       f = double(sqrt(d + e));       f /= s;       c += f;       if (c < g || (c == g && d < k)) {         k = d;         g = c;         h = i;       }     }     cout << h;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int val;     int num;   } c[100010];   bool cmp(node a, node b) { return a.val < b.val; }   int main() {     int n, d, a, b, u, v, res = 0;     scanf( %d%d%d%d , &n, &d, &a, &b);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &u, &v);       c[i].val = u * a + v * b;       c[i].num = i;     }     sort(c + 1, c + 1 + n, cmp);     int i;     for (i = 1; i <= n; i++) {       if (d - c[i].val < 0) {         res = i - 1;         break;       }       d = d - c[i].val;     }     if (i == n + 1) res = n;     printf( %d n , res);     for (int i = 1; i <= res; i++) printf( %d  , c[i].num);     return 0;   }
#include<bits/stdc++.h>   #define R register   #define I inline   #define ll long long   #define ull unsigned long long   #define LL __int128   #define db double   using namespace std;   #define pii pair<int,int>   #define mp(x,y) make_pair(x,y)   #define piii pair<pair<int,int>,int>   #define mp3(x,y,z) make_pair(make_pair(x,y),z)   #define fi first.first   #define se first.second   #define th second   #define putint(x) printf( %d n ,x)   #define putll(x) printf( %lld n ,x)   #define putull(x) printf( %llu n ,x)   #define lowbit(x) ((x)&(-(x)))   #define inf (0x7fffffff)   #define INF (1e18)   #define eps (1e-8)   I int read()   {    char ch=getchar();    int res=0,flag=1;    while(ch< 0 ||ch> 9 )    {     if(ch== - )      flag=-1;     ch=getchar();    }    while(ch>= 0 &&ch<= 9 )    {     res=res*10+ch- 0 ;     ch=getchar();    }    return res*flag;   }   int a,b,k;   int main()   {    a=read();    b=read();    k=read();    if(b==1)    {     if(k==0)     {      puts( YES );      cout<< 1 ;      for(R int i=1;i<=a;++i)       cout<< 0 ;      puts(  );      cout<< 1 ;      for(R int i=1;i<=a;++i)       cout<< 0 ;      puts(  );      return 0;     }     else     {      puts( NO );      return 0;     }    }    if(a==0)    {     if(k==0)     {      puts( YES );      for(R int i=1;i<=b;++i)       cout<< 1 ;      puts(  );      for(R int i=1;i<=b;++i)       cout<< 1 ;      puts(  );     }     else      puts( NO );     return 0;    }    if(k<a+b-1)    {     puts( YES );     int pos1=a+b,pos2=a+b-k,cnt=0;     for(R int i=1;i<=a+b;++i)     {      if(i==pos2)       cout<<1,++cnt;      else if(cnt<b-(i<pos2))       cout<<1,++cnt;      else       cout<<0;     }     puts(  );     cnt=0;     for(R int i=1;i<=a+b;++i)     {      if(i==pos2&&pos1!=pos2)      {       cout<<0;       continue;      }      if(i==pos1)       cout<<1,++cnt;      else if(cnt<b-1)       cout<<1,++cnt;      else       cout<<0;     }     puts(  );    }    else     puts( NO );       return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1ll << 62;   struct Query {     long long n;     int id;     Query(long long _n = 0, int _id = 0) : n(_n), id(_id) {}     inline bool operator<(const Query& rhs) const { return n > rhs.n; }   } qry[100010];   long long ans[100010];   vector<pair<long long, int> > dic[65];   inline long long qpow(long long base, int pw) {     long long res = 1;     while (pw) {       if (pw & 1) {         if (res < inf / base)           res = res * base;         else           return inf;       }       if (pw > 1) {         if (base < inf / base)           base = base * base;         else           return inf;       }       pw >>= 1;     }     return res;   }   inline long long get_sqrt(long long x) {     long long l = 1, r = 1000000001ll;     while (r - l > 1) {       long long mid = (l + r) >> 1;       if (mid * mid <= x)         l = mid;       else         r = mid;     }     return l;   }   bool notPrime[65];   int mu[65];   vector<int> prime;   void linear_sieve() {     notPrime[0] = notPrime[1] = true;     for (int i = 2; i <= 60; i++) {       if (!notPrime[i]) {         prime.push_back(i);         mu[i] = -1;       }       for (int j = 0; j < (int)prime.size() && i * prime[j] <= 60; j++) {         int d = i * prime[j];         notPrime[d] = true;         mu[d] = -mu[i];         if (i % prime[j] == 0) {           mu[d] = 0;           break;         }       }     }   }   int main() {     int T;     long long n;     scanf( %d , &T);     for (int i = 1; i <= T; i++) {       scanf( %lld , &n);       qry[i] = Query(n, i);     }     sort(qry + 1, qry + 1 + T);     for (int i = 3; i <= 60; i++) {       long long v;       for (int j = 2; (v = qpow(j, i)) <= 1000000000000000000ll; j++)         dic[i].push_back(pair<long long, int>(v, j));     }     linear_sieve();     for (int i = 1; i <= T; i++) {       n = qry[i].n;       long long& res = ans[qry[i].id];       res = n - 1 + (get_sqrt(n) - 1) * mu[2];       for (int i = 3; i <= 60; i++) {         while (!dic[i].empty() && dic[i].back().first > n) dic[i].pop_back();         if (dic[i].empty()) break;         res += (dic[i].back().second - 1) * mu[i];       }     }     for (int i = 1; i <= T; i++) printf( %lld n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<long long, bool> tz;   int gcd(int a, int b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   int cnk(long long n, long long k, long long mod) {     long long result = 1;     int lal = 0;     for (int lol = n; lal < k; lal++, lol--) {       result *= lol;       result %= mod;     }     return result;   }   const long long mod = 1e9 + 7;   vector<long long> graph[100000];   vector<long long> vec;   vector<long long> vec1[1001];   vector<long long> vec2[1001];   long long mas[100][100];   vector<long long> nap[4];   bool masi[100000];   long long mas1[100];   long long mas2[100];   string s;   bool comp(long long a, long long b) { return a > b; }   int main() {     long long a, b, c, d;     long long k = 0;     double p;     cin >> a;     long long mini = 1e9;     for (long long lol = 0; lol < a; lol++) {       scanf( %i , &k);       mini = min(mini, k);     }     cin >> a;     for (long long lol = 0; lol < a; lol++) {       scanf( %i , &k);       vec.push_back(k);     }     long long res = 0;     std::sort(vec.begin(), vec.end(), comp);     for (long long bom = 0; bom < vec.size(); bom++) {       if (bom % (mini + 2) < mini) {         res += vec[bom];       }     }     cout << res;     return 0;   }