malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e7 + 100;   const int INF = 0x3FFFFFFF;   bool vis[MAXN];   int main() {     long long a, b, m;     cin >> a >> b >> m;     for (int i = 1; i <= a; i++) {       long long t = 1e9;       long long mod = i * t % m;       if (vis[mod]) break;       vis[mod] = 1;       if (b + mod < m && mod) {         cout <<  1  ;         int cnt = 0;         int temp = i;         while (i) {           i /= 10;           cnt++;         }         for (int j = 1; j <= 9 - cnt; j++) cout << 0;         cout << temp << endl;         return 0;       }     }     cout << 2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 710, size = 1 << 20, mod = (int)1e9 + 7, inf = 2e9;   const long long INF = 1e15;   template <class o>   void qr(o& x) {     char c = getchar();     x = 0;     int f = 1;     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) x = x * 10 + c -  0 , c = getchar();     x *= f;   }   template <class o, class... O>   void qr(o& x, O&... y) {     qr(x);     qr(y...);   }   template <class o>   void qw(o x) {     if (x / 10) qw(x / 10);     putchar(x % 10 +  0 );   }   template <class o>   void pr1(o x) {     if (x < 0) x = -x, putchar( - );     qw(x);     putchar(   );   }   template <class o, class... O>   void pr1(o x, O... y) {     pr1(x);     pr1(y...);   }   template <class o>   void pr2(o x) {     if (x < 0) x = -x, putchar( - );     qw(x);     putchar(  n );   }   template <class o, class... O>   void pr2(o x, O... y) {     pr2(x);     pr2(y...);   }   long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   long long power(long long a, long long b = mod - 2, long long p = mod) {     long long c = 1;     while (b) {       if (b & 1) c = c * a % p;       b /= 2;       a = a * a % p;     }     return c;   }   long long exgcd(long long a, long long b, long long& x, long long& y) {     if (!a) {       x = 0;       y = 1;       return b;     }     long long d = exgcd(b % a, a, y, x);     x -= b / a * y;     return d;   }   long long INV(long long n, long long p = mod) {     long long x, y;     exgcd(n, p, x, y);     return (x % p + p) % p;   }   template <class o>   void cmax(o& x, o y) {     if (x < y) x = y;   }   template <class o>   void cmin(o& x, o y) {     if (x > y) x = y;   }   template <typename t1, typename t2>   void ad(t1& x, t2 y) {     x += y;     if (x >= mod) x -= mod;   }   template <typename t1, typename t2>   void dl(t1& x, t2 y) {     x -= y;     if (x < 0) x += mod;   }   char str[N];   int n, a[N], cnt[10], f[N][N][10][2];   void solve() {     scanf( %s , str + 1);     int n = strlen(str + 1);     for (int i = 1; i <= n; i++) a[i] = str[i] -  0 ;     for (int i = 1; i <= 9; i++) f[0][0][i][0] = 1;     for (int i = 0; i <= n - 1; i++)       for (int j = 0; j <= i; j++)         for (int k = 1; k <= 9; k++)           for (int l = 0; l <= 1; l++)             if (f[i][j][k][l])               for (int v = !l ? a[i + 1] : 9; v >= 0; v--)                 ad(f[i + 1][j + (v >= k)][k][l | (v < a[i + 1])], f[i][j][k][l]);     long long p = 1, ans = 0;     for (int i = 1; i <= n; i++) {       long long sum = 0;       for (int j = 1; j <= 9; j++) sum += f[n][i][j][0] + f[n][i][j][1];       sum %= mod;       ans = (ans + sum * p) % mod;       p = (p * 10 + 1) % mod;     }     pr2(ans);   }   int main() {     int T = 1;     while (T--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005], ans[100005], ti[100005], app[100005], t, n;   int cnt(int k) {     int ret = 1, count = 0;     ++t;     for (int i = 1; i <= n; i++) {       if (ti[a[i]] != t) {         ti[a[i]] = t;         app[a[i]] = false;       }       if (!app[a[i]]) {         if (count == k) {           count = 0;           ret++;           ti[a[i]] = ++t;         }         count++;       }       app[a[i]] = true;     }     return ret;   }   void solve(int l, int r, int lo, int hi) {     if (l > r) return;     int mid = (l + r) / 2;     int res = lo == hi ? lo : cnt(mid);     ans[mid] = res;     solve(l, mid - 1, res, hi);     solve(mid + 1, r, lo, res);   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     solve(1, n, 1, n);     for (int i = 1; i <= n; i++) {       if (i > 1) printf(   );       printf( %d , ans[i]);     }     cout << endl;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   inline void read(long long &x) {     x = 0;     long long f = 1;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s >=  0  && s <=  9 ) {       x = (x << 3) + (x << 1) + (s ^ 48);       s = getchar();     }     x *= f;   }   inline long long Max(long long x, long long y) { return x > y ? x : y; }   inline long long Min(long long x, long long y) { return x < y ? x : y; }   long long Gcd(long long a, long long b) {     if (!b) return a;     return Gcd(b, a % b);   }   inline long long Abs(long long x) {     if (x < 0) return -x;     return x;   }   inline double Fabs(double x) {     if (x > 0) return x;     return -x;   }   long long a[100005];   int main() {     long long n;     read(n);     long long XiangMeiHaoGuai = 1;     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     for (register int i = 1; i <= n; ++i) read(a[i]);     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     sort(a + 1, a + 1 + n);     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     long long FuckingAns = a[2] - a[1];     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     for (register int i = 3; i <= n; ++i)       FuckingAns = Gcd(FuckingAns, a[i] - a[i - 1]);     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     long long FuckingDis = a[n] - a[1], Sucky = 1 - n;     printf( %lld , FuckingDis / FuckingAns + Sucky);     if (XiangMeiHaoGuai + 1 == 3) printf( SXYYouYiGeQiaoPiGu );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     string s[4];     for (int i = 0; i < 4; i++) cin >> s[i];     int x = 0;     for (int i = 0; i < 3; i++) {       for (int j = 0; j < 3; j++) {         x = s[i][j] ==  # ;         x += s[i + 1][j] ==  # ;         x += s[i][j + 1] ==  # ;         x += s[i + 1][j + 1] ==  # ;         if (x != 2) return cout <<  YES , 0;       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, S;     cin >> n >> S;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     long long z = LLONG_MAX;     sort(a.begin(), a.end());     long long fh = 0, sh = 0;     for (int i = 0; i < n / 2; i++) {       if (a[i] > S) fh += a[i] - S;       if (a[n - 1 - i] < S) sh += S - a[n - 1 - i];     }     cout << fh + sh + abs(a[n / 2] - S);     return 0;   }
/*    problem : CF1466I The Riddle of the Sphinx    reference : https://www.luogu.com.cn/blog/CXY07/solution-cf1466i   */   #include <bits/stdc++.h>   #define mp std::make_pair   #define pb push_back   #define fi first   #define se second   #define gc getchar   #define pc putchar   #define ep emplace   #define eb emplace_back   #define ctz __builtin_ctz   typedef unsigned char u8;   typedef unsigned short u16;   typedef unsigned int u32;   typedef long long ll;   typedef long double ld;   typedef unsigned long long ull;   typedef std::pair <int, int> pii;   typedef std::pair <int, ll> pil;   typedef std::pair <ll, int> pli;   typedef std::pair <ll, ll> pll;   const int max_N = 207;   int n, b;   std::string ans;   int read() {    char c = gc(); int ans = 0; bool flag = true;    while (!isdigit(c)) flag &= (c !=  - ), c = gc();    while (isdigit(c)) ans = ans * 10 + c -  0 , c = gc();    return flag ? ans : -ans;   }   void Write(int x) {    if (x < 0) pc( - ), x = -x;    if (x < 10) pc(x +  0 );    else Write(x / 10), pc(x % 10 +  0 );   }   int min(int x, int y) {return x < y ? x : y;}   int max(int x, int y) {return x > y ? x : y;}   void _min(int &x, int y) {if (x > y) x = y;}   void _max(int &x, int y) {if (x < y) x = y;}   namespace Interactive {    bool compare(int x, std::string y) {     std::cout << x <<     << y << std::endl;     return std::cin >> y, y ==  yes ;    }    bool compare_less(int x, std::string y) {     if (!std::count(y.begin(), y.end(),  1 )) return false;     for (int pos = y.size() - 1; y[pos] ==  0  ? (y[pos] =  1 , true) : (y[pos] =  0 , false); pos--);      return y.insert(y.end(), b - y.size(),  1 ), !compare(x, y);    }    bool compare_greater(int x, std::string y) {     if (!std::count(y.begin(), y.end(),  0 )) return false;     return y.insert(y.end(), b - y.size(),  1 ), compare(x, y);    }    void report(std::string x) {     std::cout << 0 <<     << x << std::endl;    }   }   void solve(std::vector <int> vec, int w) {    std::vector <int> stack;    for (auto i : vec) {     while (!stack.empty() && Interactive::compare_greater(i,      (std::string) {ans.begin(), ans.begin() + w + stack.size()})) stack.pop_back();     if (w + stack.size() < b)      ans[w + stack.size()] = !Interactive::compare_less(i,       (std::string) {ans.begin(), ans.begin() + w + stack.size()} +  1 ) +  0 , stack.pb(i);    }    for (int i = stack.size() - 1; i >= 0; i--)     if (Interactive::compare_greater(stack[i],      (std::string) {ans.begin(), ans.begin() + w + stack.size()})) stack.resize(i + 1);    if (w + stack.size() < b) solve(stack, w + stack.size());   }   int main() {    std::cin >> n >> b;    std::vector <int> vec; vec.resize(n);    std::iota(vec.begin(), vec.end(), 1);    ans.resize(b); solve(vec, 0);    return Interactive::report(ans), 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 3e5 + 30;   long long N, M, T, X[maxn], ans[maxn], shift;   char W[maxn];   vector<pair<long long, long long> > v;   vector<long long> last;   int main() {     cin >> N >> M >> T;     for (long long i = 1; i <= N; i++) {       scanf( %lld %c , &X[i], &W[i]);       v.push_back(pair<long long, long long>(X[i], i));       W[i] = W[i] ==  L  ? -1 : 1;     }     for (long long i = 1; i <= N; i++) {       long long a = (X[i] + T * W[i]), plus = 0;       if (W[i] == -1) {         a = a <= 0 ? (-a) / M + 1 : 0;       } else         plus = -(!(a % M)), a /= M;       shift += W[i] * a + plus;     }     T %= M;     for (long long i = 1; i <= N; i++) {       long long a = X[i] + T * W[i] + M;       a = (a - 1) % M + 1;       last.push_back(a);     }     sort(v.begin(), v.end());     sort(last.begin(), last.end());     if (shift) shift = shift / abs(shift) * (abs(shift) % N);     long long beg = ((-shift + N + 1) - 1) % N + 1;     long long j = 0;     for (long long i = beg - 1; i < N; i++) ans[v[i].second] = last[j++];     for (long long i = 0; i < beg - 1; i++) ans[v[i].second] = last[j++];     for (long long i = 1; i <= N; i++) printf( %lld  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<double, pair<int, int> > > s;   int n, x;   pair<double, pair<int, int> > tmp;   signed main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n;     for (register int i = 1; (1 < n) ? (i <= n) : (i >= n);          i += (1 < n) ? 1 : (-1)) {       cin >> x;       s.push_back(make_pair(x, make_pair(i, i)));       while (s.size() > 1 && s[s.size() - 2] > s.back()) {         tmp = s.back();         s.pop_back();         tmp = make_pair((tmp.first * (tmp.second.second - tmp.second.first + 1) +                          s.back().first * (s.back().second.second -                                            s.back().second.first + 1)) /                             (tmp.second.second - s.back().second.first + 1),                         make_pair(s.back().second.first, tmp.second.second));         s.pop_back();         s.push_back(tmp);       }     }     for (auto i : s) {       for (register int j = 1; (1 < i.second.second - i.second.first + 1)                                    ? (j <= i.second.second - i.second.first + 1)                                    : (j >= i.second.second - i.second.first + 1);            j += (1 < i.second.second - i.second.first + 1) ? 1 : (-1)) {         printf( %.9lf n , i.first);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long X[(int)1e5 + 9];   long long C[(int)1e5 + 9];   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);     long long n, k, a, c, cost;     cin >> n >> k;     for (int i = 1; i <= n; i++) {       cin >> X[i];     }     cin >> a;     for (int i = 1; i <= n; i++) {       cin >> C[i];     }     c = k;     priority_queue<long long, vector<long long>, greater<long long> > Q;     cost = 0;     bool ans_ase = true;     for (int i = 1; i <= n; i++) {       Q.push(C[i]);       if (c < X[i]) {         if (Q.size() * a + c >= X[i]) {           while (c < X[i]) {             c += a;             cost += Q.top();             Q.pop();           }         } else {           ans_ase = 0;           break;         }       }     }     if (ans_ase)       cout << cost <<   n ;     else       cout << -1 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000009;   vector<long long> vec;   long long powmod(long long a, long long m) {     long long ret = 1 % MOD;     for (; m; m >>= 1) {       if (m & 1) {         ret *= a;         if (ret >= MOD) ret %= MOD;       }       a *= a;       if (a >= MOD) a %= MOD;     }     return ret;   }   int main() {     long long n, m, k;     vec.clear();     cin >> n >> m >> k;     m = n - m;     if (m >= n) {       cout <<  0  << endl;       return 0;     }     long long p = (long long)(n / k);     if (m >= p) {       cout << n - m << endl;       return 0;     }     long long pos = n - m * k;     long long div = pos / k;     long long mod = pos % k;     long long mul = (powmod(2, div) - 1) * k % MOD * 2 % MOD;     mul = (mul + MOD) % MOD;     mul = (mul + mod) % MOD;     long long ans = (mul + n - pos - m) % MOD;     ans = (ans + MOD) % MOD;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int d[100008] = {0};     int n = 0, f = 0;     cin >> n;     for (f = 0; f < n; f++) cin >> d[f];     sort(d, d + n);     if (d[n - 1] >= d[n - 2] + d[n - 3])       cout <<  NO ;     else {       cout <<  YES n ;       for (f = n - 1; f >= 0; f -= 2) cout << d[f] <<    ;       f = n % 2;       for (; f < n; f += 2) {         cout << d[f];         if (f != n - 2) cout <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 7;   const int inf = INT_MAX;   const long long inff = 1e18;   const long long mod = 1e9 + 7;   int p[30];   int n;   string s;   int used[40];   int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); }   void Union(int x, int y) { p[Find(x)] = Find(y); }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     for (int i = 1; i <= 26; i++) p[i] = i;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> s;       int N = s.length();       for (int i = 0; i < N; i++) {         used[s[i] -  a  + 1]++;       }       for (int i = 0; i < N - 1; i++) {         Union(s[i] -  a  + 1, s[i + 1] -  a  + 1);       }     }     set<int> second;     for (int i = 1; i <= 26; i++) {       if (used[i]) {         second.insert(Find(i));       }     }     cout << ((int)(second).size()) <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int dr8[] = {0, 0, 1, -1, 1, 1, -1, -1};   int dc8[] = {1, -1, 0, 0, -1, 1, -1, 1};   int dr4[] = {0, 1, -1, 0};   int dc4[] = {1, 0, 0, -1};   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     int on = 1023;     cin >> n;     int z = 0;     string s;     for (int i = 0; i < n; i++) {       cin >> s;       int w;       cin >> w;       if (s[0] ==  | ) {         z = z | w;         on = on | w;       } else if (s[0] ==  ^ ) {         z = z ^ w;         on = on ^ w;       } else {         z = z & w;         on = on & w;       }     }     int a[10];     int x1 = 0, x2 = 1023, x3 = 0;     for (int i = 0; i < 10; i++) {       if (z % 2 == on % 2 && on % 2 == 1) {         a[i] = 1;         x1 = x1 ^ (1 << i);       } else if (z % 2 == on % 2 && on % 2 == 0) {         a[i] = 0;         x2 = x2 ^ (1 << i);       } else if (z % 2 == 1 && on % 2 == 0)         x3 = x3 ^ (1 << i);       z = z / 2;       on = on / 2;     }     cout << 3 << endl;     cout <<  |   << x1 << endl;     cout <<  &   << x2 << endl;     cout <<  ^   << x3 << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > ad(123456);   vector<int> vis(123456, 0), par(123456, -1), hc(123456, 0), hp(123456, 0),       v(123456, 0);   void dfs(int s) {     int i, a, x = ad[s].size(), y = 0;     for (i = 0; i < x; i++) {       a = ad[s][i];       if (vis[a] == 0) par[a] = s, vis[a] = 1, dfs(a);     }     for (i = 0; i < x; i++) {       a = ad[s][i];       if (par[a] == s) {         if (v[a] == 1 || hc[a] > 0) y = max(y, 1 + hc[a]);       }     }     hc[s] = y;     return;   }   void fun(int s) {     int x = ad[s].size(), y = -1, i, a, as, k, ind;     for (i = 0; i < x; i++) {       a = ad[s][i];       if (vis[a] == 0) {         if (hc[a] > y && (hc[a] > 0 || v[a] == 1))           y = hc[a], k = 1, ind = a;         else if ((hc[a] == y && y > 0) || (y == 0 && v[a] == 1))           k++;       }     }     if (y == -1) {       if (hp[s] > 0 || v[s] == 1)         as = hp[s] + 1;       else if (hp[s] == 0)         as = 0;     } else if (y >= 0)       as = max(1 + hp[s], y + 2);     if (as > 0) {       for (i = 0; i < x; i++) {         a = ad[s][i];         if (vis[a] == 0) hp[a] = as;       }     }     if (y >= 0 && k == 1) {       y = -1;       for (i = 0; i < x; i++) {         a = ad[s][i];         if (vis[a] == 0 && a != ind && (hc[a] > 0 || v[a] == 1))           y = max(hc[a], y);       }       if (y == -1) {         if (hp[s] > 0 || v[s] == 1)           hp[ind] = hp[s] + 1;         else if (hp[s] == 0)           hp[ind] = 0;       } else if (y >= 0)         hp[ind] = max(y + 2, hp[s] + 1);     }     for (i = 0; i < x; i++) {       a = ad[s][i];       if (vis[a] == 0) vis[a] = 1, fun(a);     }     return;   }   int trv(int s) {     int x = ad[s].size(), i, y = 0, z, a;     for (i = 0; i < x; i++) {       a = ad[s][i];       if (vis[a] == 0) {         vis[a] = 1, z = trv(a);         if (z > 0 || v[a] == 1) y += (2 + z);       }     }     return y;   }   int main() {     int x, y, n, m, i;     scanf( %d , &n), scanf( %d , &m);     for (i = 1; i < n; i++) {       scanf( %d , &x), scanf( %d , &y);       x--, y--, ad[x].push_back(y), ad[y].push_back(x);     }     for (i = 0; i < m; i++) scanf( %d , &x), x--, v[x] = 1;     vis[0] = 1;     dfs(0);     for (i = 1; i < n; i++) vis[i] = 0;     fun(0);     x = -1, y = -1;     for (i = 0; i < n; i++) {       m = max(hc[i], hp[i]);       if (m > y && v[i]) y = m, x = i;     }     for (i = 0; i < n; i++) vis[i] = 0;     vis[x] = 1;     m = trv(x);     printf( %d n%d n , x + 1, m - y);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 100, M = 52 + 10, LG = 30, base = 2;   const int MOD = 1e9 + 7, mod = 1e9 + 9;   const long long INF = 1e9, inf = 1e18;   long long p, q, m, k;   string w, s, t;   vector<long long> a, b;   vector<long long> ans;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     ;     cin >> w >> s >> t;     while (p = w.find(s, p) + 1) a.push_back(p);     while (q = w.find(t, q) + 1) b.push_back(q);     for (int i = 0; i < a.size(); i++) {       m = 0, k = 0;       for (int j = a[i]; j <= w.size(); j++) {         while (k < b.size() && b[k] < j) k++;         if (k < b.size() && b[k] == j && j + t.size() >= a[i] + s.size())           ans.push_back(m);         m = m * mod + (w[j - 1] -  a  + 1);       }     }     sort(ans.begin(), ans.end());     cout << unique(ans.begin(), ans.end()) - ans.begin();     return 0;   }
#include<bits/stdc++.h>   #define ll long long   #define pll pair<ll,ll>   #define pii pair<int,int>   #define rep(i,a,b) for(int i=a;i<=b;++i)   #define per(i,a,b) for(int i=a;i>=b;--i)   #define mem0(x) memset(x,0,sizeof(x))   #define meminf(x) memset(x,0x3f,sizeof(x))   #define VI vector<int>   #define VL vector<ll>   #define pb push_back   #define YES(n) cout << ((n) ?  YES  :  NO   ) << endl   #define Yes(n) cout << ((n) ?  Yes  :  No   ) << endl   #define endl   n    #define pb push_back   #define fi first    #define se second      #define dump(x)  cerr << #x <<   =   << (x) << endl;   #define debug(x) cerr << #x <<   =   << (x) <<   (L  << __LINE__ <<  )  <<     << __FILE__ << endl;   //#define DEBUG   using namespace  std;         const int N = 150+5, inf = 0x3f3f3f3f;      int n,k;   ll a[N],b[N],tmm[N];      void solve(){       cin>>n;       rep(i,1,n){        cin>>a[i]>>b[i];       }       rep(i,1,n){        cin>>tmm[i];       }              ll tim = 0;          rep(i,1,n){        tim += a[i]-b[i-1]+tmm[i];        if(n == i) break;        ll lim = max(b[i]-tim, (b[i]-a[i]+1)/2);        tim += lim;       }       cout << tim <<endl;          }         int main(){       ios::sync_with_stdio(0);       int tt;cin>>tt;       while(tt--){           solve();       }   }
#include <bits/stdc++.h>   using namespace std;   void ch_max(int &x, int y) {     if (x < y) x = y;   }   void ch_min(int &x, int y) {     if (x > y) x = y;   }   const double pi = acos(-1.0);   const double eps = 1e-9;   bool solve(long long a, long long b) {     if (a == 0 || b == 0) return false;     if (a < b) swap(a, b);     if (a % b == 0) return true;     if (!solve(a % b, b)) return true;     long long t0 = a / b;     long long t1 = t0 % (b + 1);     if (t1 % 2) return false;     return true;   }   int main() {     int i, j, k, t, nc = 0;     scanf( %d , &t);     while (t--) {       long long a, b;       scanf( %I64d%I64d , &a, &b);       if (solve(a, b))         printf( First n );       else         printf( Second n );     }     return 0;   }