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

}

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

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

}


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

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

}

/*

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

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

*/


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

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

#include <cstring>

#include <cstdlib>

#include <queue>

#include <cmath>

#include <iostream>

#include <algorithm>

#define mt(a) memset(a,0,sizeof(a))

#define ll long long

using namespace std;

int main(void)

{

	int n,c,k;

	int p[200005];

	mt(p);

	cin>>n>>c>>k;

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

		cin>>p[i];

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

	ll ans = 1;

	int t = 1;

	int sum = 1;

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

	{

		if(p[i]<=p[t]+k&&sum<c)

		{

			sum++;

		}

		else

		{

			sum = 1;

			ans++;

			t = i;

		}		

	}

	cout<<ans<<endl;

	return 0;

}

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

#include<algorithm>

using namespace std;



int Time[100005];



int main(){

    int N, C, K, ans = 0;

    cin >> N >> C >> K;

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

        cin >> Time[i] ;

    }

    sort(Time + 1, Time + N + 1);

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

        ans++;

        int temp = i;

        for(int j=temp+1; j<=temp+C-1; j++){

            if(j > N) break;

            if(Time[j] <= Time[temp]+K){

                i++;

            }

        }

    }

    cout << ans << endl;

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

#include <cstring>

#include <cstdlib>

#include <queue>

#include <cmath>

#include <iostream>

#include <algorithm>

#define mt(a) memset(a,0,sizeof(a))

#define ll long long

using namespace std;

int main(void)

{

	int n,c,k;

	int p[200005];

	mt(p);

	cin>>n>>c>>k;

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

		cin>>p[i];

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

	ll ans = 1;

	int t = 1;

	int sum = 1;

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

	{

		if(p[i]<=p[t]+k&&sum<c)

		{

			sum++;

		}

		else

		{

			sum = 1;

			ans++;

			t = i;

		}		

	}

	cout<<ans<<endl;

	return 0;

}

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

#include <algorithm>

#include <cstring>

#define ll long long

using namespace std;



ll arr [100005];

int main() {

  int n; ll c, k;

  cin >> n >> c >> k;



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

    cin >> arr[i];

  }

  

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



  ll ans = 1;

  ll track = 0;

  ll org = 0;

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

    ll a = arr[i];

    ll b = arr[i-1];

    

    if (track == 0){

      track++;

      org = a;

    }

    else{

      if (track+1 <= c && a-org <= k){

        track++;

      }

      else{

        ans++;

        track = 1;

        org = a;

      }



    }



  }   



  cout << ans << endl;

  return 0;

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

}

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



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

} 

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

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

}




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

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

}

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

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

}

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

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

}

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



using namespace std;



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



int main()

{

	int n,a,x;

	cin >> n >> a;

	dp[n][0]=1;

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

	{

		cin >> x;

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

	}

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

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

	cout << ans;

	return 0;

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

}

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



using namespace std;



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



int main()

{

	int n,a,x;

	cin >> n >> a;

	dp[n][0]=1;

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

	{

		cin >> x;

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

	}

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

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

	cout << ans;

	return 0;

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

}

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

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

}

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

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

}

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

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

}

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

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

}

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

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

}




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

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

}

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

}