malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void printVec(vector<int> v2, string s =   ) {     cout << s;     for (int i = 0; i < (int)v2.size(); ++i) cout << v2[i] <<    ;     cout <<   n ;   }   bool isOdd(int a) { return (a % 2 == 1); }   void initMem(int n, int mem[]) {     for (int i = 0; i < n; i++) mem[i] = -1;   }   bool lucky(long long n) {     n = abs(n);     while (n) {       if (n % 10 == 8) {         return true;       }       n /= 10;     }     return false;   }   int main() {     int k;     int d;     cin >> k >> d;     string s =   ;     s += ( 0  + d);     for (int i = 1; i < k; i++) s +=  0 ;     if (d == 0) {       if (k == 1)         cout << 0;       else         cout <<  No solution ;       return 0;     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long a, b;     cin >> a >> b;     long long ans = abs(a - b) / 5;     a = abs(a - b) % 5;     if (a == 4) cout << ans + 2;     if (a == 3) cout << ans + 2;     if (a == 2) cout << ans + 1;     if (a == 1) cout << ans + 1;     if (a == 0) cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.precision(20);     long long t = 1;     cin >> t;     while (t--) {       solve();       cout <<   n ;     }     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int gizzly;     cin >> gizzly;     priority_queue<int> scoreList;     for (int i = 1; i < n; i++) {       int x;       cin >> x;       scoreList.push(x);     }     int candy = 0;     while (gizzly <= scoreList.top()) {       int opponent = scoreList.top();       scoreList.pop();       opponent -= 1;       gizzly += 1;       candy += 1;       scoreList.push(opponent);     }     cout << candy << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, a[((int)1001 * 1000)], maxi, mini;   vector<int> v;   int jaghool;   bitset<((int)1001 * 1000)> dp, mark;   int main() {     scanf( %d%d , &n, &k);     int k2 = k;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= n; i++)       if (!mark[i]) {         int x = a[i], p = 1;         while (x != i) p++, mark[x] = 1, x = a[x];         v.push_back(p);         maxi += min(k2, p / 2) * 2, k2 -= min(k2, p / 2);         if (p % 2) jaghool++;       }     maxi += min(k2, jaghool);     dp[0] = 1;     sort(v.begin(), v.end());     v.push_back(-1);     vector<int> v2;     for (int i = 0, cnt = 1; i < v.size(); i++) {       if (v[i] != v[i + 1]) {         int x = v[i];         while (cnt) {           dp |= (dp << v[i]);           for (int j = 0; j < ((int)20); j++) {             if ((1 << j) <= cnt && cnt < (1 << (j + 1))) {               cnt -= (1 << j);               break;             }             dp |= (dp << (v[i] << j));           }         }         cnt = 1;       } else         cnt++;     }     cout << k + 1 - dp[k] <<     << maxi <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int Q, cnt = 1;   int par[400010][21], nxt[400010][21], len[400010];   long long w[400010], sum[400010][21];   long long mx[400010][21];   int find_first_bigger(int u, int W) {     if (mx[u][0] >= W) return u;     for (int i = 18; i >= 0; i--)       if (mx[u][i + 1] >= W && mx[u][i] < W) u = par[u][i];     return mx[u][0] >= W ? u : 0;   }   void add(int R, int W) {     int u = ++cnt;     w[u] = W;     int fb = find_first_bigger(R, W);     len[u] = len[fb] + 1;     nxt[u][0] = fb;     sum[u][0] = W;     par[u][0] = R;     mx[u][0] = w[u];     for (int i = 1; i < 21; i++) {       nxt[u][i] = nxt[nxt[u][i - 1]][i - 1];       sum[u][i] = sum[nxt[u][i - 1]][i - 1] + sum[u][i - 1];       par[u][i] = par[par[u][i - 1]][i - 1];       mx[u][i] = max(mx[par[u][i - 1]][i - 1], mx[u][i - 1]);     }   }   long long getsum(long long u, long long k) {     if (!k) return 0;     long long ret = 0;     for (int i = 0; k; i++, k >>= 1)       if (k & 1) {         ret += sum[u][i];         u = nxt[u][i];       }     return ret;   }   long long query(long long u, long long x) {     long long lo = 1, hi = len[u];     while (lo < hi) {       long long mid = (lo + hi) >> 1;       long long s = getsum(u, mid);       if (s > x)         hi = mid;       else         lo = mid + 1;     }     if (getsum(u, lo) <= x)       return lo;     else if (getsum(u, lo - 1) > x)       return 0;     return lo - 1;   }   int main() {     for (int i = 0; i < 400010; i++)       for (int j = 0; j < 21; j++) mx[i][j] = -4e18;     for (int i = 0; i < 21; i++) mx[1][0] = 0;     len[1] = 1;     scanf( %d , &Q);     long long last = 0;     while (Q--) {       long long tt, p, q;       scanf( %lld%lld%lld , &tt, &p, &q);       if (tt == 1) {         long long R = p ^ last, W = q ^ last;         add(R, W);       } else {         long long R = p ^ last, X = q ^ last;         printf( %lld n , last = query(R, X));       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> vec;     set<int> st;     for (int i = 0; i < int(n); ++i) {       int a;       cin >> a;       st.insert(i);       vec.push_back(a);     }     queue<int> tok;     int ans = 0;     int killed = 0;     for (int i = n - 1; i > 0; i--) {       if (vec[i] < vec[i - 1]) {         st.erase(i);         ++killed;         tok.push(i - 1);       }     }     if (killed) ans++;     queue<int> qtok;     while (killed) {       killed = 0;       while (!tok.empty()) {         int tp = tok.front();         tok.pop();         auto it = st.find(tp);         if (it == st.end()) continue;         auto itn = st.find(tp);         itn++;         if (itn == st.end()) continue;         if (vec[*it] > vec[*itn]) {           qtok.push(*it);           ++killed;           st.erase(itn);         }       }       while (!qtok.empty()) {         tok.push(qtok.front());         qtok.pop();       }       if (killed) ans++;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double pie = 3.14159265358979;   const long long mod = 1e9 + 7;   string vow =  aeiou ;   void solve(int test_case) {     string f, m, s;     cin >> f >> m >> s;     map<string, string> beat;     beat[ rock ] =  scissors ;     beat[ scissors ] =  paper ;     beat[ paper ] =  rock ;     if (beat[f] == m && beat[f] == s)       cout <<  F ;     else if (beat[m] == f && beat[m] == s)       cout <<  M ;     else if (beat[s] == f && beat[s] == m)       cout <<  S ;     else       cout <<  ? ;     cout <<   n ;   }   int main() {     int t = 1;     for (int i = 0; i < t; i++) solve(i);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ls[310];   int dp[110][310][310];   pair<int, int> p[110];   int L[110], R[110], x[110];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &p[i].first, &p[i].second);       ls[i * 3 - 2] = p[i].first - p[i].second;       ls[i * 3 - 1] = p[i].first;       ls[i * 3] = p[i].first + p[i].second;     }     sort(p + 1, p + n + 1);     sort(ls + 1, ls + n * 3 + 1);     int ex = unique(ls + 1, ls + n * 3 + 1) - ls;     for (int i = 1; i <= n; i++) {       L[i] = lower_bound(ls + 1, ls + ex, p[i].first - p[i].second) - ls;       x[i] = lower_bound(ls + 1, ls + ex, p[i].first) - ls;       R[i] = lower_bound(ls + 1, ls + ex, p[i].first + p[i].second) - ls;     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j < ex; j++) {         for (int k = j; k < ex; k++) {           dp[i][j][max(k, R[i])] = max(               dp[i][j][max(k, R[i])], dp[i - 1][j][k] + max(0, ls[R[i]] - ls[k]));           if (L[i] <= j)             dp[i][0][max(k, x[i])] =                 max(dp[i][0][max(k, x[i])],                     dp[i - 1][j][k] + max(0, ls[x[i]] - ls[k]));         }       }       for (int k = 1; k < ex; k++) {         if (k >= x[i])           dp[i][0][max(k, R[i])] = max(               dp[i][0][max(k, R[i])], dp[i - 1][0][k] + max(0, ls[R[i]] - ls[k]));         else           dp[i][0][R[i]] =               max(dp[i][0][R[i]], dp[i - 1][0][k] + ls[R[i]] - ls[x[i]]);         for (int j = k; j < x[i]; j++)           dp[i][j][R[i]] =               max(dp[i][j][R[i]], dp[i - 1][0][k] + ls[R[i]] - ls[j]);         if (k >= L[i])           dp[i][0][max(k, x[i])] = max(               dp[i][0][max(k, x[i])], dp[i - 1][0][k] + max(0, ls[x[i]] - ls[k]));         else           dp[i][0][x[i]] =               max(dp[i][0][x[i]], dp[i - 1][0][k] + ls[x[i]] - ls[L[i]]);         for (int j = k; j < L[i]; j++)           dp[i][j][x[i]] =               max(dp[i][j][x[i]], dp[i - 1][0][k] + ls[x[i]] - ls[j]);       }     }     int ans = 0;     for (int i = 1; i < ex; i++) ans = max(ans, dp[n][0][i]);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) x = x * 10 + c -  0 ;     return x * f;   }   const int MAXN = 200010;   const int INF = 1e9;   const int Mod = 998244353LL;   int mx;   int N;   int tms = 0;   pair<int, int> sta[MAXN * 10 + 1];   int top;   int Node[MAXN << 1], Next[MAXN << 1], Root[MAXN + 1], cnt;   int deg[MAXN + 1];   inline void insert(int u, int v) {     Node[++cnt] = v;     Next[cnt] = Root[u];     Root[u] = cnt;     return;   }   inline void solve(int k, int Fa, int val) {     if (k != 1) --deg[k];     int last = deg[k];     sta[++top] = make_pair(k, tms);     bool flag = 0;     if (tms == mx && val != -1) {       tms = max(val - last, 0);       if (tms + last != val) flag = 1;       sta[++top] = make_pair(k, tms);     }     for (int x = Root[k]; x; x = Next[x]) {       int v = Node[x];       if (v == Fa) continue;       ++tms;       --last;       solve(v, k, ((tms == val && flag) ? tms : tms - 1));       ++tms;       sta[++top] = make_pair(k, tms);       if (tms == mx && val != -1) {         tms = max(val - last, 0);         if (tms + last != val) flag = 1;         sta[++top] = make_pair(k, tms);       }     }     if (val != -1 && tms > val) {       sta[++top] = make_pair(k, val);       tms = val;     }     return;   }   int main() {     N = read();     for (int i = 1; i < N; i++) {       int u = read(), v = read();       insert(u, v);       insert(v, u);       ++deg[u];       ++deg[v];     }     mx = 0;     for (int i = 1; i <= N; i++) mx = max(mx, deg[i]);     solve(1, 0, -1);     printf( %d n , top);     for (int i = 1; i <= top; i++) printf( %d %d n , sta[i].first, sta[i].second);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 600000;   const int MOD = (int)1e9 + 7;   int n, m, k, u, v, g[N];   long long c[N], w[N];   set<long long> s;   vector<pair<long long, pair<int, int> > > e;   int find(int cur) { return cur == g[cur] ? g[cur] : g[cur] = find(g[cur]); }   int main() {     scanf( %d %d %d , &n, &m, &k);     w[0] = 1;     for (int i = 1; i <= n; i++) {       w[i] = 2LL * w[i - 1] % MOD;     }     for (int i = 0; i < n; i++) {       scanf( %lld , &c[i]);     }     for (int i = 0; i < m; i++) {       scanf( %d %d , &u, &v);       u--;       v--;       s.insert(c[u] ^ c[v]);       e.push_back({c[u] ^ c[v], make_pair(u, v)});     }     long long ans = (((1LL << k) - s.size()) % MOD) * w[n] % MOD;     sort(e.begin(), e.end());     for (int i = 0; i < e.size();) {       int j = i;       while (j < e.size() && e[i].first == e[j].first) {         j++;       }       for (int p = i; p < j; p++) {         int u = e[p].second.first;         int v = e[p].second.second;         g[u] = u;         g[v] = v;       }       int c = n;       for (int p = i; p < j; p++) {         int u = e[p].second.first;         int v = e[p].second.second;         u = find(u);         v = find(v);         if (u != v) {           c--;           g[v] = u;         }       }       ans += w[c];       ans %= MOD;       i = j;     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, lamps[2002], sol = 0, cs;     memset(lamps, 0, sizeof(lamps));     cin >> n >> m;     string s[2002];     for (int i = 0; i < n; i++) {       cin >> s[i];     }     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++)         if (s[i][j] ==  1 ) lamps[j]++;     for (int i = 0; i < n; i++) {       cs = 1;       for (int j = 0; j < m; j++) {         if (s[i][j] ==  1  && lamps[j] < 2) {           cs = 0;           break;         }       }       if (cs == 1) {         sol = 1;         break;       }     }     if (sol)       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200000 + 100;   const int M = 30;   vector<int> G[MAXN];   int deep[MAXN], fa[MAXN][M];   void DFS(int cur, int pre) {     fa[cur][0] = pre;     for (int i = 1; i < 20; ++i) fa[cur][i] = fa[fa[cur][i - 1]][i - 1];     for (int i = 0; i < G[cur].size(); i++) {       int to = G[cur][i];       if (to == pre) continue;       deep[to] = deep[cur] + 1;       DFS(to, cur);     }   }   int LCA(int v, int u) {     if (deep[v] > deep[u]) swap(v, u);     for (int i = 0; i < 20; ++i)       if (deep[u] - deep[v] >> i & 1) u = fa[u][i];     for (int i = 19; i >= 0; --i)       if (fa[v][i] != fa[u][i]) v = fa[v][i], u = fa[u][i];     return v == u ? v : fa[v][0];   }   int cal(int s, int t, int f) {     int ans = 0, sf = LCA(s, f) == f, tf = LCA(t, f) == f;     if (sf != tf)       return 1;     else if (sf)       ans = deep[LCA(s, t)] - deep[f];     else if (LCA(s, f) != LCA(t, f))       ans = deep[f] - max(deep[LCA(f, s)], deep[LCA(f, t)]);     else       ans = deep[LCA(s, t)] + deep[f] - 2 * deep[LCA(s, f)];     return ans + 1;   }   int main() {     int n, q;     scanf( %d%d , &n, &q);     for (int i = 2; i <= n; ++i) {       int x;       scanf( %d , &x);       G[i].push_back(x);       G[x].push_back(i);     }     DFS(1, 0);     while (q--) {       int a, b, c;       scanf( %d%d%d , &a, &b, &c);       printf( %d n , max(cal(a, b, c), max(cal(b, c, a), cal(c, a, b))));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool check(int i, int n, set<pair<int, int> >& st) {     for (auto it : st) {       pair<int, int> t(it.first + i, it.second + i);       if (t.first > n) t.first %= n;       if (t.second > n) t.second %= n;       if (t.first > t.second) swap(t.first, t.second);       if (!st.count(t)) return false;     }     return true;   }   int main() {     int n, m, a, b;     while (cin >> n >> m) {       set<pair<int, int> > st;       for (int i = 1; i <= m; i++) {         cin >> a >> b;         st.insert(make_pair(min(a, b), max(a, b)));       }       bool flg = false;       for (int i = 1; i * i <= n; i++) {         if (n % i == 0) {           if (check(i, n, st)) {             flg = true;             break;           } else if (i != 1 && check(n / i, n, st)) {             flg = true;             break;           }         }       }       cout << (flg ?  Yes  :  No ) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int i, j, k, l, n, m, s, an, K, X;   const int N = 5100;   int a[1100000], g[1100000];   long long f[N][N];   int main() {     scanf( %d%d , &n, &K);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     sort(&a[1], &a[n + 1]);     int v1 = n / K + 1;     int v2 = n / K;     if (n % K == 0) v1--;     int ss = n % K;     if (!ss) ss = K;     ss = K - ss;     memset(f, 120, sizeof(f));     f[0][0] = 0;     for (int i = 0; i <= K; i++)       for (int j = 0; j <= ss; j++) {         int now = j * v2 + (i - j) * v1;         f[i + 1][j] = min(f[i + 1][j], f[i][j] + a[now + v1] - a[now + 1]);         f[i + 1][j + 1] =             min(f[i + 1][j + 1], f[i][j] + a[now + v2] - a[now + 1]);       }     printf( %I64d n , f[K][ss]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void fun(long long a[], long long remain, long long total, long long n,            long long m) {     vector<long long> ans;     long long i, j;     for (i = 0; i < n && total > 0; i++) {       if (a[i] % m == remain) {         ans.push_back(a[i]);         total--;       }     }     sort(ans.begin(), ans.end());     for (i = 0; i < ans.size(); i++) cout << ans[i] <<    ;   }   int main() {     long long t, n, i, j, k, m;     t = 1;     while (t--) {       cin >> n >> k >> m;       map<long long, long long> x;       long long a[n], flag = 0;       for (i = 0; i < n; i++) {         cin >> a[i];         x[a[i] % m]++;       }       for (auto itr = x.begin(); itr != x.end(); itr++) {         if (itr->second >= k) {           flag = 1;           cout <<  Yes  << endl;           fun(a, itr->first, k, n, m);           break;         }       }       if (flag == 0) cout <<  No  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   bool isprime(long long int n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long int i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   int main() {     int t;     cin >> t;     string y =  YES n , z =  NO n ;     while (t--) {       long long int a, b, i, j;       cin >> a >> b;       if (a - b != 1)         cout << z;       else {         if (isprime(a + b))           cout << y;         else           cout << z;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int n = 0;     while (s.at(n) !=  . ) n++;     if (s.at(n - 1) ==  9 )       cout <<  GOTO Vasilisa. ;     else {       if (s.at(n + 1) < 53)         cout << s.substr(0, n);       else {         cout << s.substr(0, n - 1);         cout << (char)(s.at(n - 1) + 1);       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     while (scanf( %I64d , &n) != EOF) {       long long x, y, l, h, mid;       l = 0, h = 1e18 + 7;       while (l < h - 1) {         mid = (l + h) >> 1;         if (n / (3 * mid) >= mid + 1)           l = mid;         else           h = mid;       }       x = 2 * l;       y = 0;       long long ret = n - 3 * l * (l + 1);       l++;       if (ret >= 1) {         x++;         y += 2;         if (ret <= l) {           x -= ret - 1;           y += 2 * (ret - 1);         } else {           x -= l - 1;           y += 2 * (l - 1);           if (ret <= 2 * l) {             x -= 2 * (ret - l);           } else {             x -= 2 * l;             if (ret <= 3 * l) {               x -= ret - 2 * l;               y -= 2 * (ret - 2 * l);             } else {               x -= l;               y -= 2 * l;               if (ret <= 4 * l) {                 x += ret - 3 * l;                 y -= 2 * (ret - 3 * l);               } else {                 x += l;                 y -= 2 * l;                 if (ret <= 5 * l) {                   x += 2 * (ret - 4 * l);                 } else {                   x += 2 * l;                   x += ret - 5 * l;                   y += 2 * (ret - 5 * l);                 }               }             }           }         }       }       printf( %I64d %I64d n , x, y);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 4e5 + 10;   int n, a[M], b[M], ans, cnt;   int f(int x, int i) {     return n - (x >> i) - (lower_bound(b, b + n, (1 << (i + 1)) - x) - b);   }   int32_t main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , a + i);     for (int i = 0; i < 28; i++) {       for (int j = 0; j < n; j++) b[j] = (a[j] & ((1 << (i + 1)) - 1));       sort(b, b + n);       cnt = 0;       for (int j = 0; j < n; j++) cnt += f(b[j], i);       ans += (((cnt >> 1) & 1) << (i + 1));     }     if (n % 2 == 0)       for (int i = 0; i < n; i++) ans ^= a[i];     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double PI = acos(-1);   const long long MOD = 1000000007;   const long long FMOD = 998244353;   long long cnt1, cnt2, x, y;   bool isSafe(long long mid) {     long long div1 = mid / x;     long long div2 = mid / y;     long long div3 = mid / (x * y);     long long no = mid - (div1 + div2 - div3);     long long p = div1 - div3;     long long q = div2 - div3;     long long ans1 = cnt1 - q;     long long ans2 = cnt2 - p;     if (ans1 < 0) ans1 = 0;     if (ans2 < 0) ans2 = 0;     return (ans1 + ans2) <= no;   }   signed main() {     cin >> cnt1 >> cnt2 >> x >> y;     long long beg = 0, end = 1e10;     long long ans = 0;     while (beg <= end) {       long long mid = (beg + end) / 2;       if (isSafe(mid)) {         ans = mid;         end = mid - 1;       } else {         beg = mid + 1;       }     }     cout << ans;   }
/*/ Author: Aniruddh Lawande /*/   #include<bits/stdc++.h>   using namespace std;      /*/---------------------------Defines----------------------/*/       #define ll long long   #define F first   #define S second   #define pb push_back   #define endl   n    #define all(v) (v).begin(),(v).end()      typedef pair<ll,ll> pii;   /*/-----------------------Modular Arithmetic---------------/*/       const long long INF = 1ll << 32;    const int mod=1e9+7;   inline int add(int x,int y){       x+=y;       if (x>=mod) return x-mod;       return x;   }   inline int sub(int x,int y){       x-=y;       if (x<0) return x+mod;       return x;   }   inline int mul(int x,int y){       return (x*1ll*y)%mod;   }   inline int power(int x,int y){       int ans=1;       while(y){           if (y&1) ans=mul(ans,x);           x=mul(x,x);           y>>=1;       }       return ans;   }   inline int inv(int x){       return power(x,mod-2);   }      const ll FACTORIAL_SIZE = 1.1e6;   ll fact[FACTORIAL_SIZE], ifact[FACTORIAL_SIZE];   void gen_factorial(ll n) {    fact[0] = fact[1] = ifact[0] = ifact[1] = 1;         for (ll i = 2; i <= n; i++) {     fact[i] = (i * fact[i - 1]) % mod;    }    ifact[n] = inv(fact[n]);    for (ll i = n - 1; i >= 2; i--) {     ifact[i] = ((i + 1) * ifact[i + 1]) % mod;    }   }         ll nck(ll n, ll k) {    ll den = (ifact[k] * ifact[n - k]) % mod;    return (den * fact[n]) % mod;   }      /*/-----------------------------Code begins----------------------------------/*/   const int N=2e5+5;      void solve()   {       ll d,k;       cin>>d>>k;       ll x=0,y=0;       ll i=0;       while(x*x+y*y<=d*d)       {           if(i%2==0)           {               if((x+k)*(x+k)+y*y<=d*d) x+=k;               else break;           }           else           {               if(x*x+(y+k)*(y+k)<=d*d) y+=k;               else break;           }           i++;       }       if(i%2!=0)       {           cout<< Ashish <<endl;       }       else       {           cout<< Utkarsh <<endl;       }          }            int main()   {       ios_base::sync_with_stdio(false);       cin.tie(NULL);       cout.tie(NULL);    int tc=1;    cin>>tc;       int i=1;    while(tc--)    {           //cout<< CASE # <<i<< :  ;     solve();           i++;    }    return 0;   }