criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long dp[60][60][2600];
 
int main() {
  long long N,A;
  cin >> N >> A;
  vector<long long> x(N+10);
  for(int i=1;i<=N;i++)cin >> x[i];
  dp[0][0][0]=1;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=i;j++){
      for(int k=1;k<=N*A;k++){
        dp[i][j-1][k]=dp[i-1][j-1][k];
        if(i>j && j>=x[i]){dp[i][j][k]=dp[i-1][j-1][k]+dp[i-1][j-1][k-x[i]];}
      }
    }
  }
  long long cnt=0;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=i;j++){
      for(int k=1;k<=N*A;k++){
        if(j*A==dp[i][j][k]){cnt+=dp[i][j][k];}
      }
    }
  }
  cout << cnt << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:27:23: error: expected '}' at end of input
   27 |   cout << cnt << endl;
      |                       ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int n,a;
int x[50];
int sum = 0;
priority_queue<int> p;
int cnt = 0;
void dfs(int num, int sum){
    if(num == n) return;
    if(sum + x[num] == a) cnt++;
    dfs(num+1,sum+x[i]);
    dfs(num+1,sum);
    return;
}
int main(){
    cin >> n >> a;
    for(int i = 0; i < n; i++) {
        cin >> x[i];
        x[i] -= a;
    }
    sort(x,x+n);
    dfs(0,0);
    cout << cnt << endl;
}

 

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:23:21: error: 'i' was not declared in this scope
   23 |     dfs(num+1,sum+x[i]);
      |                     ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
  long long N, D;
  cin >> N >> D;
  vector<long long> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] -= D;
  }
  vector<map<long long, long long>> dp(N + 1);
  dp[0][0] = 1;
  for(int i = 0; i < N; i++) {
    for(auto e : dp[i]) {
      long long j = e.first;
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j + A[i]] += dp[i][j];
    }
  }
  cout << dp[N][0] - 1 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'map' was not declared in this scope
   14 |   vector<map<long long, long long>> dp(N + 1);
      |          ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include <vector>
  +++ |+#include <map>
    3 | 
a.cc:14:34: error: template argument 1 is invalid
   14 |   vector<map<long long, long long>> dp(N + 1);
      |                                  ^~
a.cc:14:34: error: template argument 2 is invalid
a.cc:15:5: error: invalid types 'int[int]' for array subscript
   15 |   dp[0][0] = 1;
      |     ^
a.cc:17:20: error: invalid types 'int[int]' for array subscript
   17 |     for(auto e : dp[i]) {
      |                    ^
a.cc:19:9: error: invalid types 'int[int]' for array subscript
   19 |       dp[i + 1][j] += dp[i][j];
      |         ^
a.cc:19:25: error: invalid types 'int[int]' for array subscript
   19 |       dp[i + 1][j] += dp[i][j];
      |                         ^
a.cc:20:9: error: invalid types 'int[int]' for array subscript
   20 |       dp[i + 1][j + A[i]] += dp[i][j];
      |         ^
a.cc:20:32: error: invalid types 'int[int]' for array subscript
   20 |       dp[i + 1][j + A[i]] += dp[i][j];
      |                                ^
a.cc:23:13: error: invalid types 'int[long long int]' for array subscript
   23 |   cout << dp[N][0] - 1 << endl;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,A;
  cin >> N >> A;
  vector<int> x(N);
  for(int i=0;i<N;i++)cin >> x[i];
  for(int i=0;i<N;i++)x[i]-=A;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:31: error: expected '}' at end of input
    9 |   for(int i=0;i<N;i++)x[i]-=A;
      |                               ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    long long n,a,c=0;
    cin >> n >> a;
    vector<long long>x(n);
    for(long long i=0;i<n;i++){
        cin>>x[i];
    }
    sort(x.begin(),x.end());
    long long max=max(x[n-1],a);
    long long dp[50+10][50+10][2500+10];
    memset(dp,0,sizeof(dp));
    dp[0][0][0]=1;
    for(long long j=1;j<=n;j++){
        for(long long k=0;k<=n;k++){
            for(long long s=0;s<=n*max;s++){
                if(s<x[j-1])dp[j][k][s]+=dp[j-1][k][s];
                else if(k>=1&&s>=x[j-1])dp[j][k][s]+=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]];
                else dp[j][k][s]=0;
            }
        }
    }
    for(long long j=1;j<=n;j++){
        c+=dp[n][j][a*j];
    }
    cout<<c;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'max' cannot be used as a function
   20 |     long long max=max(x[n-1],a);
      |                   ~~~^~~~~~~~~~
