malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int g[(1 << 22)][4], f[23], n, m, a, b;   void output(int v, int u) {     if (u == 0) return;     if (v == 0) return;     output(g[v][1], u - 1);     printf( %d  , g[v][2]);   }   int cnt(int v) {     int ret = 0;     for (; v; v >>= 1)       if (v & 1) ret++;     return ret;   }   int main(void) {     memset(g, 127, sizeof(g));     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++)       scanf( %d%d , &a, &b), f[a] |= 1 << (b - 1), f[b] |= 1 << (a - 1);     for (int i = 1; i <= n; i++)       f[i] |= 1 << (i - 1), g[f[i]][1] = 0, g[f[i]][2] = i, g[f[i]][3] = 0;     for (int i = 1; i <= n; i++) g[f[i]][3]++;     for (int i = 1; i <= n; i++)       if (g[f[i]][3] == cnt(f[i]))         g[f[i]][0] = 0;       else         g[f[i]][0] = 1;     for (int i = 1; i <= (1 << n) - 1; i++)       if (g[i][0])         for (int j = 1; j <= n; j++)           if ((i | (1 << (j - 1))) == i) {             int gf = i | f[j];             if (g[gf][0] > g[i][0] + 1)               g[gf][0] = g[i][0] + 1, g[gf][1] = i, g[gf][2] = j;           }     printf( %d n , g[(1 << n) - 1][0]);     output((1 << n) - 1, g[(1 << n) - 1][0]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void __print(int x) { cerr << x; }   void __print(long x) { cerr << x; }   void __print(long long x) { cerr << x; }   void __print(unsigned x) { cerr << x; }   void __print(unsigned long x) { cerr << x; }   void __print(unsigned long long x) { cerr << x; }   void __print(float x) { cerr << x; }   void __print(double x) { cerr << x; }   void __print(long double x) { cerr << x; }   void __print(char x) { cerr <<      << x <<     ; }   void __print(const char *x) { cerr <<     << x <<    ; }   void __print(const string &x) { cerr <<     << x <<    ; }   void __print(bool x) { cerr << (x ?  true  :  false ); }   template <typename T, typename V>   void __print(const pair<T, V> &x) {     cerr <<  { ;     __print(x.first);     cerr <<  , ;     __print(x.second);     cerr <<  } ;   }   template <typename T>   void __print(const T &x) {     int f = 0;     cerr <<  { ;     for (auto &i : x) cerr << (f++ ?  ,  :   ), __print(i);     cerr <<  } ;   }   void _print() { cerr <<  ] n ; }   template <typename T, typename... V>   void _print(T t, V... v) {     __print(t);     if (sizeof...(v)) cerr <<  ,  ;     _print(v...);   }   const int N = 3e5 + 5;   long long a[N];   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     string s;     cin >> s;     string open =  ([{< ;     string close =  )]}> ;     map<char, char> closeMp;     for (int i = 0; i < 4; i++) closeMp[close[i]] = open[i];     stack<char> st;     int ans = 0;     for (auto i : s) {       if (closeMp.count(i) == 0) {         st.push(i);       } else {         if (st.empty())           return cout <<  Impossible , 0;         else {           if (st.top() != closeMp[i]) ans++;           st.pop();         }       }     }     if (st.empty())       cout << ans;     else       cout <<  Impossible ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long find_smallest_number_with_cumulative_sum_greater_or_equal_than_sum(       long long sum) {     long long lower = 0, upper = (long long)15E8, mid;     while (lower < upper) {       mid = (lower + upper) / 2;       if (mid * (mid + 1) / 2 >= sum)         upper = mid;       else         lower = mid + 1;     }     return lower;   }   long long find_answer(long long n, long long H) {     long long lower = H - 1, upper = (long long)15E8, mid;     while (lower < upper) {       mid = (lower + upper) / 2;       long long current_sum = mid * (mid + 1) / 2 - H * (H - 1) / 2;       long long remaining_sum = n - current_sum;       if (find_smallest_number_with_cumulative_sum_greater_or_equal_than_sum(               remaining_sum) <= mid + 1)         upper = mid;       else         lower = mid + 1;     }     long long current_sum = lower * (lower + 1) / 2 - H * (H - 1) / 2;     long long remaining_sum = n - current_sum;     long long total_blocks_till_now = lower - (H - 1);     return total_blocks_till_now +            find_smallest_number_with_cumulative_sum_greater_or_equal_than_sum(                remaining_sum);   }   int main() {     long long n, H;     cin >> n >> H;     cout << find_answer(n, H) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int A, int B) {     if (B == 0)       return A;     else       return gcd(B, A % B);   }   long long int mod_exponentiation(long long int base, long long int exponent,                                    int modulus) {     long long int result = 1;     while (exponent > 0) {       if (exponent % 2 == 1) result = (result * base) % modulus;       exponent = exponent >> 1;       base = (base * base) % modulus;     }     return result;   }   int fermat(long long int n, long long int m) {     return mod_exponentiation(n, m - 2, m);   }   struct node {     int a;     int cnt;   };   struct Compare {     bool operator()(node &a, node &b) { return a.cnt > b.cnt; }   };   inline int toInt(string s) {     int v;     istringstream sin(s);     sin >> v;     return v;   }   template <class T>   inline string toString(T x) {     ostringstream sout;     sout << x;     return sout.str();   }   template <class T>   inline T sqr(T x) {     return x * x;   }   int main() {     int n;     cin >> n;     int a[8];     for (int i = 0; i < 7; i++) {       cin >> a[i + 1];     }     int sum = 0;     for (int i = 1; i <= 7;) {       sum += a[i];       if (sum >= n) {         cout << i;         return 0;       }       i++;       if (i > 7) {         i %= 7;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200006;   vector<vector<int> > edges(N);   vector<int> color;   bool bipartite;   vector<pair<int, int> > e;   int n, m;   void dfs(int node, int c) {     color[node] = c;     for (auto to : edges[node]) {       if (color[to] == -1) {         dfs(to, c ^ 1);       } else {         if (color[to] == color[node]) {           bipartite = false;         }       }     }     return;   }   int main() {     cin >> n >> m;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       x--;       y--;       edges[x].push_back(y);       edges[y].push_back(x);       e.push_back(make_pair(x, y));     }     bipartite = true;     color = vector<int>(n, -1);     dfs(0, 0);     if (!bipartite) {       cout <<  NO n ;       return 0;     }     cout <<  YES n ;     for (int i = 0; i < m; i++) {       cout << (color[e[i].first] < color[e[i].second]);     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ask(string q, int x) {     cout << q <<     << x << endl;     int ret;     cin >> ret;     return ret;   }   int getclosestnode(vector<vector<int>> &adj, set<int> &me, int node) {     bool visited[1001];     memset(visited, 0, sizeof visited);     queue<int> q;     q.push(node);     while (!q.empty()) {       int u = q.front();       q.pop();       if (me.count(u) != 0)         return u;       else         for (auto x : adj[u])           if (!visited[x]) {             q.push(x);             visited[x] = 1;           }     }     return -1;   }   void solve() {     int n;     vector<vector<int>> adj(1001);     cin >> n;     for (int i = 0; i < (int)(n - 1); i++) {       int a, b;       cin >> a >> b;       adj[a].push_back(b);       adj[b].push_back(a);     }     set<int> me, li;     int k;     cin >> k;     for (int i = 0; i < (int)(k); i++) {       int a;       cin >> a;       me.insert(a);     }     cin >> k;     for (int i = 0; i < (int)(k); i++) {       int a;       cin >> a;       li.insert(a);     }     int node = ask( B , *li.begin());     if (me.count(node) != 0)       cout <<  C   << node << endl;     else {       int closest = getclosestnode(adj, me, node);       int liclose = ask( A , closest);       if (li.count(liclose) != 0) {         cout <<  C   << closest << endl;       } else         cout <<  C   << -1 << endl;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int tc;     cin >> tc;     for (int i = 0; i < (int)(tc); i++) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct arc_t {     int u, v, c;     arc_t(int _u, int _v, int _c) : u(_u), v(_v), c(_c) {}     bool operator<(const arc_t& rhs) const { return c < rhs.c; }   };   int pa[2001];   void set_init(int n) {     for (int i = 1; i <= n; i++) pa[i] = i;   }   int set_find(int x) { return pa[x] == x ? x : pa[x] = set_find(pa[x]); }   int set_union(int x, int y) {     x = set_find(x);     y = set_find(y);     if (x == y) {       return -1;     }     pa[y] = x;     return 0;   }   int f[2001][2001];   vector<pair<int, int> > G[2001];   long long d[2001][2001];   int root;   vector<bool> mark;   int dfs(int u) {     mark[u] = true;     for (vector<pair<int, int> >::iterator i = G[u].begin(); i != G[u].end();          i++) {       int v = i->first;       if (!mark[v]) {         d[root][v] = d[root][u] + i->second;         dfs(v);       }     }   }   int getd(int _r) {     root = _r;     mark.clear();     mark.resize(2001, false);     d[_r][_r] = 0;     dfs(_r);   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) scanf( %d , &f[i][j]);     vector<arc_t> arc;     arc.reserve(n * n / 2 + 1);     for (int i = 1; i <= n; i++) {       if (f[i][i]) {         puts( NO );         return 0;       }       for (int j = i + 1; j <= n; j++) {         if (!f[i][j] || f[i][j] != f[j][i]) {           puts( NO );           return 0;         }         arc.push_back(arc_t(i, j, f[i][j]));       }     }     sort(arc.begin(), arc.end());     set_init(n);     for (vector<arc_t>::iterator it = arc.begin(); it != arc.end(); it++) {       if (!set_union(it->u, it->v)) {         G[it->u].push_back(make_pair(it->v, it->c));         G[it->v].push_back(make_pair(it->u, it->c));       }     }     for (int i = 1; i <= n; i++) {       getd(i);     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (d[i][j] != f[i][j]) {           puts( NO );           return 0;         }     puts( YES );     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   #pragma GCC optimize(3,  Ofast ,  inline )   using namespace std;   const long long mod = 1e9 + 7;   const long long M = 1e8 + 5;   const long long N = 6e5 + 5;   char s[N];   bool check() {     map<char, long long> mp;     long long len = strlen(s + 1);     long long l = 1;     while (s[l] ==  a ) l++;     if (l == 1) return 0;     long long pos = l;     while (s[l] ==  b ) l++;     if (l == pos) return 0;     while (s[l] ==  c ) l++;     if (l != len + 1) return 0;     for (register long long i = 1; i <= len; i++) mp[s[i]]++;     if (mp[ c ] == mp[ a ] || mp[ c ] == mp[ b ]) return 1;     return 0;   }   inline void solve() {     scanf( %s , s + 1);     puts(check() ?  YES  :  NO );   }   signed main() {     long long T = 1;     for (long long index = 1; index <= T; index++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxx = 1e2 + 10;   int a[maxx], b[maxx];   int n;   inline bool check(int m) {     int max1 = 0, max2 = 0;     for (int i = 1; i <= n; i++) {       if (a[i] && !b[i])         max1 += m;       else if (a[i] && b[i])         max1 += 1, max2 += 1;       else if (!a[i] && b[i])         max2 += 1;       else         ;     }     return max1 > max2;   }   int main() {     while (cin >> n && n) {       for (int i = 1; i <= n; i++) cin >> a[i];       for (int i = 1; i <= n; i++) cin >> b[i];       int l = 1, r = 1e7, mid;       int ans = -1;       while (l <= r) {         mid = l + r >> 1;         if (check(mid)) {           ans = mid;           r = mid - 1;         } else           l = mid + 1;       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   string s, ans;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     cin.ignore(numeric_limits<streamsize>::max(),   n );     cin >> s;     bool flag = true;     int cnt = 0, max_cnt = 0;     for (int i = 0; i < n - 1; ++i) {       string sub = s.substr(i, 2);       cnt = 0;       for (int j = 0; j < n - 1; ++j) {         flag = true;         for (int k = 0; k < 2; ++k) {           if (sub[k] != s[j + k]) flag = false;         }         if (flag) ++cnt;         if (cnt > max_cnt) {           max_cnt = cnt;           ans = sub;         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000010;   int n, k;   int C[MAXN];   void load() {     scanf( %d%d , &n, &k);     for (int i = 0; i < n; i++) scanf( %d , C + i);   }   bool A[MAXN];   int previ[MAXN];   int nexti[MAXN];   int last[MAXN];   void sito() {     int x = 2;     for (int i = 0; i < MAXN; i++) A[i] = true;     while (x * x <= MAXN) {       int y = MAXN - 1;       while (y != x) {         y = previ[y];         long long z = (long long)x * y;         if (z >= MAXN) continue;         last[z] = x;         nexti[previ[z]] = nexti[z];         previ[nexti[z]] = previ[z];         A[z] = false;       }       x = nexti[x];     }   }   int CFactors[MAXN];   bool solve() {     for (int i = 1; i < MAXN; i++) {       previ[i] = i - 1;       nexti[i] = i + 1;     }     sito();     for (int i = 0; i < MAXN; i++)       if (A[i]) last[i] = i;     for (int i = 0; i < n; i++) {       int c = C[i];       while (c > 1) {         int l = last[c];         int br = 0;         while (c % l == 0) {           br++;           c /= l;         }         CFactors[l] = max(CFactors[l], br);       }     }     while (k > 1) {       int l = last[k];       int br = 0;       while (k % l == 0) {         br++;         k /= l;       }       if (br > CFactors[l]) return false;     }     return true;   }   int main() {     load();     if (solve())       printf( Yes n );     else       printf( No n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ;     int n;     cin >> n;     if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 13 ||         n == 15)       cout <<  1  << endl;     else       cout <<  0  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int p[100];   long long u, v;   int MOD;   void addmod(int &x, int y) { x = (x + y) % MOD; }   int dfs(long long minx, long long maxx, long long left, long long right,           long long state, int step) {     if (left <= minx && maxx <= right) {       int ret = 0;       long long r = (v >= state) ? ((v - state) >> step) : -1;       long long l = (u - 1 >= state) ? ((u - 1 - state) >> step) : -1;       if (r < 0LL) return 0;       long long a = l + r + 1, b = r - l;       if (a & 1)         b >>= 1;       else         a >>= 1;       ret = a % MOD * (b % MOD) % MOD;       ret = (long long)ret * p[step] % MOD;       addmod(ret, (r - l) % MOD * (state % MOD) % MOD);       addmod(ret, (r - l) % MOD);       return ret;     }     long long mid = (minx + maxx) / 2;     int ret = 0;     if (left <= mid) addmod(ret, dfs(minx, mid, left, right, state, step + 1));     if (right > mid)       addmod(ret,              dfs(mid + 1, maxx, left, right, state | (1LL << step), step + 1));     return ret;   }   int main() {     long long n, l, r;     int m;     scanf( %I64d%d%d , &n, &m, &MOD);     p[0] = 1 % MOD;     for (int i = 1; i <= 90; ++i) {       p[i] = (p[i - 1] * 2) % MOD;     }     for (int i = 0; i < m; ++i) {       scanf( %I64d%I64d%I64d%I64d , &l, &r, &u, &v);       u = max(0LL, u - 1);       v = min(n - 1, v - 1);       if (u > v)         puts( 0 );       else         printf( %d n , dfs(0, n - 1, l - 1, r - 1, 0, 0));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const long long MAX = 105;   long long n, m, x, y, z, k;   struct Matrix {     long long row, col;     long long m[MAX][MAX];   };   Matrix Multiply(Matrix A, Matrix B) {     Matrix ans;     ans.row = A.row;     ans.col = B.col;     for (long long i = 1; i <= A.row; i++) {       for (long long j = 1; j <= B.col; j++) {         ans.m[i][j] = 0;         for (long long k = 1; k <= A.col; k++) {           ans.m[i][j] += (A.m[i][k] * B.m[k][j]) % mod;           if (ans.m[i][j] >= mod) ans.m[i][j] -= mod;         }       }     }     return ans;   }   Matrix Power(Matrix mat, long long p) {     Matrix res;     Matrix ans;     ans.row = res.row = mat.row;     ans.col = res.col = mat.col;     long long n = ans.row;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j <= n; j++) {         ans.m[i][j] = 0;         res.m[i][j] = mat.m[i][j];       }       ans.m[i][i] = 1;     }     while (p) {       if (p % 2 == 1) ans = Multiply(ans, res);       res = Multiply(res, res);       p = p / 2;     }     return ans;   }   Matrix power(Matrix mat, long long p) {     if (p == 1) return mat;     if (p & 1) return Multiply(mat, power(mat, p - 1));     Matrix re = power(mat, (p / 2));     return Multiply(re, re);   }   Matrix mat;   long long ara[MAX];   int main() {     cin >> n >> k;     for (long long i = 1; i <= n; i++) {       scanf( %lld , &ara[i]);     }     if (k == 1) {       cout << n << endl;       return 0;     }     mat.row = mat.col = n;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j <= n; j++) {         long long val = ara[i] ^ ara[j];         if (__builtin_popcountll(val) % 3 == 0)           mat.m[i][j] = 1;         else           mat.m[i][j] = 0;       }     }     mat = power(mat, k - 1);     long long ans = 0;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j <= n; j++) {         ans = (ans + mat.m[i][j]);         if (ans >= mod) ans -= mod;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : (-x);   }   template <class T>   T sqr(T x) {     return x * x;   }   const int maxn = 1000 * 1000 * 2;   const int BUBEN = 40;   long long fib[BUBEN];   int a[maxn];   int n;   long long X, Y;   long long P;   struct M {     long long a[2][2];     M() { memset(a, 0, sizeof(a)); }     long long* operator[](int x) { return a[x]; }     M operator*(M m) {       M res;       for (int i = 0; i < 2; ++i)         for (int j = 0; j < 2; ++j)           for (int k = 0; k < 2; ++k)             res[i][j] = (res[i][j] + a[i][k] * m[k][j]) % P;       return res;     }   };   M pw(M x, long long y) {     M res;     res[0][0] = res[1][1] = 1;     while (y) {       if (y % 2LL == 1LL)         res = res * x, --y;       else         x = x * x, y /= 2LL;     }     return res;   }   const double alpha = (1. + sqrt(5.)) * 0.5;   bool cmp(pair<long long, long long> p, pair<long long, long long> q) {     if (X >= BUBEN - 2)       return p.first * alpha + p.second > q.first * alpha + q.second;     return p.first * fib[X + 1] + p.second * fib[X] >            q.first * fib[X + 1] + q.second * fib[X];   }   int main() {     fib[0] = 0;     fib[1] = 1;     for (int i = 2; i < BUBEN; ++i) fib[i] = fib[i - 1] + fib[i - 2];     cin >> n >> X >> Y >> P;     long long sum = 0;     for (int i = 0; i < n; ++i) {       scanf( %d , &a[i]);       sum += a[i];       sum %= P;     }     sort(a, a + n);     if (0) {       vector<int> v;       for (int i = 0; i < n; ++i) v.push_back(a[i]);       for (int i = 0; i < X; ++i) {         vector<int> w;         w.push_back(v[0]);         for (int j = 1; j < ((int)(v).size()); ++j)           w.push_back(v[j - 1] + v[j]), w.push_back(v[j]);         v = w;       }       sort((v).begin(), (v).end());       for (int i = 0; i < Y; ++i) {         vector<int> w;         w.push_back(v[0]);         for (int j = 1; j < ((int)(v).size()); ++j)           w.push_back(v[j - 1] + v[j]), w.push_back(v[j]);         v = w;       }       long long res = 0;       for (int i = 0; i < ((int)(v).size()); ++i) res += v[i];       res %= P;       cerr << res <<   n ;     }     if (n == 1) {       cout << (a[0] % P) <<   n ;       return 0;     }     long long l1 = a[0], r1 = a[n - 1];     long long l2 = a[0];     pair<long long, long long> _r2(-1, -1);     for (int i = 0; i < n - 1; ++i) {       long long x = a[i], y = a[i + 1];       if (x < y) swap(x, y);       pair<long long, long long> cur(x, y);       if (cmp(cur, _r2)) _r2 = cur;     }     M mf;     mf[0][0] = mf[0][1] = mf[1][0] = 1;     M F = pw(mf, X);     long long r2 = F[0][0] * (_r2.first % P) + F[0][1] * (_r2.second % P);     r2 %= P;     M m1;     m1[0][0] = 3;     m1[0][1] = (P - 1) % P;     m1[1][1] = 1;     M m2 = pw(m1, X);     long long T1 = l1 + r1;     long long T2 = l2 + r2;     T1 %= P;     T2 %= P;     long long s0 = m2[0][0] * sum + m2[0][1] * (T1);     s0 %= P;     M m3 = pw(m1, Y);     long long res = m3[0][0] * s0 + m3[0][1] * (T2);     res %= P;     res += P;     res %= P;     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int f[123];   int l[123];   int t[123][123];   int h[123][123];   int main() {     int n, m, H;     cin >> n >> m >> H;     for (int i = 0; i < m; i++) scanf( %d , f + i);     for (int i = 0; i < n; i++) scanf( %d , l + i);     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) scanf( %d , &t[i][j]);     for (int j = 0; j < m; j++) {       for (int i = 0; i < n; i++)         if (t[i][j] && l[i] >= f[j]) {           h[i][j] = f[j];         }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++)         if (t[i][j] && f[j] >= l[i]) {           h[i][j] = max(h[i][j], l[i]);         }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) printf( %d  , h[i][j]);       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, i, j, a[100100], p = 1;     scanf( %lld , &n);     for (i = 0; i < n; i++) scanf( %lld , &a[i]);     sort(a, a + n);     for (i = 0; i < n; i++) {       if (a[i] >= p) p++;     }     printf( %lld n , p);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string toString(int n) {     ostringstream ost;     ost << n;     ost.flush();     return ost.str();   }   int toInt(string s) {     int r = 0;     istringstream sin(s);     sin >> r;     return r;   }   int main() {     int n;     cin >> n;     int arr[100];     map<int, int> mp;     vector<int> vp;     for (int i = 0; i < n; i++) cin >> arr[i], mp[arr[i]]++, vp.push_back(arr[i]);     sort(arr, arr + n);     {       sort((vp).begin(), (vp).end());       (vp).erase(unique((vp).begin(), (vp).end()), vp.end());     };     int ans = 0;     for (int i = 0; i < vp.size(); i++) {       ans += mp[vp[i]] / 2;     }     cout << (ans / 2) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t;   int main() {     cin >> t;     while (t--) {       int n, nrp = 0, nri = 0;       cin >> n;       while (n--) {         int x;         cin >> x;         if (x % 2)           nri++;         else           nrp++;       }       if (nrp == 0)         if (nri % 2)           cout <<  YES n ;         else           cout <<  NO n ;       else if (nri)         cout <<  YES n ;       else         cout <<  NO n ;     }     return 0;   }