stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
# include <cstdio>

# include <map>

# include <cmath>



using namespace std;



const int mod = 1e9+7;



int main()

{

    int n;

    int  a[100005];

    map<int,int> m;

    scanf("%d",&n);



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

    {

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

        m[a[i]]++;

    }



    int flag = 0; 

    if(n%2) //奇数 

    {

        if(m[0] != 1)

        {

            flag = 1;

        }

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

        {

            if(m[i] != 2)

            {

                flag = 1;

            }

        }

    }else{

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

        {

            if(m[i] != 2)

            {

                flag = 1;

            }

        }

    }

    long long sum = 1;



    for(int i =0;i < floor(n/2);i++)

    {

        sum = ((sum % mod) * 2)% mod;

    }



    if(n%2)

    {

        if(flag)

        printf("0\n");

        else

        printf("%lld\n",sum);

    }   

    else

    {

        if(flag)

        printf("0\n");

        else

        printf("%lld\n",sum);

    }



    return 0;

 } 

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

int num[100005],a[100005];

void init(int x)

{

    if(x%2==0)

        for(int i=1;i<=x;i+=2) 

        {

            a[i]=i;

            a[i+1]=a[i];

        }

    else

        for(int i=2;i<=x;i+=2)

        {

            a[i]=i;

            a[i+1]=a[i];

        }



}

int main()

{

    int n,k=1;

    scanf("%d",&n);

    init(n);

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

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

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

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

        if(a[i]!=num[i])

        {

            printf("0");

            return 0; 

        }



    long long ans=1;

    n/=2;

    while(n--)

        ans=ans*2%mod;

    printf("%lld",ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main() {

    int n; cin >> n;

    int a[100000] = {0};

    

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

        int aa; cin >> aa;

        if ((n % 2 == 0 && aa % 2 == 0) || (n % 2 != 0 && aa % 2 != 0)) {

            cout << 0 << endl;

            return 0;

        }

        //n - 1 - 2 * key = aa

        int key = (n - 1 - aa) / 2;

        a[key]++;

        if (key != n - 1 - key) a[n - 1 - key]++;

    }

    long long ans = 1;

    if (n % 2 != 0 && a[n / 2] % 2 == 0) {

        cout << 0 << endl;

        return 0;

    }

    for (int i = 0; i < (n % 2 != 0 ? n / 2 + 1 : n / 2); ++i) {

        if (a[i]) {

            ans *= a[i];

            ans %= (long long)1e9 + 7;

        }

        if (i < n / 2 && a[i] % 2 != 0) {

            cout << 0 << endl;

            return 0;

        }

    }

    cout << ans << endl;

}




// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define eb emplace_back

#define all(v) v.begin(), v.end()

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

#define rep3(i, l, n) for (int i = l; i < (n); ++i)

#define sz(v) (int)v.size()

#define inf (int)(1e9+7)

template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }

template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }













int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    

    

    

    int n;

    cin >> n;

    vector<int> a(n);

    rep(i, n) cin >> a[i];

    map<int, int> mp;

    rep(i, n) mp[a[i]]++;

    for (auto e : mp) {

        // cout << e.F << " " << e.S << endl;

        if (n % 2 != 0 && e.F == 0) {

            if (e.S != 1) {

                cout << 0 << endl;

                return 0;

            }

        } else if (e.S != 2) {

            cout << 0 << endl;

            return 0;

        }

    }

    int m = 0;

    int cnt = 0;

    ll ans = (n % 2 == 0 ? 2 : 1);

    for (auto e : mp) {

        if (cnt++ == 0) {

            m = e.F;

        } else {

            if (e.F != m + 2) {

                cout << 0 << endl;

                return 0;

            } else {

                (ans *= 2) %= inf;

            }

            m = e.F;

        }

        

    }

    cout << ans << endl;

}






// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

# include <map>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;

const int mod = 1e9+7;



int main()

