stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

    int n,s;

	cin>>n>>s;

    if(s % 1000 != 0) {

        printf("-1 -1 -1\n");

    } else {

        s /= 1000;

        for(int i = 0;i <= 2000;i++) {

            for(int j = 0;j <= 1000;j++) {

                if(i + j*5 > s) {

                    continue;

                }

                if( ((s - (i + j*5)) % 10 == 0 ) ) {

                    if(i + j + ((s - (i + j*5))/10) == n) {

                        printf("%d %d %d\n",((s - (i + j*5))/10),j,i);

                        return 0;

                    }

                }

            }

        }

        printf("-1 -1 -1\n");

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9325936112334742x):
/*

        Author: Prokash

                CSE48, JU



*/



#include<bits/stdc++.h>

using namespace std;



typedef long long ll;

#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int ara[2005];

int main()

{

    FAST;

    int N,Y,taka,z=0;

    cin>>N>>Y;

    for(int x=0;x<=N;x++)

    {

        for(int y=0;x+y<=N;y++)

        {

            taka=Y-10000*x-5000*y;

        if(taka<0)

        {

            continue;

        }

        if(taka%1000!=0)

        {

            continue;

        }

        z=taka/1000;

        if(x+y+z==N)

        {

            cout<<x<<" "<<y<<" "<<z<<endl;

            return 0;

        }

    }

    }

    cout<<"-1 -1 -1"<<endl;

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

    int n,s;

	cin>>n>>s;

    if(s % 1000 != 0) {

        printf("-1 -1 -1\n");

    } else {

        s /= 1000;

        for(int i = 0;i <= 2000;i++) {

            for(int j = 0;j <= 1000;j++) {

                if(i + j*5 > s) {

                    continue;

                }

                if( ((s - (i + j*5)) % 10 == 0 ) ) {

                    if(i + j + ((s - (i + j*5))/10) == n) {

                        printf("%d %d %d\n",((s - (i + j*5))/10),j,i);

                        return 0;

                    }

                }

            }

        }

        printf("-1 -1 -1\n");

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9536808850174994x):
#include<bits/stdc++.h>

#define ll long long int



using namespace std;

int main()

{

    ll n,y,i,j,k,to=0,ten=-1,five=-1,thou=-1;



    cin>>n>>y;



    for(i=0; i<=n; i++)

    {

        for(j=0; i+j<=n; j++)

        {

            k=n-i-j;

            to=10000*i+5000*j+1000*k;



            if(to==y)

            {

                ten=i;

                five=j;

                thou=k;

            }

        }

    }

    cout<<ten<<" "<<five<<" "<<thou<<endl;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

    int n,s;

	cin>>n>>s;

    if(s % 1000 != 0) {

        printf("-1 -1 -1\n");

    } else {

        s /= 1000;

        for(int i = 0;i <= 2000;i++) {

            for(int j = 0;j <= 1000;j++) {

                if(i + j*5 > s) {

                    continue;

                }

                if( ((s - (i + j*5)) % 10 == 0 ) ) {

                    if(i + j + ((s - (i + j*5))/10) == n) {

                        printf("%d %d %d\n",((s - (i + j*5))/10),j,i);

                        return 0;

                    }

                }

            }

        }

        printf("-1 -1 -1\n");

    }



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9838858142194293x):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long n,y;

    cin>>n>>y;

    int f=0;

    for(long long i=0;i<=n;i++)

    {

        for(long long j=0;i+j<=n;j++)

        {

            long long c=n-i-j;

            if(i*10000+j*5000+c*1000==y)

            {

                f=5;

                cout<<i<<" "<<j<<" "<<c<<endl;

                return 0;

            }



        }

    }

    if(f==0)

    {

        cout<<"-1"<<" "<<"-1"<<" "<<"-1"<<endl;

    }

return 0;

}
// Slower C++ solution:
#include<cmath>

#include<cstdio>

#include<vector>

#include<algorithm>



#define	pb			push_back

#define	rep(i,n)	for(int i=0;i<n;i++)



using namespace std;



