malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   char xB[1 << 15], *xS = xB, *xTT = xB;   template <typename T>   inline void rd(T& xaa) {     char xchh;     T f = 1;     xaa = 0;     while (xchh = (xS == xTT && (xTT = (xS = xB) + fread(xB, 1, 1 << 15, stdin),                                  xS == xTT)                        ? 0                        : *xS++),            !((xchh >=  0  && xchh <=  9 ) || (xchh ==  - )))       ;     if (xchh ==  - ) {       f = -1;       xchh = (xS == xTT &&                       (xTT = (xS = xB) + fread(xB, 1, 1 << 15, stdin), xS == xTT)                   ? 0                   : *xS++);     }     xaa = xchh -  0 ;     while (xchh = (xS == xTT && (xTT = (xS = xB) + fread(xB, 1, 1 << 15, stdin),                                  xS == xTT)                        ? 0                        : *xS++),            ((xchh >=  0  && xchh <=  9 ) || (xchh ==  - )))       xaa = xaa * 10 + xchh -  0 ;     xaa *= f;     return;   }   long long geta(long long x, long long y, long long a, long long b) {     return x * a + y * b;   }   long long getb(long long x, long long y, long long a, long long b) {     return x * b - y * a;   }   int n;   long long a, b, res;   int main() {     rd(n);     rd(a);     rd(b);     map<long long, vector<long long> > val;     for (int i = 1; i <= n; i++) {       long long e, x, y;       rd(e);       rd(x);       rd(y);       long long px = geta(x, y, 1, a), py = getb(x, y, 1, a);       val[py].push_back(px);     }     long long res = 0;     for (map<long long, vector<long long> >::iterator it = val.begin();          it != val.end(); it++) {       vector<long long>& tv = it->second;       sort(tv.begin(), tv.end());       long long nv = 0, nc = 0;       bool st = 0;       int len = static_cast<int>(tv.size());       for (vector<long long>::iterator it1 = tv.begin(); it1 != tv.end(); it1++) {         if (!st) {           nv = *it1;           nc = 1;           st = 1;         } else {           if (*it1 == nv)             nc++;           else {             res += nc * (len - nc);             nv = *it1;             nc = 1;           }         }       }       res += nc * (len - nc);     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   long long mod2 = 998244353;   long long mod3 = 1000003;   long long mod4 = 998244853;   long long inf = 1LL << 60;   long double pi = 3.14159265358979323846L;   double eps = 1e-12;   int dh[4] = {1, -1, 0, 0};   int dw[4] = {0, 0, 1, -1};   int ddh[8] = {-1, -1, -1, 0, 0, 1, 1, 1};   int ddw[8] = {-1, 0, 1, -1, 1, -1, 0, 1};   long long gcd(long long a, long long b) {     if (a < b) swap(a, b);     if (b == 0) return a;     if (a % b == 0) return b;     return gcd(b, a % b);   }   long long Pow(long long n, long long k) {     long long ret = 1;     long long now = n;     while (k > 0) {       if (k & 1) ret *= now;       now *= now;       k /= 2;     }     return ret;   }   long long beki(long long n, long long k, long long md) {     long long ret = 1;     long long now = n;     while (k > 0) {       if (k % 2 == 1) {         ret *= now;         ret %= md;       }       now *= now;       now %= md;       k /= 2;     }     return ret;   }   long long gyaku(long long n, long long md) { return beki(n, md - 2, md); }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     for (long long i = 0; i < t; i++) {       long long n, m;       cin >> n >> m;       long long a[m];       long long sum = 0;       unordered_map<long long, long long> mp;       for (long long j = 0; j < m; j++) {         cin >> a[j];         sum += a[j];         mp[a[j]]++;       }       if (sum < n) {         cout << -1 << endl;         continue;       }       unordered_map<long long, bool> ok;       long long nn = n;       for (long long j = 0; j < 60; j++) {         long long now = 1LL << j;         if (nn % 2) {           ok[now] = false;         } else           ok[now] = true;         nn /= 2;       }       long long now = 1;       sum = 0;       set<long long> st;       long long ans = 0;       for (;;) {         sum += mp[now] * now;         if (mp[now] > 0) {           long long u = *st.begin();           long long uu = now;           while (uu > u) {             ans++;             uu /= 2;           }           for (auto itr = st.begin(); itr != st.end(); itr++) {             sum -= *itr;           }           st.clear();         }         if (ok[now] == false) {           if (sum >= now) {             sum -= now;             ok[now] = true;           } else {             st.insert(now);           }         }         now *= 2;         if (now > 1000000000000000000) break;       }       cout << ans << endl;     }   }
#include<bits/stdc++.h>   #include<math.h>      using namespace std;      #define ll long long      #define endl   n       #define pb push_back      #define eraseO(s, x) if(s.find(x) != s.end()) { s.erase(s.lower_bound(x)); }      #define vi vector<int>      #define vc vector<char>      #define vl vector<ll>      #define ip pair<int, int>      #define cip pair<int, char>      #define vip vector<ip>      #define msi multiset<int>      #define REP(d, i) for(int i = 0; i < d; ++i)      #define REPD(d, i) for(int i = d - 1; i >= 0; i--)      #define REPM(d, d1, i, j) for(int i = 0; i < d; ++i){for(int j = 0; j < d1; ++j)      #define REPV(v, i) REP(v.size(), i)      #define REPVD(v, i) REPD(v.size(), i)      #define FOR(d) REP(d, i)      #define FORD(d) REPD(d, i)      #define FORM(d, d1) REPM(d, d1, i, j)      #define FORV(v) REPV(v, i)      #define FORVD(v) REPVD(v, i)      #define INA(a, d) FOR(d) { cin >> a[i]; }      #define INM(a, d, d1) FORM(d, d1) { cin >> a[i][j];}}      #define OUTA(a, d) FOR(d) { cout << a[i] <<    ; }      #define OUTV(a) FORV(a) { cout << a[i] <<    ; }      #define OUTM(c, d, d1) FORM(d, d1) { cout << c[i][j] <<    ; } cout << endl;}      void solve() {          int n;       cin >> n;          map<int, int> oc1;       map<int, int> ec1;       map<int, int> oc2;       map<int, int> ec2;          set<int> nums;          int a[n];       INA(a, n);          FOR(n) {           if(i % 2) {               oc1[a[i]]++;           } else {               ec1[a[i]]++;           }           nums.insert(a[i]);       }       sort(a, a + n);          FOR(n) {           if(i % 2) {               oc2[a[i]]++;           } else {               ec2[a[i]]++;           }       }          bool ok = 1;          for(int i : nums) {           if(oc1[i] != oc2[i] || ec1[i] != ec2[i]) {               ok = 0;           }       }          if(ok) {           cout <<  YES  << endl;       } else {           cout <<  NO  << endl;       }   }      int main() {       ios_base::sync_with_stdio(false);       cin.tie(NULL);       int t;       cin >> t;       FOR(t) {           solve();       }   }
#include <bits/stdc++.h>   using namespace std;   int a[100] = {0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 15, 4};   int n;   int main() {     scanf( %d , &n);     if (n <= 10)       puts( 0 );     else       printf( %d n , a[n - 10]);   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)2e9;   const long long INFL = (long long)9e18;   const int MAXINT = ((~0) ^ (1 << 31));   const long long MAXLL = ((~0) ^ ((long long)1 << 63));   template <class T>   inline T pow2(T a) {     return a * a;   }   template <class T>   inline bool mineq(T& a, T b) {     return (a > b) ? (a = b, true) : false;   }   template <class T>   inline bool maxeq(T& a, T b) {     return (a < b) ? (a = b, true) : false;   }   const int maxn = 2e2, maxn2 = 1e5, mod = 1e9 + 7;   long long n, b, k, x, m[40][maxn][maxn], a[maxn2], res[maxn][maxn];   void mul(long long n, long long ans[maxn][maxn], long long a[maxn][maxn],            long long b[maxn][maxn]) {     long long t[maxn][maxn];     for (int i = 0; i < n; i++) memset(t[i], 0, sizeof t[i]);     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         for (int z = 0; z < n; z++)           t[i][j] = (t[i][j] + (a[i][z] * b[z][j] + mod) % mod + mod) % mod;       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) ans[i][j] = t[i][j];     }   }   void pow(long long n, long long ans[maxn][maxn], long long t[maxn][maxn],            long long k) {     for (int i = 0; i < n; i++) memset(ans[i], 0, sizeof ans[i]);     if (k == 0) {       for (int i = 0; i < n; i++) {         for (int j = 0; j < n; j++) ans[i][j] = (i == j);       }       return;     }     pow(n, ans, t, k / 2);     mul(n, ans, ans, ans);     if (k % 2 != 0) mul(n, ans, t, ans);   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> b >> k >> x;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < x; i++) {       for (int j = 0; j < n; j++) m[0][i][(10 * i + a[j]) % x]++;     }     for (int i = 1; i < 40; i++) mul(x, m[i], m[i - 1], m[i - 1]);     pow(x, res, m[0], b);     cout << res[0][k];   }
#include <bits/stdc++.h>   const int N = 5e4 + 5;   struct Point {     int x, y, z, id;     void input() { scanf( %d%d%d , &x, &y, &z); }   } a[N];   int main() {     std::map<std::pair<int, int>, std::vector<Point> > f;     std::map<int, std::vector<Point> > g;     std::vector<Point> h;     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       a[i].input();       a[i].id = i;       f[std::pair<int, int>(a[i].x, a[i].y)].push_back(a[i]);     }     for (auto &p : f) {       auto &v = p.second;       std::sort(v.begin(), v.end(),                 [](const Point &a, const Point &b) { return a.z < b.z; });       if (v.size() & 1) g[v.back().x].push_back(v.back()), v.pop_back();       for (int i = 0; i < v.size(); i += 2)         printf( %d %d n , v[i].id, v[i + 1].id);     }     for (auto &p : g) {       auto &v = p.second;       std::sort(v.begin(), v.end(),                 [](const Point &a, const Point &b) { return a.y < b.y; });       if (v.size() & 1) h.push_back(v.back()), v.pop_back();       for (int i = 0; i < v.size(); i += 2)         printf( %d %d n , v[i].id, v[i + 1].id);     }     for (int i = 0; i < h.size(); i += 2) printf( %d %d n , h[i].id, h[i + 1].id);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, q = 1, i, res = 1;     cin >> n >> m;     for (i = 0; i < m; i++) {       q = (q << 1);       q %= 1000000009;     }     q--;     for (i = 0; i < n; i++) {       res *= (q - i);       if (res <= 0) {         cout <<  0 ;         return 0;       }       res %= 1000000009;     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   const int maxn = 3005, maxm = maxn << 1;   int n, e, ans, minn;   int start[maxn], to[maxm], then[maxm], worth[maxm], f[maxn], tot[maxn],       xx[maxm], yy[maxm];   inline int min(int a, int b) { return a < b ? a : b; }   inline int max(int a, int b) { return a > b ? a : b; }   inline void add(int x, int y, int z) {     then[++e] = start[x], start[x] = e, to[e] = y, worth[e] = z;   }   void dfs(int x, int last) {     minn = min(minn, tot[x]);     for (int i = start[x]; i; i = then[i]) {       int y = to[i];       if (y == last) continue;       tot[y] = tot[x] + (worth[i] == 0 ? -1 : 1);       dfs(y, x);       f[x] += f[y] + (worth[i] ^ 1);     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       add(x, y, 1), add(y, x, 0);     }     ans = n - 1;     for (int i = 1; i <= n; i++)       for (int j = start[i]; j; j = then[j])         if (worth[j] == 1) {           int k = to[j], sum = 0;           for (int p = 1; p <= n; p++) f[p] = tot[p] = 0;           dfs(i, 0), ans = min(ans, f[i]);           for (int p = 1; p <= n; p++) f[p] = tot[p] = 0;           minn = 1000000000, dfs(i, k);           sum += f[i] + minn;           for (int p = 1; p <= n; p++) f[p] = tot[p] = 0;           minn = 1000000000, dfs(k, i);           sum += f[k] + minn;           ans = min(ans, sum);         }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 4;   int n, A, B, a[N], par[N];   map<int, int> Map;   int root(int u) { return (par[u] < 0) ? u : (par[u] = root(par[u])); }   void Merge(int u, int v) {     u = root(u);     v = root(v);     if (u != v) {       if (par[u] > par[v]) swap(u, v);       par[u] += par[v];       par[v] = u;     }   }   void sol() {     for (int i = 0; i <= n + 1; ++i) par[i] = -1;     for (int i = 1; i <= n; ++i) {       if (Map.count(A - a[i]))         Merge(i, Map[A - a[i]]);       else         Merge(i, n + 1);       if (Map.count(B - a[i]))         Merge(i, Map[B - a[i]]);       else         Merge(i, 0);     }     int u = root(0), v = root(n + 1);     if (u == v)       cout <<  NO ;     else {       cout <<  YES  n ;       for (int i = 1; i <= n; ++i) {         int tmp = root(i);         if (tmp == u)           cout << 0 <<    ;         else           cout << 1 <<    ;       }     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> A >> B;     for (int i = 1; i <= n; ++i) cin >> a[i], Map[a[i]] = i;     sol();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void print(vector<int> v) {     for (int i = 0; i < v.size(); i++) {       cout << v[i] <<    ;     }     cout <<   n ;     return;   }   bool isSubsetSum(vector<int> set, int n, int sum) {     bool subset[n + 1][sum + 1];     for (int i = 0; i <= n; i++) subset[i][0] = true;     for (int i = 1; i <= sum; i++) subset[0][i] = false;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= sum; j++) {         if (j < set[i - 1]) subset[i][j] = subset[i - 1][j];         if (j >= set[i - 1])           subset[i][j] = subset[i - 1][j] || subset[i - 1][j - set[i - 1]];       }     }     return subset[n][sum];   }   int main(int argc, char const *argv[]) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int N;     cin >> N;     for (int I = 0; I < N; I++) {       int n;       cin >> n;       vector<int> v(2 * n);       for (int i = 0; i < 2 * n; i++) {         cin >> v[i];       }       int p = 0;       int t = v[0];       vector<int> temp;       for (int i = 0; i < 2 * n; i++) {         if (v[i] > t) {           t = v[i];           temp.push_back(i - p);           p = i;         }       }       temp.push_back(2 * n - p);       if (isSubsetSum(temp, temp.size(), n)) {         cout <<  YES               <<   n ;       } else {         cout <<  NO               <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, m, k, A, B;     cin >> n;     int r1 = -1, p2 = 100000, p1 = -1;     for (int(i) = 0; (i) < (n); (i)++) {       int x;       cin >> x;       r1 = max(x, r1);     }     cin >> m;     for (int(i) = 0; (i) < (m); (i)++) {       int x;       cin >> x;       p1 = max(p1, x);     }     cin >> k;     for (int(i) = 0; (i) < (k); (i)++) {       int x;       cin >> x;       p2 = min(p2, x);     }     cin >> A >> B;     double a = r1, b = p1, c = p2;     double ans = (a * a * B * b) / (B * b + A * c);     cout << fixed << setprecision(10) << sqrt(ans) <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   bool isFile;   using namespace std;   const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};   const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};   const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   void _();   void faster() {     _();     if (isFile) {       freopen(            taskA             .in ,            r , stdin);       freopen(            taskA             .out ,            w , stdout);     }     if (1) {       ios_base::sync_with_stdio(false);       cin.tie(0);       cout.tie(0);     }   }   const long long INF = 9e18;   const int inf = 2e9;   const int MOD = 998244353;   const long double PI = acos(-1);   const long double EPS = 1e-7;   const int N = (int)2e5 + 5;   const int M = 1234;   vector<int> g[N];   int dp[N];   void dfs(int v, int pr = -1, int lvl = 0) {     dp[lvl % 2]++;     for (int to : g[v])       if (to != pr) dfs(to, v, lvl + 1);   }   void solve() {     int n;     cin >> n;     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       u--, v--;       g[u].push_back(v);       g[v].push_back(u);     }     dfs(1);     cout << min(dp[0], dp[1]) - 1 << endl;   }   void _() {}   int main() {     faster();     int t = 1;     int id = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cout.tie(NULL);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<int> v(n);       vector<int> cnt(n + 1, 0);       for (int i = 0; i < n; i++) {         cin >> v[i];         cnt[v[i]]++;       }       long long sum = 0, ans = 0, len = 0;       for (int i = 0; i < n; i++) {         sum = v[i], len = 1;         for (int j = i + 1; j < n; j++) {           sum += v[j];           len++;           if (len >= 2) {             if (sum <= n) {               ans += cnt[sum];               cnt[sum] = 0;             } else               break;           }         }       }       cout << ans <<   n ;     }     return 0;   }
#include<bits/stdc++.h>   #define maxn 200005   #define endl   n    using namespace std;       int n,m,a[maxn],dis[maxn];   vector<int> e[maxn];       queue<int> q;       void bfs()   {    while(!q.empty())    {     int u=q.front();     q.pop();     for(int i=0;i<e[u].size();i++)     {      int v=e[u][i];      if(dis[v]!=-1) continue;      dis[v]=dis[u]+1;      q.push(v);     }    }   }               int mx[maxn],ans[maxn],ok[maxn];   vector<int> b[maxn];       void bfs2(int tt)   {    while(!q.empty())    {     int u=q.front();     q.pop();     for(int i=0;i<e[u].size();i++)     {      int v=e[u][i];      if(ok[v]) continue;      ans[v]=max(ans[v],tt);      if(mx[v]>=mx[u]-1) continue;      mx[v]=mx[u]-1;      q.push(v);     }    }   }       signed main()   {    ios::sync_with_stdio(0);    cin>>n;    for(int i=1,u,v;i<n;i++)     {     cin>>u>>v;     e[u].push_back(v);     e[v].push_back(u);    }    cin>>m;    memset(dis,-1,sizeof(dis));    for(int i=1;i<=m;i++)     {     cin>>a[i];     ok[a[i]]=1;     dis[a[i]]=0;     q.push(a[i]);    }    bfs();    for(int i=1;i<=n;i++)     b[dis[i]].push_back(i),ans[i]=dis[i];    for(int i=n;i>=1;i--)    {     if(b[i].size()==0) continue;     while(!q.empty()) q.pop();   //  q.clear();     for(int j=0;j<b[i].size();j++)      {      q.push(b[i][j]);      if(mx[b[i][j]]>=i-1) continue;      mx[b[i][j]]=i-1;      ans[b[i][j]]=max(i,ans[b[i][j]]);     }     bfs2(i);    }    for(int i=1;i<=n;i++)     cout<<ans[i]<<   ;    cout<<endl;   }
#include <bits/stdc++.h>   int main() {     int h, l;     float a;     scanf( %d %d , &h, &l);     a = l * tan(atan(1.0 * h / l) - atan(1.0 * l / h));     if (a < 0) a = -a;     printf( %.10f , a);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     double a;     int b;     friend const bool operator<(const node& x, const node& y) {       if (fabs(x.a - y.a) < 1e-10)         return x.b < y.b;       else         return x.a < y.a;     }   };   int n, t, q, p[200007], l[200007], cnt[200007];   double res;   set<node> a, b;   int read() {     int num = 0;     char c = getchar();     while (c <  0  || c >  9 ) c = getchar();     while (c >=  0  && c <=  9 ) num = num * 10 + c -  0 , c = getchar();     return num;   }   int ins(int x) {     if (cnt[x] < l[x])       a.insert(node{((((double)cnt[x] + 1) / (l[x] + cnt[x] + 1)) * p[x]) -                         ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]),                     x});     if (cnt[x])       b.insert(node{((((double)cnt[x] - 1) / (l[x] + cnt[x] - 1)) * p[x]) -                         ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]),                     x});     res += ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]);     return 0;   }   int del(int x) {     if (cnt[x] < l[x])       a.erase(node{((((double)cnt[x] + 1) / (l[x] + cnt[x] + 1)) * p[x]) -                        ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]),                    x});     if (cnt[x])       b.erase(node{((((double)cnt[x] - 1) / (l[x] + cnt[x] - 1)) * p[x]) -                        ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]),                    x});     res -= ((((double)cnt[x]) / (l[x] + cnt[x])) * p[x]);     return 0;   }   int add(int x) {     del(x);     cnt[x]++;     t--;     ins(x);     return 0;   }   int era(int x) {     del(x);     cnt[x]--;     t++;     ins(x);     return 0;   }   int main() {     n = read();     t = read();     q = read();     for (int i = 1; i <= n; i++) p[i] = read();     for (int i = 1; i <= n; i++) l[i] = read();     for (int i = 1; i <= n; i++)       a.insert(node{((((double)1) / (l[i] + 1)) * p[i]), i});     while (t && !a.empty()) add(a.rbegin()->b);     for (int i = 1; i <= q; i++) {       int tp = read(), x = read();       if (tp == 2 && cnt[x] == l[x]) era(x);       del(x);       if (tp == 1)         l[x]++;       else         l[x]--;       ins(x);       if (t && !a.empty()) add(a.rbegin()->b);       if (!a.empty() && !b.empty() && (a.rbegin()->a + b.rbegin()->a) > 0) {         int x = a.rbegin()->b, y = b.rbegin()->b;         era(y);         add(x);       }       printf( %.010lf n , res);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int x, long long int y, long long int p) {     long long int res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   bool sortbysec(const pair<long long int, long long int> &a,                  const pair<long long int, long long int> &b) {     return (a.second > b.second);   }   string decToBin(long long int n) {     string s =  0 ;     if (n == 0) return s;     s =   ;     while (n > 0) {       s += (n % 2) +  0 ;       n = n / 2;     }     reverse(s.begin(), s.end());     return s;   }   long long int binToDec(string s) {     long long int ans = 0;     reverse(s.begin(), s.end());     for (__typeof(s.size()) i = (0) - ((0) > (s.size()));          i != (s.size()) - ((0) > (s.size())); i += 1 - 2 * ((0) > (s.size()))) {       ans += pow(2, i) * (s[i] -  0 );     }     return ans;   }   long long int nCr(long long int n, long long int r) {     vector<long long int> fac(200000);     fac.push_back(1);     for (long long int i = 1; i < n + 1; i++) {       fac.push_back((fac[i - 1] * i) % 1000000007);     }     long long int ans = fac[n] / (fac[n - r] * fac[r]);     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n;     cin >> n;     string s;     cin >> s;     long long int mn = 0;     vector<long long int> st;     if (n % 2 == 1) {       cout << -1 << endl;       exit(0);     }     long long int op = 0, cl = 0;     for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));          i += 1 - 2 * ((0) > (n))) {       if (s[i] ==  ( ) {         st.push_back(0);         op++;       } else {         if (st.size() != 0) {           st.pop_back();         }         cl++;       }       if (cl == op) {         if (st.size() == 0) {           cl = 0;           op = 0;           continue;         }         mn += cl + op;         cl = 0;         op = 0;         st.clear();       }     }     if (cl == 0 && op == 0)       cout << mn << endl;     else       cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long a, b;       int cnt = 0;       cin >> a >> b;       long long d = abs(a - b);       if (d % 10 == 0) {         cout << d / 10 << endl;       } else {         cout << d / 10 + 1 << endl;       }     }     return 0;   }