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

#include<iostream>

#include<algorithm>

using namespace std;

int T[100050];

int N,C,K;

int main()

{

	scanf("%d%d%d",&N,&C,&K);

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

	{

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

	}

	sort(T,T+N);

	int sum=1;

	int cnt=1;

	int st=T[0];

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

	{

		if(st+K<T[i])

		{

			sum++;

			cnt=1;

			st=T[i];

			continue;

		}

		if(st+K>=T[i])

		{

			cnt++;

			if(cnt>C)

			{

				cnt=1;

				sum++;

				st=T[i];

			}

		}

	}

	printf("%d",sum);

}

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

#include <cstring>

#include <algorithm>

#define N 110000

using namespace std;

int n,c,k,t[N],l;

int main(){

//	freopen("a.in","r",stdin);

	scanf("%d%d%d",&n,&c,&k);

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

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

	int ans=0;

	l=1;

	t[n+1]=0x7FFFFFFF;

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

		int sum=0;

		while(l<i and t[l]+k<t[i]) l+=min(i-l,c),sum++;

		ans+=sum;

	}

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

	return 0;

}

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

using namespace std;

int T[100100],Head,Tail,N,C,K,ans;

int main()

{

	cin>>N>>C>>K;

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

		cin>>T[i];

	sort(T,T+N);

	while(true)

	{

		while(Tail<min(N,Head+C)&&T[Tail]<=T[Head]+K)

			Tail++;

		Head=Tail;

		ans++;

		if(Tail==N)

			break;

	}

	cout<<ans<<endl;

	return 0;

}


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

#include <cstring>

#include <algorithm>

#define N 110000

using namespace std;

int n,c,k,t[N],l;

int main(){

//	freopen("a.in","r",stdin);

	scanf("%d%d%d",&n,&c,&k);

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

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

	int ans=0;

	l=1;

	t[n+1]=0x7FFFFFFF;

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

		int sum=0;

		while(l<i and t[l]+k<t[i]) l+=min(i-l,c),sum++;

		ans+=sum;

	}

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

	return 0;

}

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

using namespace std;

const int N=1e5+5;

int n,c,k,a[N],ans,sum,ji;

int main()

{

	cin>>n>>c>>k;

	for(int i=0;i<n;i++)cin>>a[i];

	sort(a,a+n);

	ji=a[0];

	sum=1;

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

	{

		if(k<a[i]-ji||sum==c)

			ans++,sum=1,ji=a[i];

		else

			sum++;

	}

	if(sum)ans++;

	cout<<ans<<endl;

}

/*

Ì°ÐÄË¼Â·£º½«Í¬Ò»¶ÎÊ±¼äÄÚµÄÈËÒ»µ©×øÂúÁËÒ»Á¾³µ»òÕßÊ±¼ä³¬¹ýÁË£¬ÄÇÃ´¾ÍÔÙÐÂ¿ªÒ»Á¾³µ£¬

ÖØÐÂ¼ÇÂ¼Ò»ÏÂ×îÐÂµÄÊ±¼ä£¬È¥ÈÝÄÉ¸ü¶àµÄÈË¡£ 

*/


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

#include <cstring>

#include <algorithm>

#define N 110000

using namespace std;

int n,c,k,t[N],l;

int main(){

//	freopen("a.in","r",stdin);

	scanf("%d%d%d",&n,&c,&k);

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

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

	int ans=0;

	l=1;

	t[n+1]=0x7FFFFFFF;

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

		int sum=0;

		while(l<i and t[l]+k<t[i]) l+=min(i-l,c),sum++;

		ans+=sum;

	}

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

	return 0;

}

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

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }





ll dp[51][51][51*51];



int main(void){

    int N, A; cin >> N >> A;

    vector<int> x(N+1);

    for(int i=1; i<=N; i++) cin >> x[i];



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



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

        for(int k=0; k<=N; k++){

            for(int s=0; s<=50*50+1; s++){

                if(j>=1 && x[j]>s) dp[j][k][s] = dp[j-1][k][s];

                if(j>=1 && k>=1 && s>=x[j]) dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j]];

            }

        }

    }





    ll ans = 0;

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

        ans += dp[N][k][k*A];

    }

    cout << ans << endl;

}

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

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

    sizeは(int)とキャストしよう

    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？

