malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename T>   using min_pq = priority_queue<T, vector<T>, greater<T>>;   template <typename T>   using max_pq = priority_queue<T>;   const int inf = 2e9 + 5;   const long long l_inf = 2e18 + 5;   const int mod_v = 1e9 + 7;   const int max_n = 1e5 + 5;   const int dx[4] = {-1, 0, 1, 0};   const int dy[4] = {0, 1, 0, -1};   template <typename T>   T gcd(T a, T b) {     while (b) {       T temp = a % b;       a = b;       b = temp;     }     return a;   }   template <typename T>   tuple<T, T, T> egcd(T a, T b) {     T x1 = 1, x2 = 0, y1 = 0, y2 = 1;     while (b) {       T q = a / b, r = a % b;       T new_x = x1 - q * x2, new_y = y1 - q * y2;       x1 = x2, y1 = y2, x2 = new_x, y2 = new_y;       a = b, b = r;     }     return make_tuple(a, x1, y1);   }   inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   template <typename T>   inline T mod(T a, T b = mod_v) {     return (a % b + b) % b;   }   template <typename T>   inline T mod_inv(T a, T b = mod_v) {     return mod(get<1>(egcd(a, b)), b);   }   template <typename T>   inline T sum(T a, T b, T m = mod_v) {     return mod(mod(a, m) + mod(b, m), m);   }   template <typename T>   inline T difference(T a, T b, T m = mod_v) {     return mod(mod(a, m) - mod(b, m), m);   }   inline long long product(long long a, long long b, long long m = mod_v) {     return mod(mod(a, m) * mod(b, m), m);   }   inline long long quotient(long long a, long long b, long long m = mod_v) {     return mod(mod(a, m) * mod_inv(b, m), m);   }   template <typename T, typename T2>   ostream &operator<<(ostream &s, const pair<T, T2> &p) {     return s << p.first <<     << p.second <<    ;   }   template <typename T, typename T2>   istream &operator>>(istream &s, pair<T, T2> &p) {     return s >> p.first >> p.second;   }   template <typename T>   ostream &operator<<(ostream &s, const vector<T> &v) {     for (auto it : v) s << it <<    ;     return s;   }   template <typename T>   istream &operator>>(istream &s, vector<T> &v) {     for (auto it = (v).begin(), it_ = (v).end(); it != it_; ++it) s >> *it;     return s;   }   template <typename T>   void read_range(T beg, T end) {     while (beg != end) cin >> *beg++;   }   template <typename T>   void print_range(T beg, T end) {     while (beg != end) cout << *beg++ <<    ;   }   struct reader {     template <typename T>     reader &operator,(T &v) {       cin >> v;       return *this;     }   } rdr;   struct debugger {     template <typename T>     debugger &operator,(const T &v) {       cerr << v <<  ,  ;       return *this;     }   } dbg;   int cnt[300];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     rdr, n;     ;     string s;     rdr, s;     ;     if (n > 26) {       cout << -1;       return 0;     }     int ans = 0;     for (char ch : s) {       if (cnt[ch] != 0) ++ans;       ++cnt[ch];     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   int main() {     int x, y, a, b;     cin >> x >> y >> a >> b;     int t = gcd(a, b);     a /= t;     b /= t;     x /= a;     y /= b;     cout << a * min(x, y) <<     << b * min(x, y);     cin >> a;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   long long inf = 1e18;   double eps = 1e-8;   double pi = acos(-1);   ifstream in( input.txt );   ofstream out( output.txt );   int main() {     int n;     cin >> n;     vector<int> a;     for (int i = 0; i < n; i++) {       int t;       cin >> t;       a.push_back(t);     }     sort(a.begin(), a.end());     for (int i = 0; i < n; i++) {       if (i + 1 != a[i]) {         cout << i + 1 << endl;         return 0;       }     }     cout << n + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> a, v, val;   long long int n, x;   long long int eval(long long int d, long long int i) {     if ((d + x - 1) <= a[i]) {       long long int ans = ((d + x - 1) * (d + x)) / 2 - ((d - 1) * (d)) / 2;       return ans;     } else {       long long int c = x - (a[i] - d + 1);       long long int l, r, mid, m, ans = 0;       l = i + 1;       r = 2 * n;       while (l <= r) {         mid = l + (r - l) / 2;         if ((v[mid] - v[i]) >= c) {           m = mid;           r = mid - 1;         } else           l = mid + 1;       }       ans += ((a[i]) * (a[i] + 1)) / 2 - ((d - 1) * (d)) / 2;       ans += val[m - 1] - val[i];       c -= v[m - 1] - v[i];       ans += c * (c + 1) / 2;       return ans;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int i, ans = 0, l, r, m1, m2, c, b;     cin >> n >> x;     a.resize(2 * n + 2);     v.resize(2 * n + 2);     val.resize(2 * n + 2);     for (i = 1; i <= n; i++) {       cin >> a[i];       a[i + n] = a[i];     }     for (i = 1; i <= 2 * n; i++) {       v[i] = v[i - 1] + a[i];       val[i] = val[i - 1] + (a[i] * (a[i] + 1)) / 2;     }     for (i = 1; i <= n; i++) {       l = 1;       r = a[i];       m1 = l;       while (l <= r) {         m1 = l + (r - l) / 3;         m2 = r - (r - l) / 3;         c = eval(m1, i);         b = eval(m2, i);         ans = max(ans, c);         ans = max(ans, b);         if (c >= b)           r = m2 - 1;         else           l = m1 + 1;       }       ans = max(ans, eval(m1, i));     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void maxi(T &x, T y) {     if (y > x) x = y;   }   template <class T>   inline void mini(T &x, T y) {     if (y < x) x = y;   }   const int N = 2e5, B = 0x7fffffff;   int t;   int main() {     scanf( %d , &t);     for (int tt = 1; tt <= t; tt++) {       long long x, y, p, q;       scanf( %lld %lld %lld %lld , &x, &y, &p, &q);       long long l = 0, r = 1000000000;       long long ans = -1;       while (l <= r) {         long long mid = (l + r) >> 1;         if (mid * p >= x && mid * q >= y) {           if ((mid * q) - y >= (mid * p) - x)             ans = mid, r = mid - 1;           else             l = mid + 1;         } else           l = mid + 1;       }       if (ans == -1)         puts( -1 );       else         printf( %lld n , (ans * q) - y);     }     return !!0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long test;     test = 1;     while (test--) {       long long n;       cin >> n;       long long a[n], b[n];       for (long long i = 0; i < n; i++) cin >> a[i];       for (long long i = 0; i < n; i++) cin >> b[i];       long long aalone = 0, balone = 0;       for (long long i = 0; i < n; i++) {         if (a[i] == 1 && b[i] == 0)           aalone++;         else if (a[i] == 0 && b[i] == 1)           balone++;       }       if (aalone == 0)         cout <<  -1 ;       else {         if ((balone + 1) % aalone == 0)           cout << (balone + 1) / aalone;         else {           cout << (balone + 1) / aalone + 1;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T1>   void deb(T1 e1) {     cout << e1 << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   const long long int mod = 10000000000007;   vector<pair<long long int, long long int> > adj1[1000005];   vector<pair<long long int, long long int> > adj2[1000005];   long long int come[1000005];   long long int bak[1000005];   long long int pre[1000005];   int main() {     int n, m, k;     scanf( %d %d %d , &n, &m, &k);     for (int i = 1; i <= m; i++) {       long long int u, v, d, c;       scanf( %lld %lld %lld %lld , &d, &u, &v, &c);       if (u == 0) {         adj2[d].push_back(make_pair(v, c));       } else {         adj1[d].push_back(make_pair(u, c));       }     }     for (int i = 1; i <= n; i++) {       pre[i] = mod;       come[0] += pre[i];     }     for (int i = 1; i < 1000005; i++) {       long long int now = come[i - 1];       for (int j = 0; j < adj1[i].size(); j++) {         int u = adj1[i][j].first;         long long int cost = adj1[i][j].second;         if (pre[u] > cost) {           now -= pre[u];           pre[u] = cost;           now += pre[u];         }       }       come[i] = now;     }     for (int i = 1; i <= n; i++) {       pre[i] = mod;       bak[1000005 - 1] += pre[i];     }     for (int i = 1000005 - 2; i >= 1; i--) {       long long int now = bak[i + 1];       for (int j = 0; j < adj2[i].size(); j++) {         int u = adj2[i][j].first;         long long int cost = adj2[i][j].second;         if (pre[u] > cost) {           now -= pre[u];           pre[u] = cost;           now += pre[u];         }       }       bak[i] = now;     }     long long int ans = mod * 100;     for (int i = 1; i + k < 1000005; i++) {       ans = min(ans, come[i - 1] + bak[i + k]);     }     if (ans >= mod) ans = -1;     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int a;     string type;     node() {}     node(int x, const char *s) {       a = x;       type = s;     }   };   map<string, node> h;   char str[100];   int main() {     int n;     scanf( %d , &n);     char a[100], b[100];     int x, y;     h[ void ] = node(0,  void );     for (int i = 1; i <= n; i++) {       scanf( %s , str);       if (strcmp(str,  typedef ) == 0) {         scanf( %s %s , a, b);         x = y = 0;         int j = 0;         while (a[j] ==  & ) j++, x++;         j = strlen(a) - 1;         while (a[j] ==  * ) j--, y++;         a[j + 1] = 0;         node tmp;         if (h.find(a + x) == h.end()) {           tmp = node(0,  errtype );         } else           tmp = h[a + x];         x -= y;         tmp.a += x;         if (tmp.a > 0) {           tmp.type =  errtype ;         }         h[b] = tmp;       } else {         scanf( %s , a);         x = y = 0;         int j = 0;         while (a[j] ==  & ) j++, x++;         j = strlen(a) - 1;         while (a[j] ==  * ) j--, y++;         a[j + 1] = 0;         node t;         if (h.find(a + x) == h.end()) {           t = node(0,  errtype );         } else           t = h[a + x];         x -= y;         t.a += x;         if (t.a > 0) {           cout <<  errtype  << endl;         } else {           cout << t.type;           if (t.type !=  errtype ) {             for (int i = 1; i <= -t.a; i++) putchar( * );           }           puts(  );         }       }     }     return 0;   }
#include <bits/stdc++.h>   int luckyDigits(long long int *a) {     int count1 = 0, dig;     while (*a != 0) {       dig = *a % 10;       if (dig == 4 || dig == 7) {         count1++;       }       *a = *a / 10;     }     return count1;   }   int main() {     long long int i, j, k, n, a, count = 0;     scanf( %lld%lld , &n, &k);     for (i = 0; i < n; i++) {       a = 0;       scanf( %lld , &a);       if (luckyDigits(&a) <= k) {         count++;       }     }     printf( %lld , count);   }
#include <bits/stdc++.h>   using namespace std;   static const int INF = 500000000;   template <class T>   void debug(T a, T b) {     for (; a != b; ++a) cerr << *a <<    ;     cerr << endl;   }   template <class T>   void chmin(T& a, const T& b) {     if (a > b) a = b;   }   template <class T>   void chmax(T& a, const T& b) {     if (a < b) a = b;   }   string s, t;   bool check() {     cin >> s;     t = s;     reverse((t).begin(), (t).end());     if (t != s) return false;     for (int i = 0; i < (s.size()); ++i) {       if (s[i] ==  A  || s[i] ==  H  || s[i] ==  I  || s[i] ==  M  ||           s[i] ==  O  || s[i] ==  T  || s[i] ==  U  || s[i] ==  V  ||           s[i] ==  W  || s[i] ==  X  || s[i] ==  Y )         ;       else         return false;     }     return true;   }   int main() {     if (check())       puts( YES );     else       puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[200010], s[200010], b[200010];     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       s[a[i]] = i;     }     int j = 0;     for (int i = 1; i <= n; i++) {       cin >> b[i];       int ans = s[b[i]] - j;       if (ans < 0)         ans = 0;       else         j = s[b[i]];       cout << ans <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m;     cin >> n >> m;     vector<string> v, l, b;     for (long long int i = 0; i < n; i++) {       string s;       cin >> s;       v.push_back(s);     }     long long int c = -1;     for (long long int i = 0; i < n; i++) {       for (long long int j = 0; j < m + 2; j++) {         if (v[i][j] ==  1 ) {           c = i;           break;         }       }       if (c != -1) break;     }     if (c == -1) {       cout << 0;       return 0;     }     for (long long int i = c; i < n; i++) {       l.push_back(v[i]);     }     n = n - c;     long long int f = n;     for (long long int i = n - 1; i >= 0; i--) {       for (long long int j = 0; j < m + 2; j++) {         if (l[i][j] ==  1 ) {           f = i;           break;         }       }       if (f != n) break;     }     if (f == n) {       cout << 0;       return 0;     }     for (long long int i = 0; i <= f; i++) {       b.push_back(l[i]);     }     long long int g = n;     n = f + 1;     long long int k = 0;     for (long long int i = m + 1; i >= 0; i--) {       if (b[n - 1][i] ==  1 ) {         k = i;         break;       }     }     if (n == 1) {       cout << k + g - 1 - f;     } else {       long long int a[n][m + 2];       memset(a, 0, sizeof(a));       a[n - 1][0] = 2 * k;       a[n - 1][m + 1] = m + 1;       a[n - 2][0] = 2 * k + 1;       a[n - 2][m + 1] = m + 2;       for (long long int i = n - 2; i > 0; i--) {         long long int x1 = 0;         long long int x2 = m + 1;         for (long long int j = m + 1; j >= 0; j--) {           if (b[i][j] ==  1 ) {             x1 = j;             break;           }         }         for (long long int j = 0; j <= (m + 1); j++) {           if (b[i][j] ==  1 ) {             x2 = j;             break;           }         }         a[i - 1][0] = 1 + min(m + 1 + a[i][m + 1], a[i][0] + 2 * x1);         a[i - 1][m + 1] =             1 + min(m + 1 + a[i][0], a[i][m + 1] + 2 * (m + 1 - x2));       }       long long int x1 = 0;       long long int x2 = m + 1;       for (long long int j = m + 1; j >= 0; j--) {         if (b[0][j] ==  1 ) {           x1 = j;           break;         }       }       for (long long int j = 0; j <= (m + 1); j++) {         if (b[0][j] ==  1 ) {           x2 = j;           break;         }       }       cout << min(a[0][0] + x1, a[0][m + 1] + m + 1 - x2) + g - 1 - f << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> m >> n;     vector<string> a(n);     for (int i = 0; i < n; i++) {       cin >> a[i];     }     string s =   ;     for (int i = 0; i < n; i++) s +=    ;     vector<string> ans(m, s);     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         ans[j][n - i - 1] = a[i][j];       }     swap(n, m);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m / 2; j++) {         swap(ans[i][j], ans[i][m - j - 1]);       }     }     string ss =   ;     for (int i = 0; i < 2 * m; i++) {       ss +=    ;     }     vector<string> ansx2(2 * n, ss);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         ansx2[2 * i][j] = ans[i][j];         ansx2[2 * i + 1][j] = ans[i][j];       }       for (int j = 0; j < m; j++) {         ansx2[2 * i][2 * j] = ans[i][j];         ansx2[2 * i][2 * j + 1] = ans[i][j];         ansx2[2 * i + 1][2 * j] = ans[i][j];         ansx2[2 * i + 1][2 * j + 1] = ans[i][j];       }     }     for (int i = 0; i < 2 * n; i++) {       for (int j = 0; j < 2 * m; j++) {         cout << ansx2[i][j];       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   typedef long long ll;   const int N = 1000;   const int MAX_WEIGHT = 20000;   const ll INF =10000000000000;      int n, m;   vector<int> b[2], a[2];   vector<int> suff[2];   map<int,bool> exist;      int get(int i, int j, int c) {     int result = 0;     int value = b[i][j] + c - 1;     int s = j, e = b[i].size() - 1, mid ,best = j;     while (s <= e) {       mid = s + e;       mid >>= 1;       if (b[i][mid] <= value) {         best = mid;         s = mid + 1;       } else {         e = mid - 1;       }     }     result = best - j + 1;     return result;   }      void solve() {     for (int i = 0 ; i < 2 ; i++) {       sort(a[i].begin(), a[i].end());       sort(b[i].begin(), b[i].end());       suff[i].clear();       suff[i].resize(a[i].size() + 1);     }        suff[0][a[0].size()] = suff[1][a[1].size()] = 0;        for (int j = 0 ; j < 2 ; j++)       for (int i = a[j].size() - 1 ; i >= 0 ; i--) {         suff[j][i] = suff[j][i + 1] + exist[(j == 0 ? 1 : -1) * a[j][i]];       }     int answer = 0;     for (int i = 0 ; i < 2 ; i++) {       if (a[i].size() == 0)         continue;       int last_moved = 0;       int mx = 0;       int num_moved = 1;       for (int j = 0 ; j < (int) b[i].size() ; j++) {         if (b[i][j] < a[i][0])           continue;         while (last_moved != (int) a[i].size() && a[i][last_moved] < b[i][j] + num_moved)           last_moved++, num_moved++;         num_moved--;         last_moved--;         mx = max(mx, suff[i][last_moved + 1] + get(i, j, num_moved));       }       answer += mx;     }     cout << answer << endl;      }      void read() {     cin >> n>> m;     a[0].clear();     b[0].clear();     a[1].clear();     b[1].clear();     exist.clear();     for (int i = 0, a ; i < n ; i++) {       scanf( %d , &a);       ::a[a < 0].push_back(a * (a < 0 ? -1 : 1));     }     for (int i = 0, b ; i < m ; i++) {       scanf( %d , &b);       exist[b] = true;       ::b[b < 0].push_back(b * (b < 0 ? -1 : 1));     }   }      signed main() {     int t = 1;     cin >> t;     while (t--) {       read();       solve();     }        return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 55;   int n;   int xi[maxn], yi[maxn];   int ans1 = 0, ans2 = 0;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &xi[i]), ans1 += xi[i];     for (int i = 1; i <= n; i++) scanf( %d , &yi[i]), ans2 += yi[i];     if (ans1 < ans2)       printf( No n );     else       printf( Yes n );     return 0;   }
#include <bits/stdc++.h>   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unroll-loops )   using namespace std;   template <class T1, class T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  {  << p.first <<  ,  << p.second <<  } ;     return os;   }   const int N = 3e5 + 5;   const int oo = 1e9 + 7;   int a[N];   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     int tot1 = 0;     for (int i = 1; i <= n; i++) {       cin >> a[i];       tot1 += a[i];     }     bool res = a[1];     for (int i = 2; i <= n; i++) {       res = !res or a[i];     }     if (res == 0) {       cout <<  YES n  << a[1];       for (int i = 2; i <= n; i++) cout <<  ->  << a[i];       cout <<   n ;     } else if (a[n] == 1 or n <= 2 or (a[n - 2] == 1 and tot1 == n - 2)) {       cout <<  NO n ;     } else if (a[n - 2] == 0) {       cout <<  YES n  << a[1];       for (int i = 2; i <= n - 3; i++) cout <<  ->  << a[i];       cout <<  ->(  << a[n - 2] <<  ->  << a[n - 1] <<  )->  << a[n] <<   n ;     } else {       int zero = -1;       for (int i = n - 3; i >= 1; i--)         if (a[i] == 0) {           zero = i;           break;         }       assert(zero != -1);       cout <<  YES n ;       if (zero > 1) {         cout << a[1];         for (int i = 2; i < zero; i++) {           cout <<  ->  << a[i];         }         cout <<  -> ;       }       cout <<  (  << a[zero] <<  ->((  << a[zero + 1];       for (int i = zero + 2; i <= n - 2; i++) cout <<  ->  << a[i];       cout <<  )->  << a[n - 1] <<  ))->  << a[n] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 502;   vector<int> adj[maxn];   bool vis[maxn];   bool fin[maxn];   vector<pair<int, int> > edgesInCycle;   int n;   bool dfs(int node) {     vis[node] = 1;     for (int ch : adj[node]) {       edgesInCycle.push_back({node, ch});       if (!vis[ch]) {         if (dfs(ch)) return 1;       } else if (!fin[ch])         return 1;       edgesInCycle.pop_back();     }     fin[node] = 1;     return 0;   }   bool checkDag() {     memset(vis, 0, sizeof(vis));     memset(fin, 0, sizeof(fin));     for (int i = 1; i <= n; ++i) {       if (!vis[i] && dfs(i)) return 0;     }     return 1;   }   bool solve() {     if (checkDag()) return 1;     vector<pair<int, int> > edges = edgesInCycle;     for (pair<int, int> edge : edges) {       int u = edge.first;       int v = edge.second;       auto it = find(adj[u].begin(), adj[u].end(), v);       assert(it != adj[u].end());       adj[u].erase(it);       if (checkDag()) return 1;       adj[u].push_back(v);     }     return 0;   }   int main() {     int m;     cin >> n >> m;     int u, v;     for (int i = 0; i < m; ++i) {       cin >> u >> v;       adj[u].push_back(v);     }     cout << (solve() ?  YES n  :  NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t;     cin >> n >> t;     if (n == 1 && t == 10) {       cout <<  -1  << endl;       return 0;     }     cout << ((t == 10) ? 1 : t);     while (n-- > 1) {       cout <<  0 ;     }     return 0;   }
#include <iostream>   #include <algorithm>   #include <cstdio>   #include <vector>   #include <stack>   #include <string>   #include <cstring>   #include <queue>   #include <map>   #include <set>   #include <cmath>   #include <climits>   #include <functional>      typedef long long ll;      using namespace std;      int main()   {   #ifdef ONLINE_JUDGE   #else       freopen( in1.txt ,  r , stdin);       // freopen( w.txt ,  w , stdout);   #endif       // ios::sync_with_stdio(false);              ll T, d, k;       for (cin >> T; T--;) {           cin >> d >> k;              ll cnt = 0;           while ((cnt * k) * (cnt * k) * 2 <= d * d) {               ++cnt;           }           --cnt;                      ll res = (cnt * k) * (cnt * k) + (cnt * k + k) * (cnt * k + k);              cout << (res <= d * d ?  Ashish  :  Utkarsh ) << endl;          }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     static char data[100015];     static int a[100015];     static int b[100015];     memset(a, 0, sizeof(a));     memset(b, 0, sizeof(b));     int i, j, N, len;     N = 0;     scanf( %s n , data);     len = strlen(data);     if (len > N) N = len;     for (i = 0; i < len; i++) {       a[len - i - 1] = (int)(data[i] -  0 );     }     scanf( %s , data);     len = strlen(data);     if (len > N) N = len;     for (i = 0; i < len; i++) {       b[len - i - 1] = (int)(data[i] -  0 );     }     N += 5;     for (i = N; i >= 0; i--) {       j = i;       while ((a[j]) && (a[j + 1])) {         a[j] = 0;         a[j + 1] = 0;         a[j + 2] = 1;         j += 2;       }       j = i;       while ((b[j]) && (b[j + 1])) {         b[j] = 0;         b[j + 1] = 0;         b[j + 2] = 1;         j += 2;       }     }     i = N;     while ((i >= 0) && (a[i] == b[i])) i--;     if (i < 0)       printf( = );     else if (a[i] > b[i])       printf( > );     else       printf( < );     printf(  n );     return 0;   }