stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 1.3665958614055742x):
#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;

}
// Slower C++ solution:
#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)

#define abs(x) (x >= 0 ? x : -(x))

#define ceil(a, b) a / b + !!(a % b)

template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }

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



int main() {

    int n;

    cin >> n;

    

    int table[100001] = {0};

    

    rep(i, n) {

        int a;

        cin >> a;

        table[a] += 1;

    }

    

    int flg = 0;

    if (n % 2 != 0) {

        if (table[0] != 1) flg = 1;

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

            if (table[i] != 2) flg = 1;

        }

    } else {

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

            if (table[i] != 2) flg = 1;

        }

    }

    

    if (flg == 1) {

        cout << 0 << endl;

        return 0;

    }

    

    ll ans = 1;

    rep(i, n / 2) {

        (ans *= 2) %= inf;

    }

    cout << ans << endl;

}




// Faster C++ solution for the same problem (measured speedup: 1.3685481352317654x):
#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;

}
// Slower C++ solution:
#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;

 }

// Faster C++ solution for the same problem (measured speedup: 1.3867722376939717x):
#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;

 }

}
// Slower C++ solution:
#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;

 }

// Faster C++ solution for the same problem (measured speedup: 1.4221087723627235x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 6.212169746489604x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 6.211447451808967x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.3890388246597183x):
#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;

}
// Slower C++ solution:
//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;

} 

// Faster C++ solution for the same problem (measured speedup: 7.504441398935484x):
#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);

}
// Slower C++ solution:
#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;

}


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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

#define ALL(x) (x).begin(), (x).end()

#define rt return

#define dll(x) scanf("%I64d",&x)

#define xll(x) printf("%I64d\n",x)

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

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

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

#define repd(i,x,n) for(int i=x;i<=n;i++)

#define pii pair<int,int>

#define pll pair<long long ,long long>

#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)

#define MS0(X) memset((X), 0, sizeof((X)))

#define MSC0(X) memset((X), '\0', sizeof((X)))

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define eps 1e-6

#define gg(x) getInt(&x)

#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;

using namespace std;

typedef long long ll;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll powmod(ll a,ll b,ll MOD){ll ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}

inline void getInt(int* p);

const int maxn=1000010;

const int inf=0x3f3f3f3f;

/*** TEMPLATE CODE * * STARTS HERE ***/

ll dp[55][55*55];

int k;

int n;

int main()

{

    //freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);

    //freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);

    gbtb;

    cin>>n>>k;

    int x;

    dp[0][0]=1ll;

    repd(i,1,n)

    {

        cin>>x;

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

        {

            for(int w=0;w<=55*j;w++)

            {

                dp[j+1][w+x]+=dp[j][w];

            }

        }

    }

    ll ans=0ll;

    repd(i,1,n)

    {

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

    }

    cout<<ans<<endl;





    return 0;

}



inline void getInt(int* p) {

    char ch;

    do {

        ch = getchar();

    } while (ch == ' ' || ch == '\n');

    if (ch == '-') {

        *p = -(getchar() - '0');

        while ((ch = getchar()) >= '0' && ch <= '9') {

            *p = *p * 10 - ch + '0';

        }

    }

    else {

        *p = ch - '0';

        while ((ch = getchar()) >= '0' && ch <= '9') {

            *p = *p * 10 + ch - '0';

        }

    }

}
// Slower C++ solution:
//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;

} 

// Faster C++ solution for the same problem (measured speedup: 1.4561906183815785x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.5768678938593483x):
#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;

}