*/



ll dp[51][51][51*51];



int main(){

    ll N, A; cin >> N >> A;

    vector<ll> x(N+1);

    for(int i=1; i<=N; i++) cin >> x[i];



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

    dp[1][1][x[1]] = 1;



    // 配るdpを書きます

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

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

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

                if(dp[i][j][k] == 0) continue;



                // x_(i+1)は選ばない

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



                // x_(i+1)を選ぶ

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



            }

        }

    }



    ll ans = 0;

    for(int j=1; j<=N; j++) ans += dp[N][j][j*A];

    cout << ans << endl;



}

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

using namespace std;

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

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

typedef long long ll;

typedef pair<int,int> P;



constexpr int s_max = 2600;



int main(){

  int n, a;

  cin >> n >> a;

  vector<int> x(n);

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



  vector<vector<ll>> dp(n + 1, vector<ll>(s_max, 0));



  dp[0][0] = 1;



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

    vector<vector<ll>> ndp(n + 1, vector<ll>(s_max, 0));

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

      for (int k = 0; k < s_max; k++) {

        ndp[j][k] += dp[j][k]; 

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

      }

    }

    swap(ndp, dp); 

  }



  ll res = 0;



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

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

  }



  cout << res - 1 << endl;



  return 0;

} 

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

using namespace std;

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

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

typedef long long ll;

typedef pair<int,int> P;

constexpr int XMAX = 2501;

int main() {

  int n, a;

  cin >> n >> a;

  vector<int> x(n);

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

  vector<vector<ll>> dp(n + 1, vector<ll>(XMAX, 0));

  dp[0][0] = 1;

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

    for (int j = n; j >= 0; j--) {

      for (int k = XMAX - 1; k >= 0; k--) {

        if (j != n && x[i] + k < XMAX) dp[j + 1][k + x[i]] += dp[j][k];

      }

    }

  }

  ll res = 0;

  for (int i = 1; i <= n; i++) res += dp[i][i * a];

  cout << res << endl;

  return 0;

} 

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

#include <algorithm>

#include <climits>

#include <string>

#include <vector>

#include <cmath>

using namespace std;



#define EPS 1e-08



int N, A;

int x[60];

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



int main() {

  cin >> N >> A;

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

    cin >> x[i];

  }

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

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

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

      for (int k=0; k<2600; k++) {

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

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

      }

    }

  }

  long long ans = 0;

  for (int j=1; j<=N; j++) {

    ans += dp[N][j][j*A];

  }

  cout << ans << "\n";

  return 0;

}




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

#include <algorithm>

#include <climits>

#include <string>

#include <vector>

#include <cmath>

using namespace std;



#define EPS 1e-08



int N, A;

int x[60];

long long dp[60][6000];



int main() {

  cin >> N >> A;

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

    cin >> x[i];

  }

  dp[0][2600] = 1;

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

    for (int k=-2600; k<2600; k++) {

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

      dp[i][2600+k+x[i-1]-A] += dp[i-1][2600+k];

    }

  }

  cout << dp[N][2600] - 1 << "\n";

  return 0;

}




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



using namespace std;



const int MAX_N = 55;



long long dp[2][MAX_N*MAX_N][MAX_N],ans;



int main()

{

	int n,a,x;

	cin >> n >> a;

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

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

	{

		cin >> x;

		copy(&dp[1][0][1],&dp[1][n*a][n]+1,

				&dp[0][0][1]);

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

			for (int s=x; s<=n*a; s++)

				dp[0][s][k]+=dp[1][s-x][k-1];

	

//		copy(&dp[1][0][1],&dp[1][n*a][n]+1,&dp[0][0][1]);

//		transform(&dp[0][x][1],&dp[0][n*a][n]+1,&dp[1][0][0],&dp[0][x][1],plus<>());

		swap(dp[0],dp[1]);

	}

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

		ans+=dp[1][a*k][k];

	cout << ans;

	return 0;

}

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



