malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t, i, oo = 0, oz = 0, zo = 0, zz = 0;     char s1[2000005], s2[2000005];     cin >> t;     cin >> s1;     cin >> s2;     t = 2 * t;     for (i = 0; i < t; i++) {       if (s1[i] ==  1  && s2[i] ==  1 )         oo++;       else if (s1[i] ==  1  && s2[i] ==  0 )         oz++;       else if (s1[i] ==  0  && s2[i] ==  1 )         zo++;       else         zz++;     }     if (oo % 2 == 0) {       if (oz > zo)         cout <<  First ;       else if (oz + 1 == zo || oz == zo)         cout <<  Draw ;       else         cout <<  Second ;     } else {       if (oz >= zo)         cout <<  First ;       else if (oz + 1 == zo || oz + 2 == zo)         cout <<  Draw ;       else         cout <<  Second ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, l, r, q;   map<pair<int, int>, int> vi;   int V[100005 << 2], ly[100005 << 2];   void push_down(int o) {     if (ly[o]) {       ly[o << 1] |= ly[o];       ly[o << 1 | 1] |= ly[o];       V[o << 1] |= ly[o];       V[o << 1 | 1] |= ly[o];       ly[o] = 0;     }   }   void push_up(int o) { V[o] = V[o << 1] & V[o << 1 | 1]; }   void ud(int o, int l, int r, int L, int R, int x) {     int mid = (l + r) / 2;     if (L <= l && r <= R) {       V[o] |= x;       ly[o] |= x;       return;     }     push_down(o);     if (L <= mid) ud(o << 1, l, mid, L, R, x);     if (R > mid) ud(o << 1 | 1, mid + 1, r, L, R, x);     push_up(o);   }   int qy(int o, int l, int r, int L, int R) {     int mid = (l + r) / 2;     if (L <= l && r <= R) return V[o];     push_down(o);     int ans = (1 << 30) - 1;     if (L <= mid) ans &= qy(o << 1, l, mid, L, R);     if (R > mid) ans &= qy(o << 1 | 1, mid + 1, r, L, R);     push_up(o);     return ans;   }   int main() {     cin >> n >> m;     int ok = 1;     for (int i = 0; i < m; i++) {       scanf( %d%d%d , &l, &r, &q);       int tp = qy(1, 1, n, l, r);       if (vi[make_pair(l, r)]) {         if (tp != q) {           ok = 0;         }       }       if (!ok) continue;       vi[make_pair(l, r)] = 1;       if ((tp & q) == tp)         ud(1, 1, n, l, r, q);       else         ok = 0;     }     if (!ok) {       puts( NO );       return 0;     }     printf( YES n );     for (int i = 1; i <= n; i++) printf( %d  , qy(1, 1, n, i, i));   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   int main() {     list<int> a;     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int x;       scanf( %d , &x);       a.push_back(x);     }     for (auto t = a.begin(); t != a.end(); t++) {       auto s = t;       s--;       if (t == a.begin()) continue;       while (true) {         if (*t == *s) {           *t = *t + 1;           t = a.erase(s);           if (t == a.begin()) break;           s = t, s--;         } else           break;       }     }     printf( %d n , a.size());     for (auto t : a) printf( %d  , t);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int dp[800][800][10];   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       dp[x][y][1]++;       dp[y][x][1]++;     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (i != j)           for (int q = 1; q <= n; q++)             if (q != i && q != j) {               dp[i][j][2] += dp[i][q][1] * dp[j][q][1];             }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (i != j) {           for (int q = 1; q <= n; q++)             if (q != i && q != j) {               dp[i][j][3] += dp[i][q][2] * dp[j][q][1] +                              dp[i][q][1] * dp[j][q][2] -                              dp[i][j][1] * dp[i][q][1] * dp[i][q][1] -                              dp[i][j][1] * dp[j][q][1] * dp[j][q][1];             }           dp[i][j][3] /= 2;         }     long long sum = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (i != j && dp[i][j][3] != 0 && dp[i][j][2] != 0) {           for (int q = 1; q <= n; q++)             if (q != i && q != j && dp[i][q][1] != 0 && dp[j][q][1] != 0) {               sum += dp[i][j][3];               sum -= dp[j][q][2] - dp[i][j][1] + dp[i][q][2] - dp[i][j][1];             }         }     printf( %lld , sum / 10);     return 0;   }
#include <bits/stdc++.h>   const bool debug = false;   int triple[1 << 12][3];   int use[1 << 12];   int cost[1 << 12];   std::vector<int> gen_masks(int L) {     std::vector<int> masks;     masks.push_back(0);     for (int i = 0; i < L; i++) {       for (int j = 1; j < L; j++) {         if (i + j * 2 >= L) continue;         masks.push_back((1 << i) | (1 << (i + j)) | (1 << (i + 2 * j)));       }     }     return masks;   }   int as[100005];   int main() {     std::vector<int> masks = gen_masks(12);     for (int u : masks) {       for (int v : masks) {         for (int w : masks) {           int res = (u ^ v ^ w) & ((1 << 9) - 1);           triple[res][0] = u;           triple[res][1] = v;           triple[res][2] = w;         }       }     }     std::vector<std::array<int, 3> > moves;     int NN;     scanf( %d , &NN);     int N = NN;     for (int i = 1; i <= N; i++) {       scanf( %d , &as[i]);     }     while (N >= 12) {       int M = 0;       for (int i = 0; i < 9; i++) {         M |= (as[N - i] << i);       }       for (int t = 0; t < 3; t++) {         std::array<int, 3> move;         int index = 0;         for (int i = 0; i < 12; i++) {           if (triple[M][t] & (1 << i)) {             as[N - i] ^= 1;             move[index++] = N - i;           }         }         if (index) {           assert(index == 3);           moves.push_back(move);         }       }       N -= 9;     }     N = std::min(NN, 12);     masks = gen_masks(N);     for (int i = 1; i < (1 << N); i++) {       cost[i] = 1e9;     }     for (int mask : masks) {       for (int i = 0; i < (1 << N); i++) {         if (cost[i ^ mask] > cost[i] + 1) {           cost[i ^ mask] = cost[i] + 1;           use[i ^ mask] = mask;         }       }     }     if (debug) {       int worst = 0;       for (int i = 0; i < (1 << N); i++) {         if (cost[i] < 1e9) worst = std::max(worst, cost[i]);         printf( %d:  , i);         for (int k = 0; k < N; k++) {           printf( %d , (use[i] >> k) & 1);         }         printf(  n );       }       printf( WORST: %d n , worst);     }     while (true) {       int M = 0;       for (int i = 0; i < N; i++) {         M |= (as[N - i] << i);       }       if (M == 0) break;       std::array<int, 3> move;       int index = 0;       for (int i = 0; i < 12; i++) {         if (use[M] & (1 << i)) {           as[N - i] ^= 1;           move[index++] = N - i;         }       }       if (index == 0) {         printf( NO n );         return 0;       }       assert(index == 3);       moves.push_back(move);     }     for (int i = 0; i < N; i++) {       assert(as[i] == 0);     }     printf( YES n );     printf( %d n , (int)moves.size());     for (auto move : moves) {       printf( %d %d %d n , move[0], move[1], move[2]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, a[100010], b[100010], c[100010];   void nhap() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &c[i]);     int dem = 1;     a[1] = c[1];     for (int i = 2; i <= n; i++)       if (c[i] != a[dem]) {         dem++;         a[dem] = c[i];       }     n = dem;   }   void xuli() {     a[0] = 0;     a[n + 1] = 0;     memset(b, 0, sizeof b);     for (int i = 1; i <= n; i++)       if (a[i - 1] == a[i + 1])         b[a[i]] += 2;       else         b[a[i]]++;     int dem = 0, kq;     for (int i = 1; i <= k; i++)       if (dem < b[i]) dem = b[i], kq = i;     cout << kq;   }   int main() {     if (0) {       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);     };     nhap();     xuli();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(void) {     long n, m, l, r;     vector<long> a(100005);     map<long, vector<long> >::iterator mi;     vector<long>::iterator vi1, vi2;     map<long, vector<long> > hash;     scanf( %ld %ld , &n, &m);     for (long i = 0; i < n; i++) {       scanf( %ld , &a[i]);       if (hash.find(a[i]) != hash.end())         hash[a[i]].push_back(i);       else {         vector<long> v;         v.push_back(i);         hash[a[i]] = v;       }     }     mi = hash.begin();     while (mi != hash.end()) {       if (mi->first > mi->second.size()) {         long temp = mi->first;         mi++;         hash.erase(hash.find(temp));       } else         mi++;     }     long diff = r - l + 1, count = 0;     long first, last;     for (long i = 0; i < m; i++) {       scanf( %ld %ld , &l, &r);       diff = r - l + 1, count = 0;       mi = hash.begin();       while (mi->first <= diff && mi != hash.end()) {         vi1 = upper_bound(mi->second.begin(), mi->second.end(), r - 1);         vi2 = lower_bound(             mi->second.begin(),             mi->second.end() - ((mi->first - 3 > 0) ? (mi->first - 3) : 0),             l - 1);         last = vi1 - mi->second.begin(), first = vi2 - mi->second.begin();         if (last - first == mi->first) count++;         mi++;       }       printf( %ld n , count);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int __SIZE = 1 << 18;   char ibuf[__SIZE], *iS, *iT;   template <typename T>   inline void read(T &x) {     char ch, t = 0;     x = 0;     while (!isdigit(ch = (iS == iT                               ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),                                  (iS == iT ? EOF : *iS++))                               : *iS++)))       t |= ch ==  - ;     while (isdigit(ch))       x = x * 10 + (ch ^ 48),       ch = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),                         (iS == iT ? EOF : *iS++))                      : *iS++);     x = t ? -x : x;   }   inline int read_int() {     int x;     return read(x), x;   }   inline long long read_ll() {     long long x;     return read(x), x;   }   template <typename T>   inline void chkmin(T &a, T b) {     a = a < b ? a : b;   }   template <typename T>   inline void chkmax(T &a, T b) {     a = a > b ? a : b;   }   const int MAXN = 150010;   const int mod = 998244353;   inline void Add(int &x, int y) { x += y, x -= x >= mod ? mod : 0; }   inline int Mod(int x) { return x >= mod ? x - mod : x; }   inline int fsp(int x, int k = mod - 2) {     int s = 1;     while (k) {       if (k & 1) s = 1LL * s * x % mod;       x = 1LL * x * x % mod, k >>= 1;     }     return s;   }   inline long long S(long long x, long long k) { return (x + x + k - 1) * k / 2; }   inline long long find(long long x, long long k) {     if (!x) return k * (k + 1) >> 1;     long long p = find(x / k, k), rest = x % k;     long long st = (x / k) * (k * k + 1) + rest * k + 1;     if (st + k <= p)       return S(st, k);     else       return S(st, k) + min(k, st + k - p);   }   inline void Solve() {     long long n = read_ll(), k = read_int(), bel = (n - 1) / (k * k + 1);     long long p = find(bel, k);     if (p == n)       cout << (bel + 1) * (k + 1) << endl;     else {       long long pos = n - bel - 1 + (n < p);       long long t = (n - 1) % (k * k + 1) + 1;       long long cnt = bel * k + (t - 1 - (n >= p)) / k;       cout << pos + cnt << endl;     }   }   int main() {     int Case = read_int();     while (Case--) Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     int arr[n];     int unos = 0;     for (int i = 0; i < n; i++) {       scanf( %d , &arr[i]);       if (arr[i]) unos++;     }     int fin = 0;     for (int i = 0; i < n; i++) {       int total = unos;       for (int j = i; j < n; j++) {         if (arr[j])           total--;         else           total++;         fin = max(fin, total);       }     }     printf( %d , fin);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   unsigned int n, i, f, p, s, rez;   int main() {     cin >> n;     f = 1;     for (i = 1; i <= n; i++) f = ((unsigned long long)f * i) % 998244353;     f = ((unsigned long long)f * n) % 998244353;     p = 1;     s = 0;     for (i = n; i >= 2; i--) {       p = ((unsigned long long)p * i) % 998244353;       s = (s + p) % 998244353;     }     rez = (f - s + 998244353) % 998244353;     cout << rez;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long calc_2(int s) {     if (s < 0) return 0;     return 1LL * (s + 1) * (s + 2) / 2;   }   long long calc_3(int s) {     if (s < 0) return 0;     long long ans = 0;     for (int i = 0; i <= s; i++) ans += calc_2(s - i);     return ans;   }   int val[5];   int main() {     int a, b, c, L;     scanf( %d%d%d%d , &a, &b, &c, &L);     val[1] = a - b - c, val[2] = b - a - c, val[3] = c - a - b;     long long ans = calc_3(L);     for (int i = 1; i <= 3; i++) {       for (int z = 0; z <= L; z++) {         int ed = min(L - z, val[i] + z);         ans -= calc_2(ed);       }     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nmax = 26;   int cost[nmax][3];   const int l = 0, m = 1, w = 2;   map<pair<int, int>, pair<string, int> > myMap;   pair<string, long long> global;   bool ok = 0;   void firstHalf(int a, int b, int c, string s) {     if (myMap.count({a - b, b - c}) == 0 || myMap[{a - b, b - c}].second < a) {       myMap[{a - b, b - c}] = {s, a};     }   }   void findMatch(int a, int b, int c, string s) {     if (myMap.count({b - a, c - b}) != 0) {       int ans = myMap[{b - a, c - b}].second + a;       string fin = myMap[{b - a, c - b}].first + s;       if (ans > global.second) {         ok = 1;         global = {fin, ans};       }     }   }   void solve(int i, const int stop, void (*op)(int, int, int, string), int a,              int b, int c, string s) {     if (i == stop + 1) {       op(a, b, c, s);       return;     }     solve(i + 1, stop, op, a + cost[i][l], b + cost[i][m], c, s +  LM n );     solve(i + 1, stop, op, a + cost[i][l], b, c + cost[i][w], s +  LW n );     solve(i + 1, stop, op, a, b + cost[i][m], c + cost[i][w], s +  MW n );   }   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; ++i) cin >> cost[i][l] >> cost[i][m] >> cost[i][w];     global.second = -26 * 10e7;     string pl;     solve(1, n / 2, &firstHalf, 0, 0, 0, pl);     solve(n / 2 + 1, n, &findMatch, 0, 0, 0, pl);     if (ok)       cout << global.first;     else       cout <<  Impossible ;   }
#include <bits/stdc++.h>   using namespace std;   int a[10];   int main() {     int ans = 0;     for (int i = 0; i < 6; i++) scanf( %d , &a[i]);     if (a[2] == a[4]) {       swap(a[0], a[3]);       swap(a[1], a[2]);       swap(a[4], a[5]);     }     for (int i = a[0] + a[0] - 1 + 2, j = 0; j < max(a[1], a[5]); i += 2, j++) {       if (j == min(a[1], a[5]))         i--;       else if (j > min(a[1], a[5]))         i -= 2;       ans += i;     }     for (int i = a[3] + a[3] - 1 + 2, j = 0; j < min(a[2], a[4]); i += 2, j++) {       ans += i;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     cin >> t;     for (int i = 0; i < t; i++) {       int n;       cin >> n;       long long mn = 1e9, mx = -1e9;       long long a[n];       for (int j = 0; j < n; j++) {         cin >> a[j];         mn = min(a[j], mn);         mx = max(a[j], mx);       }       long long x = mn * mx;       int ans = 1;       set<long long> s;       for (int j = 2; j <= sqrt(x); j++) {         if (x % j == 0) {           s.insert(j);           s.insert(x / j);         }       }       int cnt = 0;       for (int j = 0; j < n; j++) {         if (x % a[j] == 0) {           cnt++;         } else {           cnt = -1;           break;         }       }       if (cnt != s.size()) {         cout << -1 << endl;       } else         cout << x << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   class IntTree {    public:     IntTree(int size) : nodes_(4 * size + 10, 0), size_(size) {}     void Set(int pos, char ch) { Set(0, 1, size_, pos, ch); }     int Count(int left, int right) {       int mask = Mask(0, 1, size_, left, right);       return CountBits(mask);     }       private:     static int Left(int node) { return 2 * node + 1; }     static int Right(int node) { return 2 * node + 2; }     static int CountBits(int num);     void Set(int node, int left, int right, int pos, char ch);     int Mask(int node, int left, int right, int x, int y);     vector<int> nodes_;     int size_;   };   int IntTree::CountBits(int num) {     int count = 0;     while (num > 0) {       count += 1;       num -= (num & -num);     }     return count;   }   void IntTree::Set(int node, int left, int right, int pos, char ch) {     if (left == right) {       nodes_[node] = (1 << (ch -  a ));       return;     }     int mid = left + (right - left) / 2;     if (pos <= mid) {       Set(Left(node), left, mid, pos, ch);     } else {       Set(Right(node), mid + 1, right, pos, ch);     }     nodes_[node] = (nodes_[Left(node)] | nodes_[Right(node)]);   }   int IntTree::Mask(int node, int left, int right, int x, int y) {     if (x <= left && right <= y) {       return nodes_[node];     }     int mask = 0;     int mid = left + (right - left) / 2;     if (x <= mid) {       mask |= Mask(Left(node), left, mid, x, y);     }     if (mid < y) {       mask |= Mask(Right(node), mid + 1, right, x, y);     }     return mask;   }   int main() {     string str;     getline(cin, str);     IntTree tree(str.size());     for (size_t i = 0; i < str.size(); i += 1) {       tree.Set(i + 1, str[i]);     }     int queries;     cin >> queries;     for (int i = 0; i < queries; i += 1) {       int type, x, y;       char ch;       cin >> type;       if (type == 1) {         cin >> x >> ch;         tree.Set(x, ch);       } else {         cin >> x >> y;         cout << tree.Count(x, y) <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   constexpr int N = 155;   int in[N][N];   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         cin >> in[i][j];       }     }     vector<int> ans(N);     for (int v = 1; v < n; v++) {       for (int i = 1; i <= n; i++) {         bool f1 = false;         bool f2 = true;         for (int j = 1; j <= n; j++) {           if (in[i][j] == v)             f1 = true;           else {             if (in[i][j] != -1 and in[i][j] != 0) f2 = false;           }         }         if (f1 && f2) {           ans[i] = v;           for (int j = 1; j <= n; j++) in[i][j] = in[j][i] = -1;           break;         }       }     }     for (int i = 1; i <= n; i++) cout << (ans[i] == 0 ? n : ans[i]) <<    ;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e5 + 9;   int n;   int mp[9];   bool done[109];   vector<pair<long long, pair<long long, long long> > > v[109];   void dfs(int node) {     done[node] = 1;     for (int i = 0; i < v[node].size(); i++) {       int u = v[node][i].first;       int e = v[node][i].second.first;       int f = v[node][i].second.second;       if (done[u]) continue;       mp[f] += e, dfs(u);     }   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cin >> n;     for (int i = 0; i < n; i++) {       int a, b, c;       cin >> a >> b >> c;       a--;       b--;       v[a].push_back({b, {c, 1}});       v[b].push_back({a, {c, 0}});     }     dfs(0);     mp[1 - v[0][1].second.second] += v[0][1].second.first;     cout << min(mp[1], mp[0]) << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> a[100004];   int p[100004];   int v[100004];   long long int c[100004];   struct sajal {     long long int add, sub, d;   };   sajal d[100004];   int main() {     long n;     cin >> n;     long x, y;     for (long i = 1; i < n; i++) {       cin >> x >> y;       a[x].push_back(y);       a[y].push_back(x);     }     queue<long> q;     q.push(1);     p[1] = 1;     while (!q.empty()) {       long f = q.front();       q.pop();       v[f] = 1;       for (long i = 0; i < a[f].size(); i++) {         if (v[a[f][i]] == 0) {           v[a[f][i]] = 1;           q.push(a[f][i]);           p[a[f][i]] = f;         }       }     }     for (long i = 1; i <= n; i++) {       cin >> c[i];       d[i].add = 0;       d[i].sub = 0;       d[i].d = a[i].size();       if (a[i].size() == 1 && i != 1) {         q.push(i);       }     }     long long int add = 0;     long long int sub = 0;     long cur = 1;     while (!q.empty()) {       long f = q.front();       q.pop();       long long int e = d[f].add - d[f].sub;       long long int h = -c[f] - e;       long long int w = p[f];       if (h >= 0) {         d[f].add = d[f].add + h;       } else {         h = -h;         d[f].sub = h + d[f].sub;       }       if (d[f].sub > sub) sub = d[f].sub;       if (d[f].add > add) add = d[f].add;       if (d[w].sub < d[f].sub) d[w].sub = d[f].sub;       if (d[w].add < d[f].add) d[w].add = d[f].add;       d[w].d--;       if (d[w].d == 1 && w != 1) {         q.push(w);       }     }     c[1] = c[1] + d[1].add - d[1].sub;     c[1] = -c[1];     if (c[1] >= 0) {       d[1].add = d[1].add + c[1];     } else {       c[1] = -c[1];       d[1].sub = d[1].sub + c[1];     }     if (add < d[1].add) add = d[1].add;     if (sub < d[1].sub) sub = d[1].sub;     cout << add + sub << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, l, r, x;   string s;   int main() {     cin >> n >> m;     r = 0;     l = n + 1;     for (int i = 0; i < m; ++i) {       cin >> s;       cin >> s;       cin >> s;       if (s ==  left ) {         cin >> s >> x;         l = min(l, x);       } else {         cin >> s >> x;         r = max(r, x);       }     }     if (l - r - 1 <= 0)       cout << -1 << endl;     else       cout << l - r - 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string intial, code;     cin >> intial >> code;     int res = 0;     for (int i = 0; i < n; i++) {       int a = (((intial[i] -  0 ) - (code[i] -  0 )) + 10) % 10;       int b = (((code[i] -  0 ) - (intial[i] -  0 )) + 10) % 10;       res += min(a, b);     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int e[100010];   int main() {     int n, u, i, j = 3;     double ans = 0;     scanf( %d%d , &n, &u);     for (i = 1; i <= n; i++) scanf( %d , &e[i]);     for (i = 1; i <= n; i++) {       while (j <= n && e[j] - e[i] <= u) j++;       j--;       if (j > i + 1) ans = max(ans, (e[j] - e[i + 1] + 0.0) / (e[j] - e[i]));     }     if (ans == 0)       cout << -1 << endl;     else {       cout.precision(19);       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int t;     cin >> t;     while (t--) {       long long int temperature;       long long int a12, b11;       long long int solution;       cin >> a12 >> b11;       if (b11 == a12) {         solution = 0;       } else if (b11 > a12) {         temperature = b11 - a12;         if (temperature & 1) {           solution = 1;         } else {           solution = 2;         }       } else {         temperature = a12 - b11;         if (temperature & 1) {           solution = 2;         } else {           solution = 1;         }       }       cout << solution <<   n ;     }     return 0;   }