Language: C++


    cin >> n >> a;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    dp[0][0][0] = 1;
    rep(i, n)rep(k, i+1)rep(j, 2501){
        if(dp[i][k][j] > 0){
            dp[i+1][k+1][j+x[i]] += dp[i][k][j];
            dp[i+1][k][j] += dp[i][k][j];
        }
    }
    LL ans = 0;
    rep1(i, n+1){
        rep(j, 2501){
            if(j%i == 0 && j/i == a)
            {
                ans += dp[n][i][j];
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc:2:5: error: 'cin' does not name a type
    2 |     cin >> n >> a;
      |     ^~~
a.cc:3:5: error: 'vector' does not name a type
    3 |     vector<int> x(n);
      |     ^~~~~~
a.cc:4:8: error: expected constructor, destructor, or type conversion before '(' token
    4 |     rep(i, n) cin >> x[i];
      |        ^
a.cc:5:5: error: 'dp' does not name a type
    5 |     dp[0][0][0] = 1;
      |     ^~
a.cc:6:8: error: expected constructor, destructor, or type conversion before '(' token
    6 |     rep(i, n)rep(k, i+1)rep(j, 2501){
      |        ^
a.cc:12:5: error: 'LL' does not name a type
   12 |     LL ans = 0;
      |     ^~
a.cc:13:9: error: expected constructor, destructor, or type conversion before '(' token
   13 |     rep1(i, n+1){
      |         ^
a.cc:21:5: error: 'cout' does not name a type
   21 |     cout << ans << endl;
      |     ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>

using namespace std;

long long dp[51][51][2500]; long long n, a, x[50];
int main() {
  cin >> n >> a;
  for (int i = 0; i < n; i++)cin >> x[i];
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 2500; k++) {
	if (dp[i][j][k] == 0)continue;
	dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
	dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++)sum += dp[n][i][a*i];
  cout << sum << endl;
}
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>

using namespace std;

long long dp[51][51][2500]; long long n, a, x[50];
int main() {
  cin >> n >> a;
  for (int i = 0; i < n; i++)cin >> x[i];
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 2500; k++) {
	if (dp[i][j][k] == 0)continue;
	dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
	dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++)sum += dp[n][i][a*i];
  cout << sum << endl;
}


Compiler output:
a.cc:35:11: error: redefinition of 'long long int dp [51][51][2500]'
   35 | long long dp[51][51][2500]; long long n, a, x[50];
      |           ^~
a.cc:9:11: note: 'long long int dp [51][51][2500]' previously declared here
    9 | long long dp[51][51][2500]; long long n, a, x[50];
      |           ^~
a.cc:35:39: error: redefinition of 'long long int n'
   35 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                       ^
a.cc:9:39: note: 'long long int n' previously declared here
    9 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                       ^
a.cc:35:42: error: redefinition of 'long long int a'
   35 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                          ^
a.cc:9:42: note: 'long long int a' previously declared here
    9 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                          ^
a.cc:35:45: error: redefinition of 'long long int x [50]'
   35 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                             ^
a.cc:9:45: note: 'long long int x [50]' previously declared here
    9 | long long dp[51][51][2500]; long long n, a, x[50];
      |                                             ^
a.cc:36:5: error: redefinition of 'int main()'
   36 | int main() {
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main() {
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;
ll dp[51][51][2600] = {0};
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  ll sum,N,A,x[51];
  cin >> N >> A;
  REP(i,N)cin >> x[i+1];
  REP(i,51)REP(j,51)REP(k,2600)dp[i][j][k] = 0;
  dp[0][0][0] = 1;
  
  for(int i=1;i<=N;i++){
    for(int j=0;j<=N;j++){
    for(int k=0;k<2500;k++){
      if(k-x[i] >= 0 && j-1 >= 0)
        dp[i][j][k] = dp[i-1][j-1][k-x[i]] + dp[i-1][j][k];
      else
        dp[i][j][k] = dp[i-1][j][k];
    }
    }
  }
  for(LL j=1;A*j<=2599;j++)
    sum += dp[N][j][A*j];
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:7: error: 'LL' was not declared in this scope; did you mean 'll'?
   43 |   for(LL j=1;A*j<=2599;j++)
      |       ^~
      |       ll
a.cc:43:16: error: 'j' was not declared in this scope
   43 |   for(LL j=1;A*j<=2599;j++)
      |                ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;

typedef uint64_t uint;
typedef int64_t sint;

int main(int argc, char* argv[])
{
	for (;;) {
		uint N, A;
		cin >> N >> A;
		if (cin.fail()) break;

		std::vector<uint> xx;
		for (uint i = 0; i < N; i++) {
			uint x;
			cin >> x;
			xx.push_back(x);
		}

		map<uint, map<uint, uint>> m; // <sum, <div, count>>
		m[0][0] = 1;
		for (uint x : xx) {
			auto old_m = m;
			for (auto& e1 : old_m) {
				for (auto& e2 : e1.second) {
					m[e1.first + x][e2.first + 1] += e2.second;
				}
			}
		}

		uint result = 0;
		for (auto& e1 : m) {
			for (auto& e2 : e1.second) {
				if (e2.first > 0 && e1.first % e2.first == 0 && e1.first / e2.first == A) {
					result += e2.second;
				}
			}
		}

		printf("%I64d\n", result);
	}

	return 0;
}


Compiler output:
a.cc:17:9: error: 'uint64_t' does not name a type
   17 | typedef uint64_t uint;
      |         ^~~~~~~~
a.cc:15:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   14 | #include <assert.h>
  +++ |+#include <cstdint>
   15 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int dp[60][60][3000]; //i番目までの中からj個選んで総和になりうるか
  int N,A;
  cin>>N>>A;
  int x[N+1];
  for(int i=0; i<N; i++){
    cin>>x[i];
  }
  dp[0][0][0]=1;
  for(int i=0; i<N; i++){
    for(int j=0; j<=N; j++){
      for(int k=0; k<=A*N; k++){
        dp[i+1][jA+1][k+x[i]]+=dp[i][j][k];
        dp[i+1][j][k]+=dp[i][j][k];
      }
    }
  }
 	int sum = 0;
	for (int i = 0; i <= N; i++){
      sum += dp[N][i][A*i];
    }
	cout << sum-1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'jA' was not declared in this scope; did you mean 'j'?
   15 |         dp[i+1][jA+1][k+x[i]]+=dp[i][j][k];
      |                 ^~
      |                 j
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#define re register
#define N 55
#define LL long long
using namespace std;
int n,A,a[N];
LL f[N][N][N*N],ans=0;
int main(){
	scanf("%d%d",&n,&A);
	for(re int i=1;i<=n;++i) scanf("%d",&a[i]);
	memset(f,0,sizeof(f)); f[0][0][0]=1ll;
	for(re int i=0;i<=n;++i){
		for(re int j=0;j<=i;++j){
			for(re int k=0;k<=2500;++k){
				if(f[i][j][k]){
					f[i+1][j+1][k+a[i+1]]+=f[i][j][k];
					f[i+1][j][k]+=f[i][j][k];
				}
			}
		}
	}
	for(re int i=1;i<=n;++i) if(f[n][i][i*A]) ans+=f[n][i][i*A];
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |         for(re int i=1;i<=n;++i) scanf("%d",&a[i]);
      |                    ^
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(f,0,sizeof(f)); f[0][0][0]=1ll;
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<cstdlib>
  +++ |+#include <cstring>
    4 | #define re register
a.cc:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |         for(re int i=0;i<=n;++i){
      |                    ^
a.cc:15:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |                 for(re int j=0;j<=i;++j){
      |                            ^
a.cc:16:36: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   16 |                         for(re int k=0;k<=2500;++k){
      |                                    ^
a.cc:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |         for(re int i=1;i<=n;++i) if(f[n][i][i*A]) ans+=f[n][i][i*A];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N,A,K,x[210000000];
int f[210000000],a[210000000];
int ans=0;
void dfs(int dep)
{
	if(dep==K+1)
	{
		int sum=0;
		for(int i=1;i<=K;i++)
		{
			sum+=x[a[i]];
		}
		if(sum==K*A)
		{
			ans++;
		}
	}
	else
	{
		for(int i=1;i<=N;i++)
		{
			if(f[i]==0&&a[dep-1]<i)
			{
				f[i]=1;
				a[dep]=i;
				dfs(dep++);
				f[i]=0;
			}
		}
	}
}
int main()
{
	cin>>N>>A;
	for(int i=1;i<=N;i++)
	{
		cin>>x[i]; 
	}
	for(int i=1;i<=N;i++)
	{
		K=i;
		dfs(1);
	}
	cout<<ans<<endl;
}

Compiler output:
/tmp/ccP6qeX0.o: in function `dfs(int)':
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
a.cc:(.text+0x89): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
/tmp/ccP6qeX0.o: in function `main':
a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccP6qeX0.o
collect2: error: ld returned 1 exit status
Language: C++

//
// Created by 童正阳 on 2018/9/14.
// https://abc044.contest.atcoder.jp/tasks/arc060_a
// 动态规划：dp[i][j]表示选i个数和为j的方法数
// 那么有：dp[i][j]=\sum{dp[i-1][j-a[k]], 1<=k<=N}
// 最终结果为：\sum{dp[i][i*A]}
//
#include <iostream>
using namespace std;
typedef long long ll;
int N, A, x[51], sum[51];
ll dp[51][2501];
int main() {
    cin >> N >> A;
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
        sum[i] = sum[i-1] + x[i];
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int k = 1; k <= N; k++) {
        for (int i = k; i >= 1; i--) {
            for (int j = sum[k]; j >= x[k]; j--) {
                dp[i][j] += dp[i-1][j-x[k]];
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += dp[i][i*A];
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
   15 |     memset(sum, 0, sizeof(sum));
      |     ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <iostream>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
int main(){
    long long n,a;
    cin >> n >> a;
    long long x[n];
    for (int i=0; i<n; i++){
        cin >> x[i];
        x[i]-=a;
    }
    if (n>=17){
        long long dp[n][100*n+1]={{0,0}};
        dp[0][x[0]+50*n]=1;
        dp[0][50*n]+=1;
        for (int i=1; i<n; i++){
            for (int j=0; j<=100*n; j++){
                if (j>=x[i] && j-x[i]<=100*n){
                    dp[i][j]=dp[i-1][j]+dp[i-1][j-x[i]];
                }
                else{
                    dp[i][j]=dp[i-1][j];
                }
                
            }
            
        }
        cout << dp[n-1][50*n]-1<<endl;
    }
    else {
        for (int i=1; i< (1<<n); i++){
            int sum=0;
            for (int j=0; j<n; j++){
                if (i>>j & 1){
                    sum+=x[j];
                }
            }
            if (sum==0){
                ans++;
            }
        }
        cout << ans <<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |                 ans++;
      |                 ^~~
      |                 abs
a.cc:41:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |         cout << ans <<endl;
      |                 ^~~
      |                 abs
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Abc044c2 {

	public static void main(String args[]) {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a = scanner.nextInt();
		List<Integer> x = new ArrayList<>();

		for (int i = 0; i < n; i++) {
			int tmp = scanner.nextInt();
			x.add(tmp - a);
		}
		
		HashMap<Integer,Long> mapa=new HashMap<Integer,Long>();
		HashMap<Integer,Long> mapb=new HashMap<Integer,Long>();
		
		mapa.put(0,1L);
		mapb.put(0, 1L);

		
		for (Integer num : x) {
			for (Entry<Integer, Long> entry : mapb.entrySet()) {
				int sum = entry.getKey() + num;
				long way = entry.getValue();
				if(mapa.containsKey(sum)){
					mapa.put(sum, mapa.get(sum) + way);
				}else{
					mapa.put(sum, way);
				}
			}
			mapb.clear();
			mapb.putAll(mapa);
		}
		System.out.println(mapb.get(0)-1);
	}
}


Compiler output:
Main.java:7: error: class Abc044c2 is public, should be declared in a file named Abc044c2.java
public class Abc044c2 {
       ^
1 error
Language: C++

    #include <iostream>
    #include <stdio.h>
    #include <string>
    #include <math.h>
    #include<algorithm>
    #include <numeric>
    using namespace std;
     
    int main(){
      int N ,A;
      cin >> N >>A;
      int x[N];
      for(int i=1;i<N+1;i++){
       cin >> x[i]; 
      }
      long long dp[51][2501][51]={};
      dp[0][0][0]=1;
      for(int i=1;i<N+1;i++){
       for(int j=0;j<K;j++){
         for(int k=0;k<N+1;k++){
           if(k<1 || j<x[i]){
            dp[i][j][k]=dp[i-1][j][k]; 
           }else{
             dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-x[i]][k-1];
           }
         }
       }
      }
      long long ans=0;
      for(int i=1; i<=N; i++){
    ans+=dp[N][i*A][i];
  }
      cout << ans << endl;
      return 0;}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:22: error: 'K' was not declared in this scope
   19 |        for(int j=0;j<K;j++){
      |                      ^
Language: C++

from itertools import product

N, A = map(int, input().split())
x = [int(xi) for xi in input().split()]
x_max = max(max(x), A)

dp = [[[0 for _ in range((N + 1) * x_max)]
      for _ in range(N + 1)]
      for _ in range(N + 1)]

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

for j, k, s in product(range(1, N + 1),
                       range(N + 1),
                       range((N + 1) * x_max)):
    if s < x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s]
    elif k >= 1 and s >= x[j - 1]:
        dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]

answer = sum([dp[N][k][k*A] for k in range(1, N + 1)])
print(answer)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from itertools import product
      | ^~~~
Language: C++

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

using namespace std;

// 今,選んだ枚数,合計
long long dp[][51][2501];

int main()
{
	int n, a, x[50];
	cin >> n >> a;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	dp[0][0][0] = 1;
	dp[0][1][x[0]] = 1;
	for (int i = 1; i < n; i++)
		for (int j = 0; j < n + 1; j++)
			for (int k = 0; k < 251; k++)
				dp[i][j][k] = dp[i - 1][j][k] + (j == 0 || k - x[i] < 0 ? 0 : dp[i - 1][j - 1][k - x[i]]);
	long long ans = 0;
	for (int i = 1; i < n + 1; i++)
		ans += dp[n - 1][i][i * a];
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:7:11: error: storage size of 'dp' isn't known
    7 | long long dp[][51][2501];
      |           ^~
Language: C++

#!/usr/bin/env python
N, A = map(int, raw_input().split())
x = map(int, raw_input().split())

DP =[[0 for i in range(N * 50 + 1)] for j in range(N + 1)]

DP[0][0] = 1

for i in range(N):
	for j in range(N, 0, -1):
		for k in range(x[i], N * 50 + 1):
			DP[j][k] += DP[j - 1][k - x[i]]

ans = 0
for i in range(1, N + 1):
	ans += DP[i][i * A]

print ans

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:2:1: error: 'N' does not name a type
    2 | N, A = map(int, raw_input().split())
      | ^
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
#define Vi vector<int>
#define ll long long
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i=0;i<n;++i)
int main()
{	
  	int n,a;
  	cin>>n>>a;
  	vector<ll>x(n);
  	vector<ll>y(n);
  	rep(i,n){
  		cin>>x[i];
  		y[i]=x[i]-a;
  	}
  	Sort(x);
  	ll X=x[x.size()-1];
  	vector<vector<ll>> dp(n+2,vector<ll>(2*n*X+5));
  	rep(i,n+2){
  		rep(j,2*n*X+5){
  			dp[i][j]=0;
  		}
  	}
  	rep(j,n){
  		rep(t,2*n*X+5){
  			if(j==0||t==n*X){dp[j][t]=1;}
  			else if(j>=1){
  			  	if(t-y[j]<0||t-y[j]>2*n*x){
  					dp[j][t]=dp[j-1][t];
  				}	
  				else{dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j]];}
  			}
  			else {dp[j][t]=0;}
  		}
  	}
  	cout<<dp[n][n*x]-1<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:56: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
   34 |                                 if(t-y[j]<0||t-y[j]>2*n*x){
      |                                                     ~~~^~
      |                                                      |  |
      |                                                      |  std::vector<long long int>
      |                                                      int
a.cc:42:22: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
   42 |         cout<<dp[n][n*x]-1<<endl;
      |                     ~^~
      |                     | |
      |                     | std::vector<long long int>
      |                     int
Language: C++

#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <iostream>
using namespace std;
#define Vi vector<int>
#define ll long long
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i=0;i<n;++i)
int main()
{	
  	int N,a;
  	cin>>N>>a;
  	vector<ll>x(n);
  	vector<ll>y(n);
  	rep(i,n){
  		cin>>x[i];
  		y[i]=x[i]-a;
  	}
  	Sort(x);
  	ll X=x[x.size()-1];
  	vector<vector<ll>> dp(n+2,vector<ll>(2*n*X+5));
  	rep(i,n+2){
  		rep(j,2*n*X+5){
  			dp[i][j]=0;
  		}
  	}
  	rep(j,n){
  		rep(t,2*n*X+5){
  			if(j==0||t==n*X){dp[j][t]=1;}
  			else if(j>=1){
  			  	if(t-y[j]<0||t-y[j]>2*N*x)){
  					dp[j][t]=dp[j-1][t];
  				}	
  				else{dp[j][t]=dp[j-1][t]+dp[j-1][t-y[j]];}
  			}
  			else {dp[j][t]=0;}
  		}
  	}
  	cout<<dp[n][n*x]-1<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: 'n' was not declared in this scope
   16 |         vector<ll>x(n);
      |                     ^
a.cc:34:56: error: no match for 'operator*' (operand types are 'int' and 'std::vector<long long int>')
   34 |                                 if(t-y[j]<0||t-y[j]>2*N*x)){
      |                                                     ~~~^~
      |                                                      |  |
      |                                                      |  std::vector<long long int>
      |                                                      int
a.cc:34:59: error: expected primary-expression before ')' token
   34 |                                 if(t-y[j]<0||t-y[j]>2*N*x)){
      |                                                           ^
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll __int64
#define P pair<ll,ll>
//#define __int64 long long

int n,a;
int x[100];
ll dp[51][5100];
const int Z=2500;
const int M=100;
int main(){	
	cin>>n>>a;
	rep(i,n)cin>>x[i];
	rep(i,n)x[i]-=a;

	//rep(i,M)rep(j,M)dp[i][j]=-1;
	dp[0][Z]=1;

	rep(i,n){
		for(int j=-Z;j<=Z;j++){
				dp[i+1][j+x[i]+Z]+=dp[i][j+Z];
				dp[i+1][j+Z]+=dp[i][j+Z];
		}
	}

	cout<<dp[n][Z]-1<<endl;
	return 0;
}


Compiler output:
a.cc:17:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
   23 | ll dp[51][5100];
      | ^~
a.cc: In function 'int main()':
a.cc:32:9: error: 'dp' was not declared in this scope; did you mean 'mp'?
   32 |         dp[0][Z]=1;
      |         ^~
      |         mp
Language: C++

#include <iostream>

using namespace std;

int main() {
    int n, a;

    cin >> n >> a;

    int x[60];

    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }

    long long dp[60][60][2510] = {0};

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

    for (int j = 0; j <= n; ++j) {
        for (int k = 0; k <= n; ++k) {
            for (int s = 0; s <= n*a; ++s) {
                if (k >= 1 && x[j] <= s) {
                    d[j+1][k][s] = d[j][k][s] + d[j][k-1][s-x[j]];
                } else {
                    d[j+1][k][s] = d[j][k][s];
                }
            }
        }
    }

    long long result = 0;

    for (int k = 1; k <= n; ++k) {
        result += dp[n][k][k*a];
    }

    cout << result << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: 'd' was not declared in this scope
   24 |                     d[j+1][k][s] = d[j][k][s] + d[j][k-1][s-x[j]];
      |                     ^
a.cc:26:21: error: 'd' was not declared in this scope
   26 |                     d[j+1][k][s] = d[j][k][s];
      |                     ^
Language: C++

#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
	int n, A;
	cin >> n >> A;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= 2500; k++) {
				if (a[j] <= k && j >= 1) {
					dp[i + 1][j][k] = dp[i][j][k] + dp[i][j - 1][k - a[j]];
				} else {
					dp[i + 1][j][k] = dp[i][j][k];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		ans += dp[n][j][j * A];
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: 'j' was not declared in this scope
   29 |                 ans += dp[n][j][j * A];
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
	int n, A;
	cin >> n >> A;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k <= 2500; k++) {
				if (a[j] <= k && j >= 1) {
					a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
				} else {
					a[i + 1][j][k] = a[i][j][k];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		ans += dp[n][j][j * A];
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:49: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                 ^
a.cc:20:62: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                              ^
a.cc:20:75: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                                           ^
a.cc:22:49: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                                 ^
a.cc:22:62: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                                              ^
a.cc:29:30: error: 'j' was not declared in this scope
   29 |                 ans += dp[n][j][j * A];
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
	int n, A;
	cin >> n >> A;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int i = 0; i <= 2500; i++) {
				if (a[j] <= k && j >= 1) {
					a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
				} else {
					a[i + 1][j][k] = a[i][j][k];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		ans += dp[n][j][j * A];
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:45: error: 'k' was not declared in this scope
   19 |                                 if (a[j] <= k && j >= 1) {
      |                                             ^
a.cc:20:49: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                 ^
a.cc:20:62: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                              ^
a.cc:20:75: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                                           ^
a.cc:22:49: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                                 ^
a.cc:22:62: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                                              ^
a.cc:29:30: error: 'j' was not declared in this scope
   29 |                 ans += dp[n][j][j * A];
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dp[60][60][2510];
int main() {
	int n, a;
	cin >> n >> a;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int i = 0; i <= 2500; i++) {
				if (a[j] <= k && j >= 1) {
					a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
				} else {
					a[i + 1][j][k] = a[i][j][k];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		ans += dp[n][j][j * a];
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: conflicting declaration 'int a [n]'
   11 |         int a[n];
      |             ^
a.cc:9:16: note: previous declaration as 'int a'
    9 |         int n, a;
      |                ^
a.cc:13:25: error: invalid types 'int[int]' for array subscript
   13 |                 cin >> a[i];
      |                         ^
a.cc:19:38: error: invalid types 'int[int]' for array subscript
   19 |                                 if (a[j] <= k && j >= 1) {
      |                                      ^
a.cc:19:45: error: 'k' was not declared in this scope
   19 |                                 if (a[j] <= k && j >= 1) {
      |                                             ^
a.cc:20:42: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                          ^
a.cc:20:59: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                           ^
a.cc:20:72: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                                        ^
a.cc:20:88: error: invalid types 'int[int]' for array subscript
   20 |                                         a[i + 1][j][k] = a[i][j][k] + a[i][j - 1][k - a[j]];
      |                                                                                        ^
a.cc:22:42: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                          ^
a.cc:22:59: error: invalid types 'int[int]' for array subscript
   22 |                                         a[i + 1][j][k] = a[i][j][k];
      |                                                           ^
a.cc:29:30: error: 'j' was not declared in this scope
   29 |                 ans += dp[n][j][j * a];
      |                              ^
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//枝刈り・方向意識バージョン（おそらく最速）
//改変前：AC
//今：未完成


int main(void){
	ll N,A,p[51];
	mp M;
	scanf("%lld%lld",&N,&A);
	rep(i,N){
		scanf("%lld",&p[i]);
		p[i]-=A;//合計が０になれば良い
	}
	sort(p,p+N);//小→大
	rep(i,N){
		if(p[i]>0){//方向は正：小から計算。　２
			for (mp::iterator q=M.begin(); q!=M.end();++q) {
				if(q->first+p[i] <= 0)break;
				M[q->first+p[i]]+=q->second;//0到達時点で0より大なら計算不要
			}		
		}else{//方向は負：どっちから計算しても良さそう １
			for (mp::iterator q=M.begin(); q!=M.end();++q) {
				M[q->first+p[i]]+=q->second;
			}	
		}
	    M[p[i]]+=1;
	}
	printf("%lld\n",M[0]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:34: error: 'iterator' is not a member of 'mp' {aka 'std::pair<long long int, long long int>'}
   40 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                  ^~~~~~~~
a.cc:40:56: error: 'q' was not declared in this scope
   40 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                                        ^
a.cc:40:61: error: 'mp' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
   40 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                                             ^~~
a.cc:45:34: error: 'iterator' is not a member of 'mp' {aka 'std::pair<long long int, long long int>'}
   45 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                  ^~~~~~~~
a.cc:45:56: error: 'q' was not declared in this scope
   45 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                                        ^
a.cc:45:61: error: 'mp' {aka 'struct std::pair<long long int, long long int>'} has no member named 'end'
   45 |                         for (mp::iterator q=M.begin(); q!=M.end();++q) {
      |                                                             ^~~
a.cc:49:14: error: no match for 'operator[]' (operand types are 'mp' {aka 'std::pair<long long int, long long int>'} and 'll' {aka 'long long int'})
   49 |             M[p[i]]+=1;
      |              ^
a.cc:51:26: error: no match for 'operator[]' (operand types are 'mp' {aka 'std::pair<long long int, long long int>'} and 'int')
   51 |         printf("%lld\n",M[0]);
      |                          ^
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>

using namespace std;

int main()
{
    int N, A;
    cin >> N >> A;
    cout << N << A << endl;
    int *ary = new int[N + 1];
    for (int i = 1; i <= N; ++i)
    {
        cin >> ary[i];
    }

    long memo[51][51][50 * 50 + 1];
    memset(memo, 0, sizeof(memo));
    memo[0][0][0] = 1;
    cout << 1243 << endl;

    for (int j = 1; j < N + 1; ++j)
    {
        for (int k = 0; k < N + 1; ++k)
        {
            for (int s = 0; s < N * A + 1; ++s)
            {
                if (j >= 1 && s < ary[j])
                    memo[j][k][s] = memo[j - 1][k][s];
                else if (j >= 1 && s >= ary[j] && k >= 1)
                    memo[j][k][s] = memo[j - 1][k][s] + memo[j - 1][k - 1][s - ary[j]];
            }
        }
    }

    long sum = 0;
    for (int i = 1; i < N + 1; ++i)
    {
        sum += memo[N][i][i * A];
    }
    cout << 123 << endl;
    cout << sum << endl;
    delete[] ary;
    cout << 12 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
   19 |     memset(memo, 0, sizeof(memo));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <stdlib.h>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

int main()
{
    int N, A;
    cin >> N >> A;
    cout << N << A << endl;
    int *ary = new int[N + 1];
    for (int i = 1; i <= N; ++i)
    {
        cin >> ary[i];
    }

    long memo[51][51][50 * 50 + 1];
    memset(memo, 0, sizeof(memo));
    memo[0][0][0] = 1;
    cout << 1243 << endl;

    for (int j = 1; j < N + 1; ++j)
    {
        for (int k = 0; k < N + 1; ++k)
        {
            for (int s = 0; s < N * A + 1; ++s)
            {
                if (j >= 1 && s < ary[j])
                    memo[j][k][s] = memo[j - 1][k][s];
                else if (j >= 1 && s >= ary[j] && k >= 1)
                    memo[j][k][s] = memo[j - 1][k][s] + memo[j - 1][k - 1][s - ary[j]];
            }
        }
    }

    long sum = 0;
    for (int i = 1; i < N + 1; ++i)
    {
        sum += memo[N][i][i * A];
    }
    cout << 123 << endl;
    cout << sum << endl;
    delete[] ary;
    cout << 12 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'memset' was not declared in this scope
   19 |     memset(memo, 0, sizeof(memo));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cstdlib>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int dp(int j, int k, int s, int[] X)
{
    if (j == 0 && k == 0 && s == 0)
    {
        return 1;
    }
    else if (j >= 1 && s < X[j])
    {
        return dp(j - 1, k, s);
    }
    else if (j >= 1 && s >= X[j])
    {
        return dp(j - 1, k, s) + dp(j - 1, k - 1, s - X[j]);
    }
    else
    {
        return 0;
    }
}

int main()
{
    int N, A;
    cin >> N >> A;
    int *ary = new int[N];

    for (int i = 0; i < N; ++i)
    {
        cin >> ary[i];
    }
    vector<vector<vector<int>>> memo(N);
    for (int i = 0; i < N; ++i)
    {
        memo[i].resize(N + 1);
        for (int j = 0; j < N + 1; ++j)
        {
            memo[i][j].resize(N * A + 1);
            for (int s = 0; s < N * A + 1; ++s)
            {
                memo[i][j][s] = 0;
            }
        }
    }

    int sum = 0;
    for (int i = 0; i < N + 1; ++i)
    {
        sum += dp(N, i, N * A, ary);
    }
    cout << sum << endl;
    delete[] ary;
    return 0;
}

Compiler output:
a.cc:6:35: error: expected ',' or '...' before 'X'
    6 | int dp(int j, int k, int s, int[] X)
      |                                   ^
a.cc: In function 'int dp(int, int, int, int*)':
a.cc:12:28: error: 'X' was not declared in this scope
   12 |     else if (j >= 1 && s < X[j])
      |                            ^
a.cc:14:18: error: too few arguments to function 'int dp(int, int, int, int*)'
   14 |         return dp(j - 1, k, s);
      |                ~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
    6 | int dp(int j, int k, int s, int[] X)
      |     ^~
a.cc:18:18: error: too few arguments to function 'int dp(int, int, int, int*)'
   18 |         return dp(j - 1, k, s) + dp(j - 1, k - 1, s - X[j]);
      |                ~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
    6 | int dp(int j, int k, int s, int[] X)
      |     ^~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int dp[51][51][2501];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A;
    cin >> N >> A;
    int x[N];
    rep(i, N) cin >> x[i];

    //rep(i, N) cout << x[i] << " ";
    //cout << endl;

    dp[0][0][0] = 1;
    rep(k, N) {
        rep(i, N) {
            rep(j, 2501) {
                dp[k][i+1][j] += dp[k][i][j];
                if (j - x[i] >= 0) dp[k+1][i+1][j] += dp[k][i][j-x[i]];
            }
        }
    }

    ll ans = 0;
    REP(i, 1, N) ans += dp[i][N][A*i];
    REP(i, 1, N) {
        //cout << "dp[" << N << "][" << A*i << "] =" << dp[i][N][A*i] << endl;
    }
    cout << ans << endl;




    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'long long long' is too long for GCC
   12 | #define int long long int
      |             ^~~~
a.cc:3:22: note: in expansion of macro 'int'
    3 | #define ll long long int
      |                      ^~~
a.cc:37:5: note: in expansion of macro 'll'
   37 |     ll ans = 0;
      |     ^~
a.cc:12:18: error: 'long long long' is too long for GCC
   12 | #define int long long int
      |                  ^~~~
a.cc:3:22: note: in expansion of macro 'int'
    3 | #define ll long long int
      |                      ^~~
a.cc:37:5: note: in expansion of macro 'll'
   37 |     ll ans = 0;
      |     ^~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
int dp[51][51][2501];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A;
    cin >> N >> A;
    int x[N];
    rep(i, N) cin >> x[i];

    //rep(i, N) cout << x[i] << " ";
    //cout << endl;

    dp[0][0][0] = 1;
    rep(k, N) {
        rep(i, N) {
            rep(j, 2501) {
                dp[k][i+1][j] += dp[k][i][j];
                if (j - x[i] >= 0) dp[k+1][i+1][j] += dp[k][i][j-x[i]];
            }
        }
    }

    ll ans = 0;
    REP(i, 1, N) ans += dp[i][N][A*i];
    REP(i, 1, N) {
        //cout << "dp[" << N << "][" << A*i << "] =" << dp[i][N][A*i] << endl;
    }
    cout << ans << endl;




    return 0;
}


Compiler output:
a.cc:12:23: error: '::main' must return 'int'
   12 | #define int long long int
      |                       ^~~
a.cc:15:1: note: in expansion of macro 'int'
   15 | int main(void)
      | ^~~
a.cc: In function 'int main()':
a.cc:12:13: error: 'long long long' is too long for GCC
   12 | #define int long long int
      |             ^~~~
a.cc:3:22: note: in expansion of macro 'int'
    3 | #define ll long long int
      |                      ^~~
a.cc:37:5: note: in expansion of macro 'll'
   37 |     ll ans = 0;
      |     ^~
a.cc:12:18: error: 'long long long' is too long for GCC
   12 | #define int long long int
      |                  ^~~~
a.cc:3:22: note: in expansion of macro 'int'
    3 | #define ll long long int
      |                      ^~~
a.cc:37:5: note: in expansion of macro 'll'
   37 |     ll ans = 0;
      |     ^~