using namespace std;

typedef long long ll;



const int MAX_N = 55;



int n,a,x;

ll dp[MAX_N*MAX_N][MAX_N];



int main()

{

	cin >> n >> a;

	dp[0][0]=1;

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

	{

		cin >> x;

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

			for (int s=x; s<=n*a; s++)

				dp[s][k]+=dp[s-x][k-1];

	}

	ll ans=0;

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

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

	cout << ans;

	return 0;

}

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



using namespace std;



const int MAX_N = 55;



long long dp[2][MAX_N*MAX_N][MAX_N],ans;



int main()

{

	int n,a,x;

	cin >> n >> a;

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

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

	{

		cin >> x;

		copy(&dp[1][0][1],&dp[1][n*a][n]+1,&dp[0][0][1]);

		transform(&dp[0][x][1],&dp[0][n*50][n]+1,&dp[1][0][0],&dp[0][x][1],plus<>());

		swap(dp[0],dp[1]);

	}

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

		ans+=dp[1][a*k][k];

	cout << ans;

	return 0;

}

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



using namespace std;

typedef long long ll;



const int MAX_N = 55;



int n,a,x;

ll dp[MAX_N*MAX_N][MAX_N];



int main()

{

	cin >> n >> a;

	dp[0][0]=1;

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

	{

		cin >> x;

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

			for (int s=x; s<=n*a; s++)

				dp[s][k]+=dp[s-x][k-1];

	}

	ll ans=0;

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

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

	cout << ans;

	return 0;

}

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



using namespace std;



long long dp[51][5001],ans;



int main()

{

	int n,a,x;

	cin >> n >> a;

	dp[0][2500]=1;

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

	{

		cin >> x;

		x -= a;

		for (int s=0; s<=5000; s++)

			dp[i][s]=dp[i-1][s]+

				(s-x >=0 && s-x <= 5000 ? dp[i-1][s-x] : 0);

	}

	cout << dp[n][2500]-1;

	return 0;

}

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

 

using namespace std;

 

long long dp[5001];

 

int main()

{

	int n,a,x;

	cin >> n >> a;

	dp[2500]=1;

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

	{

		cin >> x;

		x -= a;

		if (x > 0)

			for (int s=5000; s>=x; s--)

				dp[s]+=dp[s-x];

		else

			for (int s=0; s-x<=5000; s++)

				dp[s]+=dp[s-x];

	}

	cout << dp[2500]-1;

	return 0;

}

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



using namespace std;



long long dp[3000][51];



int main () {



    ios_base::sync_with_stdio(false);

    cin.tie(nullptr); cout.tie(nullptr);



    int N, A; cin >> N >> A;

    vector<int> a(N);

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

        cin >> a[i];

    vector<int> p(N);

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

        p[i] = A * (i + 1);

    long long ans = 0;

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

        memset(dp, 0, sizeof(dp));

        dp[0][0] = 1;

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

            for (int k = p[i]; k >= 0; --k) {

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

                    if (k - a[j] + 1 > 0)

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

                }

            }

        }ans += dp[p[i]][i+1];

    }cout << ans << '\n';



    return 0;

}




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

 

using namespace std;

 

long long dp[3000][51];

 

int main () {

 

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr); cout.tie(nullptr);

 

    int N, A; cin >> N >> A;

    vector<int> a(N);

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

        cin >> a[i];

    vector<int> p(N);

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

        p[i] = A * (i + 1);

    long long ans = 0;

    memset(dp, 0, sizeof(dp));

    dp[0][0] = 1;

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

        for (int k = N*A; k >= 0; --k) 

            for (int z = 1; z < N + 1; ++z) 

                if (k - a[j] + 1 > 0)

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

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

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

    cout << ans << '\n';

 

    return 0;

}


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

#include <vector>

#include <string>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;



