malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T Abs(const T& value) {     return value < 0 ? -value : value;   }   template <typename T>   inline T Sqr(const T& value) {     return value * value;   }   const int maxn = 110;   int a[maxn][maxn];   int main() {     int k;     int n = 0;     cin >> k;     while (k > 0) {       int d = 3;       while (((d + 1) * d * (d - 1)) / 6 <= k) {         ++d;       }       for (int i = n; i < n + d; ++i)         for (int j = i + 1; j < n + d; ++j) {           a[i][j] = 1;           a[j][i] = 1;         }       k -= ((d) * (d - 2) * (d - 1)) / 6;       int how = 2;       n += d;       while (true) {         how = 1;         while (((how + 1) * how) / 2 <= k) ++how;         if (how >= 2) {           k -= (how * (how - 1)) / 2;           for (int i = n - d; i < n && how > 0; ++i, --how) {             a[n][i] = 1;             a[i][n] = 1;           }           ++n;         } else           break;       }     }     cout << n << endl;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) cout << a[i][j];       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000 + 9;   struct Point {     double x, y;     Point operator-(const Point& b) const { return (Point){x - b.x, y - b.y}; }   } p[N];   double dis2(Point a, Point b) {     return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   }   double dis(Point a, Point b) { return sqrt(dis2(a, b)); }   double cross(Point a, Point b) { return a.x * b.y - b.x * a.y; }   double solve(Point a, Point c, Point b) {     return fabs(cross(c - a, b - a)) / dis(a, b);   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %lf %lf , &p[i].x, &p[i].y);     double ans = 10000000000;     for (int i = 0; i < n; ++i) {       ans = min(ans, solve(p[i], p[(i + 1) % n], p[(i + 2) % n]));     }     printf( %.10f , ans / 2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, i, j, m, x, y;   const int N = 1e5 + 7;   int t, S, q, ans;   int main() {     ios_base::sync_with_stdio(false);     cin >> t >> S >> q;     while (S < t) {       S *= q;       ans++;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double PI = acos(-1.0);   const double eps = 1e-12;   const int MAX = 1000 + 10;   const int EDGE = 100000 + 10;   struct point {     double x, y;     point() {}     void input() { scanf( %lf%lf , &x, &y); }     point(double a, double b) {       x = a;       y = b;     }     double operator^(const point &b) const { return x * b.y - b.x * y; }     point operator-(const point &b) const { return point(x - b.x, y - b.y); }     double operator*(const point &b) const { return x * b.x + y * b.y; }   } p[1111];   double dis(point a, point b) { return sqrt((a - b) * (a - b)); }   double dis2(point a, point b, point c) {     double x, y, z, tp;     x = dis(a, b);     y = dis(b, c);     z = dis(c, a);     tp = (x + y + z) / 2;     return sqrt(tp * (tp - x) * (tp - y) * (tp - z)) / z;   }   int main() {     int n, i;     double ans;     while (~scanf( %d , &n)) {       for (i = 0; i < n; i++) {         p[i].input();       }       p[n++] = p[0];       p[n++] = p[1];       ans = INF;       for (i = 2; i < n; i++) {         ans = min(ans, dis2(p[i - 2], p[i - 1], p[i]));       }       printf( %.10lf n , ans + eps);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 55, K = 55;   int n, k, M, t[K];   int main() {     scanf( %d%d%d , &n, &k, &M);     long long wholetime = 0;     for (int i = 0; i < k; i++) {       scanf( %d , &t[i]);       wholetime += t[i];     }     sort(t, t + k);     int ans = 0;     for (int whole = 0; whole <= n; whole++) {       long long time = whole * wholetime;       int pts = whole * (k + 1);       if (time <= M) {         for (int i = 0; i < k; i++) {           bool done = false;           for (int j = 0; whole + j < n; j++) {             if (time + t[i] <= M) {               time += t[i];               pts++;             }           }         }         ans = max(ans, pts);       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     int m;     int count;     int sum;     while (scanf( %d%d , &n, &m) != EOF) {       count = 0;       sum = 0;       if (n == m) {         printf( 0 );         printf(  n );         continue;       }       while (n < m) {         n = n * 2;         count++;       }       int k = n - m;       sum += count;       while (count != -1 && k != 0) {         while (k >= (1 << count)) {           sum += k / (1 << count);           k = k - (k / (1 << count)) * (1 << count);         }         count--;       }       printf( %d n , sum);     }   }
#include <bits/stdc++.h>   using namespace std;   bool prime[1000001];   const double gr = 1.6180339887;   void SieveOfErat(long long int mn) {     memset(prime, true, sizeof(prime));     for (long long i = 2; i * i <= mn; i++) {       if (prime[i] == true) {         for (long long j = i * 2; j <= 1000000; j += i) prime[j] = false;       }     }   }   long long int num;   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> num;     vector<long long int> v(num);     vector<long long int> v1(num);     for (long long int i = 0; i < num; i++) {       cin >> v[i] >> v1[i];     }     sort(v.begin(), v.end());     sort(v1.begin(), v1.end());     long long int val = num;     for (long long int i = 0; i < num; i++) {       if (v[i] >= v1[i])         val = val + v[i];       else         val = val + v1[i];     }     cout << val << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T, class U>   inline ostream& operator<<(ostream& os, const pair<T, U>& p) {     os << p.first <<     << p.second;     return os;   }   template <class T, class U>   inline istream& operator>>(istream& os, pair<T, U>& p) {     os >> p.first >> p.second;     return os;   }   template <class T>   inline ostream& operator<<(ostream& os, const vector<T>& v) {     if (v.empty()) return os;     if (v.begin() != v.end()) os << v.front();     for (auto it = ++v.begin(); it != v.end(); ++it) os <<     << *it;     return os;   }   template <class T>   inline istream& operator>>(istream& is, vector<T>& v) {     for (auto& i : v) is >> i;     return is;   }   void Solve(istream& is, ostream& os) {     int n;     is >> n;     int res = n / 2 + 1;     os << res <<   n ;     for (int i = 1; i < res + 1; ++i) {       os << i <<     << 1 <<   n ;     }     for (int i = 2; i < n - res + 2; ++i) {       os << res <<     << i <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout << setprecision(15) << fixed;     Solve(cin, cout);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct fastIO {     fastIO() {}   };   void no() {     cout <<  NO ;     exit(0);   }   void yes() {     cout <<  YES ;     exit(0);   }   const int MAXN = 1e6 * 2;   long long n, x, a[MAXN], b[MAXN], m, l, ans, y, z;   int main() {     if (0) cerr << fixed << setprecision(20);     fastIO();     cin >> n >> m >> l;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       if (a[i] > l) {         if (!x) {           x++;           b[i]++;           ans++;         }       } else if (x) {         b[i - 1]++;         x = 0;       }     }     for (int i = 0; i < m; i++) {       cin >> x;       if (x) {         cin >> y >> z;         y--;         if (a[y] > l) continue;         a[y] += z;         if (0) cerr << endl;         if (y && a[y] > l && b[y - 1] && b[y + 1]) {           ans--;         } else if (a[y] > l) {           if ((y && b[y - 1]) || b[y + 1]) {             b[y]++;           } else {             ans++;             b[y]++;           }         }       } else {         cout << ans << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int arr[m + 1];     arr[0] = 1;     for (int i = 1; i <= m; i++) cin >> arr[i];     long long step = 0;     for (int i = 0; i < m; i++) {       if (arr[i + 1] < arr[i])         step += (n - arr[i]) + (arr[i + 1] - 1) + 1;       else         step += arr[i + 1] - arr[i];     }     cout << step;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long SIZE = (long long)1e6 + 50;   const long long NUM = 15;   const long long TOT = 5;   const long long SUM = (long long)1e2 + 50;   const long long inf = (long long)1e18 + 50;   inline long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch ^ 48);       ch = getchar();     }     return f * x;   }   long long n, ans;   long long num[SIZE], high[SIZE], ls[SIZE], rs[SIZE], cnt[SIZE];   signed main() {     n = read();     long long indax = 0;     for (long long i = 0; i < n; ++i) num[i] = read();     for (long long i = 1; i < n; ++i)       if (num[i] > num[indax]) indax = i;     for (long long i = 0; i <= n; ++i) high[i] = num[(i + indax) % n];     for (long long i = 1; i <= n; ++i) {       ls[i] = i - 1;       while (ls[i] && high[i] >= high[ls[i]]) ls[i] = ls[ls[i]];     }     for (long long i = n - 1; i >= 0; --i) {       rs[i] = i + 1;       while (rs[i] < n && high[i] > high[rs[i]]) rs[i] = rs[rs[i]];       if (rs[i] < n && high[i] == high[rs[i]]) {         cnt[i] = cnt[rs[i]] + 1;         rs[i] = rs[rs[i]];       }     }     for (long long i = 0; i < n; ++i) {       ans += cnt[i];       if (high[i] < high[0]) {         ans += 2;         if (!ls[i] && rs[i] == n) ans--;       }     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2005;   const int MOD = 1e9 + 7;   int a[N][N];   vector<pair<int, pair<int, int> > > vv;   int p[N], dist[N][N];   std::vector<pair<int, int> > v[N];   int visit[N];   int root(int x) {     while (x != p[x]) {       p[x] = p[p[x]];       x = p[x];     }     return x;   }   void join(int x, int y) { p[root(y)] = root(x); }   void dfs(int node, int dis, int start) {     visit[node] = start;     if (a[start][node] != dis) {       printf( NO );       exit(0);     }     for (auto i : v[node]) {       if (visit[i.first] != start) {         dfs(i.first, dis + i.second, start);       }     }   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         scanf( %d , &a[i][j]);         if (a[i][j] && i == j) {           printf( NO );           return 0;         }         if (!a[i][j] && i != j) {           printf( NO );           return 0;         }         if (i < j && a[i][j]) {           vv.push_back({a[i][j], {i, j}});         }       }     }     sort(vv.begin(), vv.end());     int ct = 0;     for (int i = 1; i <= n; i++) p[i] = i;     for (auto i : vv) {       int wt = i.first, l = i.second.first, r = i.second.second;       if (root(l) != root(r)) {         join(l, r);         v[l].push_back({r, wt});         v[r].push_back({l, wt});         ct++;         if (ct == n - 1) break;       }     }     for (int i = 1; i <= n; i++) {       dfs(i, 0, i);     }     printf( YES );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[10];   int MOD = 1000000007;   long long C[101][101];   void comb(int lim) {     int n, r;     C[0][0] = 1;     for (n = 1; n <= lim; n++) {       C[n][0] = 1;       for (r = 1; r <= n - 1; r++) {         C[n][r] = (C[n - 1][r - 1] + C[n - 1][r]) % MOD;       }       C[n][n] = 1;     }   }   int f[101][10];   int main() {     comb(100);     scanf( %d , &n);     for (int i = 0; i < (10); i++) scanf( %d , &a[i]);     long long r = 0;     for (int l = 0; l <= n; l++) {       f[l][9] = (l >= a[9]);       for (int d = 8; d >= 1; d--) {         for (int k = a[d]; k <= l; k++) {           f[l][d] = (f[l][d] + C[l][k] * f[l - k][d + 1]) % MOD;         }       }       for (int k = a[0]; k <= l; k++) {         f[l][0] = (f[l][0] + C[l - 1][k] * f[l - k][1]) % MOD;       }       if (l >= 1) r = (r + f[l][0]) % MOD;     }     cout << r << endl;     return 0;   }
#include <bits/stdc++.h>   int ar[100000];   int main() {     int i, j, m, n, total = 0, a, b, c;     scanf( %d %d , &n, &m);     if (m == 0 || n == 1)       printf( 0 );     else {       for (j = 1; j <= m; j++) {         scanf( %d %d %d , &a, &b, &c);         ar[a] += c;         ar[b] -= c;       }       for (i = 1; i <= n; i++) {         if (ar[i] < 0) total += ar[i];       }       total = -1 * total;       printf( %d , total);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const long long INF = (long long)1000000007 * 1000000007;   const long double eps = 1e-8;   const long double pi = acos(-1.0);   int dx[4] = {1, -1, 0, 0};   int dy[4] = {0, 0, 1, -1};   int n, m, t[200010];   set<int> se[200010];   int e = 0;   void merge(int a, int b) {     if (se[a].size() < se[b].size()) {       swap(se[a], se[b]);     }     for (int s : se[b]) {       auto it1 = se[a].lower_bound(s + 1);       if (it1 != se[a].end()) {         if (*it1 == s + 1) e -= 1;       }       auto it2 = se[a].lower_bound(s - 1);       if (it2 != se[a].end()) {         if (*it2 == s - 1) e -= 1;       }     }     auto it = se[b].begin();     while (!se[b].empty()) {       se[a].insert(*it);       it = se[b].erase(it);     }   }   void solve() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       scanf( %d , &t[i]);       t[i]--;       se[t[i]].insert(i);     }     for (int i = 0; i < n - 1; i++) {       e += (t[i] != t[i + 1]);     }     cout << e << endl;     for (int i = 0; i < m - 1; i++) {       int a, b;       scanf( %d%d , &a, &b);       a--;       b--;       merge(a, b);       printf( %d n , e);     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout << fixed << setprecision(50);     solve();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long a, b;       cin >> a >> b;       long long c = abs(a - b);       if (a == b)         cout <<  0  <<   n ;       else {         long long ans;         if (c % 10 == 0)           ans = c / 10;         else {           ans = (c / 10) + 1;         }         cout << ans <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[109];   int ans;   int s;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       s += a[i];       ans = max(ans, a[i]);     }     for (;; ans++) {       if (ans * n - s > s) {         printf( %d , ans);         return 0;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const double pi = 4 * atan(1);   const int inf = 0x3f3f3f3f;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const int MOD = 1e9 + 7;   int nCase = 0;   int dcmp(double x) {     if (fabs(x) < eps) return 0;     return x < 0 ? -1 : 1;   }   template <class T>   inline bool read(T &n) {     T x = 0, tmp = 1;     char c = getchar();     while ((c <  0  || c >  9 ) && c !=  -  && c != EOF) c = getchar();     if (c == EOF) return false;     if (c ==  - ) c = getchar(), tmp = -1;     while (c >=  0  && c <=  9 ) x *= 10, x += (c -  0 ), c = getchar();     n = x * tmp;     return true;   }   template <class T>   inline void write(T n) {     if (n < 0) {       putchar( - );       n = -n;     }     int len = 0, data[20];     while (n) {       data[len++] = n % 10;       n /= 10;     }     if (!len) data[len++] = 0;     while (len--) putchar(data[len] + 48);   }   long long QMOD(long long x, long long k) {     long long res = 1LL;     while (k) {       if (k & 1) res = res * x % MOD;       k >>= 1;       x = x * x % MOD;     }     return res;   }   int n;   priority_queue<pair<int, int> > q;   map<int, int> mp;   vector<pair<pair<int, int>, int> > v;   inline bool check(int mid) {     priority_queue<pair<int, int> > que = q;     int cnt = 0;     v.clear();     while (que.size() > 2 && cnt < mid) {       pair<int, int> f1 = que.top();       que.pop();       pair<int, int> f2 = que.top();       que.pop();       pair<int, int> f3 = que.top();       que.pop();       int a = f1.second;       int b = f2.second;       int c = f3.second;       if (a < b) swap(a, b);       if (a < c) swap(a, c);       if (b < c) swap(b, c);       v.push_back(pair<pair<int, int>, int>(pair<int, int>(a, b), c));       ++cnt;       if (--f1.first > 0) que.push(f1);       if (--f2.first > 0) que.push(f2);       if (--f3.first > 0) que.push(f3);     }     return cnt >= mid;   }   int main(int argc, const char *argv[]) {     scanf( %d , &n);     for (int i = 1, x; i <= n; ++i) {       read(x);       mp[x]++;     }     map<int, int>::iterator it;     for (it = mp.begin(); it != mp.end(); ++it) {       q.push(pair<int, int>(it->second, it->first));     }     int l = 0, r = n / 3;     int ans = 0;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(mid) == true) {         l = mid + 1;         ans = mid;       } else         r = mid - 1;     }     printf( %d n , ans);     if (ans > 0) {       for (int i = 0; i < ans; ++i)         printf( %d %d %d n , v[i].first.first, v[i].first.second, v[i].second);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int ansx[maxn], ansy[maxn];   int b[maxn], c[maxn];   struct node {     int g, p, t, id;     node() {}     node(int g, int p, int t, int id) {       this->g = g;       this->p = p;       this->t = t;       this->id = id;     }   } a[maxn], init[maxn];   bool cmp(node x, node y) {     return (x.t - x.p) < (y.t - y.p) || ((x.t - x.p) == (y.t - y.p) && x.p < y.p);   }   int main() {     std::ios::sync_with_stdio(false);     int n, w, h;     cin >> n >> w >> h;     for (int i = 1; i <= n; i++) {       cin >> a[i].g >> a[i].p >> a[i].t;       a[i].id = i;       init[i] = a[i];     }     sort(a + 1, a + 1 + n, cmp);     int now = 1;     while (now <= n) {       int t1 = 0, t2 = 0;       if (a[now].g == 1)         b[t1++] = a[now].id;       else         c[t2++] = a[now].id;       now++;       while (now <= n && (a[now].t - a[now].p == a[now - 1].t - a[now - 1].p)) {         if (a[now].g == 1)           b[t1++] = a[now].id;         else           c[t2++] = a[now].id;         now++;       }       for (int i = 0; i < t1; i++) {         int lastx = t1 - i - 1;         int lasty = t2;         if (lastx < lasty) {           ansx[b[i]] = w;           ansy[b[i]] = init[c[lastx]].p;         } else {           ansx[b[i]] = init[b[i + lasty]].p;           ansy[b[i]] = h;         }       }       for (int i = 0; i < t2; i++) {         int lastx = t1;         int lasty = t2 - i - 1;         if (lastx > lasty) {           ansy[c[i]] = h;           ansx[c[i]] = init[b[lasty]].p;         } else {           ansx[c[i]] = w;           ansy[c[i]] = init[c[i + lastx]].p;         }       }     }     for (int i = 1; i <= n; i++) printf( %d %d n , ansx[i], ansy[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int m, r;     scanf( %d %d , &m, &r);     int i;     double sum = 0.0;     if (m == 1)       printf( %f , 2.0 * r);     else if (m == 2)       printf( %f , (2.0 + sqrt(2.0) / 2) * r);     else {       for (i = 2; i <= m - 1; i++) {         sum += (i - 1.0) * (i - 2.0) + (m - i) * (m - i - 1.0) +                (m - 3.0) * 2.0 * sqrt(2.0) + 6 + 2 * sqrt(2.0);       }       double ans;       ans = sum * 1.0 / m * r / m +             ((m - 1.0) * (m - 2.0) + 4 + sqrt(2.0) + (m - 2) * 2 * sqrt(2.0)) *                 2 * r / m / m;       printf( %f , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {}   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     long long n;     cin >> n;     deque<long long> dq;     for (long long i = 1; i <= n; i++) {       long long x;       cin >> x;       dq.push_back(x);     }     for (long long i = 1; i <= 2e6; i++) {       while ((long long)dq.size()) {         if (dq.front() - 1 <= i) {           dq.pop_front();         } else           break;       }       while ((long long)dq.size()) {         if (1e6 - dq.back() <= i) {           dq.pop_back();         } else           break;       }       if (dq.empty()) {         cout << i <<   n ;         break;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int query(int a, int b) {     cout <<  ?   << a <<     << b << endl;     fflush(stdout);     int tmp;     cin >> tmp;     return tmp;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int flag = query(0, 0);     int a = 0, b = 0;     int tmp;     for (int i = 29; i >= 0; i--) {       if (flag == 0) {         tmp = query(a | (1 << i), b);         if (tmp == -1) {           a |= (1 << i);           b |= (1 << i);         }       } else if (flag == 1) {         tmp = query(a | (1 << i), b | (1 << i));         if (tmp == -1) {           a |= (1 << i);           flag = query(a, b);         } else {           tmp = query(a | (1 << i), b);           if (tmp == -1) {             a |= (1 << i);             b |= (1 << i);           }         }       } else {         tmp = query(a | (1 << i), b | (1 << i));         if (tmp == 1) {           b |= (1 << i);           flag = query(a, b);         } else {           tmp = query(a | (1 << i), b);           if (tmp == -1) {             a |= (1 << i);             b |= (1 << i);           }         }       }     }     cout <<  !   << a <<     << b << endl;     fflush(stdout);   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 1e5 + 4;   int a[NMAX];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     int mn = 1e9 + 4;     for (int i = 0; i < n; ++i) {       cin >> a[i];       mn = min(mn, a[i]);     }     vector<int> res;     for (int i = 0; i < n; ++i) {       if (a[i] == mn) {         res.push_back(i);       }     }     int ans = 1e6 + 4;     for (int i = 0; i < res.size() - 1; ++i) {       ans = min(ans, (res[i + 1] - res[i]));     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     long long x;     long long e = 0;     long long pos = 0;     long long ans = 0;     for (long long i = 0; i < n; i++) {       cin >> x;       e += (pos - x);       if (e < 0) {         ans += (-1) * e;         e = 0;       }       pos = x;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int num[6300000];   int main() {     int i, j, k;     memset(num, 0, sizeof(num));     for (i = 1; i <= 500; i++) num[(i * (i + 1)) / 2] = 1;     while (~scanf( %d , &k)) {       if (num[k] == 1)         printf( YES n );       else         printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     cin >> a >> b >> c;     int counter = 0;     int min_c = min(min(a, b / 2), c / 4);     counter = 4 * min_c + min_c + min_c * 2;     if (c / 4 == 0 || b / 2 == 0) {       cout << 0;     } else {       cout << counter;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( -Ofast ,  -funroll-all-loops )   using namespace std;   long long a, k, res;   inline long long check(long long x) {     while (x) {       if (x % 10 == 0) return 1;       x /= 10;     }     return 0;   }   inline long long f(long long x) {     long long res = 0;     while (x) res = max(res, x % 10), x /= 10;     return res;   }   inline long long g(long long x) {     long long res = 10;     while (x) res = min(res, x % 10), x /= 10;     return res;   }   inline void solve() {     cin >> a >> k;     res = k;     if (k == 1) return printf( %lld n , a), void();     for (long long i = 2; i <= k; i++) {       if (check(a)) break;       a = a + f(a) * g(a);     }     printf( %lld n , a);   }   signed main() {     long long T;     cin >> T;     while (T--) solve();     return 0;   }