criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private static final FastIn in = new FastIn();
	private static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		var sol = new Solver();
		sol.solve();
		out.close();
	}

	private static final class Solver {
		public void solve() {
			var n = in.nextInt(), a = in.nextInt();
			int[] x = new int[n];
			for (int i = 0; i < n; ++i) x[i] = in.nextInt();
			int[][][] dp = new int[n + 1][n + 1][5000];
			dp[0][0][0] = 1;
			for (int i = 0; i < n; ++i) {
				for (int j = 0; j < n; ++j) {
					for (int k = 0; k < 5000; ++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 ans = 0;
			for (int i = 1; i <= n; ++i) ans += dp[n][i][a * i];
			out.println(ans);
		}
	}

	private static final class FastIn {
		private BufferedReader br;
		private StringTokenizer st;
		
		public FastIn() {
			br = new BufferedReader(new InputStreamReader(System.in), 1 << 20);
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


Compiler output:
Main.java:20: error: 'var' is not allowed in a compound declaration
			var n = in.nextInt(), a = in.nextInt();
			^
1 error
Language: C++

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

const int nax = 55;

int main()
{
	using ll = long long;
	int n, a;
	cin >> n >> a;
	vector<int> x(n);
	for(int& i: x) cin >> i;
		
	vector<vector<ll>> dp(nax, vector<ll>(nax*nax));
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++) {
		for(int j = i; j >= 0; j--) {
			for(int k = 0; k < nax*nax; k++) {
				if(k + x[i] < 100) {
					dp[j+1][k+x[i]] += dp[j][k];
				}
			}
		}
	}
	
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += dp[i][i * a];
		deb(i, a, i*a, dp[i][i*a]);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: 'deb' was not declared in this scope
   29 |                 deb(i, a, i*a, dp[i][i*a]);
      |                 ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,a;
    cin>>n>>a;
    int b[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int dp[5000][5000]={0};
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=i-1;j>=0;j--)
        {
            for(int k=0;k<=2500;k++)
            {
                dp[j][k+b[i]]+=dp[j][k];
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=dp[i][a*i];
    }
    cout<<ans;
    return 0;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: invalid types 'int[int]' for array subscript
   13 |         cin>>a[i];
      |               ^
Language: C++

#include<iostream>
using namespace std;

long long dp[51][2560] = {0};
 
int main(){
  int N, A;
  cin >> N >> A;
  
  dp[0][0] = 1
  for (int i = 1; i <= N; i ++){
    int x;
    cin >> x;
    for (int j = i - 1; j >= 0; j --){
      for (int k = 0; k <= 2501; k ++){
        dp[j + 1][k + x] += dp[j][k];
      }
    }
  }
  
  
  long long totalWays = 0;
  for (int i = 1; i <= N; i ++){
    totalWays += dp[i][i * A];
  }
  
  cout << totalsWays << '\n';
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: expected ';' before 'for'
   10 |   dp[0][0] = 1
      |               ^
      |               ;
   11 |   for (int i = 1; i <= N; i ++){
      |   ~~~          
a.cc:11:19: error: 'i' was not declared in this scope
   11 |   for (int i = 1; i <= N; i ++){
      |                   ^
a.cc:27:11: error: 'totalsWays' was not declared in this scope; did you mean 'totalWays'?
   27 |   cout << totalsWays << '\n';
      |           ^~~~~~~~~~
      |           totalWays
Language: C++

#include<iostream>
using namespace std;

long long dp[51][2560] = {0}
 
int main(){
  int N, A;
  cin >> N >> A;
  
  dp[0][0] = 1
  for (int i = 1; i <= N; i ++){
    int x;
    cin >> x;
    for (int j = i - 1; j >= 0; j --){
      for (int k = 0; k <= 2501; k ++){
        dp[j + 1][k + x] += dp[j][k];
      }
    }
  }
  
  
  long long totalWays = 0;
  for (int i = 1; i <= N; i ++){
    totalWays += dp[i][i * A];
  }
  
  cout << totalsWays << '\n';
  
}

Compiler output:
a.cc:6:1: error: expected ',' or ';' before 'int'
    6 | int main(){
      | ^~~
Language: C

#include<iostream>
using namespace std;

void sort(int x[], int N){
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            if(x[j] < x[i]){
                int temp = x[i];
                x[i] = x[j];
                x[j] = temp;
            }
        }
    }
}

long long ways[51][51][2501] = {0};



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

    ways[0][0][0]=1;

    for(int beforePos=1; beforePos<=N; beforePos++){
        for(int chooseNum=beforePos; chooseNum>=0; chooseNum--){
            for(int value=A*N+1; value>=0; value--){
                ways[beforePos][chooseNum][value]+=ways[beforePos-1][chooseNum][value];
                if(value>=x[beforePos-1] && chooseNum>=1){
                    ways[beforePos][chooseNum][value]+=ways[beforePos-1][chooseNum-1][value-x[beforePos-1]];
                }
            }
        }
    }

    long long totalWays=0;

    for(int chooseNum=1; chooseNum<=N; chooseNum++){
        totalWays += ways[N][chooseNum][chooseNum*A];
    }

    cout << totalWays << '\n';
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

using namespace std;

using ll = long long;

int N, A;
int x[111];
ll dp[111][111][5555];

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 <= 5000; k++) {
            // 選ばない
            dp[i+1][j][k] += dp[i][j][k];
            // 選ぶ
            if (k >= x[i]) {
               dp[i+1][j+1][k] += dp[i][j][k-x[i]];
            }
         }
      }
   }

   ll ans = 0;
   for (int j = 1; j <= N; j++) {
      ans += dp[N][j][j*A];
   }
   cout << ans << endl;

   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: 'cin' was not declared in this scope
   10 |    cin >> N >> A;
      |    ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:31:4: error: 'cout' was not declared in this scope
   31 |    cout << ans << endl;
      |    ^~~~
a.cc:31:4: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:19: error: 'endl' was not declared in this scope
   31 |    cout << ans << endl;
      |                   ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

int main() {
  int N,A;
  cin>>N>>A;
  vector<int> x(N);
  rep(i,N) cin>>x[i];
  ll count;
  for(int tmp=0;tmp<(1<<N);tmp++){
    bitset<N> s(tmp);
    
    ll sum;
    ll ans=0;
    rep(i,N){
      count=0;
      sum=0;
      if(s.test(i)){
        sum+=x[i];
        count++;
      }
    }
    if(sum/count==A){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: the value of 'N' is not usable in a constant expression
   17 |     bitset<N> s(tmp);
      |             ^
a.cc:11:7: note: 'int N' is not const
   11 |   int N,A;
      |       ^
a.cc:17:13: note: in template argument for type 'long unsigned int'
   17 |     bitset<N> s(tmp);
      |             ^
a.cc:24:12: error: request for member 'test' in 's', which is of non-class type 'int'
   24 |       if(s.test(i)){
      |            ^~~~
a.cc:33:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

int main() {
  ll N,A;
  cin>>N>>A;
  vector<ll> x(N);
  rep(i,N) cin>>x[i];
  ll count;
  for(ll tmp=0;tmp<(1<<N);tmp++){
    bitset<N> s(tmp);
    
    ll sum;
    ll ans=0;
    rep(i,N){
      count=0;
      sum=0;
      if(s.test(i)){
        sum+=x[i];
        count++;
      }
    }
    if(sum/count==A){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: the value of 'N' is not usable in a constant expression
   17 |     bitset<N> s(tmp);
      |             ^
a.cc:11:6: note: 'll N' is not const
   11 |   ll N,A;
      |      ^
a.cc:17:13: note: in template argument for type 'long unsigned int'
   17 |     bitset<N> s(tmp);
      |             ^
a.cc:24:12: error: request for member 'test' in 's', which is of non-class type 'int'
   24 |       if(s.test(i)){
      |            ^~~~
a.cc:33:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  long long dp[55][3000][55];
  int n,a;
  cin>>n>>a;
  vector<int> x(n);
  for(int i=0;i<n;i++) cin>>x[i];
  
  memset(dp,0,sizeof(dp));
  dp[0][0][0]=1;
  for(int i=0;i<n;i++){
    for(int s=0;s<=n*a;s++){
       for(int k=0;k<=n;k++){
         if(dp[i][s][k]==0) continue;
         dp[i+1][s][k]+=dp[i][s][k];
         dp[i+1][s+x[i]][k+1]+=dp[i][s][k];
       }
    }
  }
  long long res=0;
  for(int k=1;k<=n;k++) res+=dp[n][a*k][k];
  cout<<res<<endl;
  return 0;
}


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

#include<iostream>
using namespace std;
int main(){
  long long dp[55][3000][55];
  int n,a;
  cin>>n>>a;
  vector<int> x(n);
  for(int i=0;i<n;i++) cin>>x[i];
  
  memset(dp,0,sizeof(dp));
  dp[0][0][0]=1;
  for(int i=0;i<n;i++){
    for(int s=0;s<=n*a;s++){
       for(int k=0;k<=n;k++){
         if(dp[i][s][k]==0) continue;
         dp[i+1][s][k]+=dp[i][s][k];
         dp[i+1][s+x[i]][k+1]+=dp[i][s][k];
       }
    }
  }
  long long res=0;
  for(int k=1;k<=n;k++) res+=dp[n][a*k][k];
  cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> x(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> x(n);
      |          ^~~
a.cc:8:29: error: 'x' was not declared in this scope
    8 |   for(int i=0;i<n;i++) cin>>x[i];
      |                             ^
a.cc:10:3: error: 'memset' was not declared in this scope
   10 |   memset(dp,0,sizeof(dp));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:17:20: error: 'x' was not declared in this scope
   17 |          dp[i+1][s+x[i]][k+1]+=dp[i][s][k];
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;
 
int counts = 0;
 
int sum_l(vector<int> li, int size) {
    int sum = 0;
    for (int i = 0; i< size; i++) {
        sum +=li[i];
    }
    return sum;
}
 
void agg(vector<int> car, int avg,int size ){
    if(size>=2) {
        if ( sum(car, size)/size== avg){
            counts+=1;
        }
        vector<int> temp1(size-1); 
        for(int i = 0; i<size-1;i++) {
            temp1.push_back(car[i]);
        }
        agg(temp1, avg, size-1);
        
    }else {
        if (car[0] == avg){
            counts += 1;
        }
    }
}
 
int main(){
    int A, N;
    vector<int> card(A);
 
    cin >> A >> N;
    for(int i=0; i<A;i++) {
        cin >> card[i];
    }
    for (int test = 0; test< A; test++) {
        vector<int> temp(A-test);
        for(int i=0; i<A; i++) {
            temp.push_back(card[i]); 
        }
        agg(temp, N, temp.size());
    }
 
    cout << counts << endl;
 
 
}

Compiler output:
a.cc: In function 'void agg(std::vector<int>, int, int)':
a.cc:19:14: error: 'sum' was not declared in this scope
   19 |         if ( sum(car, size)/size== avg){
      |              ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
#include <list>
#include <deque>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll MOD = 1000000007;
ll INF = 1LL << 60;
#define int long long

int N, A;
vector<int> x;
int dp[55][55][2555]; // dp[インデックス][枚数][合計] = 総数

int rec(int idx, int mai, int sum) {
  // 全部調べ終わる
  if (idx >= N) {
    return ((mai * A) == sum) && (sum != 0);
  }

  // 計算済み
  if (dp[idx][mai][sum] != -1) {
    return dp[idx][mai][sum];
  }

  int ret = 0;

  // index枚目のカードを選ぶ
  int yes = rec(idx + 1, mai + 1, sum + x[idx]);
  // index枚目のカードを選ばない
  int no = rec(idx + 1, mai, sum);

  ret += yes + no;

  return dp[idx][mai][sum] = ret;
}

signed main() {
  cin >> N >> A;
  x.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }

  memset(dp, -1, sizeof(dp));
  int ans = rec(0, 0, 0);

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc:17:1: error: 'll' does not name a type
   17 | ll MOD = 1000000007;
      | ^~
a.cc:18:1: error: 'll' does not name a type
   18 | ll INF = 1LL << 60;
      | ^~
a.cc: In function 'int main()':
a.cc:55:3: error: 'memset' was not declared in this scope
   55 |   memset(dp, -1, sizeof(dp));
      |   ^~~~~~
a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <list>
  +++ |+#include <cstring>
   13 | #include <deque>
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N,A;
  cin>>N>>A;
  vector<int64_t>X(N);
  for(int64_t i=0;i<N;i++){
  int64_t x; cin>>x;
    x-=A;
    X.at(i)=x;
  }vector<vector<int64_t>>dp(N+1,vector<int64_t>(5001,0));
  dp[0][2500]=1;
  for(int64_t i=1;i<=N;i++){
    for(int64_t j=2500-50*i; j<=2500+50*i;j++)
      dp[i][j]=dp[i-1][j]+dp[i-1][j-X.at(i-1)]
  }cout<<dp[N][2500]<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:47: error: expected ';' before '}' token
   15 |       dp[i][j]=dp[i-1][j]+dp[i-1][j-X.at(i-1)]
      |                                               ^
      |                                               ;
   16 |   }cout<<dp[N][2500]<<endl;
      |   ~
Language: C++

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n,a;
    cin >> n >> a;
    int x[n];
    REP(i,n)cin >> x[i];
    ll count = 0;
    COUT(1<<n);
    for(int bit=1;bit<(1<<n);bit++){
        int ans = 0;
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                ans += x[i];
            }
        }
        double num = __builtin_popcount(bit);
        if((ans/num)==a)count++;
    }
    COUT(count);
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: expected '}' at end of input
   33 |     return 0;
      |              ^
a.cc:15:11: note: to match this '{'
   15 | int main(){
      |           ^
Language: C++

n,a=map(int,input().split())
x=list(map(int,input().split()))

xsum=max(max(x),a)*n
dp=[[[0]*(xsum+1) for i in range(n+1)] for ii in range(n+1)]

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

for j in range(1,n+1):
    for k in range(0,n+1):    
        for s in range(0,xsum+1):    
            if s<x[j-1] :
                dp[j][k][s]=dp[j-1][k][s]
            elif s>=x[j-1] and k>=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
dsum=0
for k in range(1,n+1):
    dsum=dsum+dp[n][k][k*a]
print(dsum)
    

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,a=map(int,input().split())
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

int64_t test(int N, int A, int X[]);
int main(void) {
    char *p;
    char str[256];

    int *X;
    int N,A;
    int i,cnt=0;

    p = fgets(str, 256, stdin);
    for(i=0;i<256;i++){
        if(str[i] == ' ') {
            str[i] = '\0';
            N = atoi(p);
            A = atoi(&str[i+1]);
            break;
        }
    }
    
    X = malloc(sizeof(int) * N);
    p = fgets(str, 256, stdin);
    for(i=0;i<256;i++){
        if(str[i] == ' '){
            str[i] = '\0';
            X[cnt++] = atoi(p);
            p = &str[i+1];
        }else if(str[i] < '0' || str[i] > '9') {
            break;
        }
    }
    X[cnt] = atoi(p);
    
    printf("%ld\n", test(N,A,X));
    free(X);

    return 0;
}

int64_t test(int N, int A, int X[]) {
    int j,t;
    int64_t **dp;
    int64_t sum = 0;
    int tmax;
    int Xm = A;


    int *Y = malloc(sizeof(int) * N);
    for(j=0;j<N;j++){
        Y[j] = X[j] - A;
        if(Xm < X[j]) Xm = X[j];
    }
    tmax = 2 * N * Xm;
    dp = calloc(1,sizeof(int64_t*) * (N+1) + (sizeof(int64_t) * ((2 * (N+1)*Xm*(N+1)) + 1)));
    for(j=0;j<=N;j++){
        dp[j] = (int64_t*)(((char*)dp) + (sizeof(int64_t*)*(N+1)) + (sizeof(int64_t) * j *(N+1)* 2 * Xm));
    }

    dp[0][N * Xm] = 1;
    for(j=1;j<=N;j++){
        for(t=0;t<=tmax;t++){
            if((t-Y[j-1] < 0) || ((t-Y[j-1]) > tmax)){
                dp[j][t] = dp[j-1][t];
            } else if((0 <= (t-Y[j-1])) && ((t-Y[j-1]) <= tmax)){
                dp[j][t] = dp[j-1][t] + dp[j-1][t-Y[j-1]];
            }
        }
    }
    
    sum = dp[N][N*Xm] - 1;
    free(Y);
    free(dp);
    return sum;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   25 |     X = malloc(sizeof(int) * N);
      |         ~~~~~~^~~~~~~~~~~~~~~~~
      |               |
      |               void*
a.cc: In function 'int64_t test(int, int, int*)':
a.cc:52:20: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   52 |     int *Y = malloc(sizeof(int) * N);
      |              ~~~~~~^~~~~~~~~~~~~~~~~
      |                    |
      |                    void*
a.cc:58:16: error: invalid conversion from 'void*' to 'int64_t**' {aka 'long int**'} [-fpermissive]
   58 |     dp = calloc(1,sizeof(int64_t*) * (N+1) + (sizeof(int64_t) * ((2 * (N+1)*Xm*(N+1)) + 1)));
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,a;
  cin>>n>>a;
  a*=n;
  vector<vvll> dp(n+1,vvll(n+1,vll(a+1)));
  dp[0][0][0]=1;
  rep(i,n){
    rep(j,n){
      for(int u=0;u<=a;u++){
        dp[i+1][j][u]=dp[i][j][u];
        if(x[i]<=u) dp[i+1][j][u]+=dp[i][j-1][u-x[i]];
      }
    }
  }
  ll ans=0;
  a/=n;
  for(int i=1;i<=n;i++){
    ans+=dp[n][i][i*a];
  }
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:12: error: 'x' was not declared in this scope
   53 |         if(x[i]<=u) dp[i+1][j][u]+=dp[i][j-1][u-x[i]];
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,S,A;
  long long int X=0;
  cin>>N>>A;
  vector<int>x(N);
  for(int i=0;i<N;i++)cin>>x.at(i);
  for(int i=0;true;i++){
    bitset<50>s(i)
    if(s.test(N))break;
    S=0;
    for(int j=0;j<N;j++)if(s.test(j))S+=x.at(j);
    if(S==s.count()*A)X++;
  }
  cout<<X<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'if'
   11 |     if(s.test(N))break;
      |     ^~
Language: C++

#include<iostream>
#include<cstring>
#include<queue>
#include<algorithm>
#include<cstdio>
using namespace std;
int dp[60][60][51*51+5];
int main(){
	memset(dp,0,sizeof dp);
	int n,a,arr[60];
	cin>>n>>a;
	for(int i=0;i<n;i++){
		scanf("%d",arr+i);
		dp[n][1][arr[i]]++;
	}
	for(int i=1;i<=n;i++){
		for(int j=i;j>=0;j--){
			for(int p=a*n+1;p>=0;a--){
				dp[i][j][k]+=dp[i-1][j][k];
                if(k>=x[i-1] && j>=1) dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]];
			}
		}
	}
	long long ans=0;
	for(int i=1;i<=n;i++) ans+=dp[n][i][a*i];
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:42: error: 'k' was not declared in this scope
   19 |                                 dp[i][j][k]+=dp[i-1][j][k];
      |                                          ^
a.cc:20:23: error: 'x' was not declared in this scope
   20 |                 if(k>=x[i-1] && j>=1) dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]];
      |                       ^
Language: C++

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

long erase(long A,int n,int k){
  return A%((long)pow(10,n-k);
}

int f(long A,int n){
  int i,j,cnt,m=n;
  long sum=0;
  int a[n];
  for(i=0;i<n;i++){
    a[n-i-1]=(A/(int)pow(10,i))%10;
  }
  for(i=0;i<n;i++){
    cnt=0;
    sum+=pow(10,n-i-1)*a[i];
    for(j=1;j<=i-1;j++){
      cnt+=(int)pow(10,i-j)*a[j];
    }
    sum+=cnt*(int)pow(2,n-i-1);
  }
  for(i=0;i<n;i++){
    sum+=f(erase(A,n));
    n--;
  }
  return sum;
}

int main(){
  int i,j,cnt;
  string s;
  cin>>s;
  int a[s.size()];
  for(i=0;i<s.size();i++){
    a[i]=s[i]-'0';
  }
  long A=0;
  for(i=0;i<s.size();i++){
    A+=(int)pow(10,s.size()-i-1)*a[i];
  }
  cout<<f(A,s.size());
}

Compiler output:
a.cc: In function 'long int erase(long int, int, int)':
a.cc:5:30: error: expected ')' before ';' token
    5 |   return A%((long)pow(10,n-k);
      |            ~                 ^
      |                              )
a.cc: In function 'int f(long int, int)':
a.cc:24:17: error: too few arguments to function 'long int erase(long int, int, int)'
   24 |     sum+=f(erase(A,n));
      |            ~~~~~^~~~~
a.cc:4:6: note: declared here
    4 | long erase(long A,int n,int k){
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
ll dp[51][51][3010];
// dp[i][j][k]
// i枚目までのカードでj枚えらんで合計がkである組み合わせ
//遷移の仕方は
// dp[i+1][j][k] = dp[i][j][k]
// dp[i+1][j+1][k+x[i]] = dp[i][j][k]
int main() {
    int N, A;
    cin >> N >> A;
    vector<int> x(N);
    int avg_cnt = 0;
    ll ans = 0LL;
    REP(i, N) { cin >> x[i]; }
    dp[0][0][0] = 1;
    REP(i, N) {
        REP(j, N) {
            REP(k, 2500) {
                dp[i + 1][j][k] += dp[i][j][k];
                dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= N; i++) {
        ans += dp[N][i][i * A]
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:8: error: redeclaration of 'll ans'
   57 |     ll ans = 0;
      |        ^~~
a.cc:46:8: note: 'll ans' previously declared here
   46 |     ll ans = 0LL;
      |        ^~~
a.cc:59:31: error: expected ';' before '}' token
   59 |         ans += dp[N][i][i * A]
      |                               ^
      |                               ;
   60 |     }
      |     ~
Language: C++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,j,N,M,a,b,ans=0;
  cin>>N>>M;
  vec v(N);
  rep(i,N){
    cin>>v[i];
    v[i]-=M;
  }
  map mp<datas,ll>;
  set<ll> se;
  queue<ll> que;
  se.insert(0);
  mp[datas(-1,0)]=1;
  rep(j,N){
    for(auto i:se){
      if(!mp[datas(j-1,i+v[j])])que.push(i+v[j]);
      mp[datas(j,i+v[j])]=mp[datas(j-1,i+v[j])]+mp[datas(j-1,i)];
      mp[datas(j,i)]=max(mp[datas(j-1,i)],mp[datas(j,i)]);
    }
    while(!que.empty()){
      se.insert(que.front());que.pop();
    }
  }
  cout<<mp[datas(N-1,0)]-1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:118:9: error: expected initializer before '<' token
  118 |   map mp<datas,ll>;
      |         ^
a.cc:122:3: error: 'mp' was not declared in this scope
  122 |   mp[datas(-1,0)]=1;
      |   ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N,A;
  cin>>N>>A;
  vector<int> x(N);
  rep(i,N) {
    cin>>x[i];
    x[i] -= A;
  }
  vector<vector<uint64_t>> dp(N,vector<uint64_t>(100));
  //dp[i][50-j]は、x[0]～x[i]からうまく選んで合計がj（-49~+49）になるようなパターンの合計。
  //ans = dp[N-1][50];（j=0のとき）
  rep(i,50){
    for(int j=-49;j<=49;j++){
      dp[i][
  cout<<dp[N-1][50]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: expected ']' before ';' token
   19 |   cout<<dp[N-1][50]<<endl;
      |                          ^
      |                          ]
a.cc:18:12: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long unsigned int> >, std::vector<long unsigned int> >::value_type' {aka 'std::vector<long unsigned int>'} and 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'})
   18 |       dp[i][
      |            ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; reference = long unsigned int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'std::vector<long unsigned int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; const_reference = const long unsigned int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'std::vector<long unsigned int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:16:12: note: to match this '{'
   16 |   rep(i,50){
      |            ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++


#include <iostream>
#include <vector>

using namespace std;

long long dp[N+1][N+1][N*A+1];

int main(){
    long long N, A;
    cin >> N >> A;
    vector<long long> x(N+1);
    for(int i = 0; i < N; i++){
        cin >> x[i+1];
    }
    
    
    // dp[j][k][s] := (x_1 ... x_j から k 枚選んで合計 s にするような選び方の総数)
    dp[0][0][0] = 1;
    for(long long j = 0; j < N+1; j++){
        for(long long k = 0; k < N+1; k++){
            for(long long s = 0; s < N*A+1; s++){
                if(j >= 1 && s < x[j]){ // j枚目を選ばないで 合計s
                    dp[j][k][s] = dp[j-1][k][s];
                }else if(j >= 1 && k >= 1 && s >= x[j]){ // j枚目を選ばないで合計s と j枚目を選んで合計s
                    dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j]];
                }
            }
        }
    }

    long long ans = 0;
    for(int k = 1; k < N+1; k++){
        ans += dp[N][k][k*A];
    }
    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc:7:14: error: 'N' was not declared in this scope
    7 | long long dp[N+1][N+1][N*A+1];
      |              ^
a.cc:7:19: error: 'N' was not declared in this scope
    7 | long long dp[N+1][N+1][N*A+1];
      |                   ^
a.cc:7:24: error: 'N' was not declared in this scope
    7 | long long dp[N+1][N+1][N*A+1];
      |                        ^
a.cc:7:26: error: 'A' was not declared in this scope
    7 | long long dp[N+1][N+1][N*A+1];
      |                          ^
a.cc: In function 'int main()':
a.cc:19:5: error: 'dp' was not declared in this scope
   19 |     dp[0][0][0] = 1;
      |     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
int n, a;
vector<int> arr;
ll dp[51][2507][51];
int answer(int cnt, int curr, int total){
    if(cnt == n){
        if(total == 0) return 0;
        int k = curr / total;
        if(k * total == curr && k == a) return 1;
        return 0;
    }
    if(dp[cnt][curr][total] != 0) return dp[cnt][curr][total];
    /*if(total != 0){
        double avg = curr / total;
        if(avg > (double)a && avg <= arr[curr]) return;
    }*/
    //if(total != 0 && curr / total < a) return;
    return dp[cnt][curr][total] = answer(cnt+1, curr, total) + answer(cnt+1, curr+arr[cnt],  total+1);
}

int main() {
	// your code goes here
    //int n, a;
    cin >> n >> a;
    arr.resize(n);
    for(int i=0; i<n; i++) cin >> arr[i];
    sort(arr.begin(), arr.end());
    ans = answer(0, 0, 0);
    cout << ans << endl;
    
}


Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll dp[51][2507][51];
      | ^~
a.cc: In function 'int answer(int, int, int)':
a.cc:14:8: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |     if(dp[cnt][curr][total] != 0) return dp[cnt][curr][total];
      |        ^~
      |        dup
a.cc:20:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |     return dp[cnt][curr][total] = answer(cnt+1, curr, total) + answer(cnt+1, curr+arr[cnt],  total+1);
      |            ^~
      |            dup
Language: C++

#include<iostream>
using namespace std;

typedef long long ll;

const int N = 55;

int n, A;
int a[N];

ll mem[N][N][N * N];

ll dp(int i, int cnt, int sum) {
	if (i == n) {
		if (cnt == 0)return 0;

		if ((sum / cnt == A) && (sum % cnt == 0))return 1;
		return 0;
	}

	ll& ret = mem[i][cnt][sum];
	if (ret != -1)return ret;

	return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}

int main() {
	cin >> n >> A;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	memset(mem, -1, sizeof mem);

	cout << dp(0, 0, 0) << endl;

	return 0;
}

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

#include<cstdio>
using namespace std;

typedef long long ll;

const int N = 55;

int n, A;
int a[N];

ll mem[N][N][N * N];

ll dp(int i, int cnt, int sum) {
	if (i == n) {
		if (cnt == 0)return 0;

		if ((sum / cnt == A) && (sum % cnt == 0))return 1;
		return 0;
	}

	ll& ret = mem[i][cnt][sum];
	if (ret != -1)return ret;

	return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}

int main() {

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

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

	memset(mem, -1, sizeof mem);
	printf("%lld\n", dp(0, 0, 0));

	return 0;
}


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

#include<cstdio>
using namespace std;

typedef long long ll;

const int N = 55;

int n, A;
int a[N];

ll mem[N][N][N * N];

ll dp(int i, int cnt, int sum) {
	if (i == n) {
		if (cnt == 0)return 0;

		if ((sum / cnt == A) && (sum % cnt == 0))return 1;
		return 0;
	}

	ll& ret = mem[i][cnt][sum];
	if (ret != -1)return ret;

	return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}

int main() {

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

	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
	}

	memset(mem, -1, sizeof mem);
	printf("%lld\n", dp(0, 0, 0));

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   29 |         scanf_s("%d %d", &n, &A);
      |         ^~~~~~~
      |         scanf
a.cc:35:9: error: 'memset' was not declared in this scope
   35 |         memset(mem, -1, sizeof mem);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<cstdio>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<cstdio>
using namespace std;

typedef long long ll;

const int N = 55;

int n, A;
int a[N];

ll mem[N][N][N * N];

ll dp(int i, int cnt, int sum) {
	if (i == n) {
		if (cnt == 0)return 0;

		if ((sum / cnt == A) && (sum % cnt == 0))return 1;
		return 0;
	}

	ll& ret = mem[i][cnt][sum];
	cout << mem[i][cnt][sum] << endl;
	if (ret != -1)return ret;

	return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}

int main() {

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

	for (int i = 0; i < n; i++) {
		scanf_s("%d", &a[i]);
	}

	memset(mem, -1, sizeof mem);
	printf("%lld\n", dp(0, 0, 0));

	return 0;
}

Compiler output:
a.cc: In function 'll dp(int, int, int)':
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << mem[i][cnt][sum] << endl;
      |         ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:22:37: error: 'endl' was not declared in this scope
   22 |         cout << mem[i][cnt][sum] << endl;
      |                                     ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstdio>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc: In function 'int main()':
a.cc:30:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   30 |         scanf_s("%d %d", &n, &A);
      |         ^~~~~~~
      |         scanf
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(mem, -1, sizeof mem);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<cstdio>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<iostream>
using namespace std;

typedef long long ll;

const int N = 55;

int n, A;
int a[N];

ll mem[N][N][N * N];

ll dp(int i, int cnt, int sum) {
	if (i == n) {
		if (cnt == 0)return 0;

		if ((sum / cnt == A) && (sum % cnt == 0))return 1;
		return 0;
	}

	ll& ret = mem[i][cnt][sum];
	cout << mem[i][cnt][sum] << endl;
	if (ret != -1)return ret;

	return ret = dp(i + 1, cnt, sum) + dp(i + 1, cnt + 1, sum + a[i]);
}

int main() {

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

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

	memset(mem, -1, sizeof mem);
	printf("%lld\n", dp(0, 0, 0));

	return 0;
}

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


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

void subsetsUtil(vector<int>& A, vector<vector<int> >& res, 
				vector<int>& subset, int index) 
{ 
	res.push_back(subset); 
	for (int i = index; i < A.size(); i++) { 

		 
		subset.push_back(A[i]); 
		
		subsetsUtil(A, res, subset, i + 1); 

		subset.pop_back(); 
	} 

	return; 
} 

vector<vector<int> > subsets(vector<int>& A) 
{ 
	vector<int> subset; 
	vector<vector<int> > res; 

	int index = 0; 
	subsetsUtil(A, res, subset, index); 

	return res; 
} 

int main() 
{ 
	vector<int> array; 
    int cnt=0;
     int n,a;
    cin>>n>>a;
      for(int i=1;i<=n;i++) {
        int x;cin>>x;
        array.push_back(x);
      }
	
	vector<vector<int> > res = subsets(array); 
	for (int i = 0; i < res.size(); i++) { 
      int sum=0;
		for (int j = 0; j < res[i].size(); j++) 
	       sum+=res[i][j];
	        if(sum/res[i].size())==a) cnt++; 
	} 
             cout<<cnt<<endl;
	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:49:38: error: expected primary-expression before '==' token
   49 |                 if(sum/res[i].size())==a) cnt++;
      |                                      ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int M = 51;
int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,A;cin >> N >> A;
  vector<int> v(N);
  rep(i,N)cin >> v[i];

  //dp[i][j+M*M*k];
  ll dp[2][M*M*M];
  ll *prev,*next;
  prev = dp[0];
  next = dp[1];
  rep(i,M*M*M+1){
    prev[i] = 0;
    next[i] = 0;
  }

  prev[0] = 1;
  next[0] = 1;
  rep(i,N){
    repp(k,1,i+2){
      rep(j,M*M){
        next[j+M*M*k] = prev[j+M*M*k];
        if(j-v[i]<0)continue;
        next[j+M*M*k] += prev[j-v[i] + M*M*(k-1)];
      }
    }
    swap(prev,next);
  }
  swap(prev,next);
  ll ans = 0;
  repp(i,1,N+1) ans += next[A*i+M*M*i];
  cout << ans << endl;
  return 0;
}t


Compiler output:
a.cc:67:2: error: 't' does not name a type; did you mean 'tm'?
   67 | }t
      |  ^
      |  tm
Language: C++

typedef long long ll;
int N, A;
int x[50];
ll dp[51][51][3010];
//-----------------------------------------------------------------
int main() {
	cin >> N >> A;
	rep(i, N) cin >> x[i];
    dp[0][0][0] = 1;
    rep(i,N){
      rep(j,N){
        rep(k,2500){
          if(dp[i][j][k]){
            dp[i + 1][j][k] += dp[i][j][k];
            dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
          }
          
          ll ans = 0;
          REP(i,1,N+1) ans += dp[N][i][i*A];
          cout << ans << endl;
          
        }
      }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> N >> A;
      |         ^~~
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         rep(i, N) cin >> x[i];
      |             ^
a.cc:8:9: error: 'rep' was not declared in this scope
    8 |         rep(i, N) cin >> x[i];
      |         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int _b=(b),i=(a);i<=_b;++i)
#define ROF(i, b, a) for(int _a=(a),i=(b);i>=_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(), (x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long int ll; typedef pair<int,int> PII;typedef unsigned long long int ull;
typedef vector<int>VI; typedef vector<ll> VL; typedef vector<PII> VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

int x[55];
int dp[55][2750];
int main() {
	IO();
	cint2(N, A);
	FOR(i, 1, N) cin >> x[i];
	MSET(dp, 0);
	dp[0][0] = 1;
	//int tot = 0;
	FOR(i, 1, N) {
		ROF(j, i-1, 0) {
			FOR(k, 0, 2500) {
				dp[j+1][x[i] + k] += dp[j][k];
			}
		}
		tot += x[i];
	}
	ll res = 0;
	FOR(i, 1, N) res += dp[i][i*A];
	printf("%lld\n",res);;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'tot' was not declared in this scope
   38 |                 tot += x[i];
      |                 ^~~
Language: C++

#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(void){
	int N,i,j,A,k;
	cin >> N >> A;
	int x[N];
	for(i=0;i<N;i++){
		cin >> x[i];
	}
	bool dpbool[N+1][N+1][N*50+1];
	long dp[N+1][N+1][N*50+1];
	for(int i=0; i<N; i++) {
		for(int j=0; j<N1; j++) {
			for(int k=0; k<N*50+1; k++) {
				dp[i][j][k]=0;
				dpbool[i][j][k]=false;
			}
		}
	}
	dpbool[0][0][0] = true;
	dp[0][0][0] = 1;
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			for(k=0;k<N*50+1;k++){
				if(dpbool[i][j][k] == true){
					dp[i+1][j][k] += dp[i][j][k];
					dp[i+1][j+1][k + x[i]] += dp[i][j][k];
					dpbool[i+1][j][k] = true;
					dpbool[i+1][j+1][k + x[i]] = true;
				}
			}
		}
	}
	int sum = 0; 
	for(int j=0; j<N; j++) {
			sum += dp[N][j][j*A];
	}
	cout << sum ;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: 'N1' was not declared in this scope; did you mean 'N'?
   14 |                 for(int j=0; j<N1; j++) {
      |                                ^~
      |                                N