malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <class TAT>   void read(TAT &a) {     static char cc;     static bool fff;     while (((cc = getchar()) <  0  || cc >  9 ) && cc !=  - )       ;     if (cc ==  - )       fff = 1, a = 0;     else       fff = 0, a = cc - 48;     while ((cc = getchar()) >=  0  && cc <=  9 ) a = a * 10 + cc - 48;     if (fff) a = -a;   }   template <class TAT>   void write(TAT a) {     static char cc[25];     static int ct;     if (a == 0) {       putchar( 0 );       return;     }     if (a < 0) {       putchar( - );       a = -a;     }     ct = 0;     while (a) {       cc[++ct] = a % 10 + 48;       a /= 10;     }     while (ct) {       putchar(cc[ct--]);     }   }   void begin() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   void end() {     fclose(stdin);     fclose(stdout);   }   template <class TAT>   void Ckmin(TAT &a, const TAT &b) {     if (a > b) a = b;   }   template <class TAT>   void Ckmax(TAT &a, const TAT &b) {     if (a < b) a = b;   }   const int mod = 1000000007;   const int maxn = 105;   const int maxm = 10005;   long long n, m, K;   long long C[maxn][maxn] = {0};   long long F[maxn][maxm] = {0};   long long P[maxn] = {0};   void Init() { read(n), read(m), read(K); }   int Pow(long long x, long long y) {     long long S = 1;     while (y) {       if (y & 1) S = (S * x) % mod;       x = (x * x) % mod;       y >>= 1;     }     return S;   }   void Prepare() {     const int N = 101;     register int i, j, k;     C[0][0] = 1;     for (i = 1; i <= N; ++i) {       C[i][0] = 1;       for (j = 1; j <= i; ++j) {         C[i][j] =             ((C[i][j - 1] * Pow(j, mod - 2)) % mod * (long long)(i - j + 1)) %             mod;       }     }   }   void Solve() {     register int i, j, k;     memset(F, 0, sizeof(F));     F[0][0] = 1;     for (i = 1; i <= n; ++i) {       for (j = 0; j <= n; ++j) P[j] = Pow(C[n][j], (m + n - i) / n) % mod;       for (j = 0; j <= K; ++j) {         for (k = j; k <= K && k <= j + n; ++k) {           F[i][k] = (F[i][k] + F[i - 1][j] * P[k - j]) % mod;         }       }     }     write(F[n][K]);     putchar(  n );   }   int main() {     Init();     Prepare();     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100009;   int main() {     string s;     cin >> s;     int l = s.size();     for (int i = 0; i < l; i++) s += s[i];     int ans = 1;     for (int i = 0; i < l;) {       int j = i;       for (; j < l + i - 1; j++) {         if (s[j] == s[j + 1])           break;         else           ans = max(ans, j - i + 2);       }       i = j + 1;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string s;     cin >> s;     long long cnt = 0;     for (long long i = 0; i < s.length(); i++) {       if (s[i] >= 97) cnt++;     }     if (cnt >= s.length() - cnt) {       transform(s.begin(), s.end(), s.begin(), ::tolower);     } else       transform(s.begin(), s.end(), s.begin(), ::toupper);     cout << s << endl;   }   int main() {     long long t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   long long n, s, l, r, res, cur, maxx = -9999999999;   int main() {     cin >> n >> s;     for (long long i = 1; i <= n; i++) {       cin >> l >> r;       maxx = max(maxx, l + r);     }     cout << max(maxx, s);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[3009], t[3009];   long long dp[3009][3009];   int n, m;   long long bigmod(long long a, long long p) {     long long r = 1ll;     while (p) {       if ((p & 1ll)) {         r = (a * r) % 998244353ll;       }       a = (a * a) % 998244353ll;       p >>= 1;     }     return r;   }   long long func(int i, int j) {     if (i < 0) {       return 1ll;     }     if (j >= m) {       return bigmod(2, i + 1);     }     long long &ret = dp[i][j];     if (~ret) return ret;     ret = 0;     if (s[i] == t[j]) ret = func(i - 1, j + 1);     if (j + i >= m || (s[i] == t[i + j])) ret += func(i - 1, j);     if (ret >= 998244353ll) ret -= 998244353ll;     return ret;   }   int main() {     scanf( %s , s);     scanf( %s , t);     n = strlen(s);     m = strlen(t);     memset(dp, -1, sizeof(dp));     long long ans = 0;     for (int i = n; i >= m; i--) {       ans += func(i - 1, 0);       if (ans >= 998244353ll) ans -= 998244353ll;     }     if (ans >= 998244353ll) ans -= 998244353ll;     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   int a, b, c, d, i, j, n, m, k, ans;   int cs[100001], mas[100001], dp[100001];   inline int sum(int a, int b) {     if (!a)       return cs[b];     else       return cs[b] - cs[a - 1];   }   int main() {     scanf( %d , &n);     for (int _n((n)-1), i(0); i <= _n; i++) {       scanf( %d , &mas[i]);       if (!i)         cs[i] = mas[i];       else         cs[i] = cs[i - 1] + mas[i];     }     ans = -1000000000 - 1;     for (int _n((n)-1), i(0); i <= _n; i++) {       if (!i)         dp[i] = max(cs[i], -cs[i]);       else         dp[i] = max(dp[i - 1] + mas[i], max(cs[i], -cs[i]));       ans = max(ans, dp[i]);     }     a = 0;     for (int i = (n - 2), _b = (0); i >= _b; i--) {       a += mas[i + 1];       ans = max(ans, max(a, -a) + dp[i]);     }     ans = max(ans, cs[n - 1]);     ans = max(ans, -cs[n - 1]);     ans = max(ans, dp[n - 1]);     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long a[200005];   long long b[200005];   void solve() {     long long n;     cin >> n;     long long c = 0, t, c1 = 0;     cin >> t;     for (long long i = 0; i < t; i++) {       cin >> a[i];     }     for (long long i = 1; i < t; i++) {       if (n - a[i - 1] > 0) c += n - a[i - 1];     }     cout << c;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     for (int i = 1; i <= t; i++) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie();     long long a, b, c, n, x;     cin >> a >> b >> c >> n;     x = a + b - c;     x = n - x;     if (x < 1 || c > a || c > b || c > (a + b))       cout << -1 << endl;     else       cout << x << endl;     return 0;   }
#include <bits/stdc++.h>   #define jh(x, y) (x ^= y ^= x ^= y)   #define loc(x, y) ((x - 1) * m + y)   #define lowbit(x) (x & -x)   typedef long long ll;   const int N = 5e5 + 5, INF = 0x3f3f3f3f, mod = 1e9 + 7;   const double PI = acos(-1), EPS = 1e-7;   using namespace std;   namespace fast_IO {    ll read() {     ll x = 0;     char c;     bool flag = false;     while ((c = getchar()) ==     || c ==   n  || c ==   r );     if (c ==  - )flag = true; else x = c ^ 48;     while ((c = getchar()) !=     && c !=   n  && c !=   r  && ~c)      x = (x << 1) + (x << 3) + (c ^ 48);     if (flag)return -x;     return x;    }    void write(ll x) {     if (x < 0)putchar( - ), x = -x;     if (x >= 10)write(x / 10);     putchar(x % 10 ^ 48);    }   }   char s[4];   bool tag[N];   int a[N], b[N], pre[N];   ll dp[N];   void print(int l, int r, int st, int m) {    if (l >= st) {     print(pre[l], l, st, m);     putchar( + );    }    printf( %d , b[l + 1]);    for (int i = l + 2; i <= r; ++i)     printf( *%d , b[i]);   }   void solve(int n) {    //既有*又有+    int m = n, st = 1;    while (m && b[m] == 1)--m;    while (st <= n && b[st] == 1)++st;    for (int i = 1; i < st; ++i) {     printf( 1 );     if (i != n)putchar( + );    }    if(st > n)return;    int sum = 1;    for (int i = st; i <= m; ++i)sum = min((m - st + 1) * 2, sum * b[i]);    if (sum == (m - st + 1) * 2) {     printf( %d , b[st]);     for (int i = st + 1; i <= m; ++i)      printf( *%d , b[i]);    }    else {     for (int i = st; i <= m; ++i)dp[i] = -1e17;     dp[st] = b[st]; pre[st] = st - 1;     dp[st - 1] = 0;     for (int i = st; i < m; ++i) {      if (b[i + 1] == 1)dp[i + 1] = dp[i] + 1, pre[i + 1] = i;      else {       ll mul = 1;       for (int j = i + 1; j >= st; --j) {        mul *= b[j];        if (dp[i + 1] < dp[j - 1] + mul) {         dp[i + 1] = dp[j - 1] + mul;         pre[i + 1] = j - 1;        }       }      }     }     print(pre[m], m, st, m);    }    for (int i = m + 1; i <= n; ++i)     printf( +1 );   }      int main() {    int n = fast_IO::read();    for (int i = 1; i <= n; ++i)a[i] = fast_IO::read();    scanf( %s , s);    for (int i = 0; s[i]; ++i)tag[s[i]] = true;    if (!s[1]) {     printf( %d , a[1]);     for (int i = 2; i <= n; ++i)      printf( %c%d , s[0], a[i]);    }    else if (!tag[ * ]) {     if (tag[ + ]) {      printf( %d , a[1]);      for (int i = 2; i <= n; ++i)       printf( +%d , a[i]);     }    }    else {     if (!tag[ + ]) {      printf( %d , a[1]);      for (int i = 2; i <= n; ++i) {       if (a[i] == 0) {        printf( -0 );        continue;       }       printf( *%d , a[i]);      }     }     else {      int now = 0;      for (int i = 1; i <= n; ++i) {       if (a[i] == 0) {        if (now)solve(now);        now = 0;        if (i != 1 && a[i - 1])putchar( + );        printf( 0 );        if (i != n)putchar( + );       }       else b[++now] = a[i];      }      if (now)solve(now);     }    }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   const int K = 65;   const int inf = 1000 * 1000 * 1000;   const int mod = 1000 * 1000 * 1000 + 7;   int n, a[N], q;   int t[4 * N][K];   void build(int v, int s, int e) {     if (s == e) {       for (int i = 0; i < 60; i++) {         if (i % a[s] == 0)           t[v][i] = 2;         else           t[v][i] = 1;       }       return;     }     int m = (s + e) / 2;     build(2 * v, s, m);     build(2 * v + 1, m + 1, e);     for (int i = 0; i < 60; i++) {       int x = (i + t[2 * v][i]) % 60;       t[v][i] = t[2 * v][i] + t[2 * v + 1][x];     }   }   void update(int v, int s, int e, int pos) {     if (s == e) {       for (int i = 0; i < 60; i++) {         if (i % a[s] == 0)           t[v][i] = 2;         else           t[v][i] = 1;       }       return;     }     int m = (s + e) / 2;     if (pos <= m)       update(2 * v, s, m, pos);     else       update(2 * v + 1, m + 1, e, pos);     for (int i = 0; i < 60; i++) {       int x = (i + t[2 * v][i]) % 60;       t[v][i] = t[2 * v][i] + t[2 * v + 1][x];     }   }   int get(int v, int s, int e, int l, int r, int st) {     if (l > r) return -1;     if (s == l && e == r) return t[v][st];     int m = (s + e) / 2;     int answ = 0;     int T = get(2 * v, s, m, l, min(r, m), st);     if (T == -1)       T = st;     else {       answ += T;       T += st;     }     int P = get(2 * v + 1, m + 1, e, max(m + 1, l), r, T % 60);     if (P != -1) answ += P;     return answ;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     a[n + 1] = 1;     build(1, 1, n + 1);     scanf( %d , &q);     while (q--) {       char x;       int aa, b;       cin >> x;       scanf( %d%d , &aa, &b);       if (x ==  A ) {         int T = get(1, 1, n + 1, aa, b - 1, 0);         printf( %d n , T);       } else {         a[aa] = b;         update(1, 1, n + 1, aa);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long a[100002];   long b[100002];   long s[100002];   long l[100002];   vector<int> br0, br1;   map<int, vector<int> > fre, an;   const int MAXN = 100001;   int comp = 0;   vector<int> g[MAXN], h[MAXN];   bool used[MAXN];   int timer, tin[MAXN], fup[MAXN], col[MAXN];   int n, ans = 0;   void IS_BRIDGE(int i, int j) {     br0.push_back(i);     br1.push_back(j);   }   void dfs(int v, int p = -1) {     used[v] = true;     tin[v] = fup[v] = timer++;     for (size_t i = 0; i < g[v].size(); ++i) {       int to = g[v][i];       if (to == p) continue;       if (used[to])         fup[v] = min(fup[v], tin[to]);       else {         dfs(to, v);         fup[v] = min(fup[v], fup[to]);         if (fup[to] > tin[v]) IS_BRIDGE(v, to);       }     }   }   void find_bridges() {     timer = 0;     for (int i = 0; i < n; ++i) used[i] = false;     for (int i = 0; i < n; ++i)       if (!used[i]) dfs(i);   }   void dfs_h(int i) {     used[i] = 1;     col[i] = comp;     for (int j = 0; j < fre[i].size(); j++)       if (!used[fre[i][j]]) dfs_h(fre[i][j]);   }   void dfs_k(int i, int dl, int z) {     used[i] = 1;     for (int j = 0; j < an[i].size(); j++)       if (an[i][j] == z) {         ans += dl + 1;       } else if (!used[an[i][j]])         dfs_k(an[i][j], dl + 1, z);   }   int main() {     int m, k, c;     cin >> n >> m;     for (int i = 1; i <= m; i++) {       cin >> a[i] >> b[i];       g[a[i]].push_back(b[i]);       g[b[i]].push_back(a[i]);     }     cin >> k;     for (int i = 1; i <= k; i++) cin >> s[i] >> l[i];     find_bridges();     for (int i = 1; i <= n; i++)       for (int j = 0; j < g[i].size(); j++) {         bool OK = 0;         for (int k = 0; k < br0.size(); k++) {           if (((br0[k] == i) && (br1[k] == g[i][j])) ||               ((br1[k] == i) && (br0[k] == g[i][j])))             OK = 1;         }         if (!OK) {           fre[i].push_back(g[i][j]);           fre[g[i][j]].push_back(i);         }       }     for (int i = 1; i <= n; i++) used[i] = 0;     for (int i = 1; i <= n; i++)       if (!used[i]) {         comp++;         dfs_h(i);       }     for (int k = 0; k < br0.size(); k++) {       an[col[br0[k]]].push_back(col[br1[k]]);       an[col[br1[k]]].push_back(col[br0[k]]);     }     for (int i = 1; i <= k; i++) {       if (col[s[i]] == col[l[i]])         cout << 0 << endl;       else {         for (int j = 1; j <= n; j++) used[j] = 0;         ans = 0;         dfs_k(col[s[i]], 0, col[l[i]]);         cout << ans << endl;       }     }   }
#include <bits/stdc++.h>   int main(int argc, const char* argv[]) {     int n, x;     std::cin >> n >> x;     std::vector<int> v(n);     for (int i = 0; i < n; i++) std::cin >> v[i];     std::sort(v.begin(), v.end());     for (int i = 0; i < n; i++) {       if (v[i] > x) {         std::cout << x - i << std::endl;         return 0;       } else if (v[i] == x) {         std::cout << x - i + 1 << std::endl;         return 0;       }     }     std::cout << x - v.size() << std::endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   const long long inf = (long long)1e9;   double PI = 3.14159265;   double eps = 1e-9;   long long t = 0;   long long pow(long long a, long long b) {     if (b == 0) return 1;     if (b % 2 == 1) {       return (pow(a, b - 1) * a);     }     if (b % 2 == 0) {       long long c = pow(a, b / 2);       return (c * c);     }   }   vector<pair<long long, long long>> reb;   long long dp[1 << 17];   long long krask[1 << 17];   vector<vector<long long>> g;   vector<long long> dep;   vector<vector<long long>> p;   vector<vector<long long>> dep2;   vector<long long> u;   vector<long long> tin, tout;   void dfs(long long v, long long k) {     tin[v] = t++;     p[v][0] = k;     for (long long i = 1; i < 20; i++) {       p[v][i] = p[p[v][i - 1]][i - 1];     }     for (long long i = 0; i < g[v].size(); i++) {       long long to = g[v][i];       if (dep[to] == -1) {         dep[to] = dep[v] + 1;         dep2[dep[to]].push_back(t);         dfs(to, v);       }     }     tout[v] = t;   }   long long parent(long long v, long long h) {     for (long long i = 0; i < 20; i++) {       if ((h & (1 << i))) {         v = p[v][i];       }     }     return v;   }   long long lca(long long a, long long b) {     if (dep[a] < dep[b]) swap(a, b);     a = parent(a, dep[a] - dep[b]);     if (a == b) return a;     for (long long i = 19; i >= 0; i--) {       if (p[a][i] != p[b][i]) {         a = p[a][i];         b = p[b][i];       }     }     return parent(a, 1);   }   struct stree {     vector<long long> t;     int n;     stree(vector<long long> a) {       n = 1;       while (n < a.size()) {         n *= 2;       }       t.resize(n + n);       for (int i = n; i < n + a.size(); i++) {         t[i] = a[i - n];       }       for (int i = n - 1; i > 0; i--) {         t[i] = t[i + i] + t[i + i + 1];       }     }     long long sum(long long l, long long r) {       long long sum = 0;       for (l += n, r += n; l <= r; l /= 2, r /= 2) {         if (l % 2 == 1) {           sum += t[l++];         }         if (r % 2 == 0) {           sum += t[r--];         }       }       return sum;     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, q;     cin >> n >> q;     vector<long long> a;     a.resize(n);     for (int i = 0; i < n; i++) {       cin >> a[i];     }     stree d(a);     vector<long long> k;     k.resize(q);     long long gl = 0;     int pred = 0;     for (int i = 0; i < q; i++) {       cin >> k[i];       long long r = a.size(), l = gl - 1;       while (r - l > 1) {         long long mid = (l + r) / 2;         long long sum = d.sum(gl, mid);         if (sum > k[i] + pred)           r = mid;         else {           l = mid;         }       }       if (r == a.size()) {         gl = 0;         pred = 0;       } else {         if (k[i] + pred < d.sum(gl, r - 1)) {           pred = k[i] + pred;         } else {           pred = k[i] + pred - d.sum(gl, r - 1);           gl = r;         }       }       cout << a.size() - gl << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a1, b1, a2, b2, a3, b3;     cin >> a1 >> b1 >> a2 >> b2 >> a3 >> b3;     int l1 = min(a1, b1);     int l2 = min(a2, b2);     int l3 = min(a3, b3);     int L1 = max(a1, b1);     int L2 = max(a2, b2);     int L3 = max(a3, b3);     if (l2 + l3 <= l1 && max(L2, L3) <= L1)       cout <<  YES             <<   n ;     else if (l2 + l3 <= L1 && max(L2, L3) <= l1)       cout <<  YES             <<   n ;     else if (L2 + L3 <= l1 && max(l2, l3) <= L1)       cout <<  YES             <<   n ;     else if (L2 + L3 <= L1 && max(l2, l3) <= l1)       cout <<  YES             <<   n ;     else if (L2 + l3 <= L1 && max(l2, L3) <= l1)       cout <<  YES             <<   n ;     else if (l2 + L3 <= L1 && max(L2, l3) <= l1)       cout <<  YES             <<   n ;     else       cout <<  NO             <<   n ;     return 0;   }
#include <bits/stdc++.h>   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(NULL);     int n;     std::cin >> n;     int a[2][n + 2];     unsigned long long b[2][n + 2];     b[0][0] = 0;     b[1][0] = 0;     b[0][1] = 0;     b[1][1] = 0;     for (int i = 2; i <= n + 1; i++) std::cin >> a[0][i];     for (int i = 2; i <= n + 1; i++) std::cin >> a[1][i];     for (int i = 2; i <= n + 1; i++) {       b[1][i % 3] = a[1][i] + std::max(b[0][(i - 1) % 3], b[0][(i - 2) % 3]);       b[0][i % 3] = a[0][i] + std::max(b[1][(i - 1) % 3], b[1][(i - 2) % 3]);     }     std::cout << std::max(b[0][(n + 1) % 3], b[1][(n + 1) % 3]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }   const int INF = (((1 << 30) - 1) << 1) + 1;   const int nINF = 1 << 31;   string s;   int main() {     ios::sync_with_stdio(false);     cin >> s;     int n = s.size();     int open, close, q, ans = 0;     for (int i = 0; i < (n); i++) {       open = 0, close = 0, q = 0;       for (int j = (i); j <= (n - 1); j++) {         if (s[j] ==  ( )           ++open;         else if (s[j] ==  ) )           ++close;         else {           ++close;           ++q;         }         if (close > open) {           if (q) {             --q;             ++open;             --close;           } else             break;         }         if ((i - j + 1) % 2 == 0 && open == close) {           ++ans;         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     long long n, k;     string x;     cin >> n >> k >> x;     string ans =   ;     int o = -1;     for (int i = 1; i < x.size(); i++) {       if (x.substr(i, x.size() - i) == x.substr(0, x.size() - i)) {         o = i;         break;       }     }     if (o == -1) {       for (int i = 0; i < k; i++) {         cout << x;       }     } else {       for (int i = 0; i < k; i++) {         cout << x.substr(0, o);       }       cout << x.substr(o, x.size() - o);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using lli = long long;   using lld = long double;   using ulli = unsigned long long int;   using pll = pair<lli, lli>;   using ttt = pair<lli, pll>;   using vttt = vector<ttt>;   using vll = vector<pll>;   using vl = vector<lli>;   using vi = vector<int>;   using vvi = vector<vector<int>>;   using cd = complex<lld>;   const double PI = acos(-1);   vvi adj, dist;   pll get(vi vect) {     cout <<  ?   << ((lli)(vect).size());     for (auto& x : vect) cout <<     << x;     cout <<   n ;     cout.flush();     pll ans;     cin >> ans.first >> ans.second;     return ans;   }   void dfs(int v, int p, int dis) {     dist[dis].push_back(v);     for (auto& x : adj[v])       if (x != p) {         dfs(x, v, dis + 1);       }   }   pll check(int val) {     if (dist[val].empty()) return {1000000007, 1000000007};     return get(dist[val]);   }   int tejas_919(int kkkk) {     lli n, m, k, q, u, v, temp = 0, ans = 0;     cin >> n;     adj = vvi(n + 2);     dist = vvi(n + 2);     for (int i = 1; i < n; i++) {       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     int root, pdist;     {       vi vect;       for (int i = 1; i < n + 1; i++) vect.push_back(i);       tie(root, pdist) = get(vect);     }     dfs(root, root, 0);     int l = (pdist + 1) / 2, r = pdist, cdis;     root = -1;     while (l <= r) {       int mid = (l + r) / 2;       tie(temp, cdis) = check(mid);       if (cdis == pdist) {         l = mid + 1;         root = temp;       } else         r = mid - 1;     }     if (root < 0) root = get(dist[l - 1]).first;     dist = vvi(n + 2);     dfs(root, root, 0);     ans = get(dist[pdist]).first;     cout <<  !   << root <<     << ans <<   n ;     cout.flush();     string s;     cin >> s;     return 0;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cout << fixed << setprecision(10);     int t = 1;     cin >> t;     for (int i = 0; i < t; i++) {       tejas_919(i + 1);     }     {};   }