typedef	vector<int>	vi;



const double EPS=1e-9;



int main(){

	static bool er[100000]={};	er[0]=er[1]=true;

	rep(i,400) if(!er[i]) for(int j=i*i;j<100000;j+=i) er[j]=true;



	vi pr;

	rep(i,100000) if(!er[i]) pr.pb(i);



	for(int m,a,b;scanf("%d%d%d",&m,&a,&b),m;){

		int popt=2,qopt=2;

		rep(i,pr.size()){

			int p=pr[i];

			if(p*p>m)	continue;

			int q=*(upper_bound(pr.begin()+i,pr.end(),min(b*p/a,m/p))-1);

			if(popt*qopt<p*q)	popt=p,qopt=q;

		}

		printf("%d %d\n",popt,qopt);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3864882978986763x):
#include<cstdio>

#include<vector>

#include<algorithm>



#define	pb			push_back

#define	rep(i,n)	for(int i=0;i<n;i++)



using namespace std;



typedef	vector<int>	vi;



int main(){

	static bool er[100000]={};	er[0]=er[1]=true;

	rep(i,400) if(!er[i]) for(int j=i*i;j<100000;j+=i) er[j]=true;



	vi pr;

	rep(i,100000) if(!er[i]) pr.pb(i);



	for(int m,a,b;scanf("%d%d%d",&m,&a,&b),m;){

		int popt=2,qopt=2;

		rep(i,pr.size()){

			int p=pr[i];

			if(p*p>m)	break;

			int q=*(upper_bound(pr.begin()+i,pr.end(),min(b*p/a,m/p))-1);

			if(popt*qopt<p*q)	popt=p,qopt=q;

		}

		printf("%d %d\n",popt,qopt);

	}



	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define rep(i,n)for(int i=0;i<n;i++)

using namespace std;



bool is_prime[100000];

double prime[10000];



int main() {

	memset(is_prime, 1, sizeof(is_prime));

	is_prime[0] = is_prime[1] = false;

	int p = 0;

	for (int i = 2; i < 100000; i++) {

		if (is_prime[i]) {

			prime[p++] = i;

			for (int j = i * 2; j < 100000; j += i)is_prime[j] = false;

		}

	}

	int m; double a, b;

	while (scanf("%d%lf%lf", &m, &a, &b), m) {

		int Max = 0, P, Q;

		for (int i = 0; prime[i] * 2 <= m; i++) {

			int j = upper_bound(prime, prime + p, prime[i] / a*b) - prime - 1;

			int k = upper_bound(prime, prime + p, m / prime[i]) - prime - 1;

			j = min(j, k);

			if (j < 0)continue;

			if (Max < prime[i] * prime[j] && prime[j] / (double)prime[i] >= a / b) {

				Max = prime[i] * prime[j]; P = prime[i]; Q = prime[j];

			}

		}

		printf("%d %d\n", P, Q);

	}

}

// Faster C++ solution for the same problem (measured speedup: 1.262473614462936x):
#include<bits/stdc++.h>

#define rep(i,n)for(int i=0;i<n;i++)

using namespace std;



bool is_prime[100000];

double prime[10000];



int main() {

	memset(is_prime, 1, sizeof(is_prime));

	is_prime[0] = is_prime[1] = false;

	int p = 0;

	for (int i = 2; i < 100000; i++) {

		if (is_prime[i]) {

			prime[p++] = i;

			for (int j = i * 2; j < 100000; j += i)is_prime[j] = false;

		}

	}

	int m; double a, b;

	while (scanf("%d%lf%lf", &m, &a, &b), m) {

		int Max = 0, P, Q;

		for (int i = 0; prime[i] * prime[i] <= m; i++) {

			int j = upper_bound(prime, prime + p, prime[i] / a*b) - prime - 1;

			int k = upper_bound(prime, prime + p, m / prime[i]) - prime - 1;

			j = min(j, k);

			if (j < 0)continue;

			if (Max < prime[i] * prime[j] && prime[j] / (double)prime[i] >= a / b) {

				Max = prime[i] * prime[j]; P = prime[i]; Q = prime[j];

			}

		}

		printf("%d %d\n", P, Q);

	}

}
// Slower C++ solution:
#include <algorithm>

#include <bitset>

#include <climits>

#include <cmath>

#include <cstring>

#include <ctime>

#include <functional>

#include <iostream>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <string>

#include <tuple>

#include <unordered_map>

#include <utility>

#include <vector>

#include <complex>



using namespace std;



const int SIZ = 100000;



vector<int> getPrimes() {

    vector<int> primes;

    int sieve[SIZ];

    fill_n(sieve, SIZ, true);

    sieve[0] = sieve[1] = false;

    primes.push_back(2);

    for (int i=4; i<SIZ; i+=2) {

        sieve[i] = false;

    }

    for (int i=3; i*i<SIZ; i+=2) {

        if ( ! sieve[i]) continue;

        for (int j=i*2; j<SIZ; j+=i) {

            sieve[j] = false;

        }

    }

    for (int i=3; i<SIZ; i+=2) {

        if (sieve[i]) primes.push_back(i);

    }

    return primes;

}



int main() {

    ios::sync_with_stdio(false);

    vector<int> primes = getPrimes();

    int m, a, b;

    while (1) {

        cin >> m >> a >> b;

        if (!m && !a && !b) break;

        int tp, tq, p = 0, q = 0, max_m = 0;

        for (int i=0; i<(int)primes.size(); ++i) {

            for (int j=i; j<(int)primes.size(); ++j) {

                tp = primes[i];

                tq = primes[j];

                if (tp * tq < 0) break;

                if (m < tp * tq || b * tp < a * tq) {

                    break;

                }

                if (max_m < tp * tq) {

                    p = tp;

                    q = tq;

                    max_m = tp * tq;

                }

            }

        }

        cout << p << " " << q << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3776772990898982x):
#include <iostream>

#include <string>

#include <vector>



using namespace std;



const int MX = 100000;

bool isprime[MX];



vector<int> getPrimes() {

    vector<int> ret;

    fill_n(isprime, MX, true);

    isprime[0] = isprime[1] = false;

    for (int i=2; i<=MX; ++i) {

        if ( ! isprime[i]) continue;

        ret.push_back(i);

        for (int j=i*i; 0<j && j<=MX; j+=i) {

            isprime[j] = false;

        }

    }

    return ret;

}



int main() {

    vector<int> primes = getPrimes();

    long long m, a, b;

    while (1) {

        cin >> m >> a >> b;

        if (!m && !a && !b) break;

        long long pq = 0;

        pair<int,int> ans;

        for (int i=0; i<(int)primes.size(); ++i) {

            long long p = primes[i];

            if (p * p > m) break;

            for (int j=i; j<(int)primes.size(); ++j) {

                long long q = primes[j];

                if (p * q > m || a * q > b * p) break;

                if (pq < p * q) {

                    pq = p * q;

                    ans.first = p;

                    ans.second = q;

                }

            }

        }

        cout << ans.first << " " << ans.second << endl;

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std ;

int main()

{

	int n,x,a[105]  ; cin >> n >>x;

	for(int i=0;i<n;i++)

		cin >> a[i] ;

	sort(a,a+n) ;

	int m=0;

	while(x>=a[m]&&m<n-1) {x-=a[m] ;m++;}

	if(x==a[m]) m++;

	cout << m ;

	return 0 ;

}

// Faster C++ solution for the same problem (measured speedup: 5.227799195737078x):
#include <cstdio>

#include <algorithm>

using namespace std;

int a[101];

int main(void)

{

	int n, x;

	scanf("%d%d", &n, &x);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	int ans = 0;

	for (int i = 1; i <= n; ++i)

	{

		if (x < a[i])

		{

			printf("%d", ans);

			return 0;

		}

		++ans;

		x -= a[i];

	}

	if (x) --ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include<cstdlib>

#include<cstdio>

#include<iostream>

#include<algorithm>

using namespace std;

int a[1000];

int main()

{

	int n,x;

	scanf("%d%d",&n,&x);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	sort(a+1,a+n+1);

	int ans=0;

	for(int i=1;i<n;i++)

	{

		if(x>=a[i])

		{

			x-=a[i];

			ans++;

		}

	}

	if(x==a[n])

	{

		ans++;

	}

	printf("%d\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1715363344014085x):
#include <cstdio>

#include <algorithm>

using namespace std;

int a[101];

int main(void)

{

	int n, x;

	scanf("%d%d", &n, &x);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	int ans = 0;

	for (int i = 1; i <= n; ++i)

	{

		if (x < a[i])

		{

			printf("%d", ans);

			return 0;

		}

		++ans;

		x -= a[i];

	}

	if (x) --ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

long long int happy[105];

int main()

{

    long long int k, c;

    cin >> k >> c;

    long long int totalhappy = 0;

    for ( int i = 1; i <= k; i++ )

    {

        cin >> happy[i];

        totalhappy = totalhappy + happy[i];

    }

    long long int maxhappy = 0, candyused = 0;

    if ( totalhappy == c )

    {

        cout << k;

    }

    else if ( totalhappy < c )

    {

        cout << k - 1;

    }

    else

    {

        long long int deposit;

        for ( int i = 1; i <= k; i++ )

        {

            for ( int j = i+1; j <= k; j++ )

            {

                if ( happy[j] < happy[i] )

                {

                    deposit = happy[i];

                    happy[i] = happy[j];

                    happy[j] = deposit;

                }

            }

        }

        for ( int i = 1; i <= k; i++ )

        {

            candyused = candyused + happy[i];

            if ( candyused <= c )

            {

                maxhappy++;

            }

            else

            {

                break;

            }

        }

        cout << maxhappy;

    }

}

// Faster C++ solution for the same problem (measured speedup: 5.224464710744413x):
#include <cstdio>

#include <algorithm>

using namespace std;

int a[101];

int main(void)

{

	int n, x;

	scanf("%d%d", &n, &x);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	int ans = 0;

	for (int i = 1; i <= n; ++i)

	{

		if (x < a[i])

		{

			printf("%d", ans);

			return 0;

		}

		++ans;

		x -= a[i];

	}

	if (x) --ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

inline LL read()

{

    LL x=0,f=1;char ch=getchar();

    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}

    return x*f;

}



const int maxn=1e5+7;

int a[maxn];

int main()

{

    int n=read(),x=read();

    for(int i=1;i<=n;i++)a[i]=read();

    sort(a+1,a+1+n);

    int ans=0;

    for(int i=1;i<=n;i++){

        if(i==n){

            if(x==a[i])ans++;

            break;

        }

        if(x>=a[i]){

            x-=a[i];

            ans++;

        }

        else break;

    }

    printf("%d\n",ans);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.153674695896939x):
#include <cstdio>

#include <algorithm>

using namespace std;

int a[101];

int main(void)

{

	int n, x;

	scanf("%d%d", &n, &x);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	int ans = 0;

	for (int i = 1; i <= n; ++i)

	{

		if (x < a[i])

		{

			printf("%d", ans);

			return 0;

		}

		++ans;

		x -= a[i];

	}

	if (x) --ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>



using namespace std; 



int arr[1005];



void findMaxHappy(int n , int x){

    int count = 0;

    for(int i = 0; i < n; i++){

        if(x >= arr[i]){

            if(i == n - 1 && (x - arr[i])!=0){

                cout << count << endl;

                exit(0);

            }

            else{

                count++; 

                x = x - arr[i]; // Update x value

            }

        }

    }

    cout << count << endl;

}



int main(){

    int n , x; 

    cin >> n >> x;



    for(int i = 0; i < n; i ++){

        cin >> arr[i];

    }

    sort(arr , arr + n); // Sort array



    findMaxHappy(n , x);

}

// Faster C++ solution for the same problem (measured speedup: 5.232564535128092x):
#include <cstdio>

#include <algorithm>

using namespace std;

int a[101];

int main(void)

{

	int n, x;

	scanf("%d%d", &n, &x);

	for (int i = 1; i <= n; ++i)

		scanf("%d", &a[i]);

	sort(a + 1, a + n + 1);

	int ans = 0;

	for (int i = 1; i <= n; ++i)

	{

		if (x < a[i])

		{

			printf("%d", ans);

			return 0;

		}

		++ans;

		x -= a[i];

	}

	if (x) --ans;

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cstring>

#include<string>

#include<vector>

using namespace std;



const int maxn = 100;

vector<int>g[maxn];

int vis[maxn];

int n,m;

int num,tot;

void dfs(int t)

{	

	int j;

	for(j=1;j<=n;j++)

	{

		if(vis[j]!=1)

			break;

	}

	if(j==n+1)

	{

		num++;

		return;

	}

	for(int i=0;i<g[t].size();i++)

	{

		int x = g[t][i];

		if(vis[x]==0)

		{

			vis[x]=1;

			dfs(x);

			vis[x]=0;

		}

	}

	return ;

}

int main()

{

	memset(vis,0,sizeof(vis));

	cin>>n>>m;

	tot=0;

	num=0;

	for(int i=1;i<=n;i++)

	{

		g[i].clear();

	}

	for(int i=1;i<=m;i++)

	{

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	vis[1]=1;

	num=0;

	for(int i=0;i<g[1].size();i++)

	{

		int x=g[1][i];

		vis[x]=1;

		dfs(x);

		vis[x]=0;

	}

	cout<<num<<endl;

	

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.5384163106337354x):
#include <stdio.h>

#include <algorithm>

using namespace std;

int x[10][10];

int gen(int g[],int s,int n,int c[]){



}

main(){

    int n,m;

    scanf("%d %d",&n,&m);

    int arr[n];

    for(int i=0;i<n;i++){

        arr[i]=i+1;

    }

    for(int i=0;i<m;i++){

        int a,b;

        scanf("%d %d",&a,&b);

        x[a][b]=1;

        x[b][a]=1;

    }

    int co=0;

    do{

        int b=1;

        for(int i=0;i<n-1;i++){

            if(x[arr[i]][arr[i+1]]==0){

                b=0;

            }

        }

        co+=b;

    }while(next_permutation(arr+1,arr+n));

    printf("%d",co);

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cstring>

#include<string>

#include<vector>

using namespace std;



const int maxn = 100;

vector<int>g[maxn];

int vis[maxn];

int n,m;

int num,tot;

void dfs(int t)

{	

	int j;

	for(j=1;j<=n;j++)

	{

		if(vis[j]!=1)

			break;

	}

	if(j==n+1)

	{

		num++;

		return;

	}

	for(int i=0;i<g[t].size();i++)

	{

		int x = g[t][i];

		if(vis[x]==0)

		{

			vis[x]=1;

			dfs(x);

			vis[x]=0;

		}

	}

	return ;

}

int main()

{

	memset(vis,0,sizeof(vis));

	cin>>n>>m;

	tot=0;

	num=0;

	for(int i=1;i<=n;i++)

	{

		g[i].clear();

	}

	for(int i=1;i<=m;i++)

	{

		int a,b;

		cin>>a>>b;

		g[a].push_back(b);

		g[b].push_back(a);

	}

	vis[1]=1;

	num=0;

	for(int i=0;i<g[1].size();i++)

	{

		int x=g[1][i];

		vis[x]=1;

		dfs(x);

		vis[x]=0;

	}

	cout<<num<<endl;

	

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.278476041649727x):
#include <stdio.h>

#include <algorithm>

int s[10][10],v,e,t1,t2;

using namespace std;

main()

{

    scanf("%d %d",&v,&e);

    for(int i=0;i<e;i++)

    {

        scanf("%d %d",&t1,&t2);

        s[t1][t2]=1;

        s[t2][t1]=1;

    }

    int arr[v];

    for (int i=0;i<v;i++)

    {

        arr[i]=i+1;

    }

    bool p=true;

    int cnt=0;

    do

    {

        p=true;

        if(arr[0]!=1) break;

        for (int i=0;i<v-1;i++)

        {

            if(s[arr[i]][arr[i+1]]==1);

            else

            {

                p=false;

                break;

            }

        }

        if(p==true) cnt++;

    }while (next_permutation(arr,arr+v));

    printf("%d\n",cnt);

}
// Slower C++ solution:
#include <stdio.h>

#include <algorithm>

#include <list>

using namespace std;

list <int> to[9];

int arr[9];

int node,edge;

int ans=0;

int where(int in,int what)

{

    for (list<int>::iterator it = to[in].begin();it!=to[in].end();it++)

    {

        if (*it == what)

        {

            return 1;

        }

    }

    return 0;

}

void calcu(int arr[])

{

    for (int i=1;i<node;i++)

    {

        if (where(arr[i],arr[i+1])==0)

        {

            return;

        }

    }

    ans++;

    return;

}

main()

{

    scanf("%d %d",&node,&edge);

    for (int i=0;i<edge;i++)

    {

        int one,two;

        scanf("%d %d",&one,&two);

        to[one].push_back(two);

        to[two].push_back(one);

    }

    for (int i=1;i<=node;i++)

    {

        arr[i]=i;

    }

    do

    {

        calcu(arr);

    }

    while (next_permutation(arr+2,arr+node+1));

    printf("%d",ans);

}


// Faster C++ solution for the same problem (measured speedup: 4.070187174747596x):
#include <stdio.h>

#include <algorithm>

int s[10][10],v,e,t1,t2;

using namespace std;

main()

{

    scanf("%d %d",&v,&e);

    for(int i=0;i<e;i++)

    {

        scanf("%d %d",&t1,&t2);

        s[t1][t2]=1;

        s[t2][t1]=1;

    }

    int arr[v];

    for (int i=0;i<v;i++)

    {

        arr[i]=i+1;

    }

    bool p=true;

    int cnt=0;

    do

    {

        p=true;

        if(arr[0]!=1) break;

        for (int i=0;i<v-1;i++)

        {

            if(s[arr[i]][arr[i+1]]==1);

            else

            {

                p=false;

                break;

            }

        }

        if(p==true) cnt++;

    }while (next_permutation(arr,arr+v));

    printf("%d\n",cnt);

}
// Slower C++ solution:
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

#define pp pair<int,int>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

#define ll long long

#define ld long double

#define al(a) (a).begin(),(a).end()

#define mk make_pair

ll MOD=1000000007;

ll mod=998244353;

int inf=1000001000;

ll INF=1e18+5;



int main() {

  int n,m,ans=0; cin>>n>>m;

  vector<vector<int>> path(n);

  vector<int> p;

  rep(i,n) p.push_back(i);

  rep(i,m){

    int a,b; cin>>a>>b;

    a--; b--;

    path[a].push_back(b);

    path[b].push_back(a);

  }

    do{

      if(p[0]!=0) break;

      

      int ju=0;

      rep(i,n-1){

        ju=0;

        for(auto q : path[p[i]]) if(q==p[i+1]) ju=1;

        if(ju!=1) break; 

        if(i==n-2) ans++;

      }

    } while(next_permutation(al(p)));

  

  cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 1.8700207091590566x):
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define pp pair<int,int>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

#define ld long double

#define al(a) (a).begin(),(a).end()

#define mk make_pair

#define check cout<<"?"<<endl;



ll MOD=1000000007;

ll mod=998244353;

int inf=1000001000;

ll INF=1e18+5;



int main(){

    int n,m,ans=0; cin>>n>>m;

    set<pp> path;

    rep(i,m){

        int a,b; cin>>a>>b;

        a--; b--;

        path.insert(mk(a,b));

        path.insert(mk(b,a));

    }

    vector<int> v(n,0);

    rep(i,n) v[i]=i+1;

    do{

        if(v[0]!=1) break;

        int d=1;

        rep(i,n-1){

            if(!(path.count(mk(v[i]-1,v[i+1]-1)))) d=0;

        }

        if(d) ans++;

    }while(next_permutation(al(v)));

    cout<<ans<<endl;

}