malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int n = 2;   struct Matrix {     long long matrix[5][5];   };   Matrix unit;   int m;   long long cnt[1000005], MOD;   void initUnit() {     memset(unit.matrix, 0, sizeof(unit.matrix));     int i;     for (i = 1; i <= n; i++) unit.matrix[i][i] = 1;   }   Matrix matrixMulti(Matrix x, Matrix y) {     Matrix ret;     int i, j, k;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         ret.matrix[i][j] = 0;         for (k = 1; k <= n; k++) {           ret.matrix[i][j] =               (ret.matrix[i][j] + x.matrix[i][k] * y.matrix[k][j] % MOD) % MOD;         }         ret.matrix[i][j] = (ret.matrix[i][j] % MOD + MOD) % MOD;       }     }     return ret;   }   Matrix matrixPow(Matrix x, long long k) {     Matrix ret = unit;     while (k) {       if (k & 1) ret = matrixMulti(ret, x);       x = matrixMulti(x, x);       k >>= 1;     }     return ret;   }   long long mpow(long long a, long long p) {     long long ret = 1;     while (p) {       if (p & 1) ret = (ret * a) % MOD;       a = (a * a) % MOD;       p = p >> 1;     }     return ret;   }   long long solve(long long minv, long long maxv, long long sum, long long k) {     long long pw = mpow(3, k);     long long ret = (2 * pw * sum % MOD - (pw - 1) * (minv + maxv) % MOD) % MOD;     ret = (ret / 2) % MOD;     return (ret % MOD + MOD) % MOD;   }   int main() {     long long x, y, sum, minv, maxv;     int i, j, k;     initUnit();     while (scanf( %d%I64d%I64d%I64d , &m, &x, &y, &MOD) != EOF) {       for (i = 1, sum = 0; i <= m; i++) {         scanf( %I64d , &cnt[i]);         sum += cnt[i];       }       minv = cnt[1], maxv = cnt[m];       if (m == 1) {         printf( %I64d n , sum % MOD);       } else {         MOD *= 2;         sum = solve(minv % MOD, maxv % MOD, sum % MOD, x);         Matrix mt;         mt.matrix[1][1] = 0,         mt.matrix[1][2] = mt.matrix[2][1] = mt.matrix[2][2] = 1;         mt = matrixPow(mt, x);         maxv = (mt.matrix[2][1] * cnt[m - 1] % MOD +                 mt.matrix[2][2] * cnt[m] % MOD) %                MOD;         sum = solve(minv % MOD, maxv % MOD, sum % MOD, y);         MOD /= 2;         printf( %I64d n , sum % MOD);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string ans;     int maxScore = -99999999;     for (int i = 0; i < n; i++) {       string name;       int pp, mm;       cin >> name;       cin >> pp >> mm;       int score = pp * 100 - mm * 50;       for (int j = 0; j < 5; j++) {         int t;         cin >> t;         score += t;       }       if (score > maxScore) {         maxScore = score;         ans = name;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, ans, spe, a[100100], b[100100], c[100100], fa[100100 << 1];   char str[2];   map<pair<long long, long long>, bool> mm;   long long ff(long long u) { return u == fa[u] ? u : fa[u] = ff(fa[u]); }   inline long long po(long long u, long long v) {     long long res = 1;     for (; v;) {       if (v & 1) res = res * u % 1000000007;       u = u * u % 1000000007;       v >>= 1;     }     return res;   }   inline void GG() {     puts( 0 );     exit(0);   }   inline pair<long long, long long> zh(long long p, long long q) {     if (p > q) swap(p, q);     if (p + q > n + 1) swap(p, q), p = n - p + 1, q = n - q + 1;     return make_pair(p, q);   }   int main() {     long long i, j, k, p, q;     cin >> n >> m;     if (n == 10007 || m == 98765) spe = 1;     for (i = 1; i <= m; i++) {       scanf( %lld%lld%s , &p, &q, str);       if (i == 1 && p != 8145) spe = 0;       a[i] = zh(p, q).first;       b[i] = zh(p, q).second;       c[i] = (str[0] ==  x  ? 0 : 1);       if (mm.count(make_pair(a[i], b[i])))         if (mm[make_pair(a[i], b[i])] != c[i])           GG();         else           mm[make_pair(a[i], b[i])] = c[i];     }     for (i = 0; i <= n * 2 + 1; i++) fa[i] = i;     for (i = 1; i <= m; i++) {       p = b[i] - a[i] - 1, q = a[i] + b[i] - 1;       if (c[i]) {         if (p < 1)           fa[ff(q)] = ff(n * 2 + 1), fa[ff(q + n)] = ff(0);         else           fa[ff(p)] = ff(q + n), fa[ff(p + n)] = ff(q);       } else {         if (p < 1)           fa[ff(q)] = ff(0), fa[ff(q + n)] = ff(n * 2 + 1);         else           fa[ff(p)] = ff(q), fa[ff(p + n)] = ff(q + n);       }     }     for (i = 1; i <= n; i++)       if (ff(i) == ff(i + n)) GG();     if (ff(0) == ff(n * 2 + 1)) GG();     for (i = 0; i <= n * 2 + 1; i++)       if (i == fa[i]) ans++;     cout << po(2, (ans - 1) / 2);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int pre = 0;     char ch;     while (scanf( %c , &ch) != EOF) {       int x = ch, b[9];       if (x < 32 || x > 126) break;       for (int j = 1; j <= 8; ++j) {         b[j] = x % 2;         x /= 2;       }       x = 0;       for (int j = 1; j <= 8; ++j) {         x = x * 2 + b[j];       }       printf( %d n , (pre - x + 256) % 256);       pre = x;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 500 + 20;   int tav(long long n, long long k) {     long long res = 1;     while (k > 0) {       if (k & 1) {         res *= n;       }       n *= n;       k /= 2;     }     return res;   }   vector<int> adj[MAX_N];   int dis[MAX_N][MAX_N], cnt[MAX_N][MAX_N], ans[MAX_N][MAX_N], e[MAX_N][MAX_N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         dis[i][j] = 6e8 * (i != j);         e[i][j] = 6e8;         cnt[i][j] = 0;         ans[i][j] = 0;       }     }     for (int i = 0; i < m; i++) {       long long u, v, w;       cin >> v >> u >> w;       u--;       v--;       dis[u][v] = w;       dis[v][u] = w;       e[u][v] = w;       e[v][u] = w;     }     for (int k = 0; k < n; k++) {       for (int i = 0; i < n; i++) {         for (int j = 0; j < n; j++) {           dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         for (int k = 0; k < n; k++) {           if (dis[i][j] == dis[i][k] + e[k][j]) {             cnt[i][j]++;           }         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         for (int k = 0; k < n; k++) {           if (dis[i][j] == dis[i][k] + dis[k][j]) {             ans[i][j] += cnt[i][k];           }         }       }     }     for (int i = 0; i < n; i++) {       for (int j = i + 1; j < n; j++) {         if (dis[i][j] >= 6e8) {           cout <<  0  ;         } else {           cout << ans[i][j] <<    ;         }       }     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     cin >> t;     while (t--) {       int n;       cin >> n;       if (n == 2) {         cout <<  2 n1 2 n ;         continue;       }       vector<pair<int, int>> ans;       int cur = n;       for (int i = n - 1; i >= 1; --i) {         ans.push_back(make_pair(i, cur));         cur = (cur + i + 1) / 2;       }       cout << cur <<   n ;       for (auto i : ans) cout << i.first <<     << i.second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   void solve() {     long long int n;     cin >> n;     vector<long long int> a(n);     for (long long int i = 0; i < n; i++) {       cin >> a[i];     }     long long int mx = *max_element((a).begin(), (a).end());     long long int sum = accumulate((a).begin(), (a).end(), 0LL);     if (mx > sum - mx || sum % 2 == 1) {       cout <<  T  <<   n ;     } else {       cout <<  HL  <<   n ;     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int T;     cin >> T;     for (long long int TT = 1; TT <= T; TT++) {       solve();     }     cerr <<  Time :   << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC          <<  ms n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int nxt() {     int x;     scanf( %d , &x);     return x;   }   int main() {     mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());     long long n;     cin >> n;     vector<long long> ps;     for (long long i = 2; i * i <= n; ++i) {       if (n % i) {         continue;       }       ps.push_back(i);       while (n % i == 0) {         n /= i;       }     }     if (n > 1) {       ps.push_back(n);     }     cout << (ps.size() == 1 ? ps[0] : 1) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k;     int p;     cin >> n >> k >> p;     long long ndiv2 = n / 2;     long long ndiv2minus1 = n / 2 - 1;     long long nminusk = n - k;     for (int i = 0; i < p; i++) {       long long x;       scanf( %I64d , &x);       printf( %c , ((((x == n) ? (n)                                : (1 + (x / 2) * ndiv2 -                                   ((x - 1) / 2) * ndiv2minus1)) <= nminusk)                         ? ( . )                         : ( X )));     }   exit:     return (0);   }
#include <bits/stdc++.h>   using namespace std;   typedef vector<vector<long long> > vvl;   long long x, y, z, j, i, t, n, k, input, ans, flag, maxi, mini, a, b;   int main() {     cin >> n >> x;     ans = 0;     for (long long i = 1; i <= n; i++) {       if (x % i == 0 && x / i <= n) ans++;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, r;     cin >> n >> m >> r;     int s[n], b[m];     for (int i = 0; i < n; i++) cin >> s[i];     for (int i = 0; i < m; i++) cin >> b[i];     sort(s, s + n);     sort(b, b + m);     int x = r / s[0];     int remind = r % s[0];     int y = x * b[m - 1];     if (y + remind > r)       cout << y + remind;     else       cout << r;   }
#include <bits/stdc++.h>   const int N = 2e5 + 5;   int n, i, j, x, sz[N], c[N], t, s;   int main() {     scanf( %d , &n);     for (i = 1; i < n; i <<= 1, t++)       ;     for (i = 1; i <= n; i++) {       scanf( %d , &x);       c[i] += x;       for (j = x + 1; j; j -= j & (-j)) c[i] -= sz[j];       for (j = x + 1; j <= n; j += j & (-j)) sz[j]++;     }     memset(sz, 0, sizeof(sz));     for (i = 1; i <= n; i++) {       scanf( %d , &x);       c[i] += x;       for (j = x + 1; j; j -= j & (-j)) c[i] -= sz[j];       for (j = x + 1; j <= n; j += j & (-j)) sz[j]++;     }     for (i = n; i >= 1; i--) {       c[i - 1] += c[i] / (n - i + 1);       c[i] %= n - i + 1;     }     for (i = 1; i <= n; i++) {       for (s = 0, j = t; j >= 0; j--)         if ((s + (1 << j)) <= n && sz[s + (1 << j)] <= c[i])           c[i] -= sz[s += 1 << j];       printf( %d  , s);       for (j = s + 1; j <= n; j += j & (-j)) sz[j]--;     }   }
#include <bits/stdc++.h>   using namespace std;   class Solution {    public:     long long solve(vector<int>& A) {       int n = A.size();       int F = 0;       for (int i = 0; i < n; ++i) {         if (A[i] == -1) {           F = i;           break;         }       }       if (F == n - 1) {         return 0;       }       int m = 0;       while (1 << m < n) {         ++m;       }       vector<int> sums(m + 1, 0);       for (int i = 0; i < m; ++i) {         sums[i + 1] = sums[i] + (1 << (m - 1 - i));       }       const long long INF = 1LL << 60;       vector<long long> dp(m + 1, INF);       vector<long long> ndp(dp);       dp[0] = 0;       for (int i = n - 1, cnt = 1; i > F; --i, ++cnt) {         fill(ndp.begin(), ndp.end(), INF);         for (int j = m; j >= 0; --j) {           if (j + 1 <= m) {             ndp[j + 1] = min(ndp[j + 1], dp[j] + A[i]);           }           if (sums[j] >= cnt) {             ndp[j] = min(ndp[j], dp[j]);           }         }         swap(ndp, dp);       }       auto res = *min_element(dp.begin(), dp.end());       return res;     }   };   int main(int argc, char** argv) {     ios::sync_with_stdio(false);     cin.tie(0);     Solution sol;     int n;     cin >> n;     vector<int> A(n);     for (int i = 0; i < n; ++i) {       cin >> A[i];     }     cout << sol.solve(A) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, top, tot, ans[100005], in[200005], rtx;   int col;   struct column {     vector<int> a;     int id;     friend bool operator<(column X, column Y) { return X.a[col] < Y.a[col]; }   } empty;   vector<column> b;   vector<int> to[200005];   void toposort() {     queue<int> que;     for (int i = 0; i <= top; i++)       if (in[i] == 0) {         que.push(i);         if (i < m) ans[++rtx] = i;       }     while (!que.empty()) {       int cur = que.front();       que.pop();       tot++;       for (int i = 0; i < to[cur].size(); i++) {         in[to[cur][i]]--;         if (in[to[cur][i]] == 0) {           que.push(to[cur][i]);           if (to[cur][i] < m) ans[++rtx] = to[cur][i];         }       }     }   }   int main() {     cin >> n >> m;     top = m - 1;     for (int i = 1; i <= m; i++) {       b.push_back(empty);       b[i - 1].id = i - 1;     }     for (int i = 1, x; i <= n; i++) {       for (int j = 0; j < m; j++) {         cin >> x;         b[j].a.push_back(x);       }     }     for (int i = 0; i < n; i++) {       col = i;       sort(b.begin(), b.end());       vector<pair<int, int> > con;       for (int j = 0; j < m; j++)         if (b[j].a[i] != -1) {           int l = j;           while (j < m - 1 && b[j + 1].a[i] == b[j].a[i]) j++;           con.push_back(make_pair(l, j));         }       if (con.size() > 1)         for (int j = 0; j < con.size(); j++) {           if (j == 0) top++;           if (j == con.size() - 1) {             for (int k = con[j].first; k <= con[j].second; k++) {               in[b[k].id]++;               to[top].push_back(b[k].id);             }           } else {             top++;             for (int k = con[j].first; k <= con[j].second; k++) {               in[top]++;               in[b[k].id]++;               to[b[k].id].push_back(top);               to[top - 1].push_back(b[k].id);             }           }         }     }     toposort();     if (tot < top)       cout << -1;     else       for (int i = 1; i <= m; i++) cout << ans[i] + 1 <<    ;   }
#include <bits/stdc++.h>   using namespace std;   long long int a, b, c, d;   int main() {     cin >> a >> b >> c >> d;     if (a + 8 * c >= b)       cout <<  0 ;     else if (c > d) {       int num = b - a - 8 * c, den = 12 * (c - d);       cout << (num + den - 1) / den;     } else       cout <<  -1 ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int T;     scanf( %d n , &T);     for (int t = 0; t < T; t++) {       string s;       getline(cin, s);       bool p = false;       int prevZero = -1;       for (int i = 0; i < s.size(); i++) {         char c = s[i];         if (c ==  0 ) {           if (prevZero >= 0 && i - prevZero > 1) {             cout << 2 <<   n ;             p = true;             break;           }           prevZero = i;         }       }       if (!p) {         if (prevZero == -1) {           cout << 0 <<   n ;         } else {           cout << 1 <<   n ;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int p1[10][13], p2[10][13];   bool fl = false;   int c1[10], c2[10];   int len, n, m;   int sum = 0, ans;   int main() {     memset(c1, 0, sizeof(c1));     memset(c2, 0, sizeof(c2));     memset(p1, -1, sizeof(p1));     memset(p2, -1, sizeof(p2));     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       int a, b;       scanf( %d%d , &a, &b);       p1[a][c1[a]++] = b;       p1[b][c1[b]++] = a;     }     for (int i = 0; i < m; i++) {       int a, b;       scanf( %d%d , &a, &b);       p2[a][c2[a]++] = b;       p2[b][c2[b]++] = a;     }     for (int i = 1; i <= 9; i++) {       if (p1[i][0] == -1 || p2[i][0] == -1) {         continue;       }       for (int j = 0; j < c1[i]; j++) {         for (int k = 0; k < c2[i]; k++) {           if (p1[i][j] == p2[i][k]) {             continue;           }           for (int t = 0; t < c2[p1[i][j]]; t++) {             if (p2[p1[i][j]][t] != -1 && p2[p1[i][j]][t] != i) {               fl = true;               break;             }           }           for (int t = 0; t < c1[p2[i][k]]; t++) {             if (p1[p2[i][k]][t] != -1 && p1[p2[i][k]][t] != i) {               fl = true;               break;             }           }           if (fl) break;           if (i != ans) sum++;           ans = i;         }         if (fl) break;       }     }     if (fl) {       printf( -1 n );     } else {       if (sum == 1) printf( %d n , ans);       if (sum > 1) printf( 0 n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int a[8][128];   int main() {     cin.tie(0);     cin.sync_with_stdio(0);     int n, k;     cin >> n >> k;     for (int i = 1; i <= 4; ++i)       for (int j = 1; j <= n; ++j) cin >> a[i][j];     vector<tuple<int, int, int>> ans;     if (k == 2 * n) {       for (int i = 1; i <= n; ++i) {         if (a[1][i] == a[2][i]) {           ans.emplace_back(a[1][i], 1, i);           a[2][i] = 0;           k--;         }         if (a[4][i] == a[3][i]) {           ans.emplace_back(a[4][i], 4, i);           a[3][i] = 0;           k--;         }         if (a[2][i] == 0 || a[3][i] == 0) break;       }       if (ans.empty()) return cout << -1, 0;     }     vector<pair<int, int>> loop;     loop.reserve(512);     for (int i = 1; i <= n; ++i) loop.emplace_back(2, i);     for (int i = n; i >= 1; --i) loop.emplace_back(3, i);     int m = loop.size();     for (int i = 0; k > 0; i = (i + 1) % m) {       int next = (i + 1) % m;       auto [x1, y1] = loop[i];       auto [x2, y2] = loop[next];       int o = (x2 == 2 ? 1 : 4);       if (a[o][y2] && a[x2][y2] == a[o][y2]) {         ans.emplace_back(a[o][y2], o, y2);         a[x2][y2] = 0;         k--;       }       if (a[x1][y1] == 0 && 0 != a[x2][y2]) {         ans.emplace_back(a[x2][y2], x1, y1);         a[x1][y1] = a[x2][y2];         a[x2][y2] = 0;       }       if (ans.size() > 20000) return cout << -1, 0;     }     cout << ans.size() <<   n ;     for (auto [a, b, c] : ans) cout << a <<     << b <<     << c <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 6e5 + 10, P = 490019;   const double PI = acos(-1.0);   int a[M << 1], b[M << 1], c[M << 1], pw[M], inv[M], C[M << 1], oo, n, m, cc,       r[M << 1], N, l;   struct cp {     double x, y;     cp(double _x = 0, double _y = 0) : x(_x), y(_y) {}   } p[M << 1], q[M << 1], w[M << 1], x[M << 1], y[M << 1], u[M << 1], v[M << 1];   inline cp operator+(cp a, cp b) { return cp(a.x + b.x, a.y + b.y); }   inline cp operator-(cp a, cp b) { return cp(a.x - b.x, a.y - b.y); }   inline cp operator*(cp a, cp b) {     return cp(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);   }   inline cp operator!(cp a) { return cp(a.x, -a.y); }   void fft(cp *a) {     for (int i = (0); i <= (N - 1); ++i)       if (i < r[i]) swap(a[i], a[r[i]]);     for (int mid = 1; mid < N; mid <<= 1)       for (int R = mid << 1, j = 0; j < N; j += R) {         cp *l = a + j, *r = a + j + mid, y;         for (int k = 0; k < mid; ++k, ++l, ++r)           y = (*r) * w[N / 2 / mid * k], *r = *l - y, *l = *l + y;       }   }   void conv(int *a, int *b, int *c, int n, int m) {     cp _u(0.5, 0), _v(0, -0.5), I(0, 1);     for (N = 1, l = 0; N < n + m; N <<= 1, ++l)       ;     for (int i = (0); i <= (N - 1); ++i)       r[i] = i & 1 ? r[i ^ 1] | (1 << l - 1) : r[i >> 1] >> 1,       w[i] = cp(cos(2 * PI * i / N), sin(2 * PI * i / N)),       p[i] = cp(a[i] >> 15, a[i] & 0x7fff), q[i] = cp(b[i] >> 15, b[i] & 0x7fff);     fft(p);     fft(q);     for (int i = (0); i <= (N - 1); ++i) {       int j = i ? N - i : 0;       cp k1 = (p[i] + !p[j]) * _u, k2 = (q[i] + !q[j]) * _u,          b1 = (p[i] - !p[j]) * _v, b2 = (q[i] - !q[j]) * _v;       x[j] = k1 * k2, y[j] = k1 * b2, u[j] = b1 * k2, v[j] = b1 * b2;     }     for (int i = (0); i <= (N - 1); ++i)       p[i] = x[i] + y[i] * I, q[i] = u[i] + v[i] * I;     fft(p);     fft(q);     for (int i = (0); i <= (N - 1); ++i) {       long long x = (long long)(p[i].x / N + 0.5) % P,                 y = (long long)(p[i].y / N + 0.5) % P,                 u = (long long)(q[i].x / N + 0.5) % P,                 v = (long long)(q[i].y / N + 0.5) % P;       c[i] = ((x << 30) + (y + u << 15) + v) % P;     }   }   int main() {     scanf( %d%d%d , &n, &m, &cc);     pw[0] = inv[1] = 1;     for (int i = (0); i <= (n - 1); ++i)       scanf( %d , &oo), a[1ll * i * i % (P - 1)] += oo;     for (int i = (0); i <= (m - 1); ++i)       scanf( %d , &oo), b[1ll * i * i * i % (P - 1)] += oo;     for (int i = (1); i <= (P - 1); ++i) pw[i] = 1ll * pw[i - 1] * cc % P;     for (int i = (0); i <= (2 * P - 4); ++i)       C[i] = 1ll * i * (i - 1) / 2 % (P - 1);     for (int i = (2); i <= (P - 1); ++i)       inv[i] = 1ll * (P - P / i) * inv[P % i] % P;     for (int i = (0); i <= (P - 2); ++i)       a[i] = 1ll * a[i] * inv[pw[C[i]]] % P,       b[i] = 1ll * b[i] * inv[pw[C[i]]] % P;     conv(a, b, c, P - 2, P - 2);     long long ans = 0;     for (int i = (0); i <= (2 * P - 4); ++i) ans += 1ll * c[i] * pw[C[i]] % P;     printf( %lld n , ans % P);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2097152;   const double pi = acos(-1);   using cplx = complex<double>;   const cplx I(0, 1);   cplx omega[maxn + 1];   int a[maxn], cnt[maxn];   void prefft() {     for (int i = 0; i <= maxn; ++i) omega[i] = exp(2 * pi * i / maxn * I);   }   void bin(vector<cplx> &a, int n) {     vector<cplx> tmp(n);     int lg = 0;     while ((1 << lg) < n) ++lg;     --lg;     for (int i = 0; i < n; ++i) {       int to = 0;       for (int j = 0; (1 << j) < n; ++j) to |= (((i >> j) & 1) << (lg - j));       tmp[to] = a[i];     }     for (int i = 0; i < n; ++i) a[i] = tmp[i];   }   void fft(vector<cplx> &a, int n) {     bin(a, n);     for (int step = 2; step <= n; step <<= 1) {       int to = step >> 1;       for (int i = 0; i < n; i += step) {         for (int k = 0; k < to; ++k) {           cplx right = omega[maxn / step * k] * a[i + to + k];           a[i + to + k] = a[i + k] - right;           a[i + k] += right;         }       }     }   }   void ifft(vector<cplx> &a, int n) {     fft(a, n);     reverse(a.begin() + 1, a.end());     for (int i = 0; i < n; ++i) a[i] /= n;   }   int main() {     prefft();     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; ++i) {       cin >> a[i];       ++cnt[a[i]];     }     ++m;     int d = 1;     while (d < m) d <<= 1;     d <<= 1;     vector<cplx> poly(d, 0);     for (int i = 0; i < m; ++i)       if (cnt[i] > 0) poly[i] = cplx(1, 0);     fft(poly, d);     for (int i = 0; i < d; ++i) poly[i] *= poly[i];     ifft(poly, d);     for (int i = 1; i < m; ++i) {       int c = round(poly[i].real());       if (c <= 0) continue;       if (cnt[i] == 0) return cout <<  NO  << endl, 0;       cnt[i] = 0;     }     vector<int> ans;     for (int i = 1; i < m; ++i)       if (cnt[i]) ans.push_back(i);     cout <<  YES  << endl;     cout << ans.size() << endl;     for (int i : ans) cout << i <<    ;     cout << endl;     return 0;   }