malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, c = 0;     cin >> n;     int r = n;     int arr[n];     deque<int> d;     for (int i = 0; i < n; i++) {       scanf( %d , &arr[i]);       d.push_back(arr[i]);     }     sort(arr, arr + n);     for (int i = 0; i < n; i++) {       if (d[i] == arr[i]) {         c++;       }     }     int mid = (n + 1) / 2 - 1;     if (c == n) {       printf( %d n , 0);       ;       return 0;     } else {       c = 0;       while (r--) {         int t = 0;         d.push_front(d.back());         d.pop_back();         c++;         if (arr[0] == d.front() && arr[n - 1] == d.back() && arr[mid] == d[mid]) {           if (mid + 1 < n) {             if (d[mid + 1] >= d[mid] && d[mid - 1] <= d[mid]) {               printf( %d n , c);               ;               return 0;             }           } else {             printf( %d n , c);             ;             return 0;           }         }       }     }     printf( %d n , -1);     ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   int size(const T &x) {     return x.size();   }   const int INF = ~(1 << 31);   const double EPS = 1e-9;   const double pi = acos(-1);   template <class T>   T smod(T a, T b) {     return (a % b + b) % b;   }   int f(char c) { return c -  a ; }   char g(int i) { return (char)(i +  a ); }   int main() {     int n;     cin >> n;     char c;     vector<bool> A(26, true);     int left = 26, cnt = 0;     for (decltype(0) i = (0); i < (n); ++i) {       cin >> c;       if (c ==  . ) {         vector<bool> B(26, true);         string s;         cin >> s;         for (decltype(0) j = (0); j < (size(s)); ++j) {           B[f(s[j])] = false;         }         for (decltype(0) j = (0); j < (26); ++j) {           A[j] = A[j] && B[j];         }       } else if (c ==  ! ) {         if (left == 1) cnt++;         vector<bool> B(26, false);         string s;         cin >> s;         for (decltype(0) j = (0); j < (size(s)); ++j) {           B[f(s[j])] = true;         }         for (decltype(0) j = (0); j < (26); ++j) {           A[j] = A[j] && B[j];         }       } else {         char s;         cin >> s;         if (left == 1 && i != n - 1) cnt++;         A[f(s)] = false;       }       left = 0;       for (decltype(0) j = (0); j < (26); ++j) {         left += A[j];       }     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, k;     cin >> n >> k;     vector<int> a(n), b(n);     for (int i = 0; i < n; ++i) cin >> a[i];     for (int i = 0; i < n; ++i) cin >> b[i];     long long ans = 0;     for (int i = 0; i < n; ++i)       if (b[i] == 1) {         ans += a[i];         a[i] = 0;       }     long long temp = 0, max = 0;     for (int i = 0; i < k; ++i) {       temp += a[i];     }     ans += temp;     max = temp;     for (int i = 1; i <= n - k; ++i) {       temp += (a[i + k - 1] - a[i - 1]);       if (max < temp) {         ans -= max;         max = temp;         ans += max;       }     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     for (int i = 1; i <= t; ++i) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   long long z = 1000000007;   long long gcd(long long a, long long b) {     if (a == 0) return b;     if (b == 0) return a;     return gcd(b, a % b);   }   long long power(long long a, long long b) {     long long res = 1;     while (b) {       if (b & 1) {         res = (res * a) % z;         b--;       } else {         a = (a * a) % z;         b = b >> 1;       }     }     return res;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t;     t = 1;     while (t--) {       long long s, x;       cin >> s >> x;       long long k = s - x;       if (k & 1)         cout <<  0 n ;       else {         long long ans = 1, c = 0;         set<long long> s;         k /= 2;         for (long long i = 0; i < 64; i++)           if (k & ((long long)1 << i)) s.insert(i);         for (long long i = 0; i < 64; i++) {           if (x & ((long long)1 << i)) {             ans *= 2;             if (s.find(i) != s.end()) {               c++;               break;             }           }         }         if (c)           cout <<  0 n ;         else {           if (k == 0)             cout << ans - 2 <<   n ;           else             cout << ans <<   n ;         }       }     }   }
#include <bits/stdc++.h>   const int maxn = 150010;   const int INF = 0x3f3f3f3f;   using namespace std;   vector<int> V;   int a[maxn];   long long ans = 0;   int ok(int i) {     if (i & 1) return a[i] < a[i - 1] && a[i] < a[i + 1];     return a[i] > a[i + 1] && a[i] > a[i - 1];   }   int ok2(int i, int j) {     int f = 1;     swap(a[i], a[j]);     if (!ok(i)) f = 0;     if (!ok(j)) f = 0;     for (int k = 0; k < V.size(); k++) {       if (!ok(V[k])) f = 0;     }     swap(a[i], a[j]);     return f;   }   void fun(int idx, int n) {     for (int i = 1; i <= n; i++) {       if (ok2(idx, i)) {         ++ans;       }     }   }   int main() {     int n, i;     while (~scanf( %d , &n)) {       for (i = 1; i <= n; i++) {         scanf( %d , &a[i]);       }       a[0] = INF;       a[n + 1] = (n + 1) % 2 ? -INF : INF;       V.empty();       for (i = 1; i <= n; i++) {         if (!ok(i)) {           V.push_back(i);         }       }       if (V.size() > 6) {         printf( 0 n );         continue;       }       ans = 0;       for (i = 0; i < V.size(); i++) {         fun(V[i], n);         for (int j = i + 1; j < V.size(); j++) {           if (ok2(V[i], V[j])) {             --ans;           }         }       }       printf( %d n , ans);     }   }
#include <bits/stdc++.h>   using namespace std;   const long double PI = acosl(-1.0);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, m;     cin >> n >> m;     int a[n][m], ans[n][m];     for (long long i = 0; i < n; i++)       for (long long j = 0; j < m; j++) cin >> a[i][j];     vector<map<int, int> > vc1, vc2;     map<int, int> mymap;     vector<int> v1, v11, v22;     for (int i = 0; i < n; i++) {       mymap.clear();       v1.clear();       for (int j = 0; j < m; j++) v1.push_back(a[i][j]);       sort(v1.begin(), v1.end());       int k = 1;       for (int j = 0; j < m; j++) {         if (mymap.find(v1[j]) == mymap.end()) mymap[v1[j]] = k++;       }       v11.push_back(k - 1);       vc1.push_back(mymap);     }     for (int i = 0; i < m; i++) {       mymap.clear();       v1.clear();       for (int j = 0; j < n; j++) v1.push_back(a[j][i]);       sort(v1.begin(), v1.end());       int k = 1;       for (int j = 0; j < n; j++) {         if (mymap.find(v1[j]) == mymap.end()) mymap[v1[j]] = k++;       }       v22.push_back(k - 1);       vc2.push_back(mymap);     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         int x = vc1[i][a[i][j]];         int y = vc2[j][a[i][j]];         if (x < y)           ans[i][j] = max(v11[i] + y - x, v22[j]);         else if (y < x)           ans[i][j] = max(v11[i], v22[j] + x - y);         else           ans[i][j] = max(v11[i], v22[j]);       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) cout << ans[i][j] <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long u, v, p;   map<long long, int> M;   map<long long, int> pre, pre2;   queue<int> x, y;   bool in(int val, int rn) {     return ((M.find(val) != M.end()) & (((M[val] >> rn) & 1)));   }   long long modpow(long long x, long long n) {     long long res = 1;     while (n > 0) {       if (n & 1) res = res * x % p;       x = x * x % p;       n >>= 1;     }     return res;   }   int main() {     cin >> u >> v >> p;     x.push(u);     y.push(v);     for (int i = 0;; i++) {       int sz = x.size();       bool en = false;       int goal = -1;       while (sz--) {         int q = x.front();         x.pop();         if (in(q, 0)) continue;         M[q] |= 1;         if (M[q] == 3) {           en = true;           goal = q;           break;         }         if (!in((q + p - 1) % p, 0)) {           x.push((q + p - 1) % p);           pre[(q + p - 1) % p] = q;         }         if (!in((q + 1) % p, 0)) {           x.push((q + 1) % p);           pre[(q + 1) % p] = q;         }         long long rev = modpow(q, p - 2);         if (!in(rev, 0)) {           x.push(rev);           pre[rev] = q;         }       }       sz = y.size();       while (sz--) {         int q = y.front();         y.pop();         if (in(q, 1)) continue;         M[q] |= 2;         if (M[q] == 3) {           en = true;           goal = q;           break;         }         if (!in((q + p - 1) % p, 1)) {           y.push((q + p - 1) % p);           pre2[(q + p - 1) % p] = q;         }         if (!in((q + 1) % p, 1)) {           y.push((q + 1) % p);           pre2[(q + 1) % p] = q;         }         long long rev = modpow(q, p - 2);         if (!in(rev, 1)) {           y.push(rev);           pre2[rev] = q;         }       }       if (en) {         vector<int> num;         int cur = goal;         num.push_back(cur);         while (cur != u) {           cur = pre[cur];           num.push_back(cur);         }         reverse(num.begin(), num.end());         cur = goal;         while (cur != v) {           cur = pre2[cur];           num.push_back(cur);         }         cout << num.size() - 1 << endl;         for (int i = 1; i < num.size(); i++) {           long long a = num[i - 1];           long long b = num[i];           if ((a + 1) % p == b) {             printf( 1  );           } else if ((a + p - 1) % p == b) {             printf( 2  );           } else             printf( 3  );         }         puts(  );         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int dp[505][505];   int a[505][505];   int main() {     int n;     int i, j, k;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> a[i][i];       for (j = i; j <= n; j++) dp[i][j] = j - i + 1;     }     for (int len = 2; len <= n; len++) {       for (i = 1; i + len - 1 <= n; i++) {         j = i + len - 1;         for (k = i; k < j; k++) {           dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j]);           if (dp[i][k] == 1 && dp[k + 1][j] == 1 && a[i][k] == a[k + 1][j]) {             dp[i][j] = 1;             a[i][j] = a[i][k] + 1;           }         }       }     }     cout << dp[1][n] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dp[105][105][105];   long long p[105][105];   long long c[105];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int TESTS = 1;     while (TESTS--) {       long long n, m, K, k, i, j, num;       cin >> n >> m >> K;       for (i = 1; i <= n; i++) cin >> c[i];       for (i = 1; i <= n; i++)         for (j = 1; j <= m; j++) cin >> p[i][j];       memset(dp, -1, sizeof dp);       if (c[1] != 0)         dp[1][c[1]][1] = 0;       else         for (j = 1; j <= m; j++) dp[1][j][1] = p[1][j];       for (i = 1; i <= n; i++) {         for (j = 1; j <= m; j++) {           for (k = 1; k <= K; k++) {             if (dp[i][j][k] != -1) {               if (c[i + 1] != 0) {                 if (j == c[i + 1]) {                   if (dp[i + 1][j][k] == -1)                     dp[i + 1][j][k] = dp[i][j][k];                   else                     dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);                 } else {                   if (dp[i + 1][c[i + 1]][k + 1] == -1)                     dp[i + 1][c[i + 1]][k + 1] = dp[i][j][k];                   else                     dp[i + 1][c[i + 1]][k + 1] =                         min(dp[i + 1][c[i + 1]][k + 1], dp[i][j][k]);                 }               } else {                 for (int col = 1; col <= m; col++) {                   if (col == j) {                     if (dp[i + 1][j][k] == -1)                       dp[i + 1][j][k] = dp[i][j][k] + p[i + 1][j];                     else                       dp[i + 1][j][k] =                           min(dp[i + 1][j][k], dp[i][j][k] + p[i + 1][j]);                   } else {                     if (dp[i + 1][col][k + 1] == -1)                       dp[i + 1][col][k + 1] = dp[i][j][k] + p[i + 1][col];                     else                       dp[i + 1][col][k + 1] =                           min(dp[i][j][k] + p[i + 1][col], dp[i + 1][col][k + 1]);                   }                 }               }             }           }         }       }       long long mn = 100000000000007;       for (i = 1; i <= m; i++)         if (dp[n][i][K] != -1) mn = min(mn, dp[n][i][K]);       if (mn == 100000000000007)         cout <<  -1 ;       else         cout << mn;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 998244353;   int main() {     string a, v[6];     cin >> a;     for (int i = 1; i <= 5; ++i) {       cin >> v[i];       if (v[i][0] == a[0] || v[i][1] == a[1]) {         cout <<  YES n ;         return 0;       }     }     cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   int main() {     int n, m, k;     cin >> n >> m >> k;     vector<pair<int, int> > v;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       v.push_back(make_pair(x, i));     }     sort(v.begin(), v.end(), greater<pair<int, int> >());     long long ans = 0;     vector<int> pos;     for (int i = 0; i < (m * k); i++) {       ans += v[i].first;       pos.push_back(v[i].second);     }     sort(pos.begin(), pos.end());     vector<int> div;     for (int i = 0; i < k - 1; i++) {       div.push_back(pos[(i + 1) * m - 1]);     }     cout << ans << endl;     for (int i = 0; i < div.size(); i++) {       cout << div[i] + 1 <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1);   const double EPS = 1e-9;   long long dis(pair<long long, long long> a, pair<long long, long long> b) {     return (a.first - b.first) * (a.first - b.first) +            (a.second - b.second) * (a.second - b.second);   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long T, v;     pair<long long, long long> C;     cin >> C.first >> C.second >> v >> T;     long long R = 1.00 * v * T;     long long n;     cin >> n;     vector<pair<double, long long> > cut;     pair<long long, long long> center;     long long radi;     for (long long i = 0; i < n; i++) {       cin >> center.first >> center.second >> radi;       double distance = dis(C, center);       if (distance < 1.0 * radi * radi + EPS) {         cout <<  1.00000 ;         return 0;       }       distance = sqrt(distance);       if (1.00 * radi + R * 1.00 < distance - EPS) continue;       double left, right, ang;       double angM = atan2(center.second - C.second, center.first - C.first);       if (angM < 0) {         angM += 2 * PI;       }       double tLen = sqrt(distance * distance - 1.0 * radi * radi);       if (tLen < R + EPS) {         ang = asin(radi / distance);       } else {         ang = acos((distance * distance + 1.00 * R * R - 1.0 * radi * radi) /                    (2 * distance * 1.00 * R));       }       left = angM - ang;       right = angM + ang;       if (left < 0) {         cut.push_back({left + 2 * PI, 1});         cut.push_back({2 * PI, -1});         cut.push_back({0.00, 1});         cut.push_back({right, -1});       } else if (right > 2 * PI) {         cut.push_back({left, 1});         cut.push_back({2 * PI, -1});         cut.push_back({0.00, 1});         cut.push_back({right - 2 * PI, -1});       } else         cut.push_back({left, 1}), cut.push_back({right, -1});     }     double ans = 0.00;     long long count = 0;     double last = 0;     sort(cut.begin(), cut.end());     for (auto &x : cut) {       if (count > 0) ans += (x.first - last);       last = x.first;       count += (x.second);     }     cout << fixed << setprecision(6) << (ans / (2 * PI));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, a, moves = 0;     cin >> n;     while (n--) {       cin >> a;       moves += a - 1;       moves %= 2;       cout << 2 - moves <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int dx[] = {-1, 0, 1, 0};   const int dy[] = {0, -1, 0, 1};   inline int read() {     int ans = 0;     bool f = 1;     char ch = getchar();     while (!isdigit(ch)) f ^= ch ==  - , ch = getchar();     while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = getchar();     return f ? ans : -ans;   }   int n, m;   long long b[100010], g[100010];   long long ans;   int main(int argc, char const *argv[]) {     ios::sync_with_stdio(false);     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %I64d , &b[i]);     for (int i = 1; i <= m; i++) scanf( %I64d , &g[i]);     sort(b + 1, b + n + 1);     sort(g + 1, g + m + 1);     if (b[n] > g[1])       cout << -1;     else if (b[n] == g[1]) {       for (int i = 1; i < n; i++) ans += b[i] * m;       for (int i = 1; i <= m; i++) ans += g[i];       cout << ans;     } else {       ans += b[n] + g[1] + b[n - 1] * (m - 1);       for (int i = n - 2; i >= 1; i--) ans += b[i] * m;       for (int i = 2; i <= m; i++) ans += g[i];       cout << ans;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string S, S1, S2, S11, S21;     getline(cin, S);     int N = S.length();     int i, j, k;     int t = 0, t3 = 0;     for (i = 0; i < N; i++) {       if (S[i] != S[N - i - 1] and t3 == 0) {         t3 = 1;         if (S[i + 1] == S[N - i - 1]) {           t = 1;           S1 = S;           S1 += S1[N - 1];           for (j = N - 1; j > N - i - 1; j--) {             S1[j + 1] = S1[j];           };           S1[N - i] = S1[i];         }         if (S[i] == S[N - i - 2]) {           t = 1;           S2 = S;           S2 += S2[N - 1];           for (j = N - 1; j > i - 1; j--) {             S2[j + 1] = S2[j];           };           S2[i] = S2[N - i];         }         if (t == 0) {           t = 1;           cout <<  NA ;           return 0;         }       }     }     S11 = S1 +  1 ;     S21 = S2 +  1 ;     if (t3 == 0) {       S += S[N - 1];       for (j = N - 1; j >= (N - 1) / 2; j--) {         S[j + 1] = S[j];       };       cout << S;       return 0;     };     int t1 = 0, t2 = 0, t5 = 0, t6 = 0;     for (i = 0; i <= N; i++) {       if (S1[i] != S1[N - i]) {         t1 = 1;       }     }     for (i = 0; i <= N; i++) {       if (S2[i] != S2[N - i]) {         t2 = 1;       }     }     if (t1 == 0 and S11 !=  1 ) {       cout << S1;       return 0;     }     if (t2 == 0 and S21 !=  1 ) {       cout << S2;       return 0;     }     cout <<  NA ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll llinf = (1ll << 61) - 1;   const int inf = 1000000007;   int TC = 1, CN, n, r, c[1 << 18 | 5];   signed main() {     cin.tie(0)->sync_with_stdio(0);     cin.exceptions(cin.failbit);     cout.precision(11), cout.setf(ios::fixed);     auto kase = [&]() -> void {       cin >> n >> r;       double sum = 0;       for (int i = 0; i < 1 << n; i++) {         cin >> c[i], sum += c[i];       }       for (int i = 0; i < r; i++) {         cout << sum / (1 << n) <<   n ;         int z, g;         cin >> z >> g;         sum -= c[z], c[z] = g, sum += c[z];       }       cout << sum / (1 << n) <<   n ;     };     while (CN++ != TC) kase();   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   const long long INF = 0x3f3f3f3f;   const double eps = 1e-9;   struct P {     long double x, y;     P() : x(0), y(0) {}     P(long double _x, long double _y) : x(_x), y(_y) {}     P operator+(P& p) { return P(x + p.x, y + p.y); }     P operator-(P& p) { return P(x - p.x, y - p.y); }     P operator*(long double d) { return P(x * d, y * d); }     P operator/(long double d) { return P(x / d, y / d); }     long double abs() { return sqrtl(x * x + y * y); }     long double dot(P p) { return x * p.x + y * p.y; }     long double det(P p) { return x * p.y - y * p.x; }   };   P p[maxn];   long double tg[maxn], d[maxn];   int main() {     ios::sync_with_stdio(false);     cout.setf(ios::fixed);     int n, q;     cin >> n >> q;     for (int i = 1; i <= n; i++) {       cin >> p[i].x >> p[i].y;     }     P g;     long double fzx = 0, fzy = 0, fm = 0;     for (int i = 2; i <= n - 1; i++) {       fzx += (p[1].x + p[i].x + p[i + 1].x) *              ((p[i].x - p[1].x) * (p[i + 1].y - p[1].y) -               (p[i + 1].x - p[1].x) * (p[i].y - p[1].y));       fzy += (p[1].y + p[i].y + p[i + 1].y) *              ((p[i].x - p[1].x) * (p[i + 1].y - p[1].y) -               (p[i + 1].x - p[1].x) * (p[i].y - p[1].y));     }     for (int i = 2; i <= n - 1; i++) {       fm += 3.0 * ((p[i].x - p[1].x) * (p[i + 1].y - p[1].y) -                    (p[i + 1].x - p[1].x) * (p[i].y - p[1].y));     }     g.x = fzx / fm;     g.y = fzy / fm;     for (int i = 1; i <= n; i++) {       P l(p[i] - g);       tg[i] = atan2l(l.y, l.x);       if (tg[i] < 0) tg[i] += 2 * acosl(-1);       d[i] = l.abs();     }     int s1 = 1, s2 = 2;     int flag = 0;     for (int i = 1; i <= q; i++) {       int op;       cin >> op;       if (op == 1) {         int f, t;         cin >> f >> t;         if (f == s1) swap(s1, s2);         s2 = t;         flag = 1;         g.x = p[s1].x;         g.y = p[s1].y - d[s1];         long double _tg = tg[s1] - tg[s2];         p[s2].x = g.x + d[s2] * sinl(_tg);         p[s2].y = g.y + d[s2] * cosl(_tg);       } else {         int v;         cin >> v;         if (!flag) {           cout << fixed << setprecision(6) << p[v].x <<     << p[v].y << endl;         } else {           long double _tg = tg[s1] - tg[v];           P ans;           ans.x = g.x + d[v] * sinl(_tg);           ans.y = g.y + d[v] * cosl(_tg);           cout << fixed << setprecision(6) << ans.x <<     << ans.y << endl;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   bool debug = 0;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   string direc =  RDLU ;   long long ln, lk, lm;   void etp(bool f = 0) {     puts(f ?  YES  :  NO );     exit(0);   }   void addmod(int &x, int y, int mod = 1000000007) {     assert(y >= 0);     x += y;     if (x >= mod) x -= mod;     assert(x >= 0 && x < mod);   }   void et() {     puts( -1 );     exit(0);   }   long long fastPow(long long x, long long y, int mod = 1000000007) {     long long ans = 1;     while (y > 0) {       if (y & 1) ans = (x * ans) % mod;       x = x * x % mod;       y >>= 1;     }     return ans;   }   long long gcd1(long long x, long long y) {     long long z = y;     while (x % y != 0) {       z = x % y;       x = y;       y = z;     }     return z;   }   int a[33];   int dp[(1 << 22) + 5], mn[(1 << 22) + 5], bs;   void fmain(int ID) {     scanf( %d%d , &n, &m);     for (int(i) = 1; (i) <= (int)(m); (i)++) {       int u, v;       scanf( %d%d , &u, &v);       u--;       v--;       a[u] |= 1 << v;       a[v] |= 1 << u;     }     bs = (1 << n) - 1;     for (int(i) = 0; (i) < (int)(n); (i)++) dp[1 << i] = 1;     for (int(i) = 0; (i) < (int)(n); (i)++) a[i] |= 1 << i;     int cc = 0;     for (int(i) = 0; (i) < (int)(n); (i)++)       if (a[i] == (1 << n) - 1) {         cc++;       }     if (cc == n) {       puts( 0 );       return;     }     for (int s = 0; s < (1 << n); s++)       if (dp[s]) {         int tmp = 0;         for (int(j) = 0; (j) < (int)(n); (j)++)           if (s & (1 << j)) {             tmp |= a[j];           }         for (int(j) = 0; (j) < (int)(n); (j)++)           if (tmp & (1 << j)) {             dp[s | (1 << j)] = 1;           }         if (tmp == (1 << n) - 1) {           if (__builtin_popcount(s) < __builtin_popcount(bs)) {             bs = s;           }         }       }     printf( %d n , __builtin_popcount(bs));     for (int(j) = 0; (j) < (int)(n); (j)++)       if (bs & (1 << j)) printf( %d  , j + 1);   }   int main() {     int t = 1;     for (int(i) = 1; (i) <= (int)(t); (i)++) {       fmain(i);     }     return 0;   }