malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int iL = 666666;   char *iS, *iT, ibuf[iL];   inline char gc() {     if (iS == iT) {       iT = (iS = ibuf) + fread(ibuf, 1, iL, stdin);       return iS == iT ? EOF : *iS++;     }     return *iS++;   }   template <class I>   void gi(I &x) {     static char c;     static int f;     for (f = 1, c = getchar(); c <  0  || c >  9 ; c = getchar())       if (c ==  - ) f = -1;     for (x = 0; c <=  9  && c >=  0 ; c = getchar()) x = x * 10 + (c & 15);     x *= f;   }   const int N = 200050;   int Ttag[N * 4], Tval[N * 4], T[N * 4][31];   int n, q, sig, d, l, r;   int cnt(int x) {     int ans = 0;     for (int i = 0; i <= 30; i++)       if (T[x][i]) ans++;     return ans;   }   void clear(int x) {     for (int i = 0; i <= 30; i++) T[x][i] = 0;     Tval[x] = Ttag[x] = 0;   }   void add(int d, int x) {     for (int i = 30; i >= 0; i--)       if ((d >> i) & 1) {         if (T[x][i])           d ^= T[x][i];         else {           T[x][i] = d;           break;         }       }   }   void Complex(int x, int lc, int rc) {     clear(x);     for (int i = 0; i <= 30; i++) add(T[lc][i], x), add(T[rc][i], x);     add(Tval[lc] ^ Tval[rc], x);     Tval[x] = Tval[lc];   }   void Complex2(int x, int rc) {     clear(N * 4 - 1);     for (int i = 0; i <= 30; i++)       add(T[x][i], N * 4 - 1), add(T[rc][i], N * 4 - 1);     add(Tval[x] ^ Tval[rc], N * 4 - 1);     Tval[N * 4 - 1] = Tval[x];     for (int i = 0; i <= 30; i++) T[x][i] = T[N * 4 - 1][i];     Tval[x] = Tval[N * 4 - 1];   }   void build(int x, int l, int r) {     clear(x);     if (l == r) {       gi(Tval[x]);       return;     }     int mid = (l + r) >> 1;     build(x << 1, l, mid);     build(x << 1 | 1, mid + 1, r);     Complex(x, x << 1, x << 1 | 1);   }   void push_down(int x) {     int lc = x << 1, rc = x << 1 | 1;     if (Ttag[x]) {       Ttag[lc] ^= Ttag[x];       Ttag[rc] ^= Ttag[x];       Tval[lc] ^= Ttag[x];       Tval[rc] ^= Ttag[x];       Ttag[x] = 0;     }   }   void change(int x, int l, int r, int lb, int rb, int d) {     if (lb <= l && r <= rb) {       Tval[x] ^= d;       Ttag[x] ^= d;       return;     }     push_down(x);     int mid = (l + r) >> 1;     if (lb <= mid) change(x << 1, l, mid, lb, rb, d);     if (rb > mid) change(x << 1 | 1, mid + 1, r, lb, rb, d);     Complex(x, x << 1, x << 1 | 1);   }   void query(int x, int l, int r, int lb, int rb) {     if (lb <= l && r <= rb) {       Complex2(0, x);       return;     }     push_down(x);     int mid = (l + r) >> 1;     if (lb <= mid) query(x << 1, l, mid, lb, rb);     if (rb > mid) query(x << 1 | 1, mid + 1, r, lb, rb);     Complex(x, x << 1, x << 1 | 1);   }   int main() {     gi(n);     gi(q);     build(1, 1, n);     while (q--) {       gi(sig);       if (sig == 1) {         gi(l);         gi(r);         gi(d);         change(1, 1, n, l, r, d);       } else {         gi(l);         gi(r);         clear(0);         query(1, 1, n, l, r);         printf( %d n , (1 << cnt(0)));       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   int main() {     string a;     cin >> a;     int sz = int(a.size());     for (__typeof(sz) i = 0; i < sz; i++)       for (__typeof(sz) j = 0; j < sz; j++)         if (a.substr(0, i) + a.substr(j + 1) ==  CODEFORCES ) {           cout <<  YES n ;           return 0;         }     cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double EPS = 1e-10;   const int OO = 2147483647;   int dx[] = {1, -1, 0, 0};   int dy[] = {0, 0, -1, 1};   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n;     cin >> n;     map<pair<long long, long long>, long long> st;     map<long long, long long> xs, ys;     long long ans = 0;     long long cnt = 0;     while (n--) {       int x, y;       cin >> x >> y;       ans += xs[x]++ + ys[y]++ - st[{x, y}]++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 1;   const int MOD = 1e9 + 7;   long long a[MAXN], b[MAXN];   bool used[MAXN];   vector<int> g[MAXN];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     ;     long long n, m, cnt = 0, ans = 0;     bool y = 0;     cin >> n;     a[1] = 1;     for (int i = 2; i <= n; i++) {       cin >> a[i];     }     cnt = n;     while (cnt != 1) {       ans++;       b[ans] = cnt;       cnt = a[cnt];     }     reverse(b + 1, b + ans + 1);     cout << 1 <<    ;     for (int i = 1; i <= ans; i++) {       cout << b[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100 * 1005;   bool bad[maxn];   vector<int> blocked;   vector<int> g[maxn];   bool seen[maxn];   int deg[maxn];   vector<int> good;   int n, m, k;   bool can(double mid) {     memset(bad, 0, sizeof(bad));     memset(deg, 0, sizeof(deg));     memset(seen, 0, sizeof(seen));     queue<int> q;     for (int i = 0; i < n; ++i) deg[i] = ((int)((g[i]).size()));     for (int i = 0; i < ((int)((blocked).size())); i++) q.push(blocked[i]);     while (!q.empty()) {       int u = q.front();       q.pop();       if (seen[u]) continue;       seen[u] = 1;       for (int i = 0; i < ((int)((g[u]).size())); i++) {         int v = g[u][i];         if (bad[v]) continue;         deg[v]--;         if (double(deg[v] / (1.0 * ((int)((g[v]).size())))) < mid) q.push(v);       }     }     good.clear();     for (int i = 0; i < n; ++i)       if (!seen[i]) good.push_back(i);     return ((int)((good).size())) > 0;   }   int main() {     int u, v;     scanf( %d %d %d , &n, &m, &k);     for (int i = 0; i < k; ++i) scanf( %d , &u), --u, blocked.push_back(u);     for (int i = 0; i < m; ++i)       scanf( %d %d , &u, &v), --u, --v, g[u].push_back(v), g[v].push_back(u);     double l = 0, r = 1.0;     double ans = 0.0;     for (int i = 0; i < 80; ++i) {       double mid = (l + r) / 2.0;       if (can(mid))         l = mid, ans = mid;       else         r = mid;     }     can(ans);     assert(((int)((good).size())) <= n - k);     assert(((int)((good).size())) != 0);     printf( %d n , ((int)((good).size())));     for (int i = 0; i < ((int)((good).size())); i++) printf( %d  , good[i] + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace MincostMaxFlow {   const int maxn(2e5 + 5);   struct Edge {     int to, next, w, f;   };   int first[maxn], cnt, vis[maxn], dis[maxn], S, T, pe[maxn], pv[maxn], maxflow,       mincost;   Edge edge[maxn * 20];   queue<int> Q;   inline void Init(int _S, int _T) {     cnt = mincost = maxflow = 0, S = _S, T = _T;     memset(first, -1, sizeof(first));   }   inline void AddEdge(int u, int v, int w, int f) {     edge[cnt] = (Edge){v, first[u], w, f}, first[u] = cnt++;     edge[cnt] = (Edge){u, first[v], -w, 0}, first[v] = cnt++;   }   inline int SPFA() {     int e, u, v, inf;     memset(dis, 63, sizeof(dis)), inf = dis[0];     Q.push(S), dis[S] = 0, vis[S] = 1;     while (!Q.empty()) {       u = Q.front(), Q.pop();       for (e = first[u]; ~e; e = edge[e].next)         if (edge[e].f && dis[u] + edge[e].w < dis[v = edge[e].to]) {           dis[v] = dis[u] + edge[e].w, pv[v] = u, pe[v] = e;           if (!vis[v]) vis[v] = 1, Q.push(v);         }       vis[u] = 0;     }     if (dis[T] >= 0) return 0;     for (v = T; v ^ S; v = pv[v]) inf = min(inf, edge[pe[v]].f);     maxflow += inf, mincost += dis[T] * inf;     for (v = T; v ^ S; v = pv[v]) edge[pe[v]].f -= inf, edge[pe[v] ^ 1].f += inf;     return 1;   }   inline int MCMF() {     while (SPFA())       ;     return mincost;   }   }  // namespace MincostMaxFlow   using MincostMaxFlow ::AddEdge;   using MincostMaxFlow ::Init;   using MincostMaxFlow ::MCMF;   const int inf(1e7);   int n, k, a[85], c[85], S, T;   int main() {     int i, j, tmp;     scanf( %d%d , &n, &k), k = min(k, n);     for (i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (i = 1; i <= n; ++i) scanf( %d , &c[i]);     Init(S = 0, T = n + n + 2), tmp = n + n + 1, AddEdge(S, tmp, 0, k);     for (i = 1; i <= n; ++i) {       AddEdge(i, i + n, -inf, 1);       for (j = i + 1; j <= n; ++j)         if (a[j] == a[i])           AddEdge(i + n, j, 0, 1);         else           AddEdge(i + n, j, c[a[j]], 1);       AddEdge(i + n, T, 0, 1), AddEdge(tmp, i, c[a[i]], 1);     }     printf( %d n , MCMF() + n * inf);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N;   int A[3][30];   int p3[30];   map<pair<int, int>, pair<int, signed long long> > M[2];   void solve() {     int i, j, k, l, r, x, y;     string s;     cin >> N;     p3[0] = 1;     for (i = 0; i < N; i++) p3[i + 1] = p3[i] * 3;     for (i = 0; i < N; i++) cin >> A[0][i] >> A[1][i] >> A[2][i];     for (signed long long mask = 0; mask < p3[min(N, 13)]; mask++) {       int t[3] = {}, tm = mask;       for (i = 0; i < min(N, 13); i++) {         x = tm % 3, tm /= 3;         if (x == 0) t[0] += A[0][i], t[1] += A[1][i];         if (x == 1) t[0] += A[0][i], t[2] += A[2][i];         if (x == 2) t[1] += A[1][i], t[2] += A[2][i];       }       M[0][{t[0] - t[1], t[0] - t[2]}] =           max(M[0][{t[0] - t[1], t[0] - t[2]}], {t[0] + (1LL << 29), mask});     }     for (signed long long mask = 0; mask < p3[max(0, N - 13)]; mask++) {       int t[3] = {}, tm = mask;       for (i = 0; i < max(0, N - 13); i++) {         x = tm % 3, tm /= 3;         if (x == 0) t[0] += A[0][13 + i], t[1] += A[1][13 + i];         if (x == 1) t[0] += A[0][13 + i], t[2] += A[2][13 + i];         if (x == 2) t[1] += A[1][13 + i], t[2] += A[2][13 + i];       }       M[1][{t[1] - t[0], t[2] - t[0]}] = max(M[1][{t[1] - t[0], t[2] - t[0]}],                                              {t[0] + (1LL << 29), mask * p3[13]});     }     signed long long co = -1LL << 40;     signed long long best = -1;     for (auto& r : M[1])       if (M[0].count(r.first) && r.second.first + M[0][r.first].first > co) {         co = r.second.first + M[0][r.first].first;         best = r.second.second + M[0][r.first].second;       }     if (best == -1)       (void)printf( Impossible n );     else {       for (i = 0; i < N; i++) {         x = best % 3;         best /= 3;         if (x == 0) (void)printf( LM n );         if (x == 1) (void)printf( LW n );         if (x == 2) (void)printf( MW n );       }     }   }   int main(int argc, char** argv) {     string s;     int i;     if (argc == 1) ios::sync_with_stdio(false);     for (i = 0; i < argc - 1; i++) s += argv[i + 1], s +=   n ;     for (i = 0; i < s.size(); i++) ungetc(s[s.size() - 1 - i], stdin);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int node[100005][2];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) scanf( %d%d , &node[i][0], &node[i][1]);     int ans = node[0][1] + node[0][0] - 1;     bool flag = 0;     for (int i = 1; i < m; i++) {       int d_val = node[i][0] - node[i - 1][0];       if (abs(node[i][1] - node[i - 1][1]) > d_val) {         flag = 1;         break;       }       ans = max(ans, node[i][1]);       ans = max(ans, max(node[i][1], node[i - 1][1]) +                          (d_val - abs(node[i][1] - node[i - 1][1])) / 2);     }     int syday = n - node[m - 1][0];     ans = max(ans, node[m - 1][1] + syday);     if (flag)       cout <<  IMPOSSIBLE  << endl;     else       cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 600;   char graph[MAXN][MAXN];   int dx[4] = {-1, 0, 0, 1};   int dy[4] = {0, -1, 1, 0};   vector<char> op;   vector<pair<int, int> > pos;   bool visited[MAXN][MAXN];   void solve(int x, int y, int n, int m, int initX, int initY) {     visited[x][y] = true;     bool flag = false;     for (int i = 0; i < 4; i++) {       int nx = x + dx[i];       int ny = y + dy[i];       if (nx >= 0 && nx < n && ny >= 0 && ny < m && graph[nx][ny] ==  .  &&           !visited[nx][ny]) {         if (!flag) {           op.push_back( B );           pos.push_back(make_pair(x + 1, y + 1));         }         flag = true;         solve(nx, ny, n, m, initX, initY);       }     }     if (!flag) {       if (x == initX && y == initY) {         op.push_back( B );       } else {         op.push_back( R );       }       pos.push_back(make_pair(x + 1, y + 1));     } else {       if (!(x == initX && y == initY)) {         op.push_back( D );         pos.push_back(make_pair(x + 1, y + 1));         op.push_back( R );         pos.push_back(make_pair(x + 1, y + 1));       }     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> graph[i][j];       }     }     memset(visited, false, sizeof(visited));     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (graph[i][j] ==  .  && !visited[i][j]) {           solve(i, j, n, m, i, j);         }       }     }     int size = op.size();     printf( %d n , size);     for (int i = 0; i < size; i++) {       printf( %c %d %d n , op[i], pos[i].first, pos[i].second);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, h, m, l, r, x;     cin >> n >> h >> m;     vector<int> v(n, h);     for (int i = 0; i < m; i++) {       cin >> l >> r >> x;       for (int j = l - 1; j < r; j++) {         v[j] = min(v[j], x);       }     }     long long sum = 0;     for (int i = 0; i < v.size(); i++) {       sum = sum + (v[i] * v[i]);     }     cout << sum <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1;     cin >> s1;     int condition = 1;     for (int i = 1; i <= s1.length(); i++) {       if (s1[i] == s1[i - 1]) {         condition++;         if (condition == 7) {           cout <<  YES  << endl;           return 0;         }       } else {         condition = 1;       }     }     cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     pair<int, int> point[n];     for (int i = 0; i < n; i++) {       cin >> point[i].first >> point[i].second;     }     sort(point, point + n,          [](pair<int, int> a, pair<int, int> b) { return a.first < b.first; });     long long ans = 0;     long long cnt = 1;     for (int i = 0; i < n - 1; i++) {       if (point[i].first == point[i + 1].first) {         cnt++;       } else {         ans += cnt * (cnt - 1) / 2;         cnt = 1;       }     }     ans += cnt * (cnt - 1) / 2;     sort(point, point + n,          [](pair<int, int> a, pair<int, int> b) { return a.second < b.second; });     cnt = 1;     for (int i = 0; i < n - 1; i++) {       if (point[i].second == point[i + 1].second) {         cnt++;       } else {         ans += cnt * (cnt - 1) / 2;         cnt = 1;       }     }     ans += cnt * (cnt - 1) / 2;     sort(point, point + n);     cnt = 1;     for (int i = 0; i < n - 1; i++) {       if (point[i] == point[i + 1]) {         cnt++;       } else {         ans -= cnt * (cnt - 1) / 2;         cnt = 1;       }     }     ans -= cnt * (cnt - 1) / 2;     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int hoa = 0;     int thuong = 0;     for (int i = 0; i < s.size(); i++) {       if (s[i] >= 65 && s[i] <= 90) {         hoa++;       } else {         thuong++;       }     }     if (thuong >= hoa) {       for (int i = 0; i < s.size(); i++) {         if (s[i] >= 65 && s[i] <= 90) {           s[i] += 32;         }       }     } else {       for (int i = 0; i < s.size(); i++) {         if (s[i] >= 97 && s[i] <= 122) {           s[i] -= 32;         }       }     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1e9 + 7;   const long long int cmod = 998244353;   const long long int N = 2e5 + 5;   const long long int inf = 1e16 + 2;   void solve(long long int ze) {     long long int n, x, t, pr = 0;     cin >> n >> x;     vector<long long int> ans;     map<long long int, long long int> check;     check[0] = 1;     check[x] = 1;     for (long long int i = 1; i < (1LL << n); i++) {       if (!check[i]) {         ans.push_back(pr ^ i);         pr = i;         check[i] = 1;         check[i ^ x] = 1;       }     }     cout << ans.size() <<   n ;     for (auto x : ans) cout << x <<    ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int testcase = 1;     long long int x = 1;     while (testcase--) {       solve(x++);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double eps = 1e-8;   const int mod = 1e9 + 7;   const int inf = 1061109567;   const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};   double dp[205][205][405], p[205];   int a[205];   int main() {     int n, l, tmp;     cin >> n >> l >> tmp;     for (int i = 1; i <= n; i++) {       cin >> p[i];       p[i] /= 100;     }     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     dp[0][0][200 + tmp] = 1;     for (int i = 0; i < n; i++) {       for (int j = 0; j <= i; j++) {         for (int k = 0; k <= 400; k++) {           if (a[i + 1] == -1) {             if (k > 0) dp[i + 1][j + 1][k - 1] += dp[i][j][k] * p[i + 1];             dp[i + 1][j][k] += dp[i][j][k] * (1 - p[i + 1]);           } else {             int val = min(400, k + a[i + 1]);             if (k > 0) dp[i + 1][j + 1][val] += dp[i][j][k] * p[i + 1];             dp[i + 1][j][k] += dp[i][j][k] * (1 - p[i + 1]);           }         }       }     }     double ans = 0;     for (int i = l; i <= n; i++) {       for (int j = 200; j <= 400; j++) {         ans += dp[n][i][j];       }     }     printf( %.8f n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long in() {     long long x = 0;     int n = 1;     char c = getchar();     while (!isdigit(c)) {       n = (c ==  - ) ? -1 : 1;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * n;   }   const int N = 80;   int n, a[N], d[5];   int f[N][N][N][2];   string s;   int NOR(int x) {     if (x < 0) return -x;     return 0;   }   void UPD(int &a, int b) {     if (a == -1)       a = b;     else       a = min(a, b);   }   int main() {     n = in();     cin >> s;     s =     + s;     for (int i = 1; i <= n; i++) {       a[i] = (s[i] ==  V ) ? 1 : (s[i] ==  K ) ? 2 : 0;       d[a[i]]++;     }     memset(f, -1, sizeof(f));     f[0][0][0][0] = f[0][0][0][1] = 0;     for (int z = 0; z <= d[0]; z++)       for (int v = 0; v <= d[1]; v++)         for (int k = 0; k <= d[2]; k++)           for (int ov = 0; ov <= 1; ov++)             if (f[z][v][k][ov] >= 0) {               for (int nd = 0; nd <= 2; nd++) {                 if (ov == 1 && nd == 2) continue;                 int Z = z + (nd == 0), V = v + (nd == 1), K = k + (nd == 2);                 int d[5];                 d[0] = z, d[1] = v, d[2] = k;                 int left = 0;                 for (int i = 1; i <= n; i++) {                   if (a[i] == nd && d[a[i]] == 0) break;                   if (d[a[i]] == 0)                     left++;                   else                     d[a[i]]--;                 }                 UPD(f[Z][V][K][(nd == 1)], f[z][v][k][ov] + left);               }             }     int res = -1;     for (int ov = 0; ov <= 1; ov++) UPD(res, f[d[0]][d[1]][d[2]][ov]);     if (res == -1)       cout << 0;     else       cout << res;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const long long mod1 = 998244353;   const double pie = 3.1415926535;   unsigned long long power(unsigned long long x, unsigned long long y) {     if (y == 0)       return 1;     else {       if (y % 2 == 0)         return power(x * x, y / 2);       else         return x * power(x * x, (y - 1) / 2);     }   }   long long mod_power(long long x, long long y, long long m) {     long long r = 1;     x = x % m;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) r = (r * x) % m;       y = y / 2;       x = (x * x) % m;     }     return r;   }   long long gcd(long long x, long long y) {     if (y == 0) return x;     return gcd(y, x % y);   }   vector<long long> extended_Euclid(long long a, long long b) {     vector<long long> v(3);     if (b == 0) {       v[0] = a;       v[1] = 1;       v[2] = 0;       return v;     } else {       vector<long long> v1 = extended_Euclid(b, a % b);       v[0] = v1[0];       v[1] = v1[2];       v[2] = v1[1] - (a / b) * v1[2];       return v;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int TESTS = 1;     cin >> TESTS;     while (TESTS--) {       unsigned long long a;       cin >> a;       unsigned long long c = 0;       c = __builtin_popcount(a);       cout << power(2, c) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   long long binPow(long long a, long long b) {     long long x = 1, y = a;     while (b) {       if (b & 1) x = (x * y) % mod;       y = (y * y) % mod;       b >>= 1;     }     return x % mod;   }   long long inverserEuler(int n) { return binPow(n, mod - 2); }   long long C(int k, int n) {     vector<long long> f(n + 1, 1);     for (int i = 2; i <= n; i++) f[i] = (f[i - 1] * i) % mod;     return (f[n] * ((inverserEuler(f[k]) * inverserEuler(f[n - k])) % mod) %             mod) %            mod;   }   void trunghieu() {     int n;     cin >> n;     int a[n], i, j;     map<int, int> cnt;     for (i = 0; i < n; ++i) cin >> a[i], cnt[a[i]]++;     if (cnt.size() == 2) {       map<int, int>::iterator it;       it = cnt.begin();       int n1 = it->second, x1 = it->first;       it++;       int n2 = it->second, x2 = it->first;       ;       if (n1 == n2)         cout <<  YES  << endl << x1 <<     << x2;       else         cout <<  NO ;     } else       cout <<  NO ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie();     trunghieu();     return 0;   }