malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, m;   int t[107][107];   int mini;   int a;   int maxi;   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       mini = 1000000009;       for (int j = 1; j <= m; j++) {         scanf( %d , &a);         if (a < mini) {           mini = a;         }       }       if (mini > maxi) maxi = mini;     }     printf( %d , maxi);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using LL = long long;   const int N = 100005;   struct Node {     char c;     int pos;     Node() {}     Node(char _c, int _pos) : c(_c), pos(_pos) {}     bool operator<(const Node& rhs) const {       if (c != rhs.c) return c < rhs.c;       return pos < rhs.pos;     }   };   Node p[N];   vector<int> q[26];   int main() {     int n, k;     scanf( %d%d , &n, &k);     string s;     cin >> s;     for (int i = 0; i < s.size(); ++i) {       p[i].c = s[i];       p[i].pos = i + 1;     }     int len = s.size();     sort(p, p + len);     for (int i = 0; i < len; ++i) {       q[p[i].c -  a ].push_back(p[i].pos);     }     for (int i = 1; i <= n; ++i) {       string t;       cin >> t;       LL res = 0;       for (int i = 0; i < t.size(); ++i) {         if (q[t[i] -  a ].size() == 0) {           res += t.size();         } else {           int d = 0;           int pos =               lower_bound(q[t[i] -  a ].begin(), q[t[i] -  a ].end(), i + 1) -               q[t[i] -  a ].begin();           if (pos == q[t[i] -  a ].size())             d = abs(i + 1 - q[t[i] -  a ][pos - 1]);           else if (pos == 0) {             d = abs(i + 1 - q[t[i] -  a ][pos]);           } else {             d = min(abs(i + 1 - q[t[i] -  a ][pos - 1]),                     abs(i + 1 - q[t[i] -  a ][pos]));           }           res += d;         }       }       printf( %lld n , res);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long x, maxi = 0, sum = 0;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(NULL);     int x;     cin >> x;     int one = 0, zero = 0;     string s;     cin >> s;     for (int i = 0; i < x; i++) {       if (s[i] -  0  == 1)         one++;       else         zero++;     }     cout << abs(one - zero);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long a;     cin >> a;     long long m = 0;     vector<long long> c;     long long b[a];     for (int i = 0; i < a; i++) {       cin >> b[i];     }     for (int y = 0; y < a; y++) {       m = 0;       for (int i = 0; i < a; i++) {         long long x = abs(i - y) + i + y;         x = x * b[i] * 2;         m = m + x;       }       c.push_back(m);     }     sort(c.begin(), c.end());     cout << c[0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   struct node {     int mx[11], mn[11], num;     friend bool operator<(const node &A, const node &B) {       int ok = 1;       for (int i = 1; i <= k; i++) ok &= A.mx[i] < B.mn[i];       return ok;     }     friend node operator+(const node &A, const node &B) {       node C;       C.num = A.num + B.num;       for (int i = 1; i <= k; i++)         C.mx[i] = max(A.mx[i], B.mx[i]), C.mn[i] = min(A.mn[i], B.mn[i]);       return C;     }   };   inline int read(register int a = 0, register char ch = getchar()) {     while (ch <  0  || ch >  9 ) ch = getchar();     while (ch >=  0  && ch <=  9 )       a = (a << 3) + (a << 1) + (ch ^ 48), ch = getchar();     return a;   }   set<node> QAQ;   int main() {     n = read(), k = read();     for (int i = 1; i <= n; i++) {       node tmp;       tmp.num = 1;       for (int j = 1; j <= k; j++) tmp.mx[j] = tmp.mn[j] = read();       set<node>::iterator it = QAQ.find(tmp);       while (it != QAQ.end()) {         tmp = tmp + (*it);         QAQ.erase(it);         it = QAQ.find(tmp);       }       QAQ.insert(tmp);       printf( %d n , (*QAQ.rbegin()).num);     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n;     string s;     int finish_x, finish_y;     cin >> n >> s >> finish_x >> finish_y;     if (n < abs(finish_x) + abs(finish_y) ||         n % 2 != (abs(finish_x) + abs(finish_y)) % 2) {       cout << -1;       return 0;     }     vector<int> dx(n + 1), dy(n + 1);     dx[n] = dy[n] = 0;     map<char, pair<int, int>> m;     m[ U ] = {0, 1};     m[ D ] = {0, -1};     m[ L ] = {-1, 0};     m[ R ] = {1, 0};     for (int i = n - 1; i >= 0; --i) {       auto &[cdx, cdy] = m[s[i]];       dx[i] = dx[i + 1] + cdx;       dy[i] = dy[i + 1] + cdy;     }     vector<int> x(n + 1), y(n + 1);     x[0] = y[0] = 0;     for (int i = 0; i < n; ++i) {       auto [cdx, cdy] = m[s[i]];       x[i + 1] = x[i] + cdx;       y[i + 1] = y[i] + cdy;     }     int l = -1, r = n;     while (r - l > 1) {       int m = (l + r) / 2;       bool good = false;       for (int i = 0; i <= n - m; ++i) {         int u = x[i] + dx[i + m];         int v = y[i] + dy[i + m];         if (abs(finish_x - u) + abs(finish_y - v) <= m) {           good = true;           break;         }       }       if (good)         r = m;       else         l = m;     }     cout << r;   }
#include <bits/stdc++.h>   using namespace std;   long double eps = (long double)1 / 1e9;   long long inf = LLONG_MAX, mod1 = 1e9 + 7, mod2 = 998244353;   long long sqr(long long a) { return a * a; }   long long qb(long long a) { return a * a * a; }   long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }   long long binpow(long long a, long long b, long long mod) {     return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod                       : sqr(binpow(a, b / 2, mod)) % mod)              : 1;   }   long long binmult(long long a, long long b, long long mod) {     return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod                       : (2 * binmult(a, b / 2, mod)) % mod)              : 0;   }   long long b[51], kl[27];   bool used[51];   char ans[51];   int main() {     cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0);     long long q, n, i, j, ps, kt;     string a;     cin >> q;     while (q--) {       cin >> a >> n;       ps = 25;       for (i = 0; i < 26; i++) kl[i] = 0;       for (i = 0; i < a.size(); i++) kl[a[i] -  a ]++;       for (i = 1; i <= n; i++) cin >> b[i], used[i] = 0;       while (1) {         kt = 0;         for (i = 1; i <= n; i++)           if (!b[i] && !used[i]) kt++;         if (!kt) break;         while (kl[ps] < kt) ps--;         vector<long long> vc;         for (i = 1; i <= n; i++)           if (!b[i] && !used[i]) used[i] = 1, vc.push_back(i);         for (auto f : vc) {           ans[f] =  a  + ps;           for (j = 1; j <= n; j++)             if (!used[j]) b[j] -= abs(j - f);         }         ps--;       }       for (i = 1; i <= n; i++) cout << ans[i];       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const long long infLL = 0x3f3f3f3f3f3f3f3fLL;   const int hash_mod = 1000037;   const double eps = 1e-10;   const double pi = acos(-1);   const int maxn = 5000 + 5;   int n, m;   char s[maxn];   int f[maxn][maxn], g[maxn];   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; ++i) {       scanf( %s , s + 1);       for (int j = 1; j <= m; ++j)         if (s[j] ==  1 ) f[i][j] = f[i][j - 1] + 1;     }     int res = 0;     for (int j = 1; j <= m; ++j) {       memset(g, 0, sizeof(g));       for (int i = 0; i < n; ++i) g[f[i][j]]++;       int t = 0;       for (int i = j; i > 0; --i) {         t += g[i];         res = max(res, i * t);       }     }     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<long long> s;   void dfs(int a, int b, long long sum, int d, int& n) {     if (d >= 0) {       if (sum <= n && sum > 0) {         s.insert(sum);       }     }     if (d == 0) {       return;     }     dfs(a, b, sum * 10 + a, d - 1, n);     dfs(a, b, sum * 10 + b, d - 1, n);   }   int main() {     int n;     cin >> n;     int c = 0, nn = n;     while (nn) {       nn /= 10;       ++c;     }     for (int i = 0; i <= 9; ++i) {       for (int j = i + 1; j <= 9; ++j) {         dfs(i, j, 0, c, n);       }     }     cout << s.size() << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 53e4, mod = 998244353;   int n, nn, L, A, B, ans, fac[N], inv[N], a[N], b[N], c[N], R[N];   int C(int a, int b) { return 1ll * fac[a] * inv[b] % mod * inv[a - b] % mod; }   int qpow(int a, int b) {     int ret = 1;     while (b) {       if (b & 1) ret = 1ll * ret * a % mod;       a = 1ll * a * a % mod, b >>= 1;     }     return ret;   }   void init(int n) {     nn = 1, L = 0;     while (nn <= 2 * n) nn <<= 1, ++L;     for (int i = 1; i < nn; ++i) R[i] = (R[i >> 1] >> 1) | ((i & 1) << L - 1);   }   void NTT(int* a, int tp) {     for (int i = 0; i < nn; ++i)       if (i < R[i]) swap(a[i], a[R[i]]);     for (int i = 1; i < nn; i <<= 1) {       int wn = qpow(3, tp * (mod / (i * 2)) + mod - 1);       for (int j = 0; j < nn; j += i * 2)         for (int k = 0, w = 1; k < i; ++k, w = 1ll * w * wn % mod) {           int x = a[j + k], y = 1ll * w * a[j + k + i] % mod;           a[j + k] = (x + y) % mod;           a[j + k + i] = (x - y + mod) % mod;         }     }     if (tp == 1) return;     int invn = qpow(nn, mod - 2);     for (int i = 0; i < nn; ++i) a[i] = 1ll * a[i] * invn % mod;   }   void solve(int n) {     if (n == 1) {       a[1] = 1;       return;     }     if (n & 1) {       solve(n - 1);       for (int i = n - 1; ~i; --i)         a[i + 1] = (a[i + 1] + a[i]) % mod, a[i] = 1ll * (n - 1) * a[i] % mod;       return;     }     int l = n / 2;     solve(l), init(l);     for (int i = 0; i < nn; ++i) b[i] = c[i] = 0;     int tmp = 1;     for (int i = 0; i <= l; ++i)       b[i] = 1ll * a[i] * fac[i] % mod, c[i] = 1ll * tmp * inv[i] % mod,       tmp = 1ll * tmp * l % mod;     reverse(b, b + l + 1);     NTT(b, 1), NTT(c, 1);     for (int i = 0; i < nn; ++i) b[i] = 1ll * b[i] * c[i] % mod;     NTT(b, -1);     reverse(b, b + l + 1);     for (int i = 0; i <= l; ++i) b[i] = 1ll * inv[i] * b[i] % mod;     for (int i = l + 1; i < nn; ++i) b[i] = 0;     init(n);     NTT(a, 1), NTT(b, 1);     for (int i = 0; i < nn; ++i) a[i] = 1ll * a[i] * b[i] % mod;     NTT(a, -1);   }   int main() {     scanf( %d%d%d , &n, &A, &B);     if (n == 1) {       if (A == 1 && B == 1)         puts( 1 );       else         puts( 0 );       return 0;     }     if (A < 1 || B < 1 || A + B > n + 1 || A + B == 2) {       puts( 0 );       return 0;     }     fac[0] = inv[0] = 1;     for (int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;     inv[n] = qpow(fac[n], mod - 2);     for (int i = n; i; --i) inv[i - 1] = 1ll * inv[i] * i % mod;     solve(n - 1);     ans = 1ll * a[A + B - 2] * C(A + B - 2, A - 1) % mod;     printf( %d , ans);   }
#include <bits/stdc++.h>   using namespace std;   int n, c[25], coin[25];   int ans = 0;   bool can;   int p_b;   bool good() {     int cnt = 0;     for (int i = 0; i < 25; i++) cnt += coin[i];     return cnt == 1;   }   void rec(int s, int r, int p) {     if (r == 1) {       if (c[p] > 1) coin[c[p]]++;       p++;       if (p < n) r = c[p];       s = 1;     }     if (p == n && good()) can = true;     for (int i = s; i < c[p] - 1; i++) {       for (int j = 0; j <= coin[i]; j++) {         if (r - i * j >= 1) {           coin[i] -= j;           rec(i + 1, r - i * j, p);           coin[i] += j;         }         if (can) return;       }     }     if (r == 1) {       p--;       if (c[p] > 1) coin[c[p]]--;     }   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &c[i]);       if (c[i] == 1) coin[1]++;     }     sort(c, c + n);     int start_pos = 0;     for (int i = 0; i < n; i++)       if (c[i] != 1) {         start_pos = i;         break;       }     rec(1, c[start_pos], start_pos);     if (can) {       cout <<  YES ;     } else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[1002], l, n;     scanf( %d %d , &n, &l);     for (int i = 0; i < n; i++) scanf( %d , a + i);     sort(a, a + n);     double d = max(a[0] - 0, l - a[n - 1]);     for (int i = n - 1; i > 0; i--) d = max(d, double(a[i] - a[i - 1]) / 2);     printf( %0.10lf , d);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double m, n;     double i;     cin >> m >> n;     double ans = 0;     for (i = 1; i <= m; i++) {       ans = ans + i * (pow((i / m), n) - pow(((i - 1) / m), n));     }     printf( %.9lf , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int pre[5005][5005];   int main() {     int n, k;     bool flag = true;     scanf( %d%d , &n, &k);     map<int, int> m;     for (int i = 1; i <= n; i++) {       int yy;       scanf( %d , &yy);       m[yy]++;       pre[yy][m[yy]] = i;       if (m[yy] > k) flag = false;     }     int xx = 0;     bool flag1 = false;     int p[5005];     for (int i = 1; i <= 5000; i++) {       for (int j = 1; j <= m[i]; j++) {         p[pre[i][j]] = ++xx;         if (xx == k) {           flag1 = true;           xx = 0;         }       }     }     if (flag == false || flag1 == false)       puts( NO );     else {       puts( YES );       for (int i = 1; i <= n; i++) {         cout << p[i] <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const long double PI = 4 * atan((long double)1);   const long long int INF = 1e18;   const long long int NINF = -1e18;   long long int get_hash(string s) {     long long int N = 1000001;     long long int base[N], A = 11, MD = 1110111110111;     base[0] = 1;     for (long long int i = (1); i < (N); ++i) base[i] = (base[i - 1] * A) % MD;     long long int hs = 0;     for (long long int i = (0); i < (s.size()); ++i) {       hs += (s[i] * base[i]);       hs %= MD;     }     return hs;   }   long long power(long long a, long long n) {     long long res = 1;     while (n) {       if (n % 2) res *= a;       a *= a;       n /= 2;     }     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int n, m;     cin >> n >> m;     map<int, int> mpc;     long long int a[n], b[m];     for (long long int i = (0); i < (n); ++i) cin >> a[i];     int arr[n];     map<int, int> mpa, mpb;     int k = 0;     for (long long int i = (0); i < (m); ++i) {       cin >> b[i];       if (mpa[b[i]] != 1) {         arr[k] = b[i];         k++;         mpa[b[i]] = 1;       }     }     if (k != n) {       for (long long int i = (1); i < (n + 1); ++i) {         if (mpa[i] != 1) {           mpa[i] = 1;           arr[k] = i;           k++;         }       }     }     stack<int> st, st1;     for (int i = n - 1; i >= 0; i--) st.push(arr[i]);     long long int ans = 0;     for (long long int i = (0); i < (m); ++i) {       int x = b[i];       while (st.top() != x) {         st1.push(st.top());         ans += a[st.top() - 1];         st.pop();       }       st.pop();       while (!st1.empty()) {         st.push(st1.top());         st1.pop();       }       st.push(x);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   int main() {     int n;     cin >> n;     int arr[n + 1];     for (int i = 1; i <= n; i++) cin >> arr[i];     int long long ans = 0;     for (int mx = 0; mx < 31; mx++) {       int long long cur = 0;       int long long best = 0;       for (int i = 1; i < n + 1; i++) {         int val = (arr[i] > mx ? -INF : arr[i]);         cur += val;         best = min(best, cur);         ans = max(ans, (cur - best) - mx);       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T, class U>   T &ctmax(T &x, const U &y) {     return x = max<T>(x, y);   }   template <class T, class U>   T &ctmin(T &x, const U &y) {     return x = min<T>(x, y);   }   int main() {     cin.tie(0)->sync_with_stdio(0);     cin.exceptions(ios::badbit | ios::failbit);     int n, c1, c2;     cin >> n >> c1 >> c2;     vector<int> a(n);     for (auto i = 0; i < n; ++i) {       cin >> a[i];     }     long long res = numeric_limits<long long>::max();     vector<int> primes;     auto get_primes = [&](int x) {       for (auto p = 2; p * p <= x; ++p) {         if (x % p == 0) {           primes.push_back(p);           while (x % p == 0) {             x /= p;           }         }       }       if (x >= 2) {         primes.push_back(x);       }     };     get_primes(a.front() - 1), get_primes(a.front()), get_primes(a.front() + 1);     get_primes(a.back() - 1), get_primes(a.back()), get_primes(a.back() + 1);     sort(primes.begin(), primes.end());     primes.erase(unique(primes.begin(), primes.end()), primes.end());     for (auto p : primes) {       array<long long, 3> dp{};       for (auto x : a) {         array<long long, 3> dp_next{};         dp_next.fill(numeric_limits<long long>::max() / 2);         if (x % p == 0) {           ctmin(dp_next[0], dp[0]);           ctmin(dp_next[2], min(dp[1], dp[2]));         }         ctmin(dp_next[1], min(dp[0], dp[1]) + c1);         if ((x + 1) % p == 0 || (x - 1) % p == 0) {           ctmin(dp_next[0], dp[0] + c2);           ctmin(dp_next[2], min(dp[1], dp[2]) + c2);         }         swap(dp, dp_next);       }       ctmin(res, *min_element(dp.begin(), dp.end()));     }     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int kl[5] = {0}, n, ans = 0, x;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> x;       kl[x]++;     }     x = min(kl[1], kl[2]);     ans += x;     kl[1] -= x;     kl[2] -= x;     kl[3] += x;     if (kl[1] != 0) {       ans += kl[1] / 3 * 2;       kl[3] += kl[1] / 3;       kl[1] %= 3;       if (kl[1] == 1) {         if (kl[3] != 0) {           ans++;           kl[3]--;           kl[4]++;           kl[1] = 0;         } else if (kl[4] >= 2) {           ans += 2;           kl[3] += 3;           kl[1] = 0;           kl[4] -= 2;         }       }       if (kl[1] == 2) {         if (kl[3] >= 2) {           ans += 2;           kl[1] = 0;           kl[3] -= 2;           kl[4] += 2;         } else {           ans++;           kl[1] = 0;           kl[2]++;         }       }     }     if (kl[2] != 0) {       ans += kl[2] / 3 * 2;       kl[3] += kl[2] / 3 * 2;       kl[2] %= 3;       if (kl[2] == 2) {         ans += 2;         kl[2] = 0;       }       if (kl[2] == 1) {         if (kl[4] != 0) {           ans += 1;           kl[2]--;         } else if (kl[3] >= 2) {           ans += 2;           kl[2] = 0;         }       }     }     if (kl[2] == 0 && kl[1] == 0)       cout << ans << endl;     else       cout <<  -1  << endl;     cin >> n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, c = 0, a[101];     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     for (i = 0; i < n - 1; i++) {       if (a[i] == 0) {         if (a[i + 1] == 1 && a[i - 1] == 1) {           c++;           a[i + 1] = 0, a[i - 1] = 0;         }       }     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = 3.141592653589793238;   int main() {     int t, a, b;     cin >> t;     while (t--) {       int n;       cin >> n;       int a[n];       for (long long int i = 0; i < n; i++) cin >> a[i];       int ct = 0, ct1 = 0, ct2 = 0;       sort(a, a + n);       for (long long int i = 0; i < n; i++) {         if (a[i] % 2 == 0)           ct1 += 1;         else           ct2 += 1;       }       int i = 0;       while (i < (n - 1)) {         if (a[i + 1] - a[i] == 1) {           ct += 1;           i += 1;         }         i += 1;       }       if (ct1 % 2 == 0 && ct2 % 2 == 0) {         cout <<  YES ;       } else {         int e = 0;         if (ct1 % 2 != 0) {           if (ct2 > 0 && ct > 0) {             if ((ct2 - 1) % 2 == 0) {               e = 1;               ct2 -= 1;               ct1 -= 1;             }           }         } else if (ct2 % 2 != 0) {           if (ct1 > 0 && ct > 0) {             if ((ct1 - 1) % 2 == 0) e = 1;           }         }         if (e == 1)           cout <<  YES ;         else           cout <<  NO ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> a[1111];   queue<int> p;   int ji[1111], f = 1, b[1111], c[1111];   void dfs(int p) {     ji[p]++;     for (int i = 0; i < a[p].size(); i++) {       if (ji[a[p][i]] >= 3) {         f = 0;         return;       }       dfs(a[p][i]);     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d%d , &x, &y);       a[x].push_back(y);       b[y]++;       c[x]++;       c[y]++;     }     int h = 0;     for (int i = 1; i <= n; i++) {       if (!b[i] && c[i]) {         p.push(i);         ji[i]++;         h++;       }     }     while (!p.empty()) {       int k = p.front();       p.pop();       ji[k]++;       for (int i = 0; i < a[k].size(); i++) {         int x = a[k][i];         b[x]--;         if (!b[x] && !ji[x]) {           p.push(x);           h++;           ji[x]++;         }       }     }     if (h == n)       printf( yes n );     else       printf( no n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > adj;   bool vis[100100];   int mx = 0;   int far = -1;   void dfs(int cur, int len) {     if (vis[cur]++) return;     if (len > mx) {       mx = len;       far = cur;     }     for (int x : adj[cur]) dfs(x, len + 1);   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     adj = vector<vector<int> >(n);     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d%d , &x, &y);       adj[x - 1].push_back(y - 1);       adj[y - 1].push_back(x - 1);     }     bool ok = (m == n - 1);     dfs(0, 0);     memset(vis, 0, sizeof(vis));     dfs(far, 0);     printf( %d , mx);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   ll mod = 1e9 + 7;   ll bpow(ll a, ll b, ll m) {     a %= m;     ll res = 1;     while (b > 0) {       if (b & 1) res = res * a % m;       a = a * a % m;       b >>= 1;     }     return res;   }   bool cmp(vector<ll> v1, vector<ll> v2) { return v1[1] < v2[1]; }   ll power(ll x, ll y) {     ll result = 1;     while (y > 0) {       if (y % 2 == 0) {         x = x * x;         y = y / 2;       } else {         result = result * x;         y = y - 1;       }     }     return result;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     cin >> t;     while (t--) {       ll n;       cin >> n;       ll a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       sort(a, a + n);       ll count = 0;       ll tar = n / 2;       for (int i = 1; i < n; i++) {         cout << a[i] <<     << a[0] << endl;         count++;         if (count == tar) break;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main(void) {     int n;     vector<string> v;     cin >> n;     for (int i = 0; i < int(n); i++) {       string s;       cin >> s;       v.push_back(s);     }     for (int i = 0; i < int(10); i++) {       cout <<  ??  << i <<  >>  << i <<  ??  << endl;     }     cout <<  ??>>?  << endl;     for (int i = 0; i < int(9); i++) {       cout << i <<  ?             <<  <>  << i + 1 << endl;     }     cout <<  9?>>?0  << endl;     cout <<  ?<>1  << endl;     cout <<  >>??  << endl;     return 0;   }