malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 5;   bool isPrime[N], vst[N];   int frq[26];   vector<int> adj[N];   vector<int> cc;   vector<vector<int>> vcc;   void dfs(int u) {     cc.push_back(u);     vst[u] = 1;     for (auto v : adj[u]) {       if (!vst[v]) dfs(v);     }   }   bool cmp(vector<int> s, vector<int> f) {     return (int)(s.size()) > (int)(f.size());   }   int main() {     ios ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     cin >> s;     for (auto i : s) {       frq[i -  a ]++;     }     isPrime[0] = isPrime[1] = 1;     for (int i = 2; i <= (int)(s.size()); i++) {       if (isPrime[i]) continue;       for (int j = 2 * i; j <= (int)(s.size()); j += i) {         isPrime[j] = 1;         adj[i].push_back(j);         adj[j].push_back(i);       }     }     for (int i = 1; i <= (int)(s.size()); i++) {       if (!isPrime[i] && !vst[i]) {         cc.clear();         dfs(i);         vcc.push_back(cc);       }     }     vector<char> out((int)(s.size()) + 2);     for (auto i : vcc) {       int siz = (int)(i.size());       int mn = (int)(s.size()) + 1;       int ch = 26;       for (int j = 0; j < 26; j++) {         if (frq[j] >= siz && frq[j] < mn) {           mn = frq[j];           ch = j;         }       }       if (ch == 26) {         return cout <<  NO n , 0;       }       frq[ch] -= siz;       for (auto j : i) {         out[j] = ch +  a ;       }     }     for (int i = 1; i <= (int)(s.size()); i++) {       for (int j = 0; j < 26; j++) {         if (frq[j]) {           frq[j]--;           out[i] = j +  a ;           break;         }       }     }     cout <<  YES n ;     for (int i = 1; i <= (int)(s.size()); i++) cout << out[i];   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5, INF = 1e9;   int a[N], n, x, y, res = 0;   int main() {     int t;     ios::sync_with_stdio(false);     cin >> t;     while (t--) {       cin >> n >> x >> y;       int res = INF;       int rs = 0, rc = 0;       for (int i = 1; i <= x; i++) {         for (int j = 1; j <= y - x + 1; j++) {           int c = i;           bool flag = true;           bool fa = false, fb = false;           for (int k = 1; k <= n; k++) {             if (c == x) {               fa = true;             }             if (c == y) {               fb = true;             }             if (c > x && fa == false) break;             if (c > y && fb == false) break;             c += j;           }           if (fa && fb) {             if (c < res) {               res = c;               rs = i;               rc = j;             }           }         }       }       int cnt = 1;       for (int i = rs; cnt <= n; cnt++, i += rc) {         cout << i <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 5;   int n, m, k, a[N][N];   const int mod = 1e9 + 7;   int f[N][N], used[15];   int ans = 0;   inline void Plus(int &x, const int &y) {     x += y;     if (x >= mod) x -= mod;   }   inline int dfs(int x, int y) {     if (y > m) y = 1, ++x;     if (x == n + 1) return 1;     int now = f[x][y - 1] | f[x - 1][y], tmp = -1, res = 0;     int num = 0;     for (int i = k; i >= 1; i--) num += !((now >> (i - 1)) & 1);     if (n + m - x - y + 1 > num) return 0;     for (int i = 1; i <= k; i++)       if (!(now >> (i - 1) & 1)) {         if (!a[x][y] || a[x][y] == i) {           f[x][y] = now | (1 << i - 1);           if (++used[i] == 1) {             if (tmp == -1) tmp = dfs(x, y + 1);             Plus(res, tmp);           } else             Plus(res, dfs(x, y + 1));           --used[i];         }       }     return res;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) scanf( %d , &a[i][j]), ++used[a[i][j]];     if (n + m - 1 > k) return printf( 0 n ), 0;     printf( %d n , dfs(1, 1));   }
#include <bits/stdc++.h>   #pragma GCC diagnostic push   #pragma GCC diagnostic ignored  -Wunused-variable    using namespace std;   using ll = long long;   const ll N = 1e6 + 3LL;   const int inf = 1e9 + 3;   const ll M = 1e9 + 7;   const ll T = 998244353;   const double pi = 3.14159;   ll n, m;   ll t[4 * N];   ll xl[N], xr[N];   bool mark[N];   vector<ll> start[N], en[N];   void upd(ll v, ll tl, ll tr, ll pos, ll val) {     if (tl == tr) {       t[v] = val;       return;     }     ll tm = (tl + tr) / 2;     if (pos <= tm) {       upd(2 * v, tl, tm, pos, val);     } else {       upd(2 * v + 1, tm + 1, tr, pos, val);     }     t[v] = t[2 * v] + t[2 * v + 1];   }   ll query(ll v, ll tl, ll tr, ll l, ll r) {     if (l > r) {       return 0;     }     if (tl == l && tr == r) {       return t[v];     }     ll tm = (tl + tr) / 2;     return query(2 * v, tl, tm, l, min(r, tm)) +            query(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);   }   void solve() {     cin >> n >> m;     ll i, j, w1, w2, p;     for (i = 0; i <= N - 1; i++) {       mark[i] = false;     }     ll ans = 1;     for (i = 1; i <= n; i++) {       cin >> p >> w1 >> w2;       mark[p] = true;       xl[p] = w1;       xr[p] = w2;       if (w1 == 0 && w2 == 1000000LL) {         ans++;       }     }     for (i = 1; i <= m; i++) {       cin >> p >> w1 >> w2;       start[w1].push_back(p);       en[w2].push_back(p);       if (w1 == 0 && w2 == 1000000LL) {         ans++;       }     }     ll e = 999999LL;     for (i = 0; i <= 1000000LL; i++) {       for (auto u : start[i]) {         upd(1, 1, e, u, 1);       }       if (mark[i]) {         ans += query(1, 1, e, max(xl[i], 1LL), min(xr[i], e));       }       for (auto u : en[i]) {         upd(1, 1, e, u, 0);       }     }     cout << ans <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int _t = 1, i;     for (i = 1; i <= _t; i++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int t = 0, x = 0, ans = 0;   int a, b;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d%d , &a, &b);       x -= a - t;       if (x < 0) x = 0;       x += b;       ans = max(ans, x);       t = a;     }     printf( %d %d , t + x, ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, p = (1 << 19);   pair<pair<int, int>, pair<int, int> > w[(1 << 20)];   int rmax[(1 << 20)];   priority_queue<pair<int, int> > pq;   int rpush[(1 << 20)];   int loc[(1 << 20)];   int best = 0, bestx = 0, besty = 0;   void push(int a) {     rmax[a] += rpush[a];     if (a < p) {       rpush[2 * a] += rpush[a];       rpush[2 * a + 1] += rpush[a];     }     rpush[a] = 0;   }   int get_max() {     push(1);     return rmax[1];   }   void range_add(int x, int lo, int hi, int qlo, int qhi, int val) {     push(x);     if (hi < qlo || lo > qhi) return;     if (hi <= qhi && lo >= qlo) {       rpush[x] += val;       push(x);       return;     } else {       range_add(2 * x, lo, (hi + lo) / 2, qlo, qhi, val);       range_add(2 * x + 1, (hi + lo) / 2 + 1, hi, qlo, qhi, val);       if (rmax[2 * x] < rmax[2 * x + 1]) {         rmax[x] = rmax[2 * x + 1];         loc[x] = loc[2 * x + 1];       } else {         rmax[x] = rmax[2 * x];         loc[x] = loc[2 * x];       }     }   }   void do_loc(int x, int lo, int hi) {     loc[x] = lo;     if (x >= p) return;     do_loc(2 * x, lo, (hi + lo) / 2);     do_loc(2 * x + 1, (hi + lo) / 2 + 1, hi);   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d %d %d , &w[i].first.first, &w[i].first.second,             &w[i].second.first);       w[i].second.second = i + 1;     }     sort(w, w + n);     memset(rmax, 0, sizeof(rmax));     memset(rpush, 0, sizeof(rpush));     memset(loc, 0, sizeof(loc));     do_loc(1, 1, p);     int j = 0;     while (j < n) {       range_add(1, 1, p, w[j].first.second, w[j].second.first, 1);       pq.push(pair<int, int>(-w[j].first.second, j));       while (-pq.top().first < w[j].first.first) {         range_add(1, 1, p, w[pq.top().second].first.second,                   w[pq.top().second].second.first, -1);         pq.pop();       }       if (get_max() > best) {         best = get_max();         bestx = w[j].first.first;         besty = loc[1];       }       j++;     }     vector<int> ans;     for (int i = 0; i < n; i++) {       if (w[i].first.first <= bestx && w[i].first.second >= bestx &&           w[i].first.second <= besty && w[i].second.first >= besty) {         ans.push_back(w[i].second.second);       }     }     printf( %d n , ans.size());     for (int i = 0; i < (int)ans.size(); i++) {       if (i != 0) printf(   );       printf( %d , ans[i]);     }     printf(  n );   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int inf = 0x3f3f3f3f;   const int N = 1e5 + 5;   const int M = 1e5 + 5;   const int mod = 1e9 + 7;   int T;   int n, ind, l, r;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> ind >> l >> r;     if (l == 1 && r == n) {       cout << 0;     } else if (l == 1) {       cout << abs(r - ind) + 1;     } else if (r == n) {       cout << abs(ind - l) + 1;     } else {       if (ind >= l && ind <= r) {         cout << min(r - ind, ind - l) + 2 + r - l;       } else if (ind < l) {         cout << r - ind + 2;       } else {         cout << ind - l + 2;       }     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   const int mod = 1e9 + 7;   int main() {     int n;     cin >> n;     map<string, int> mp;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       if (mp.find(s) != mp.end()) {         cout <<  YES n ;         continue;       } else {         cout <<  NO n ;         mp[s] = 1;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve();   int main() {     srand(time(0));     cout.setf(ios::fixed);     cout.precision(10);     int tn = 1;     for (int i = 0; i < tn; ++i) solve();   }   vector<int> g[100001];   const long long mod = 1000000007;   inline void add(long long &a, long long b) {     a += b;     a %= mod;   }   pair<long long, long long> dfs(int u) {     sort(g[u].begin(), g[u].end());     long long res[2][2][2];     memset(res, 0, sizeof(res));     res[1][0][0] = 1;     for (int i = 0; i < ((int)(g[u]).size()); ++i) {       pair<long long, long long> c = dfs(g[u][i]);       long long even = c.first;       long long odd = c.second;       long long cres[2][2][2];       for (int sum = 0; sum < 2; ++sum)         for (int was_odd = 0; was_odd < 2; ++was_odd)           for (int was_even = 0; was_even < 2; ++was_even)             cres[sum][was_odd][was_even] = res[sum][was_odd][was_even];       for (int sum = 0; sum < 2; ++sum)         for (int was_odd = 0; was_odd < 2; ++was_odd)           for (int was_even = 0; was_even < 2; ++was_even) {             add(res[sum ^ 1][1][was_even], odd * cres[sum][was_odd][was_even]);             add(res[sum][was_odd][1], even * cres[sum][was_odd][was_even]);           }     }     for (int sum = 0; sum < 2; ++sum)       for (int was_odd = 0; was_odd < 2; ++was_odd)         for (int was_even = 0; was_even < 2; ++was_even) {           if ((was_odd && sum == 1) || (was_even && sum == 0))             add(res[sum][was_odd][was_even], res[sum][was_odd][was_even]);         }     long long odd = 0, even = 0;     for (int was_odd = 0; was_odd < 2; ++was_odd)       for (int was_even = 0; was_even < 2; ++was_even) {         add(odd, res[1][was_odd][was_even]);         add(even, res[0][was_odd][was_even]);       }     return make_pair(even, odd);   }   void solve() {     int n;     cin >> n;     for (int i = 0; i < n - 1; ++i) {       int p;       cin >> p;       --p;       g[p].push_back(i + 1);     }     pair<long long, long long> res = dfs(0);     cout << (res.first + res.second) % mod <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int n, m;     cin >> n >> m;     int a[n][m];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) cin >> a[i][j];     int flag = 0;     for (int i = n - 2; i >= 1; i--) {       for (int j = m - 2; j >= 1; j--) {         if ((a[i + 1][j] == a[i][j - 1]) || (a[i][j + 1] == a[i - 1][j])) {           flag = 1;           break;         } else if (a[i][j] == 0) {           a[i][j] = min(a[i + 1][j], a[i][j + 1]) - 1;         }         if (a[i][j] <= a[i - 1][j] || a[i][j] <= a[i][j - 1]) {           flag = 1;           break;         }       }     }     int sum = 0;     for (int i = 0; i < n - 1; i++) {       if (a[i][0] >= a[i + 1][0] || a[i][m - 1] >= a[i + 1][m - 1]) {         flag = 1;         break;       }     }     for (int i = 0; i < m - 1; i++) {       if (a[0][i] >= a[0][i + 1] || a[n - 1][i] >= a[n - 1][i + 1]) {         flag = 1;         break;       }     }     if (flag == 1) {       cout << -1 <<   n ;       return 0;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) sum += a[i][j];     }     cout << sum;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   namespace IO_Optimization {   inline int read() {     int X = 0, w = 0;     char ch = 0;     while (!isdigit(ch)) {       w |= ch ==  - ;       ch = getchar();     }     while (isdigit(ch)) {       X = (X << 3) + (X << 1) + (ch ^ 48);       ch = getchar();     }     return w ? -X : X;   }   inline void write(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) write(x / 10);     putchar(x % 10 +  0 );   }   }  // namespace IO_Optimization   using namespace IO_Optimization;   int n, k;   double sum;   struct Node {     int num, pos;   } a[2000 + 2], b[2000 + 2];   struct Trans {     int s[2000 + 2];   } ans[2000 + 2];   int tot1, tot2;   inline bool cmp(Node x, Node y) { return x.num > y.num; }   int main() {     n = read(), k = read();     for (register int i = 1; i <= n; ++i) {       int x = read(), y = read();       if (y == 1)         a[++tot1].num = x, a[tot1].pos = i;       else         b[++tot2].num = x, b[tot2].pos = i;     }     sort(a + 1, a + 1 + tot1, cmp);     int noww = k - 1 < tot1 ? k - 1 : tot1;     for (register int i = 1; i <= noww; ++i) {       ans[i].s[++ans[i].s[0]] = a[i].pos;       sum += a[i].num * 0.5;     }     if (tot1 <= k - 1) {       for (register int i = 1; i <= tot2; ++i) {         int nowww = tot1 + i < k ? tot1 + i : k;         sum += b[i].num;         ans[nowww].s[++ans[nowww].s[0]] = b[i].pos;       }     } else {       int minn = 1e9;       for (register int i = k; i <= tot1; ++i) {         sum += a[i].num;         ans[k].s[++ans[k].s[0]] = a[i].pos;         minn = a[i].num < minn ? a[i].num : minn;       }       for (register int i = 1; i <= tot2; ++i) {         sum += b[i].num;         ans[k].s[++ans[k].s[0]] = b[i].pos;         minn = b[i].num < minn ? b[i].num : minn;       }       sum -= minn * 0.5;     }     printf( %.1lf n , sum);     for (register int i = 1; i <= k; ++i, puts(  )) {       write(ans[i].s[0]);       cout <<    ;       for (register int j = 1; j <= ans[i].s[0]; ++j) {         write(ans[i].s[j]);         cout <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[1 << 20], b[1 << 20], ans;   char s[20][1 << 20];   int bit[1 << 20], now, k, n, m, i, N;   void FWT(long long *a, int o) {     for (int i = 1; i < N; i <<= 1)       for (int j = 0; j < N; j += i << 1)         for (int k = 0; k < i; k++) {           long long x = a[j + k + i], y = a[j + k];           a[j + k] = y + x;           a[j + k + i] = y - x;           if (o) a[j + k] >>= 1, a[j + k + i] >>= 1;         }   }   int main() {     scanf( %d%d , &n, &m);     N = 1 << n;     for (i = 0; i < n; i++) scanf( %s , s[i]);     for (k = 0; k < m; a[now]++, k++)       for (i = now = 0; i < n; i++) now |= (1 << i) * (s[i][k] ==  1 );     for (i = 0; i < N; i++) bit[i] = bit[i >> 1] + (i & 1);     for (i = 0; i < N; i++) b[i] = min(bit[i], bit[(N - 1) ^ i]);     FWT(a, 0);     FWT(b, 0);     for (i = 0; i < N; i++) a[i] *= b[i];     FWT(a, 1);     ans = a[1];     for (i = 1; i < (1 << n); i++) ans = min(ans, a[i]);     printf( %I64d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   void solve(istream &cin = std::cin, ostream &cout = std::cout) {     int test;     cin >> test;     int n, m;     ll t;     while (cin >> n >> m >> t) {       vector<int> p(n);       for (int &x : p) cin >> x;       const int bound = *max_element(p.begin(), p.end()) + 1;       auto check = [&](int d) {         if (d == bound) return pair<int, bool>(-1, false);         ll last = 0, sum_t = 0;         int ptr = 0;         bool good = true;         int done = 0;         for (int x : p) {           if (x <= d) {             if (ptr == m) {               sum_t += last;               ptr = 0;               last = 0;             }             {               sum_t += x;               last += x;               ptr++;               if (sum_t > t)                 good = false;               else                 done++;             }           }         }         return pair<int, bool>(done, good);       };       int left = 0, right = bound;       while (right - left > 1) {         int mid = (left + right) / 2;         if (check(mid).second)           left = mid;         else           right = mid;       }       int ans = -1, d = -1;       for (int i = left; i <= right; i++) {         int cur = check(i).first;         if (ans < cur) {           ans = cur;           d = i;         }       }       if (d > t) d = t;       cout << ans <<     << d << endl;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout << fixed;     cout << setprecision(20);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = int(1e9) + 7;   const double eps = 1e-9;   vector<pair<int, int> > g[111];   int dp[111][111][30];   int n, m;   int dfs(int u, int v, int x) {     if (dp[u][v][x]) return dp[u][v][x];     dp[u][v][x] = 2;     for (int i = 0; i < int((g[u]).size()); ++i) {       pair<int, int> to = g[u][i];       if (to.second >= x) {         if (dfs(v, to.first, to.second) == 2) {           dp[u][v][x] = 1;           break;         }       }     }     return dp[u][v][x];   }   int main() {     cin >> n >> m;     for (int i = 1; i <= m; ++i) {       int u, v;       char c;       cin >> u >> v >> c;       g[u].push_back(make_pair(v, c - 97));     }     for (int i = 1; i <= n; i++) {       for (int j = 0; j < 26; j++) {         dp[i][i][j] = 2;       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         if (!dp[i][j][0]) {           dfs(i, j, 0);         }         if (dp[i][j][0] == 1)           cout <<  A ;         else           cout <<  B ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double n, a, d, t, v;     cin >> n >> a >> d;     double minitime = 0;     for (int i = 0; i < n; i++) {       cin >> t >> v;       double t1 = v / a;       double s = a * 0.5 * t1 * t1;       if (s > d) {         t += sqrt(2 * d / a);       } else {         double x = d - s;         double t2 = x / v;         t += t1 + t2;       }       t = max(minitime, t);       minitime = t;       cout << t << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int dp[5005][5005];   int main() {     long long int n, m, k;     cin >> n >> m >> k;     long long int arr[n + 1];     long long int sum[n + 1];     for (int i = 1; i <= n; i++) cin >> arr[i];     sum[1] = 0;     for (int i = 1; i <= m; i++) sum[1] += arr[i];     for (int i = 2; i <= n - m + 1; i++)       sum[i] = sum[i - 1] + arr[i + m - 1] - arr[i - 1];     long long int res = -1;     for (int i = 1; i <= n - m + 1; i++) dp[1][i] = max(dp[1][i - 1], sum[i]);     for (int i = 2; i <= k; i++) {       for (int j = 1; j <= n - m + 1; j++) {         if (j > m * (i - 1))           dp[i][j] = max(dp[i][j - 1], dp[i - 1][j - m] + sum[j]);       }     }     cout << dp[k][n - m + 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     string s;     char big =  a ;     string s1 =   ;     cin >> s;     for (int i = s.size() - 1; i >= 0; i--) {       if (int(s[i]) >= int(big)) {         s1 += s[i];         big = s[i];       }     }     reverse(s1.begin(), s1.end());     cout << s1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<pair<int, int>> g[51][51];   int ch[51][51], vis[51][51], cnt;   pair<int, int> par[51][51];   bool isValid(int x, int y) {     if (x < 0 || y < 0 || x > n - 1 || y > m - 1) return false;     return true;   }   int dx[] = {-1, 0, 0, 1};   int dy[] = {0, 1, -1, 0};   void dfs(int x, int y, int px, int py) {     vis[x][y] = 1;     par[x][y] = {px, py};     for (auto i = 0; i < 4; i++) {       int curX = x + dx[i], curY = y + dy[i];       if (isValid(curX, curY) && ch[curX][curY] == ch[x][y]) {         if (vis[curX][curY] == 0)           dfs(curX, curY, x, y);         else if (par[x][y].first != curX || par[x][y].second != curY)           cnt++;       }     }   }   void Solve() {     cin >> n >> m;     for (auto i = 0; i < n; i++) {       for (auto j = 0; j < m; j++) {         char c;         cin >> c;         ch[i][j] = c -  A  + 1;       }     }     for (auto i = 0; i < n - 1; i++) {       for (auto j = 0; j < m - 1; j++) {         if (ch[i + 1][j] == ch[i][j])           g[i][j].push_back({i + 1, j}), g[i + 1][j].push_back({i, j});         if (ch[i][j + 1] == ch[i][j + 1])           g[i][j].push_back({i, j + 1}), g[i][j + 1].push_back({i, j});       }     }     for (auto i = 0; i < n; i++) {       for (auto j = 0; j < m; j++) {         if (vis[i][j] == 0) {           cnt = 0;           dfs(i, j, -1, -1);           if (cnt > 0) {             cout <<  Yes ;             return;           }         }       }     }     cout <<  No ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int T = 1;     while (T--) Solve();     return 0;   }
#include <bits/stdc++.h>   int main() {     int a, b, ans = 0;     scanf( %d %d , &a, &b);     if (a > b) {       ans = (a - b) / 2;       printf( %d %d , b, ans);     } else if (a < b) {       ans = (b - a) / 2;       printf( %d %d , a, ans);     } else if (a == b) {       ans = (a - b) / 2;       printf( %d %d , b, ans);     }     return 0;   }