int64_t dp[51][51][2501];



int main() {

    int n, a;

    cin >> n >> a;



    int x[50];

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

        cin >> x[i];

    }



    // 最初のi枚のうちj枚を使ってkを作る通り数

    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++) {

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

                if (k - x[i - 1] >= 0) dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];

            }

        }

    }



    int64_t r = 0;

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

        r += dp[n][j][j * a];

    }

    cout << r << endl;



    return 0;

}

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

#include <vector>

#include <string>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;



int64_t dp[51][51][2501];



int main() {

    int n, a;

    cin >> n >> a;



    int x[50];

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

        cin >> x[i];

    }



    // 最初のi枚のうちj枚を使ってkを作る通り数

    int s = 0;

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

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

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

            for (int k = 0; k <= s; k++) {

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

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

            }

        }

        s += x[i];

    }



    int64_t r = 0;

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

        r += dp[n][j][j * a];

    }

    cout << r << endl;



    return 0;

}

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

using namespace std;

long long dp[52][2501],n,a,sum,s;

int main()

{

	cin>>n>>a;

	dp[0][0]=1;

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

	{

		cin>>s;

		for(int k=n-1;k>=0;k--)

			for(int l=2500-s;l>=0;l--) 

			     dp[k+1][l+s]+=dp[k][l];

	}

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

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

			sum+=dp[i][j]*(j==i*a);

	cout<<sum<<endl;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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

#include<iostream>

#define ll long long

using namespace std;

int n,p,a[51];

ll f[51][51][2501],ans;

int main(){

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

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

	f[0][0][0]=1;

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

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

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

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

				if (j>=1&&k>=a[i])

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

			}

		}

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

		ans+=f[n][i][i*p];

	printf("%lld",ans);

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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

using namespace std;

int n, A, a[51];

long long f[2][51][2510];

int main() {

	cin >> n >> A;

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

	f[0][0][0] = 1;

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

		memset(f[i & 1], 0, sizeof(f[i & 1]));

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

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

				f[i & 1][j][k] = ((k - a[i] >= 0 && j > 0) ? f[i & 1 ^ 1][j - 1][k - a[i]] : 0) + f[(i & 1) ^ 1][j][k];

			}

		}

	}

	long long ans = 0;

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

		ans += f[n & 1][i][i * A];

	}

	cout << ans << endl;

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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



using namespace std ; 



int n , ar , a[ 60 ] ;

long long f[ 60 ][ 60 ][ 2510 ] ;

//选到i，选了j个，sum为k 



int main() {

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

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

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

	}

	

	f[ 0 ][ 0 ][ 0 ] = 1 ;

	

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

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

			for( int k = ar * n + 1 ; k >= 0 ; k -- ) {

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

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

			}

		}

	}

	long long ans = 0 ;

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

		ans += f[ n ][ i ][ ar * i ] ;

	}

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

} 

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

}




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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

//	freopen(".out","w",stdout);

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

}

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



using namespace std;



typedef long long ll;



ll n, A, a[51], dp[55][55][2700]{};



int main() {

	

	cin >> n >> A;

	for (int i = 0; i < n; i++)cin >> a[i];

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

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

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

			for (int k = 0; k <= 2600; k++) {

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

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

			}

		}

	}

	ll ans = 0;

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

		for (int j = 1; j <= 2700; j++) {

			if (j%i == 0 && j / i == A)ans += dp[n][i][j];

		}

	}

	cout << ans << endl;

	return 0;

}

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

using namespace std;

typedef long long ll;



int main() {

    int n, a;

    cin >> n >> a;

    vector<int> x(n);

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

        cin >> x[i];

        x[i] -= a;

    }

    vector<map<int,ll> > dp(n+1);

    dp[0][0] = 1;

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

        for(auto p : dp[i]){

            dp[i+1][p.first+x[i]] += p.second;

            dp[i+1][p.first] += p.second;

        }

    }

    cout << dp[n][0]-1 << endl;

    return 0;

}


// Fastest known solution for this problem: