malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   void file() {}   const int N = 1e5 + 5, MAX = 3e7, MOD = 1e9 + 7;   int a[N];   int n, k;   long long dp[N][12];   long long seg[4 * N][12];   void update(int indx, int l, int r, int pos, int who, long long val) {     if (l == r) {       seg[indx][who] = val;       return;     }     if (pos <= (l + r) / 2)       update(indx * 2, l, (l + r) / 2, pos, who, val);     else       update(indx * 2 + 1, (l + r) / 2 + 1, r, pos, who, val);     seg[indx][who] = seg[indx * 2][who] + seg[indx * 2 + 1][who];   }   long long get(int indx, int l, int r, int i, int j, int who) {     if (l > j || r < i) return 0;     if (l >= i && r <= j) return seg[indx][who];     return get(indx * 2, l, (l + r) / 2, i, j, who) +            get(indx * 2 + 1, (l + r) / 2 + 1, r, i, j, who);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     file();     scanf( %d %d , &n, &k);     k++;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = n - 1; i >= 0; i--) {       for (int j = 2; j <= k; j++) {         dp[i][j] = get(1, 1, N - 1, a[i] + 1, N - 1, j - 1);         if (j == k) dp[i][j] += dp[i + 1][j];         update(1, 1, N - 1, a[i], j, dp[i][j]);       }       update(1, 1, N - 1, a[i], 1, 1);       dp[i][1] = dp[i + 1][1] + 1;     }     printf( %lld n , dp[0][k]);   }
#include <bits/stdc++.h>   using namespace std;   const long long LLmn = LLONG_MIN;   const long long LLmx = LLONG_MAX;   const long long MOD = 1e6 + 3;   const long long N = 1e9 + 7;   const long double PI = 3.14159265358979323846;   long long gcd(long long a, long long b) {     if (a == 0) {       return b;     }     return gcd(b % a, a);   }   long long lcm(long long a, long long b) { return a * b / gcd(a, b); }   pair<int, int> w[9] = {make_pair(-1, 0), make_pair(0, -1),  make_pair(1, 0),                          make_pair(0, 1),  make_pair(-1, -1), make_pair(0, 1),                          make_pair(1, -1), make_pair(1, 1)};   void solve() {     long long n;     cin >> n;     long long a[n];     for (long long i = 0; i < n; i++) cin >> a[i];     if (n & 1) {       if (a[0] + a[1] != 0)         cout << -a[2] <<     << -a[2] <<     << a[0] + a[1] <<    ;       else if (a[0] + a[2] != 0)         cout << -a[1] <<     << a[0] + a[2] <<     << -a[1] <<    ;       else         cout << a[1] + a[2] <<     << -a[0] <<     << -a[0] <<    ;       for (long long i = 3; i < n; i += 2) {         if (i + 1 < n) cout << a[i + 1] <<     << -a[i] <<    ;       }       cout <<   n ;       ;     } else {       for (long long i = 0; i < n; i += 2) {         if (i + 1 < n) cout << a[i + 1] <<     << -a[i] <<    ;       }       cout <<   n ;       ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     ;     long long t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 2e5 + 5;   const long long P = (479 << 21) + 1;   const long long G = 3;   long long wn[21];   inline long long fpw(long long x, long long y, long long m) {     long long rtn = 1;     for (x = (x >= m ? x % m : x); y; y >>= 1) {       if (y & 1) rtn = rtn * x % m;       x = x * x % m;     }     return rtn;   }   inline void Getwn() {     for (int i = 0; i < 21; i++) wn[i] = fpw(G, (P - 1) >> i, P);   }   inline vector<long long> ntt(vector<long long> rtn, int Rev = 1) {     int ntt_n = rtn.size();     for (int i = 0, j = 0; i < ntt_n; i++) {       if (i > j) swap(rtn[i], rtn[j]);       for (int k = (ntt_n >> 1); (j ^= k) < k; k >>= 1)         ;     }     for (int i = 2, m = 1; i <= ntt_n; i <<= 1, m++) {       long long w = 1, u, t;       int mh = i >> 1;       for (int j = 0; j < mh; j++) {         for (int k = j; k < ntt_n; k += i) {           u = rtn[k], t = w * rtn[k + mh] % P;           rtn[k] = (u + t) % P;           rtn[k + mh] = (u - t + P) % P;         }         w = w * wn[m] % P;       }     }     if (!~Rev) {       for (int i = 1; i < ntt_n / 2; i++) swap(rtn[i], rtn[ntt_n - i]);       long long Revn = fpw(ntt_n, P - 2, P);       for (int i = 0; i < ntt_n; i++) rtn[i] = rtn[i] * Revn % P;     }     return rtn;   }   int n, m, k;   int N = 1;   char s[MAX_N], t[MAX_N];   vector<long long> a, b;   int ans[MAX_N];   int tot;   inline void conv(char now) {     Getwn();     a = b = vector<long long>(N);     for (int i = 0, j = 0; i < n && j < n; i++) {       while ((s[j] && s[j] != now) || i - j > k) j++;       if (s[j] == now && abs(i - j) <= k) a[i] = 1;     }     for (int i = 0; i < m; i++)       if (t[i] == now) b[i] = 1;     a = ntt(a);     b = ntt(b);     for (int i = 0; i < N; i++) a[i] = a[i] * b[i] % P;     a = ntt(a, -1);     for (int i = m - 1; i < n + m - 1; i++) ans[i - m + 1] += a[i];   }   int main() {     scanf( %d%d%d , &n, &m, &k);     while (N < n + m - 1) N <<= 1;     scanf( %s , s);     scanf( %s , t);     for (int i = 0; i < m / 2; i++) swap(t[i], t[m - i - 1]);     conv( A );     conv( T );     conv( G );     conv( C );     for (int i = 0; i < n; i++)       if (ans[i] == m) tot++;     printf( %d n , tot);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mark[2000010 * 2];   int tree[2000010 * 4];   bool emerged[2000010 * 2];   void insert(int l, int r, int i, int ind, int num) {     tree[ind] += num;     if (l == r) return;     int mid = (l + r) / 2;     if (i <= mid) insert(l, mid, i, ind * 2, num);     if (i > mid) insert(mid + 1, r, i, ind * 2 + 1, num);   }   int find(int l, int r, int y, int ind) {     if (l == r) return l;     int mid = (l + r) / 2;     if (tree[ind * 2] >= y) {       return find(l, mid, y, ind * 2);     } else {       return find(mid + 1, r, y - tree[ind * 2], ind * 2 + 1);     }   }   int main() {     memset(tree, 0, sizeof(tree));     memset(emerged, 0, sizeof(emerged));     memset(mark, 0, sizeof(mark));     int n, m;     scanf( %d%d , &n, &m);     for (int i = n + 1; i <= 2 * n; ++i) insert(1, 2 * n, i, 1, 1);     int x, y;     for (int i = 0; i < m; i++) {       scanf( %d%d , &x, &y);       int place = find(1, 2 * n, y, 1);       if (((mark[place] > 0) || emerged[x]) && (mark[place] != x)) {         cout << -1 << endl;         return 0;       }       insert(1, 2 * n, place, 1, -1);       insert(1, 2 * n, n - i, 1, 1);       mark[n - i] = mark[place] = x;       emerged[x] = true;     }     int j = 1;     for (int i = n + 1; i <= 2 * n; i++) {       int tmp;       if (mark[i] > 0)         tmp = mark[i];       else {         while (emerged[j]) j++;         tmp = j;         j++;       }       printf( %d  , tmp);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x = 0, y, n, sol = 0, energy = 0;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> y;       energy += x - y;       if (energy < 0) {         sol = sol - energy;         energy = 0;       }       x = y;     }     cout << sol;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rng(time(0));   uniform_int_distribution<int> uid(-1e9, 1e9);   long double f[51];   vector<vector<vector<long double>>> dp;   pair<long double, long double> solve(vector<int> v, int l, int r) {     dp.assign(v.size() + 1, vector<vector<long double>>(                                 r + 1, vector<long double>(v.size() + 1, 0)));     dp[0][0][0] = 1;     for (int i = 0; i < v.size(); ++i)       for (int j = 0; j <= r; ++j)         for (int k = 0; k < v.size(); ++k) {           dp[i + 1][j][k] += dp[i][j][k];           if (v[i] + j <= r) dp[i + 1][j + v[i]][k + 1] += dp[i][j][k];         }     long double res = 0, x = 0;     for (int i = l; i <= r; ++i)       for (int j = 0; j <= v.size(); ++j)         if (dp[v.size()][i][j]) {           long double x2 = dp[v.size()][i][j] * f[j] * f[v.size() - j];           if (x2) res = ((res * x) + (x2 * j)) / (x + x2), x += x2;         }     return {res, x};   }   vector<int> v;   signed main() {     int n, p, s = 0;     cin >> n;     v.resize(n);     for (auto& i : v) cin >> i, s += i;     cin >> p;     if (s <= p) {       cout << n;       exit(0);     }     f[0] = 1;     for (int i = 1; i <= 50; i++) f[i] = f[i - 1] * i;     long double res = 0, x = 0;     for (int i = 0; i < n; i++) {       vector<int> w;       for (int j = 0; j < n; j++)         if (j - i) w.push_back(v[j]);       auto p2 = solve(w, max(0, p - v[i] + 1), p);       if (p2.second)         res = ((res * x) + (p2.first * p2.second)) / (x + p2.second),         x += p2.second;     }     cout << fixed << setprecision(20) << res;   }
#include <bits/stdc++.h>   using namespace std;   long long int fast_exp(long long int a, long long int b) {     if (a == 0) return 0;     if (b == 0) return 1;     if (b == 1) return a;     if (b % 2 == 0) {       return fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007, b / 2) %              1000000007;     }     return ((a % 1000000007) *             fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007,                      (b - 1) / 2)) %            1000000007;   }   long long int comb(long long int n, long long int k) {     long long int ans = 1, j = 1;     k = max(k, n - k);     for (long long int i = n; i > k; --i) {       ans *= i;       if (j <= (n - k)) {         ans = ans / j;         j++;       }     }     if (j <= (n - k)) {       ans = ans / j;       j++;     }     return ans;   }   struct node {     long long int x, y;   };   long long int ax, bx, ay, by, binx, biny;   node ar[100005];   double disA[100005], disB[100005], disBin[100005];   double dist(long long int x1, long long int y1, long long int x2,               long long int y2) {     double ans = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));     return ans;   }   int main() {     cin >> ax >> ay >> bx >> by >> binx >> biny;     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> ar[i].x >> ar[i].y;       disBin[i] = dist(binx, biny, ar[i].x, ar[i].y);       disA[i] = -disBin[i] + dist(ax, ay, ar[i].x, ar[i].y);       disB[i] = -disBin[i] + dist(bx, by, ar[i].x, ar[i].y);     }     int optimalA1 = 1, optimalA2, optimalB1 = 1, optimalB2;     double T = 0.0;     for (int i = 1; i <= n; i++) {       T += 2.0 * disBin[i];       if (disA[i] < disA[optimalA1]) {         optimalA1 = i;       }       if (disB[i] < disB[optimalB1]) {         optimalB1 = i;       }     }     optimalA2 = (optimalA1 + 1) % n;     optimalB2 = (optimalB1 + 1) % n;     for (int i = 1; i <= n; i++) {       if (disA[i] < disA[optimalA2] && i != optimalA1) {         optimalA2 = i;       }       if (disB[i] < disB[optimalB2] && i != optimalB1) {         optimalB2 = i;       }     }     if (binx == ax && biny == ay || binx == bx && biny == by) {       cout << fixed << setprecision(10) << T;       return 0;     }     if (optimalB1 == optimalA1) {       T = min(           T + disA[optimalA1],           min(T + disB[optimalB1], min(T + disA[optimalA1] + disB[optimalB2],                                        T + disA[optimalA2] + disB[optimalB1])));     } else {       T = min(T + disA[optimalA1],               min(T + disB[optimalB1], T + disA[optimalA1] + disB[optimalB1]));     }     cout << fixed << setprecision(10) << T;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long A[10][10] = {};   void rec(long long x, long long y, long long n) {     if ((n % 2) == 0) {       A[x][y] = n + 1;     }     if (n == 0)       return;     else {       long long arrx[] = {-2, 2};       long long arry[] = {-1, 1};       for (auto i : arrx) {         for (auto j : arry) {           long long newx = x + i, newy = y + j;           if (newx >= 0 && newx < 10 && newy >= 0 && newy < 10) {             {               cerr <<  >                      <<  newx                     <<  :   << newx <<   ,                      <<  newy                     <<  :   << newy << endl;             };             if (A[newx][newy] < n) rec(newx, newy, n - 1);           }         }       }       for (auto j : arrx) {         for (auto i : arry) {           long long newx = x + i, newy = y + j;           if (newx >= 0 && newx < 10 && newy >= 0 && newy < 10) {             {               cerr <<  >                      <<  newx                     <<  :   << newx <<   ,                      <<  newy                     <<  :   << newy << endl;             };             if (A[newx][newy] < n) rec(newx, newy, n - 1);           }         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       double n, h;       cin >> n >> h;       double f = h / sqrt(n);       cout << setprecision(9);       for (long long i = 0; i < n - 1; i++) {         cout << f * sqrt(i + 1) <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long K = 1;   int main() {     vector<int> ma, v;     int n, b, i, ans, x;     cin >> n >> b;     ans = b;     v.resize(n);     for (i = 0; i < n; i++) cin >> v[i];     ma.resize(n);     ma[n - 1] = v[n - 1];     for (i = n - 2; i >= 0; i--) ma[i] = max(v[i], ma[i + 1]);     for (i = 0; i < n - 1; i++) {       x = b % v[i] + b / v[i] * ma[i + 1];       if (x > ans) ans = x;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > v;   int n, m, vis[100005], in[100005], d[100005];   vector<int> e[100005];   int dfs(int i) {     vis[i] = 1;     int ans = 0;     for (auto first : e[i]) {       if (vis[first]) {         ans = max(ans, d[first]);         continue;       }       ans = max(ans, dfs(first));     }     d[i] = ans + 1;     return ans + 1;   }   bool check(int first) {     int j;     for (int i = 0; i < n; i++) {       e[i].clear();       vis[i] = 0;       in[i] = 0;       d[i] = 0;     }     for (int i = 0; i < first; i++) {       e[v[i].first].push_back(v[i].second);       in[v[i].second]++;     }     int f;     for (int i = 0; i < n; i++)       if (in[i] == 0) {         j = i;         f = dfs(i);         break;       }     return f == n;   }   void solve() {     int first, second;     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> first >> second;       first--;       second--;       v.push_back({first, second});     }     int l = 1, r = m, mid;     while (l < r) {       mid = l + (r - l) / 2;       if (check(mid))         r = mid;       else         l = mid + 1;     }     if (check(l))       cout << l <<   n ;     else       cout << -1;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool is_opening(char c) {     switch (c) {       case  ( :       case  [ :       case  { :       case  < :         return true;         break;       case  ) :       case  ] :       case  } :       case  > :         return false;         break;     }   }   bool is_match_bracket(char c1, char c2) {     if (c1 ==  (  && c2 ==  ) ) {       return true;     } else if (c1 ==  [  && c2 ==  ] ) {       return true;     } else if (c1 ==  {  && c2 ==  } ) {       return true;     } else if (c1 ==  <  && c2 ==  > ) {       return true;     }     return false;   }   int main(void) {     string str;     cin >> str;     size_t len = str.length();     int ans = 0;     stack<char> s;     bool imp = false;     for (int i = 0; i < len; ++i) {       bool is_cur_opening = is_opening(str.at(i));       if (!is_cur_opening) {         if (!s.empty() && is_opening(s.top())) {           if (!is_match_bracket(s.top(), str.at(i))) {             ++ans;           }           s.pop();         } else {           imp = true;           break;         }       } else {         s.push(str.at(i));       }     }     if (imp || !s.empty()) {       cout <<  Impossible  << endl;     } else {       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int num[5];   char board[5][10][55];   int p[] = {1, 2, 3, 0};   int main() {     for (int i = 0; i < 4; i++) cin >> num[i], num[i]--;     int cnt, ii, k;     for (int i = 0; i < 4; i++) {       for (int j = 0; j < 8; j++)         for (k = 0; k < 50; k++) board[i][j][k] = i +  A ;       for (int j = 0; j < 8 && num[p[i]]; j += 2)         for (k = 0; k < 50 && num[p[i]]; k += 2)           board[i][j][k] = p[i] +  A , num[p[i]]--;     }     cout << 32 <<     << 50 << endl;     for (int i = 0; i < 4; i++)       for (int j = 0; j < 8; j++, cout << endl)         for (int k = 0; k < 50; k++) cout << board[i][j][k];     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 250 + 10;   const int INF = 0x7f7f7f7f;   const int mod = 1000000007;   const double eps = 1e-10;   const double pi = acos(-1.0);   inline int realcmp(double a, double b) {     return (a > b + eps) ? 1 : ((a + eps < b) ? -1 : 0);   }   string s[1111];   long long f[Maxn], g[Maxn];   int n, m, a[Maxn][Maxn];   int Ver(int p) {     if (n % 2) return 0;     for (int i = 1; i <= n; i++)       if (a[i][p] == -1) return 0;     return 1;   }   long long Ver2(int p) {     memset(g, 0, sizeof(g));     g[0] = 1;     for (int i = 1; i <= n; i++) {       if (a[i][p] != 1 && a[i][p + 1] != 1) g[i] = (g[i] + g[i - 1]) % mod;       if (i >= 2 && a[i][p] != -1 && a[i][p + 1] != -1 && a[i - 1][p] != -1 &&           a[i - 1][p + 1] != -1)         g[i] = (g[i] + g[i - 2]) % mod;     }     return g[n];   }   int main() {     ios::sync_with_stdio(0);     cin >> n >> m;     for (int i = 0; i < 4 * n + 1; i++) cin >> s[i];     for (int i = 1; i < 4 * n + 1; i += 4)       for (int j = 1; j < 4 * m + 1; j += 4) {         int cnt = 0;         for (int k = 0; k < 3; k++)           for (int l = 0; l < 3; l++)             if (s[i + k][j + l] ==  O ) cnt++;         if (cnt == 0 || cnt == 1 || cnt == 4 || cnt == 5)           a[(i + 3) / 4][(j + 3) / 4] = 2;         else if (cnt == 2 || cnt == 3)           a[(i + 3) / 4][(j + 3) / 4] = (s[i][j] ==  O ) ? -1 : 1;         else if (cnt == 6)           a[(i + 3) / 4][(j + 3) / 4] = (s[i][j + 1] ==  O ) ? -1 : 1;       }     f[0] = 1;     f[1] = Ver(1);     for (int j = 2; j <= m; j++)       f[j] = (f[j - 2] * Ver2(j - 1) % mod + f[j - 1] * Ver(j) -               f[j - 2] * Ver(j - 1) * Ver(j) + mod) %              mod;     cout << f[m] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void read(T &x) {     x = 0;     char c = getchar();     bool f = 0;     for (; !isdigit(c); c = getchar()) f ^= c ==  - ;     for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);     x = f ? -x : x;   }   inline void readChar(char &c) {     for (c = getchar(); c <  A  || c >  E ; c = getchar())       ;   }   template <class T>   inline void write(T x) {     if (x < 0) {       putchar( - );       x = -x;     }     T y = 1;     int len = 1;     for (; y <= x / 10; y *= 10) ++len;     for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);   }   const int MAXN = 1e3;   int n, m, ans, a[MAXN + 5];   char s[MAXN + 5][MAXN + 5];   int main() {     read(n), read(m);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) readChar(s[i][j]);     for (int i = 1; i <= m; ++i) read(a[i]);     for (int i = 1; i <= m; ++i) {       int maxn = 0, tot[5] = {0};       for (int j = 1; j <= n; ++j) {         ++tot[(int)s[j][i] -  A ];         maxn = max(maxn, tot[(int)s[j][i] -  A ]);       }       ans += maxn * a[i];     }     write(ans);     putchar(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long LINF = 2e18;   const double PI = acos(-1.0);   const double E = exp(1);   const double EPS = 1e-8;   const long long mod = 1e4 + 7;   const int maxn = 3e5 + 5;   void pre() {     freopen( in.txt ,  r , stdin);     freopen( out.txt ,  w , stdout);   }   struct node {     long long l, r;     bool operator<(const node &q) const { return l > q.l; }   } arr[maxn];   priority_queue<long long, vector<long long>, greater<long long> > que;   int num;   long long k1, k2;   int www;   int main(void) {     cin >> num;     scanf( %I64d%I64d , &arr[0].l, &arr[0].r);     k1 = arr[0].l, k2 = arr[0].r;     for (int i = (1); i < (num); i++) {       scanf( %I64d%I64d , &arr[i].l, &arr[i].r);     }     sort(arr, arr + num);     int rk = 0;     int nxt = 0;     for (int i = 0; i < (num); i++) {       if (arr[i].l == k1 && arr[i].r == k2) {         www = i;         if (rk == 0) rk = i + 1;         break;       } else if (arr[i].l == k1) {         if (rk == 0) rk = i + 1;       }       que.push(arr[i].r - arr[i].l + 1);     }     nxt = rk;     int pos = rk;     while (!que.empty()) {       long long cur = que.top();       if (cur <= k1)         k1 -= cur;       else         break;       que.pop();       pos--;       for (int i = (nxt); i < (num); i++) {         if (i == www) continue;         if (k1 < arr[i].l) {           que.push(arr[i].r - arr[i].l + 1);           pos++;           nxt++;         } else {           break;         }       }       rk = min(rk, pos);     }     cout << rk << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<pair<int, int> > S;   set<pair<int, int> >::iterator itr;   int n, l, r, ans;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     while (n--) {       cin >> l >> r;       itr = S.lower_bound(make_pair(l, 0));       ++ans;       vector<set<pair<int, int> >::iterator> v;       while ((itr->second) <= r && itr != S.end()) {         r = max((itr->first), r);         v.push_back(itr);         l = min(l, (itr->second));         ++itr;         --ans;       }       for (int i = 0; i < v.size(); i++) S.erase(v[i]);       S.insert(make_pair(r, l));       cout << ans <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int dp[20][1 << 20];   long long int len[1 << 21] = {0};   std::vector<int> v[1000000];   int n;   int r[21][21];   long long int solve(int last, int mask, int pa) {     long long int sol = 0;     if (r[last][pa] == 1 && len[mask] >= 3) {       sol += 1;     }     if (dp[last][mask]) {       return dp[last][mask];     }     for (int i = 0; i < v[last].size(); i++) {       if ((mask & (1 << v[last][i])) == 0 && v[last][i] > pa) {         sol += solve(v[last][i], mask | (1 << v[last][i]), pa);       }     }     return dp[last][mask] = sol;   }   int main() {     int x, y, m;     cin >> n >> m;     while (m--) {       cin >> x >> y;       x--;       y--;       v[x].push_back(y);       v[y].push_back(x);       r[x][y] = 1;       r[y][x] = 1;     }     for (int i = 1; i <= (1 << (n)); i++) {       x = 0;       for (int j = 0; j < n; j++) {         if ((i >> j) & 1) x++;       }       len[i] = x;     }     long long int sol = 0;     for (int i = 0; i < n; i++) {       sol += solve(i, 0 | (1 << i), i);     }     cout << fixed;     cout << setprecision(0) << sol / 2 << endl;   }