{

    int n;

    scanf("%d",&n);

    int  a[100010];

    int m[100010]={0};



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

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

        m[a[i]]++;

    }



    int flag = 0;

    if(n%2==1)//奇数

    {

        if(m[0] != 1)

			flag = 1;

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

        {

            if(m[i] != 2)

            {

                flag = 1;

            }

        }

    }else{  //偶数

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

        {

            if(m[i] != 2)

            {

                flag = 1;

            }

        }

    }

    long long sum = 1;



    for(int i =0;i < floor(n/2);i++)

    {

        sum = (sum * 2)% mod;

    }



    if(n%2)

    {

        if(flag)

        printf("0\n");

        else

        printf("%lld\n",sum);

    }

    else

    {

        if(flag)

        printf("0\n");

        else

        printf("%lld\n",sum);

    }



return 0;

 }

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<iostream>

#include<string>

#include<cmath>

#include<algorithm>

#include<queue>

#include<set>

#include<stack>

#include<cstring>

#include<map>

#include<vector>

#define ll long long int

using namespace std;

const ll mod=1000000007;

ll powx(ll a,ll b)

{

    ll ans=1,base=a;

    while(b)

    {

        if(b%2==1)

            ans=(ans*base)%mod;

        base=(base*base)%mod;

        b/=2;

    }

    return ans;



}

int main()

{

 set<ll> s;

 ll sum=0,n;

 cin>>n;

 ll i,t,check=0;

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

 {

     cin>>t;

     if(t!=0&&s.find(t)!=s.end())

        sum++;

    else if(t!=0)

        s.insert(t);

    else

        check=1;

 }

 if(n%2==0)

 {

     if(sum!=s.size())

     {

         cout<<0;

     }

     else

     {

         cout<<powx(2,sum);



     }

 }

 else

 {

     if(check==1&&sum==n/2)

     {

         cout<<powx(2,sum);

     }

     else

        cout<<0;

 }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<cmath>

#include<algorithm>

# include <map>

//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector

//#include<bits/stdc++.h>

#define ll long long

using namespace std;

const int mod = 1e9+7;



int main()

{

    int n;

    scanf("%d",&n);

    int  a[100010];

    int b[100010]={0};



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

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

        b[a[i]]++;

    }



    int flag = 0;

    if(n%2==1)//奇数

    {

        if(b[0] != 1)

			flag = 1;

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

        {

            if(b[i] != 2)

            {

                flag = 1;

            }

        }

    }else{  //偶数

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

        {

            if(b[i] != 2)

            {

                flag = 1;

            }

        }

    }

    long long sum=1;



    for(int i=0;i<floor(n/2);i++)

    {

        sum=(sum*2)%mod;

    }

    if(flag)

        printf("0\n");

    else

        printf("%lld\n",sum);





return 0;

 }

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

const int N = 100010;

const int mod = 1000000007;

int n, a[N];

int main() {

	scanf("%d", &n);

	for (int i = 1; i <= n; ++ i) scanf("%d", &a[i]);

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

	if (n & 1) {

		if (a[1] != 0) {

			puts("0");

			return 0;

		}

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

			if (a[i] != i || a[i + 1] != i) {

				puts("0");

				return 0;

			}

		}

	} else {

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

			if (a[i] != i || a[i + 1] != i) {

				puts("0");

				return 0;

			}

		}

	}

	int ans = 1;

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

		ans = 2ll * ans % mod;

	}

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

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

using namespace std;



int main(){



	long long a, n, m, R_ans, L_sum;

	int ans = 0, i = 1;



	cin >> a >> n >> m;



	R_ans = powl(i + a, n);



	while(R_ans <= m) {

		int  num = R_ans;

		L_sum = 0;



		//  各桁数の合計値を求める

		while(num > 0){

			L_sum += num % 10;

			num /=10;

		}



		//  左辺と右辺の式を比較

		if(R_ans == powl(L_sum+a,n)) ans++; 

		i++;

		R_ans = powl(i + a, n);

	}



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <cmath>

using namespace std;

int main(void){

    

    

    //変数：デュードニー数に足す値「 a 」、指数「 n 」、上限の数「 m 」と置く

    int a, n, m, ans=0;

    

    //変数：右辺の答え「 rightAns 」、右辺の各桁の合計値「 rightDigitSum 」、左辺の合計値「 leftSum 」、と置く

    int rightAns = 0, rightDigitSum = 0, leftSum = 1;;



    //変数：左辺の合計値を求めるための仮の数「 rightSum 」と置く

    int rightSum;



    //入力：デュードニー数に足す値「 a 」、指数「 n 」、上限の数「 m 」を入力する

    cin >> a >> n >> m;



    while(pow(leftSum + a, n) <= m){

        //代入:右辺の答え「 rightAns 」に(y + a)^2の値を代入

        rightAns = pow(leftSum + a, n);

        rightSum = rightAns;

        rightDigitSum = 0;

        

        while(rightSum){

            rightDigitSum += (rightSum % 10);

            rightSum /= 10;

        }

        

        if(rightAns == pow(rightDigitSum + a, n)) ans++;

        

        leftSum++;

    }

    

    cout << ans << endl;

    

    

    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

using namespace std;



int main(){



	int a, n, m,  L_sum;

	int ans = 0, i = 1;

	long long R_ans;

	cin >> a >> n >> m;



	R_ans = powl(i + a, n);



	while(R_ans <= m) {

		int  num = R_ans;

		L_sum = 0;



		//  各桁数の合計値を求める

		while(num > 0){

			L_sum += num % 10;

			num /=10;

		}



		//  左辺と右辺の式を比較

		if(R_ans == powl(L_sum+a,n)) ans++; 

		i++;

		R_ans = powl(i + a, n);

	}



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <cmath>

using namespace std;

int main(void){

    

    

    //変数：デュードニー数に足す値「 a 」、指数「 n 」、上限の数「 m 」と置く

    int a, n, m, ans=0;

    

    //変数：右辺の答え「 rightAns 」、右辺の各桁の合計値「 rightDigitSum 」、左辺の合計値「 leftSum 」、と置く

    int rightAns = 0, rightDigitSum = 0, leftSum = 1;;



    //変数：左辺の合計値を求めるための仮の数「 rightSum 」と置く

    int rightSum;



    //入力：デュードニー数に足す値「 a 」、指数「 n 」、上限の数「 m 」を入力する

    cin >> a >> n >> m;



    while(pow(leftSum + a, n) <= m){

        //代入:右辺の答え「 rightAns 」に(y + a)^2の値を代入

        rightAns = pow(leftSum + a, n);

        rightSum = rightAns;

        rightDigitSum = 0;

        

        while(rightSum){

            rightDigitSum += (rightSum % 10);

            rightSum /= 10;

        }

        

        if(rightAns == pow(rightDigitSum + a, n)) ans++;

        

        leftSum++;

    }

    

    cout << ans << endl;

    

    

    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include<sstream>

#include<cmath>



using namespace std;



const int MAX = 13;

vector<double> Cake;

double box;

double dp[(1<<MAX)][MAX];



void init(){

  Cake.clear();

  fill(dp[0],dp[0]+(1<<MAX)*MAX,100000000);

  dp[0][0] = 0;

}



void make(){

  string s;

  getline(cin,s);

  stringstream ss(s);

  double num;

  while(ss >> num) Cake.push_back(num);

}



void solve(){





  for(int i = 0; i < (1<<Cake.size()); i++)

    for(int j = 0; j < (int)Cake.size(); j++){

      if(i == 0) {dp[(1<<j)][j] = Cake[j]; continue;}

      for(int k = 0; k < (int)Cake.size(); k++)

	if(!(i&(1<<k)) && j != k){

	  dp[i+(1<<k)][k] = min(dp[i+(1<<k)][k],dp[i][j]+2.0*sqrt(Cake[j]*Cake[k]));

	  //	  if(dp[i][j] == 0) cout << "error" << endl;

	}

    }



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

    //    cout << "cake " << Cake[i] << endl;

    //cout << dp[(1<<Cake.size())-1][i]+Cake[i] << endl;

    if(dp[(1<<Cake.size())-1][i]+Cake[i] <= box) {cout << "OK" << endl;return;}

  }

  cout << "NA" << endl;

}



int main(){



  while(cin >> box){

    init();

    make();

    solve();

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<vector>

#include<sstream>

#include<cmath>



using namespace std;



const int MAX = 12;

vector<double> Cake;

double box;

double dp[(1<<MAX)][MAX];



void init(){

  Cake.clear();

  fill(dp[0],dp[0]+(1<<MAX)*MAX,100000000);

  dp[0][0] = 0;

}



void make(){

  string s;

  getline(cin,s);

  stringstream ss(s);

  double num;

  while(ss >> num) Cake.push_back(num);

}



void solve(){





  for(int i = 0; i < (1<<Cake.size()); i++)

    for(int j = 0; j < (int)Cake.size(); j++){

      if(i == 0) {dp[(1<<j)][j] = Cake[j]; continue;}

      for(int k = 0; k < (int)Cake.size(); k++)

	if(!(i&(1<<k)) && j != k)

	  dp[i+(1<<k)][k] = min(dp[i+(1<<k)][k],dp[i][j]+2.0*sqrt(Cake[j]*Cake[k]));

	

    }



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

    if(dp[(1<<Cake.size())-1][i]+Cake[i] <= box) {cout << "OK" << endl;return;}

  }



  cout << "NA" << endl;

}



int main(){



  while(cin >> box){

    init();

    make();

    solve();

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//In the name of God

#include<bits/stdc++.h>

#define int long long



using namespace std;



int n , A , a[60] , dp[60][60][3000];



int32_t main(){

        ios_base::sync_with_stdio(false);

        cin.tie(0);

        cout.tie(0);

        cin >> n >> A;

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

                cin >> a[i];

        dp[0][0][0] = 1;

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

                dp[i][0][0] = 1;

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

                        for(int k=1 ; k < 2800 ; k++){

                                dp[i][j][k] = dp[i-1][j][k];

                                if(k >= a[i])

                                        dp[i][j][k] += dp[i-1][j-1][k - a[i]];

                        }

        }

        int res = 0;

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

                res += dp[n][i][i*A];

        cout << res;

} 

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

#define MAXN 56

using namespace std;

long long d[MAXN][MAXN][MAXN*MAXN],ans;

int n,A,a[MAXN],sum[MAXN];

int main()

{

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

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

	{

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

		sum[i]=sum[i-1]+a[i];

	}

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

		d[i][0][0]=1;

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

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

			for(int k=1;k<=sum[i];k++)

			{

				d[i][j][k]=d[i-1][j][k];

				if(k>=a[i]) d[i][j][k]=d[i][j][k]+d[i-1][j-1][k-a[i]];

			}

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

		ans+=d[n][i][A*i];

	printf("%lld",ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<map>

#include<sstream>

#include<cstring>

#include<algorithm>

#include<string>

using namespace std;

long long ans = 0;

int main()

{

    int n,a,x;

    cin >> n >> a;

    long long f[60][2600];

    memset(f,0,sizeof(f));

    f[0][0] = 1;//零个数字的和为零的状况有一种

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

    {

        cin >> x ;

        for(int j = i; j > 0; j --)//对于前i个数字

        {

            for(int k = x; k <= 2500; k ++)

            {

                f[j][k]+=f[j-1][k-x];

                //if(f[j][k])cout <<"j: " << j << " k: " << k <<" fjk " << f[j][k] <<endl;

            }

        //cout << f[j][j*a] <<endl;

        }

    }

    long long ans = 0;

    for(int i = 1; i <= n; i ++)ans += f[i][a*i];

    cout << ans <<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



const int maxn = 55;



long long f[maxn * maxn][maxn];

int x[maxn];



int main() {

	ios::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

	int n, a, s = 0; cin >> n >> a;

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

		cin >> x[i]; s += x[i];

	}

	f[0][0] = 1;

	for(int i = 0; i < n; ++ i) for(int j = s; j >= x[i]; -- j) {

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

			f[j][k] += f[j - x[i]][k - 1];

	}

	long long ans = 0;

	for(int i = 0; i <= s; ++ i) for(int j = 0; j <= n; ++ j) if(i == j * a) ans += f[i][j];

	cout << ans - 1 << "\n";

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//### In The Name Of GOD ###



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;



const int MOD = 1000000007;

const int INF = 30 * 1000 + 20;

const int MAXN = 2600;

const int MLOG = 18;

const int NMAX = 60;



#define int ll

#define pb push_back

#define pp pop_back

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

#define sz(a) (int)(a.size())

#define ct(x) const_cast<const int&>(x)



int what[MAXN][NMAX][NMAX];



int32_t main(){

	int n,A;

	cin >> n >> A;

	int x[ct(n)];

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

	what[0][i][0] = 1;

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

		cin >> x[i];

		for(int j=0;j<x[i];j++){

			for(int k = 1; k < NMAX; k++){

				what[j][i+1][k] = what[j][i][k];

			}

		}

		for(int j=x[i];j<2550;j++){

			for(int k = 1; k < NMAX; k++){

				what[j][i+1][k] = what[j-x[i]][i][k-1] + what[j][i][k];

//				if(what[j][i+1][k] > 0)

//				cerr << j << ' ' << i+1 << ' ' << k << ' '<< what[j][i+1][k] << endl;

			}

		}

	}

	int ans = 0;

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

		ans += what[A*i][n][i];

	}

	cout << ans;

}

// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;

int x[55];

long long dp[55][55*55];

int main()

{

	int n,a;

	cin >> n >> a;

	dp[0][0] = 1;

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

	cin >> x[i];

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

	{

		for(int j = i-1;j >= 0;j--)

		for(long long k = 55*j;k >=0 ;k--)

		dp[j+1][k+x[i]] += dp[j][k];

	}

	long long ans = 0;

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

	{

		ans += dp[i][i*a];

	}

	cout << ans << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

 

int x[60];;

long long dp[60][60][2600];

int main()

{

    int n, a;

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

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

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

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

        dp[i][0][0] = 1;

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

    {

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

        {

            for(int k = 0; k <= 2500; ++k)

            {

                if(k - x[i] >= 0)

                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i]];

                dp[i][j][k] += dp[i - 1][j][k];

            }

        }

    }

    long long ans = 0;

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

        ans += dp[n][i][a * i];

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

    return 0;

}

/*

3 8

8 8 9

 

4 8

7 9 8 9

 

8 5

3 6 2 8 7 6 5 9

 

33 3

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

 

*/

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

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

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

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

	dp[0][0]=1LL;

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

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

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

		ans+=dp[tot][A*tot];

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

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define LL long long

#define ULL unsigned long long

#define INF 0x3f3f3f3f

using namespace std;

 

template<class T> inline

void read(T& x) {

	int f = 1; x = 0;

	char ch = getchar();

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

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

	x *= f;

}

 

/*============ Header Template ============*/



const int N = 50 + 5;

const int M = 2500 + 5;



int n, A;

int a[N];

LL f[M][N];



int main() {

	read(n), read(A);

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

	f[0][0] = 1;

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

		for (int j = 2500; j >= a[i]; j--)

			for (int k = 1; k <= i; k++) f[j][k] += f[j - a[i]][k - 1];

	}

	LL ans = 0;

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

		if (i * A <= 2500) ans += f[i * A][i];

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

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

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

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

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

	dp[0][0]=1LL;

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

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

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

		ans+=dp[tot][A*tot];

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

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

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

	{

		memset(tmp,0,sizeof tmp);

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

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

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

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

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

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

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

	dp[0][0]=1LL;

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

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

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

		ans+=dp[tot][A*tot];

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

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

const int MAXN = 51;

const int ZERO = 2550;

const int MAXM = ZERO * 2;

typedef long long LL;

LL F[2][MAXM];

int main() {

	int n, a, i, j, x;

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

	F[0][ZERO] = 1;

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

		scanf ( "%d", &x );

		x -= a;

		for ( j = MAXN; j + MAXN < MAXM; ++j )

			F[i & 1][j] = F[ ( i - 1 ) & 1][j] + F[ ( i - 1 ) & 1][j - x];

	}

	printf ( "%lld\n", F[n & 1][ZERO] - 1 );

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

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

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

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

	dp[0][0]=1LL;

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

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

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

		ans+=dp[tot][A*tot];

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

	return 0;

}

// Fastest known solution for this problem: