malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1005;   int n;   vector<int> point[2];   vector<pair<long long, int> > area[2], vec[4];   long long query(int type, int i, int j, int k) {     printf( %d %d %d %d n , type, i, j, k);     fflush(stdout);     long long res;     scanf( %lld , &res);     return res;   }   int main() {     scanf( %d , &n);     for (int i = 3; i <= n; i++) {       if (query(2, 1, 2, i) < 0)         point[0].emplace_back(i);       else         point[1].emplace_back(i);     }     for (int i = 0; i < point[0].size(); i++)       area[0].emplace_back(make_pair(query(1, 1, 2, point[0][i]), point[0][i]));     for (int i = 0; i < point[1].size(); i++)       area[1].emplace_back(make_pair(query(1, 1, 2, point[1][i]), point[1][i]));     pair<long long, int> L, R;     for (int i = 0; i < area[0].size(); i++) L = max(L, area[0][i]);     for (int i = 0; i < area[1].size(); i++) R = max(R, area[1][i]);     for (int i = 0; i < point[0].size(); i++) {       if (point[0][i] == L.second) continue;       if (query(2, 1, L.second, point[0][i]) < 0)         vec[0].push_back(area[0][i]);       else         vec[1].push_back(area[0][i]);     }     for (int i = 0; i < point[1].size(); i++) {       if (point[1][i] == R.second) continue;       if (query(2, 1, R.second, point[1][i]) < 0)         vec[2].emplace_back(area[1][i]);       else         vec[3].emplace_back(area[1][i]);     }     for (int i = 0; i <= 3; i++) sort(vec[i].begin(), vec[i].end());     printf( 0 1  );     for (int i = 0; i < vec[0].size(); i++) printf( %d  , vec[0][i].second);     if (L.second) printf( %d  , L.second);     for (int i = vec[1].size() - 1; i >= 0; i--) printf( %d  , vec[1][i].second);     printf( 2  );     for (int i = 0; i < vec[2].size(); i++) printf( %d  , vec[2][i].second);     if (R.second) printf( %d  , R.second);     for (int i = vec[3].size() - 1; i >= 0; i--) printf( %d  , vec[3][i].second);     printf(  n );     fflush(stdout);   }
#include <bits/stdc++.h>   int a[200001];   int main() {     int n, i, ans = 0;     scanf( %d , &n);     for (i = 0; i < n; i++) {       int x;       scanf( %d , &x);       if (a[100000 + x] == 0 && x != 0) {         ans++;         a[100000 + x] = 1;       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int v[1010][1010];   int dpa[1010][1010];   int dpreva[1010][1010];   int dpb[1010][1010];   int dprevb[1010][1010];   int solvea(int currx, int curry) {     if (currx == n && curry == m) return dpa[currx][curry] = v[currx][curry];     int& ret = dpa[currx][curry];     if (ret != -1) return ret;     if (currx + 1 <= n) {       ret = max(ret, solvea(currx + 1, curry) + v[currx][curry]);     }     if (curry + 1 <= m) {       ret = max(ret, solvea(currx, curry + 1) + v[currx][curry]);     }     return ret;   }   int solvereva(int currx, int curry) {     if (currx == 1 && curry == 1) return dpreva[currx][curry] = v[currx][curry];     int& ret = dpreva[currx][curry];     if (ret != -1) return ret;     if (currx - 1 >= 1) {       ret = max(ret, solvereva(currx - 1, curry) + v[currx][curry]);     }     if (curry - 1 >= 1) {       ret = max(ret, solvereva(currx, curry - 1) + v[currx][curry]);     }     return ret;   }   int solveb(int currx, int curry) {     if (currx == 1 && curry == m) return dpb[currx][curry] = v[currx][curry];     int& ret = dpb[currx][curry];     if (ret != -1) return ret;     if (currx - 1 >= 1) {       ret = max(ret, solveb(currx - 1, curry) + v[currx][curry]);     }     if (curry + 1 <= m) {       ret = max(ret, solveb(currx, curry + 1) + v[currx][curry]);     }     return ret;   }   int solverevb(int currx, int curry) {     if (currx == n && curry == 1) return dprevb[currx][curry] = v[currx][curry];     int& ret = dprevb[currx][curry];     if (ret != -1) return ret;     if (currx + 1 <= n) {       ret = max(ret, solverevb(currx + 1, curry) + v[currx][curry]);     }     if (curry - 1 >= 1) {       ret = max(ret, solverevb(currx, curry - 1) + v[currx][curry]);     }     return ret;   }   int main(void) {     ios ::sync_with_stdio(false);     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         cin >> v[i][j];       }     }     memset(dpa, -1, sizeof dpa);     memset(dpreva, -1, sizeof dpreva);     memset(dpb, -1, sizeof dpb);     memset(dprevb, -1, sizeof dprevb);     solvea(1, 1);     solvereva(n, m);     solveb(n, 1);     solverevb(1, m);     int res = 0;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         int dist = 0;         int dist2 = 0;         if (j - 1 >= 1 && j + 1 <= m && i - 1 >= 1 && i + 1 <= n) {           dist =               dprevb[i][j - 1] + dpb[i][j + 1] + dpreva[i - 1][j] + dpa[i + 1][j];           dist2 =               dprevb[i + 1][j] + dpb[i - 1][j] + dpreva[i][j - 1] + dpa[i][j + 1];         }         res = max(res, dist);         res = max(res, dist2);       }     }     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long n, m, k, l;     cin >> n >> m >> k >> l;     if (((k + l + m - 1) / m) * m > n) {       cout << -1;       return 0;     }     cout << (k + l + m - 1) / m;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200005;   const int maxm = 300005;   const int maxq = 500005;   const int inf = 0x3f3f3f3f;   int n, m, Q, a[maxn], fa[maxn], x_[maxm], y_[maxm], u_[maxq], v_[maxq];   bool vis[maxm];   set<int> s[maxn];   set<int>::iterator it, itl, itr;   struct oper {     int op, u;   } q[maxq];   inline int find(int x) {     while (x != fa[x]) x = fa[x];     return x;   }   inline void merge(int i, int x, int y) {     int u = find(x), v = find(y);     if (u == v) return;     if (s[u].size() > s[v].size()) swap(u, v);     u_[i] = u, v_[i] = v, fa[u] = v;     for (auto x : s[u]) s[v].insert(x);   }   int main() {     scanf( %d%d%d , &n, &m, &Q);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= m; i++) scanf( %d%d , &x_[i], &y_[i]);     for (int i = 1; i <= Q; i++) {       scanf( %d%d , &q[i].op, &q[i].u);       if (q[i].op == 2) vis[q[i].u] = 1;     }     for (int i = 1; i <= n; i++) fa[i] = i, s[i].insert(a[i]);     for (int i = 1; i <= m; i++)       if (!vis[i]) merge(0, x_[i], y_[i]);     for (int i = Q; i; i--)       if (q[i].op == 2) merge(i, x_[q[i].u], y_[q[i].u]);     for (int i = 1; i <= Q; i++)       if (q[i].op == 1) {         int u = find(q[i].u);         if (s[u].empty()) {           puts( 0 );           continue;         }         printf( %d n , *s[u].rbegin());         s[u].erase(*s[u].rbegin());       } else if (q[i].op == 2) {         if (!u_[i]) continue;         int u = u_[i], v = v_[i];         fa[u] = u;         for (it = s[u].begin(); it != s[u].end();) {           itr = s[v].find(*it);           if (itr == s[v].end())             itl = it, it++, s[u].erase(itl);           else             s[v].erase(itr), it++;         }       }     return 0;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int maxn = 2e5 + 10;   const int inf = 0x3f3f3f3f;   const double eps = 1e-6;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   int n;   int l[maxn], r[maxn], t[maxn];   struct node {     int id;     bool operator<(const node &s) const {       if (r[id] != r[s.id])         return r[id] < r[s.id];       else if (l[id] != l[s.id])         return l[id] < l[s.id];       else         return id < s.id;     }   };   bool vis[maxn];   struct e {     int x, op, id;     bool operator<(const e &s) const {       if (x != s.x)         return x < s.x;       else if (op != s.op)         return op > s.op;       else         return id < s.id;     }   };   multiset<node> s[2];   set<e> ss;   int main() {     std::ios::sync_with_stdio(false), cin.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> l[i] >> r[i] >> t[i];       t[i]--;       ss.insert((e){l[i], 1, i});       ss.insert((e){r[i], -1, i});     }     int ans = n;     for (auto u : ss) {       int op = u.op;       int id = u.id;       if (op == 1) {         s[t[id]].insert((node){id});         continue;       }       if (vis[id]) continue;       vis[id] = 1;       s[t[id]].erase((node){id});       auto it = s[1 - t[id]].begin();       if (it == s[1 - t[id]].end()) continue;       int l1 = l[id];       int r1 = r[id];       int l2 = l[(*it).id];       int r2 = r[(*it).id];       if (max(l1, l2) <= min(r1, r2)) {         vis[(*it).id] = 1;         ans--;         s[1 - t[id]].erase((node){(*it).id});       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000007;   const double EPS = 1e-10;   const double PI = 3.14159265359;   int n;   int a[200005];   int cnt[200005];   int main() {     int t;     cin >> t;     while (t--) {       set<int> st;       int mx = 0;       memset(cnt, 0, sizeof cnt);       cin >> n;       for (int i = 0; i < n; i++) {         cin >> a[i];         st.insert(a[i]);         cnt[a[i]]++;         mx = max(mx, cnt[a[i]]);       }       if (mx > st.size()) {         cout << st.size() << endl;       } else if (mx == st.size()) {         cout << mx - 1 << endl;       } else {         cout << mx << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     if (n == 1) {       cout <<  yes  << endl;       cout <<  1 1 n ;       return 0;     }     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     int l = 0, r = 0;     while (l + 1 < n && a[l] < a[l + 1]) l++;     r = l + 1;     while (r < n && a[r] < a[r - 1]) r++;     reverse(a.begin() + l, a.begin() + r);     for (int i = 1; i < n; i++) {       if (a[i] < a[i - 1]) {         cout <<  no  << endl;         return 0;       }     }     cout <<  yes  << endl;     cout << l + 1 <<     << r << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, a[2000005];   int val[2000005], sumVal[2000005];   int getSum(int l, int r) {     if (l == 0)       return sumVal[r];     else       return sumVal[r] - sumVal[l - 1];   }   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> a[i];       val[a[i]]++;     }     for (int i = 1; i < 2000005; i++) {       sumVal[i] = sumVal[i - 1] + val[i];     }     sort(a, a + n);     if (a[0] <= k + 1) {       cout << a[0];       return 0;     }     long long ans = k;     for (int d = k + 1; d <= a[0]; d++) {       int res = 0;       for (int i = 0; d * i <= a[n - 1]; i++) {         res += getSum(d * i, d * i + k);       }       if (res == n) ans = d;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   char ch[500005];   bool vis[200];   int n;   double f[500005], g[500005];   void init() {     vis[ I ] = vis[ E ] = vis[ A ] = vis[ O ] = vis[ U ] = vis[ Y ] = true;     int i;     n = strlen(ch + 1);     f[0] = g[0] = 0.0;     for (i = 1; i <= n; i++) {       f[i] = f[i - 1] + 1.0 / i;       g[i] = g[i - 1] + 1.0 * i / (n - i + 1);     }   }   int main() {     scanf( %s , ch + 1);     init();     double ans = 0.0;     int i, t;     for (i = 1; i <= n; i++) {       if (!vis[ch[i]]) continue;       t = min(i, n - i + 1);       ans += t;       ans += t * (f[n - t + 1] - f[t]);       ans += g[n - (n - t + 1)];     }     printf( %.10f n , ans);   }
#include <bits/stdc++.h>   using namespace std;   string s;   vector<char> v;   int main() {     ios_base::sync_with_stdio(false);     getline(cin, s);     int cnt = 0;     bool mark;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==    )         cnt++;       else {         v.push_back(s[i]);         if (s[i] !=    ) mark = true;       }       if (mark == true &&           (i == s.size() - 1 || (s[i] ==     && s[i + 1] !=    )) &&           ((cnt != 1 || s[i] ==    ) && cnt != 2)) {         mark = false;         string t =   ;         for (int i = 0; i < v.size(); i++)           if (v[i] !=    ) t += v[i];         v.clear();         cout <<  <  << t <<  >  << endl;       }       if (cnt == 2) {         cnt = 0;         string t =   ;         for (int i = 0; i < v.size(); i++) t += v[i];         v.clear();         mark = false;         cout <<  <  << t <<  >  << endl;       }       if (cnt == 1 && s[i] ==    ) v.clear();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios::sync_with_stdio(false);     int n;     double m, mm;     cin >> n >> mm;     m = mm;     double *a = new double[n];     double *b = new double[n];     for (int i = 0; i < n; ++i) {       cin >> a[i];       if (a[i] == 1) {         cout << -1;         return 0;       }     }     for (int i = 0; i < n; ++i) {       cin >> b[i];       if (b[i] == 1) {         cout << -1;         return 0;       }     }     double x = m / (b[0] - 1);     m += x;     for (int i = n - 1; i > 0; --i) {       x = m / (a[i] - 1);       m += x;       x = m / (b[i] - 1);       m += x;     }     x = m / (a[0] - 1);     m += x;     cout << fixed << setprecision(10) << m - mm;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> e[3001], u;   int v[3001], d[3001];   bool dfs(int x, int from) {     if (v[x]++) {       for (v[x] = -1; u.back() != x; u.pop_back()) v[u.back()] = -1;       return true;     }     u.push_back(x);     for (size_t i = 0; i < e[x].size(); i++)       if (e[x][i] != from && dfs(e[x][i], x)) return true;     u.pop_back();     return false;   }   int main() {     int n, x, y;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &x, &y);       e[x].push_back(y);       e[y].push_back(x);     }     dfs(1, -1);     u.clear();     for (int i = 1; i <= n; i++)       if (v[i] < 0) u.push_back(i);     for (size_t o = 0; o < u.size(); o++) {       for (size_t i = 0; i < e[u[o]].size(); i++) {         int t = e[u[o]][i];         if (~v[t]) {           v[t] = -1;           d[t] = d[u[o]] + 1;           u.push_back(t);         }       }     }     for (int i = 1; i <= n; i++) printf( %d  , d[i]);   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rd(chrono ::steady_clock ::now().time_since_epoch().count());   long long Rand(long long l, long long h) { return l + rd() % (h - l + 1); }   template <typename T>   inline void read(T &x) {     register char c;     bool sign = 0;     for (c = getchar(); !isdigit(c); c = getchar())       if (c ==  - ) sign = !sign;     x = c -  0 ;     for (c = getchar(); isdigit(c); c = getchar()) x = x * 10 + c -  0 ;     if (sign) x = -x;   }   template <typename T>   inline bool mini(T &x, T y) {     if (x > y)       x = y;     else       return 0;     return 1;   }   template <typename T>   inline bool maxi(T &x, T y) {     if (x < y)       x = y;     else       return 0;     return 1;   }   template <typename T>   inline void _abs(T &x) {     if (x < 0) x = -x;     return;   }   const int N = 1003;   int a[N];   int d[2];   int main() {     ios ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       for (int i = 1; i <= n; ++i) cin >> a[i];       d[0] = d[1] = 0;       for (int i = 1; i <= n; ++i) d[a[i]]++;       bool t;       if (d[0] < d[1])         t = 1;       else         t = 0;       vector<int> res;       for (int i = 1; i <= n; ++i)         if (a[i] == t) res.push_back(t);       if (t && (int)(res.size()) % 2) res.pop_back();       cout << res.size() <<   n ;       for (int x : res) cout << x <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   static const int MOD = 1000000007;   using ll = long long;   using u32 = unsigned;   using u64 = unsigned long long;   using namespace std;   template <class T>   constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;   template <u32 M = 1000000007>   struct modint {     u32 val;     modint() : val(0) {}     template <typename T>     modint(T t) {       t %= (T)M;       if (t < 0) t += (T)M;       val = t;     }     modint pow(ll k) const {       modint res(1), x(val);       while (k) {         if (k & 1) res *= x;         x *= x;         k >>= 1;       }       return res;     }     template <typename T>     modint& operator=(T t) {       t %= (T)M;       if (t < 0) t += (T)M;       val = t;       return *this;     }     modint inv() const { return pow(M - 2); }     modint& operator+=(modint a) {       val += a.val;       if (val >= M) val -= M;       return *this;     }     modint& operator-=(modint a) {       if (val < a.val)         val += M - a.val;       else         val -= a.val;       return *this;     }     modint& operator*=(modint a) {       val = (u64)val * a.val % M;       return *this;     }     modint& operator/=(modint a) { return (*this) *= a.inv(); }     modint operator+(modint a) const { return modint(val) += a; }     modint operator-(modint a) const { return modint(val) -= a; }     modint operator*(modint a) const { return modint(val) *= a; }     modint operator/(modint a) const { return modint(val) /= a; }     modint operator-() { return modint(M - val); }     bool operator==(const modint a) const { return val == a.val; }     bool operator!=(const modint a) const { return val != a.val; }     bool operator<(const modint a) const { return val < a.val; }   };   using mint = modint<MOD>;   int main() {     int n, m;     cin >> n >> m;     vector<vector<int>> v(n, vector<int>(m, 0));     string s;     for (int i = 0; i < n; ++i) {       cin >> s;       for (int j = 0; j < m; ++j) {         v[i][j] = s[j] -  a ;       }     }     int q;     cin >> q;     v.resize(n + q, vector<int>(m, 0));     for (int i = 0; i < q; ++i) {       cin >> s;       for (int j = 0; j < m; ++j) {         v[n + i][j] = s[j] -  a ;       }     }     vector<int> inv = {0, 1, 3, 2, 4};     int rank = 0;     for (int c = 0; c < m; ++c) {       int k = -1;       for (int i = rank; i < n; ++i) {         if (v[i][c]) {           k = i;           break;         }       }       if (!~k) continue;       swap(v[k], v[rank]);       int x = inv[v[rank][c]];       for (int j = 0; j < m; ++j) v[rank][j] = (v[rank][j] * x) % 5;       for (int i = 0; i < n + q; ++i) {         if (i != rank && v[i][c]) {           int coeff = v[i][c];           for (int j = 0; j < m; ++j) {             v[i][j] -= v[rank][j] * coeff % 5;             if (v[i][j] < 0) v[i][j] += 5;           }         }       }       rank++;     }     int ans = mint(5).pow(n - rank).val;     for (int i = 0; i < q; ++i) {       int ok = 1;       for (int j = 0; j < m; ++j) {         if (v[n + i][j]) ok = 0;       }       printf( %d n , ok ? ans : 0);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x = 0, y = 0, x0 = 0, y0 = 0, k = 1, ans = 1;     string s;     cin >> n >> s;     for (int i = 0; i < n; i++) {       if (s[i] ==  L ) x--;       if (s[i] ==  R ) x++;       if (s[i] ==  D ) y--;       if (s[i] ==  U ) y++;       if (abs(x - x0) + abs(y - y0) < k) {         ans++;         k = 1;         x0 = x;         if (s[i] ==  L ) x0++;         if (s[i] ==  R ) x0--;         y0 = y;         if (s[i] ==  D ) y0++;         if (s[i] ==  U ) y0--;       } else         k++;     }     printf( %d , ans);     return 0;   }
#include <bits/stdc++.h>   const long long mod = (long long)1e9 + 7;   using namespace std;   vector<long long> parent, sz;   void make_set(long long v) {     parent[v] = v;     sz[v] = 1;   }   long long find_set(long long v) {     if (v == parent[v]) return v;     return parent[v] = find_set(parent[v]);   }   void union_sets(long long a, long long b) {     a = find_set(a);     b = find_set(b);     if (a != b) {       if (a < b) swap(a, b);       parent[b] = a;       sz[a] += sz[b];     }   }   long long n;   void clearall() {     parent.clear();     sz.clear();     parent.resize(n + 1);     sz.resize(n + 1);   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       cin >> n;       vector<long long> vc(n);       for (long long i = 0; i < n; i++) cin >> vc[i];       clearall();       for (long long i = 0; i <= n; i++) {         make_set(i);       }       vector<long long> mp(n + 1, 0);       for (long long i = 0; i < n; i++) {         mp[vc[i]] = i;       }       bool foo = true;       vector<long long> ocp(n, 0);       vector<long long> mxmp(n, 1);       multiset<long long, greater<long long>> st;       for (long long i = 0; i < n; i++) st.insert(1);       for (long long i = 1; i <= n; i++) {         long long mx = *(st.begin());         long long ii = mp[i];         if (mxmp[ii] != mx) {           foo = false;           break;         }         auto it = st.find(mxmp[ii]);         st.erase(it);         if (ii > 0 and ocp[ii - 1] == 1) {           union_sets(ii, ii - 1);         }         if (ii < n - 1 and ocp[ii + 1] == 1) {           union_sets(ii, ii + 1);         }         ocp[ii] = 1;         long long pr = find_set(ii);         if (pr < n - 1 and ocp[pr + 1] == 0) {           it = st.find(mxmp[pr + 1]);           st.erase(it);           mxmp[pr + 1] = sz[pr] + 1;           st.insert(sz[pr] + 1);         }       }       if (foo) {         cout <<  Yes n ;       } else {         cout <<  No n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int static_init = []() {     ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;     return 0;   }();   constexpr int N = 2e5;   int32_t n, a[N];   bool v[N];   int main() {     int64_t t, ans = 0;     cin >> n >> t;     for (int i = 0; i < n; i++) cin >> a[i];     for (;;) {       int64_t s = 0;       int m = 0;       for (int i = 0; i < n; i++) {         if (v[i]) continue;         if (s + a[i] > t)           v[i] = true;         else           s += a[i], m++;       }       if (m == 0) break;       ans += t / s * m;       t %= s;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n;     cin >> t;     while (t--) {       cin >> n;       int ar[n], e = 0, o = 0;       for (int i = 0; i < n; i++) cin >> ar[i];       for (int i = 0; i < n; i++) {         if (ar[i] % 2 == 0)           e = e + 1;         else           o = o + 1;       }       if ((e == n) || (o == n))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3005;   const int MOD = 998244353;   int f[N][N];   char s[N], t[N];   int main() {     scanf( %s %s , s + 1, t + 1);     int n = strlen(s + 1), m = strlen(t + 1);     for (int l = 1; l <= n; ++l) {       for (int r = n; r >= l; --r) {         int pos = r - l + 1;         if (l == 1 and r >= m) f[l][r] = 1;         char cur = s[pos + 1];         if (l > 1 and (l - 1 > m or t[l - 1] == cur)) {           f[l][r] += f[l - 1][r];           if (f[l][r] >= MOD) f[l][r] -= MOD;         }         if (r < n and (r + 1 > m or t[r + 1] == cur)) {           f[l][r] += f[l][r + 1];           if (f[l][r] >= MOD) f[l][r] -= MOD;         }       }     }     int ans = 0;     for (int l = 1; l <= n; ++l) {       if (l > m or s[1] == t[l]) {         ans += f[l][l];         if (ans >= MOD) ans -= MOD;         ans += f[l][l];         if (ans >= MOD) ans -= MOD;       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<string> a, b;   int n, m, k;   string s;   int main() {     cin >> n >> m;     for (int i = 0; i < n; ++i) {       cin >> s;       a.push_back(s);     }     for (int i = 0; i < m; ++i) {       cin >> s;       b.push_back(s);     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         if (a[i] == b[j]) ++k;       }     }     if (k % 2 == 0) {       if (n > m)         cout <<  YES ;       else         cout <<  NO ;     } else {       if (n >= m)         cout <<  YES ;       else         cout <<  NO ;     }   }