malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <class T>   void check_max(T& a, T b) {     if (a < b) a = b;   }   template <class T>   void check_min(T& a, T b) {     if (a > b) a = b;   }   const int MAXN = 10100;   int n, k;   double per;   double a[MAXN];   int main() {     cin >> n >> k;     per = (double)k / 100;     for (int _t = n, i = 0; i < _t; i++) cin >> a[i];     sort(a, a + n);     double l = 0, r = 1000;     while (r - l > 1e-8) {       double m = (r + l) / 2;       double more = 0, less = 0;       for (int _t = n, i = 0; i < _t; i++)         if (a[i] > m)           more += a[i] - m;         else           less += m - a[i];       if (more * (1 - per) >= less)         l = m;       else         r = m;     }     double ans = (l + r) / 2;     printf( %.7lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long i, j, k, x, y, z, n, mi = 1e16, sum = 0;     cin >> n;     long long a[n];     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     if (n == 1 || n == 2) {       cout << a[0] - 1;       return;     }     z = (long long)pow(1e18, 1.0 / n);     for (i = 1; i <= z; i++) {       sum = 0;       for (j = 0; j < n; j++) {         y = (long long)pow(i, j);         sum += abs(a[j] - y);       }       mi = min(mi, sum);     }     cout << mi;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t-- > 0) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int a[2005], b[2005];   int main() {     std::ios::sync_with_stdio(false);     int n, k, p;     long long minn = (1000 * 1000 * 1000 + 5);     minn *= (1000 * 1000 * 1000 + 7);     long long ans;     int j, val, i;     cin >> n >> k >> p;     for (i = 0; i < n; i++) {       cin >> a[i];     }     for (i = 0; i < k; i++) {       cin >> b[i];     }     sort(a, a + n);     sort(b, b + k);     for (i = 0; i < k - n + 1; i++) {       val = 0;       ans = 0;       for (j = i; j < i + n; j++) {         if ((b[j] >= a[val] && b[j] <= p) || (a[val] >= b[j] && b[j] >= p)) {           ans = max(ans, (long long)abs(a[val] - p));         } else {           ans = max(ans, (long long)abs(b[j] - a[val]) + abs(p - b[j]));         }         val++;       }       minn = min(minn, ans);     }     cout << minn << endl;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int main() {     map<string, bool> vis;     int n;     scanf( %d , &n);     while (n--) {       string s;       cin >> s;       if (vis[s])         puts( YES );       else         puts( NO );       vis[s] = 1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double n, r;   signed main() {     scanf( %lf%lf , &n, &r);     printf( %.10f n , 2.0 * n * 0.5 * r * r * sin(acos(-1.0) / (2.0 * n)) /                           sin(acos(-1.0) - (acos(-1.0) / (2.0 * n)) * 3) *                           sin(2 * acos(-1.0) / (2.0 * n)));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   double p[1000];   const int cc = 2;   double a[201][cc * 101][cc * 101];   double get(int IT) {     for (int it = 0; it <= IT; it++)       for (int i = 0; i <= cc * n; i++)         for (int j = 0; j <= cc * n; j++) a[it][i][j] = -100;     for (int i = 0; i <= cc * n; i++)       for (int j = 0; j <= min(n, i); j++)         a[0][i][min(cc * n, i - j + n - j)] =             max(a[0][i][min(cc * n, i - j + n - j)], p[j]);     for (int it = 1; it <= IT; it++) {       for (int i = 0; i <= cc * n; i++)         for (int j = 0; j <= cc * n; j++)           for (int k = 0; k <= cc * n; k++)             a[it][i][k] =                 max(a[it][i][k], (a[it - 1][i][j] + a[it - 1][j][k]) / 2);     }     double ans = 0;     for (int i = 0; i <= cc * n; i++) ans = max(ans, a[IT][0][i]);     return ans;   }   int main() {     cin >> n;     for (int i = 0; i <= n; i++) {       cin >> p[i];     }     printf( %.18lf n , (double)get(30));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long pwr(long long base, long long p, long long mod = (1000000007LL)) {     long long ans = 1;     while (p) {       if (p & 1) ans = (ans * base) % mod;       base = (base * base) % mod;       p /= 2;     }     return ans;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long nCr(long long n, long long r) {     long long C[r + 1];     memset(C, 0, sizeof(C));     C[0] = 1;     for (long long i = 1; i <= n; i++)       for (long long j = min(i, r); j > 0; j--) C[j] = C[j] + C[j - 1];     return C[r];   }   bool isPrime(long long n) {     if (n <= 1) return false;     if (n == 2) return true;     if (n % 2 == 0) return false;     long long m = sqrt(n);     for (long long i = 3; i <= m; i += 2)       if (n % i == 0) return false;     return true;   }   long long M(long long a) { return (a % (1000000007LL)); }   bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(0);     int n;     cin >> n;     vector<int> v(n);     for (long long i = 0; i < (long long)(n); ++i) cin >> v[i];     vector<int> ans(n + 1);     for (long long i = 0; i < (long long)(n); ++i) {       vector<int> color_total(n + 1);       int best = 0;       for (int j = i; j < n; j++) {         color_total[v[j]]++;         if (color_total[v[j]] > color_total[best]) {           best = v[j];         } else if (color_total[v[j]] == color_total[best]) {           if (v[j] < best) {             best = v[j];           }         }         ans[best]++;       }     }     for (long long i = 1; i <= (long long)(n); ++i) {       cout << ans[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, q, a;     cin >> n >> k >> q;     int t[150005] = {0};     for (int i = 1; i <= n; i++) {       cin >> a;       t[i] = a;     }     set<pair<int, int> > s;     set<pair<int, int> >::iterator it;     for (int i = 1; i <= q; i++) {       int flag, id;       cin >> flag >> id;       if (flag == 1) {         if (s.size() == k) {           it = s.begin();           if (t[id] > (it->first)) {             s.erase(it);             s.insert(make_pair(t[id], id));           }         } else {           s.insert(make_pair(t[id], id));         }       } else {         if (s.find(make_pair(t[id], id)) != s.end())           cout <<  YES n ;         else           cout <<  NO n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 4e3 + 10, mod = 1e9 + 7;   char a[N];   int n, k;   long long dp[N][N], dp2[N][N];   int main() {     cin >> n >> k;     cin >> (a + 1);     dp[0][0] = dp2[0][0] = 1;     for (int i = 1; i <= n; i++)       for (int j = 0; j <= k; j++) {         dp[i][j] = dp[i - 1][j] * (a[i] -  a  + 1) % mod;         for (int t = 0; t < j / (n - i + 1) && i - t > 0; t++)           dp[i][j] = (dp[i][j] +                       ( z  - a[i]) * dp2[i - t - 1][j - (t + 1) * (n - i + 1)]) %                      mod;         dp2[i][j] = (dp[i][j] - dp[i - 1][j] + mod) % mod;       }     cout << dp[n][k];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using pll = pair<ll, ll>;   using vll = vector<ll>;   using vpll = vector<pll>;   struct d_ {     template <typename T>     d_& operator,(const T& x) {       cerr <<     << x;       return *this;     }   } d_t;   int mix[1024];   int main(void) {     ios_base::sync_with_stdio(false);     ll n;     cin >> n;     ;     fill(begin(mix), end(mix), (int)1e9 + 7);     int st = 2;     for (ll i(0); i < 10; i++) {       for (ll k(0); k < 2; k++) {         set<int> vals;         for (ll j(0); j < n; j++) {           if (j % st < st / 2 and k == 0) {             vals.insert(j);           } else if (j % st >= st / 2 and k == 1) {             vals.insert(j);           }         }         if (vals.empty()) continue;         char* sp =   ;         cout << vals.size() <<   n ;         for (auto e : vals) {           cout << sp << e + 1;           sp =    ;         }         cout << endl;         for (ll j(0); j < n; j++) {           ll vl;           cin >> vl;           ;           if (!vals.count(j)) {             mix[j] = min(mix[j], (int)vl);           }         }         cout << endl;       }       st *= 2;     }     cout <<  -1  << endl;     char* sp =   ;     for (ll i(0); i < n; i++) {       cout << sp << mix[i];       sp =    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char v[2100][2100];   int n, m;   int sumx[2100][2100];   int sumy[2100][2100];   long long ans1, ans2, ans3, cima, baixo;   int main() {     bool ok;     scanf( %d %d , &n, &m);     for (int i = 0; i < n; ++i) scanf( %s , v[i]);     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         if (j > 0) sumx[i][j] = sumx[i][j - 1];         sumx[i][j] += (v[i][j] ==  . );       }     }     for (int j = 0; j < m; ++j) {       for (int i = 0; i < n; ++i) {         if (i > 0) sumy[i][j] = sumy[i - 1][j];         sumy[i][j] += (v[i][j] ==  . );       }     }     for (int i = 1; i < m - 1; ++i)       if (sumy[n - 1][i] == n) ans1++;     for (int i = 1; i < n - 1; ++i)       if (sumx[i][m - 1] == m) ans1++;     for (int i = 1; i < n - 1; ++i) {       ok = true;       if (v[i][0] ==  # ) ok = false;       if (ok)         for (int j = 1; j < m - 1; ++j) {           if (v[i][j] !=  . ) {             ok = false;             break;           }           if (sumy[i - 1][j] == i) ans2++;           if (sumy[n - 1][j] - sumy[i][j] == n - i - 1) ans2++;         }       if (v[i][m - 1] ==  # ) continue;       for (int j = m - 2; j >= 1 && v[i][j] ==  . ; --j) {         if (sumy[i - 1][j] == i) ans2++;         if (sumy[n - 1][j] - sumy[i][j] == n - i - 1) ans2++;       }     }     for (int i = 1; i < n - 1; ++i) {       cima = baixo = 0;       for (int j = 1; j < m - 1; ++j) {         if (v[i][j] ==  # ) {           cima = baixo = 0;           continue;         }         if (sumy[i][j] == i + 1) {           ans3 += baixo + cima;           if (j > 1 && v[i][j - 1] ==  .  && sumy[i][j - 1] == i + 1) ans3--;         }         if (sumy[n - 1][j] - sumy[i][j] == n - i - 1) {           ans3 += baixo + cima;           if (j > 1 && v[i][j - 1] ==  .  &&               sumy[n - 1][j - 1] - sumy[i][j - 1] == n - i - 1)             ans3--;         }         if (sumy[i][j] == i + 1) cima++;         if (sumy[n - 1][j] - sumy[i][j] == n - i - 1) baixo++;       }     }     for (int j = 1; j < m - 1; ++j) {       cima = baixo = 0;       for (int i = 1; i < n - 1; ++i) {         if (v[i][j] ==  # ) {           cima = baixo = 0;           continue;         }         if (sumx[i][j] == j + 1) {           ans3 += baixo + cima;           if (i > 1 && v[i - 1][j] ==  .  && sumx[i - 1][j] == j + 1) ans3--;         }         if (sumx[i][m - 1] - sumx[i][j] == m - j - 1) {           ans3 += baixo + cima;           if (i > 1 && v[i - 1][j] ==  .  &&               sumx[i - 1][m - 1] - sumx[i - 1][j] == m - j - 1)             ans3--;         }         if (sumx[i][j] == j + 1) cima++;         if (sumx[i][m - 1] - sumx[i][j] == m - j - 1) baixo++;       }     }     printf( %lld n , ans1 + ans2 + ans3);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};   const int dy[] = {0, -1, 0, 1, -1, 1, 1, -1};   template <class T>   inline bool get(T& n) {     char c, mul = 1;     n = 0;     while (!isdigit(c = getchar_unlocked()) && (c != EOF) && (c !=  - ))       ;     if (c == EOF) return false;     if (c ==  - ) {       c = getchar_unlocked();       mul = -1;     }     for (; isdigit(c); c = getchar_unlocked()) n = n * 10 + c -  0 ;     n *= mul;     return true;   }   inline void get(char& c) {     while (isspace(c = getchar_unlocked()))       ;   }   struct Point {     long long x, y;   } p[101010];   long long cross(Point o, Point a, Point b) {     return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);   }   int n;   int l[101010][20], par[101010], level[101010];   vector<int> child[101010];   void dfs(int u, int l) {     level[u] = l;     for (int(i) = 0, _ = (child[u].size()); (i) < _; ++i) dfs(child[u][i], l + 1);   }   void preprocess() {     vector<int> v;     int k = 0;     for (int(i) = (n - 1), _ = (0); (i) >= _; --(i)) {       par[i] = -1;       while (k > 1 && cross(p[v[k - 2]], p[v[k - 1]], p[i]) < 0) {         --k;         v.pop_back();       }       if (k > 0) {         par[i] = v.back();         child[v.back()].push_back(i);       }       v.push_back(i);       ++k;     }     int root = 0;     while (par[root] != -1) root = par[root];     dfs(root, 0);     for (int(i) = 0, _ = (n); (i) < _; ++i)       for (int j = 0; (1 << j) < n; ++j) l[i][j] = -1;     for (int(i) = 0, _ = (n); (i) < _; ++i) l[i][0] = par[i];     for (int j = 1; 1 << j < n; ++j)       for (int(i) = 0, _ = (n); (i) < _; ++i)         if (l[i][j - 1] != -1) l[i][j] = l[l[i][j - 1]][j - 1];   }   int lca(int p, int q) {     int log, i;     if (level[p] < level[q]) swap(p, q);     for (log = 1; 1 << log <= level[p]; ++log)       ;     --log;     for (i = log; i >= 0; --i)       if (level[p] - (1 << i) >= level[q]) p = l[p][i];     if (p == q) return p;     for (i = log; i >= 0; --i)       if (l[p][i] != -1 && l[p][i] != l[q][i]) p = l[p][i], q = l[q][i];     return par[p];   }   int main() {     get(n);     for (int(i) = 0, _ = (n); (i) < _; ++i) get(p[i].x), get(p[i].y);     preprocess();     int m, a, b;     get(m);     while (m--) {       get(a);       get(b);       --a;       --b;       printf( %d  , lca(a, b) + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 50 + 5;   const int maxm = 2500 + 5;   const int inf = 1 << 29;   const long long mod = 1e9 + 7;   const double eps = 1e-8;   long long read() {     long long s = 0, w = 1;     char c = getchar();     for (; !isdigit(c); c = getchar()) {       if (c ==  - ) w = -1;     }     for (; isdigit(c); c = getchar()) {       s = (s << 3) + (s << 1) + (c ^ 48);     }     return w == 1 ? s : -s;   }   int main() {     int t = read();     while (t--) {       int a = read(), b = read();       if (a > b) swap(a, b);       if ((a + b) & 1) {         int mn = b - (a + b + 1) / 2;         int mx = min((a + b + 1) / 2, b) + min((a + b) / 2, a);         printf( %d n , mx - mn + 1);         for (int i = mn; i <= mx; i++) {           printf( %d  , i);         }         puts(  );       } else {         int mn = b - (a + b) / 2;         int mx = min((a + b) / 2, b) + min((a + b) / 2, a);         printf( %d n , (mx / 2 - mn / 2 + 1));         for (int i = mn; i <= mx; i += 2) {           printf( %d  , i);         }         puts(  );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int temp;     map<int, vector<int>> mpp;     for (int i = 2; i <= n; i++) {       cin >> temp;       mpp[temp].push_back(i);     }     for (auto itr = mpp.begin(); itr != mpp.end(); ++itr) {       vector<int> v = (*itr).second;       int cnt = 0;       if (v.size() >= 1) {         for (int j = 0; j < v.size(); j++) {           if (mpp[v[j]].size() == 0) {             cnt++;           }         }         if (cnt < 3) {           cout <<  No  << endl;           return 0;         }       }     }     cout <<  Yes  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, i, j, l, k;   int h[4][2] = {0, 1, 1, 0, 0, -1, -1, 0}, dp, cp, bp;   int u[59][59];   char a[59][59];   int r[2509][5];   void dfs(int i, int j, char c) {     if (i >= n || i < 0 || j >= m || j < 0) return;     if (a[i][j] != c || u[i][j]) return;     u[i][j] = l + 1;     if (a[i + 1][j] != c) r[l][1] = i;     if (a[i - 1][j] != c) r[l][3] = i;     if (a[i][j + 1] != c) r[l][0] = j;     if (a[i][j - 1] != c) r[l][2] = j;     dfs(i + 1, j, c);     dfs(i - 1, j, c);     dfs(i, j + 1, c);     dfs(i, j - 1, c);   }   void go(int &dp, int &cp, int &bp, int i) {     int x, y;     x = r[i][dp], y = r[i][cp];     if (dp == 0 || dp == 2) swap(x, y);     int d = 0;     int dx = x + h[dp][0], dy = y + h[dp][1];     if (dx >= 0 && dx < n && dy >= 0 && dy < m) d = u[dx][dy];     if (d == 0) {       if (cp == (dp + 3) % 4)         cp = (dp + 1) % 4;       else if (cp == (dp + 1) % 4) {         dp = (dp + 1) % 4;         cp = (dp + 3) % 4;       }     } else {       bp = d;     }   }   int main() {     scanf( %d%d , &n, &k);     for (i = 0; i < n; i++) cin >> a[i];     m = strlen(a[0]);     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (a[i][j] ==  0  || u[i][j]) continue;         dfs(i, j, a[i][j]);         r[l++][4] = a[i][j];       }     }     bp = 1;     dp = 0;     cp = 3;     for (i = 0; i < k; i++) go(dp, cp, bp, bp - 1);     printf( %d , r[bp - 1][4] - 48);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k;     cin >> n >> m >> k;     pair<int, int> c = make_pair(1, 0);     int dx = 1, cover = 0, inc = 0;     while (k != 1) {       if (inc == 0) cout << 2 <<    ;       if (dx == 1 && c.second + dx <= m) {         c.second += dx;       } else if (dx == 1) {         c.first++;         dx = -1;       } else if (dx == -1 && c.second + dx >= 1) {         c.second += dx;       } else if (dx == -1) {         c.first++;         dx = 1;       }       cout << c.first <<     << c.second <<    ;       inc++;       if (inc == 2) {         cout << endl;         k--;         inc = 0;       }       cover++;     }     cout << n * m - cover <<    ;     while (cover < n * m) {       if (dx == 1 && c.second + dx <= m) {         c.second += dx;       } else if (dx == 1) {         c.first++;         dx = -1;       } else if (dx == -1 && c.second + dx >= 1) {         c.second += dx;       } else if (dx == -1) {         c.first++;         dx = 1;       }       cout << c.first <<     << c.second <<    ;       cover++;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     long long li, ri;   } sum[400000];   long long pmx[400000], nmx[400000];   long long pmi[400000], nmi[400000];   int main() {     long long n;     memset(pmi, 0x7f7f7f7f, sizeof(pmi));     memset(nmi, 0x7f7f7f7f, sizeof(nmi));     memset(pmx, -0x7f7f7f7f, sizeof(pmx));     memset(nmx, -0x7f7f7f7f, sizeof(nmx));     scanf( %lld , &n);     for (long long i = 1; i <= n; i++) {       scanf( %lld %lld , &sum[i].li, &sum[i].ri);     }     for (long long i = 1; i <= n; i++) {       pmx[i] = max(sum[i].li, pmx[i - 1]);       pmi[i] = min(sum[i].ri, pmi[i - 1]);     }     for (long long i = n; i >= 1; i--) {       nmx[i] = max(sum[i].li, nmx[i + 1]);       nmi[i] = min(sum[i].ri, nmi[i + 1]);     }     long long ans = -0x7f7f7f7f, sum1 = 0, sum2 = 0;     for (long long i = 1; i <= n; i++) {       sum1 = max(pmx[i - 1], nmx[i + 1]);       sum2 = min(pmi[i - 1], nmi[i + 1]);       ans = max(ans, sum2 - sum1);     }     if (ans < 0) {       printf( 0 n );     } else       printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int V = 0;   struct Node {     int id;     long long num, sum;     Node *l, *r;     Node() {       num = -1;       sum = 0;       l = r = nullptr;       id = V++;     }   };   int N;   string s;   Node* build(int& n) {     Node* node = new Node();     if (s[n] ==  ( ) {       n++;       node->l = build(n);       n++;       node->r = build(n);       n++;       node->sum += node->l->sum + node->r->sum + 1;     } else {       node->num = s[n] -  0 ;       n++;     }     return node;   }   const long long INF = 1 << 25;   int P, M;   bool remplus;   long long mi[10000][210];   long long ma[10000][210];   pair<long long, long long> f(Node* node, int rem) {     if (node->num != -1) {       if (rem) return {INF, INF};       return {node->num, node->num};     }     int id = node->id;     if (mi[id][rem] != INF) return {mi[id][rem], ma[id][rem]};     if (rem > node->sum) return {INF, INF};     pair<long long, long long> ret = {INF, -INF};     for (int i = 0; i < 2; i++) {       int nrem = rem - (remplus && !i || !remplus && i);       if (nrem < 0) continue;       for (int j = 0; j <= nrem; j++) {         auto res1 = f(node->l, j);         auto res2 = f(node->r, nrem - j);         if (res1.first == INF || res2.first == INF) continue;         if (i == 0) {           ret.first = min(ret.first, res1.first + res2.first);           ret.second = max(ret.second, res1.second + res2.second);         } else {           ret.first = min(ret.first, res1.first - res2.second);           ret.second = max(ret.second, res1.second - res2.first);         }       }     }     mi[id][rem] = ret.first;     ma[id][rem] = ret.second;     return ret;   }   int main() {     cin.tie(0);     ios::sync_with_stdio(false);     cin >> s >> P >> M;     N = s.size();     int n = 0;     Node* root = build(n);     fill((long long*)begin(mi), (long long*)end(mi), INF);     fill((long long*)begin(ma), (long long*)end(ma), INF);     remplus = P <= M;     int rem = remplus ? P : M;     cout << f(root, rem).second << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int x, y, n;       cin >> x >> y >> n;       int a, b;       a = n % x;       b = n - a;       if (b + y <= n) {         cout << b + y << endl;       } else {         cout << b + y - x << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int c[5555], ans[5555];   int main() {     int n;     cin >> n;     int a[n + 1];     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       memset(c, 0, sizeof(c));       int bc = 0, bt = -1;       for (int j = i; j <= n; j++) {         int s = ++c[a[j]];         if (s > bc || (s == bc && a[j] < bt)) bc = s, bt = a[j];         ++ans[bt];       }     }     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int power(int a, int b) {     if (b == 0)       return 1;     else if (b % 2 == 0)       return power((a * a) % 1000000007, b / 2);     else       return (a * power((a * a) % 1000000007, b / 2) % 1000000007);   }   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     cin >> t;     while (t--) {       int n, x, i, m, res, a;       cin >> n >> x;       set<int> s;       m = INT_MIN;       bool flag = false;       for (i = 0; i < n; i++) {         cin >> a;         s.insert(a);         m = max(m, a);         if (x == a) flag = true;       }       if (flag) {         cout <<  1 n ;         continue;       }       res = x / m;       if (x % m)         cout << max(2, res + 1) <<   n ;       else         cout << res <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int a, b, rem;     cin >> a >> b;     long long int count = 0;     a = max(a, b);     b = min(a, b);     while (a != b && b != 0) {       count += a / b;       a = a % b;       a = a + b;       b = a - b;       a = a - b;     }     cout << count;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int l, r, x, y, k;     scanf( %d%d%d%d%d , &x, &y, &l, &r, &k);     int L = (int)ceil(1.0 * x / k), R = (int)floor(1.0 * y / k);     if (R < L || R < l || r < L)       puts( NO );     else       puts( YES );     return 0;   }