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

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
 
vector<int> num;
int total,limit;
long long cont=0;
void math(int pl,int res){
  int add,sub;
  add = res + num[pl];
  sub = res - num[pl];
  if(add<=20 && add>=0){
    if(pl==limit-2 && add==total){
        cont++;
        }
    math(pl+1,add);
    }
  if(sub<=20 && sub>=0){
    if(pl==limit-2 && sub==total){
      cont++;
    }
    math(pl+1,sub);
  }
}
 
int main(){
  string equa;
  cin>>limit;
  cin.ignore();
  getline(cin,equa);
  for(int i = 0 ; i < equa.size() ; i++){
    if(equa[i]!=' ') 
    num.push_back(equa[i]-'0');
  }
  total = equa[equa.size()-1] - '0';
  math(0,0);
  cout<<cont<<endl;
}

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

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

typedef long long ll;
ll num[101];
ll memo[101][101];
ll limit;
ll math(ll p,ll sum){
  if(sum<0 || sum>20) return 0;
  else if(p == limit-1 )return sum == num[p];
  else if(memo[p][sum]>0)return memo[p][sum];
  else return memo[p][sum] = math(p+1,sum+num[p])+math(p+1,sum-num[p]);
}

int main(){
  cin>>limit;
  for(int i = 0 ; i < limit ; i++)cin>>num[i];
  cout<<math(1,num[0])<<endl;
}

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

#include <stdio.h>long long x[101],i,j,dp[100][80],n;main(){scanf("%d",&n);for(i=1;i<=n;i++){scanf("%lld",&x[i]);}dp[1][50+x[1]]=1;for(i=2;i<n;i++){for(j=0;j<=20;j++){dp[i][50+j]=dp[i-1][50+j+x[i]]+dp[i-1][50+j-x[i]];}}printf("%lld\n",dp[n-1][50+x[n]]);return 0;}

Compiler output:
main.c:1:19: warning: extra tokens at end of #include directive
    1 | #include <stdio.h>long long x[101],i,j,dp[100][80],n;main(){scanf("%d",&n);for(i=1;i<=n;i++){scanf("%lld",&x[i]);}dp[1][50+x[1]]=1;for(i=2;i<n;i++){for(j=0;j<=20;j++){dp[i][50+j]=dp[i-1][50+j+x[i]]+dp[i-1][50+j-x[i]];}}printf("%lld\n",dp[n-1][50+x[n]]);return 0;}
      |                   ^~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

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

#define N 101

int n;
int right;
int val[N];
__int64 memo[N][21];

//	今まで合計値=num
__int64 getWay(int i, int num)
{
	__int64 ret = 0;
	
	if (memo[i][num] >= 0){
		return (memo[i][num]);
	}
	
	if (i == n - 1){
		if (num == right){
			return (1);
		}
		else {
			return (0);
		}
	}
	
	if (num + val[i] <= 20){
		ret += getWay(i + 1, num + val[i]);
	}
	if (num - val[i] >= 0){
		ret += getWay(i + 1, num - val[i]);
	}
	
	return (memo[i][num] = ret);
}

int main(void)
{
	int i, j;
	
	scanf("%d", &n);
	for (i = 0; i < n - 1; i++){
		scanf("%d", val + i);
	}
	scanf("%d", &right);
	
	memset(memo, -1, sizeof(memo));
	
	printf("%llu\n", getWay(0,0));
	
	return (0);
}

Compiler output:
main.c:9:1: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 | __int64 memo[N][21];
      | ^~~~~~~
      | __int64_t
main.c:12:1: error: unknown type name '__int64'; did you mean '__int64_t'?
   12 | __int64 getWay(int i, int num)
      | ^~~~~~~
      | __int64_t
main.c: In function 'getWay':
main.c:14:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   14 |         __int64 ret = 0;
      |         ^~~~~~~
      |         __int64_t
Language: C

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

#define N 101
#define RIGHT 100

int shiki[N];
int n;
__int64 memo[N][21];

// i番目の数字, 今までの合計値
__int64 getWay(int i, int num)
{
	__int64 ret = 0;
	int dx[] = {1, -1};
	int j;
	
	if (memo[i][num] != -1){
		return (memo[i][num]);
	}
	
	if (i == n - 2){
		if (num == shiki[RIGHT]){
			return (1);
		}
		return (0);
	}
	
	for (j = 0; j < 2; j++){
		int val = num + shiki[i + 1] * dx[j];
		
		if (val >= 0 && val <= 20){
			ret += getWay(i + 1, val);
		}
	}
	
	return (memo[i][num] = ret);
}

int main(void)
{
	int i;
	
	memset(memo, -1, sizeof(memo));
	
	scanf("%d", &n);
	for (i = 0; i < n - 1; i++){
		scanf("%d", shiki + i);
	}
	scanf("%d", shiki + RIGHT);
	
	printf("%I64d\n", getWay(0, shiki[0]));
	
	return (0);
}

Compiler output:
main.c:9:1: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 | __int64 memo[N][21];
      | ^~~~~~~
      | __int64_t
main.c:12:1: error: unknown type name '__int64'; did you mean '__int64_t'?
   12 | __int64 getWay(int i, int num)
      | ^~~~~~~
      | __int64_t
main.c: In function 'getWay':
main.c:14:9: error: unknown type name '__int64'; did you mean '__int64_t'?
   14 |         __int64 ret = 0;
      |         ^~~~~~~
      |         __int64_t
Language: C++

#include <cstdio>
#include <vector>
using namespace std;

#define MAX_N 100
typedef __int64 Int;
int N, A[MAX_N];
Int table[MAX_N][21];

Int dp(int p, int res){
	if(res > 20 || res < 0) return 0;
	if(p == N - 1){
		return (res == A[p])? 1 : 0;
	}
	if(table[p][res] > -1) return table[p][res];
	return table[p][res] = dp(p + 1, res + A[p]) + dp(p + 1, res - A[p]);
}

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%d", A + i);
	}
	
	memset(table, -1, sizeof(table));
	
	printf("%I64d\n", dp(0, 0));
	
	return 0;
}

Compiler output:
a.cc:6:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    6 | typedef __int64 Int;
      |         ^~~~~~~
      |         __int64_t
a.cc:8:1: error: 'Int' does not name a type; did you mean 'int'?
    8 | Int table[MAX_N][21];
      | ^~~
      | int
a.cc:10:1: error: 'Int' does not name a type; did you mean 'int'?
   10 | Int dp(int p, int res){
      | ^~~
      | int
a.cc: In function 'int main()':
a.cc:25:16: error: 'table' was not declared in this scope; did you mean 'mutable'?
   25 |         memset(table, -1, sizeof(table));
      |                ^~~~~
      |                mutable
a.cc:25:9: error: 'memset' was not declared in this scope
   25 |         memset(table, -1, sizeof(table));
      |         ^~~~~~
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;
a.cc:27:27: error: 'dp' was not declared in this scope
   27 |         printf("%I64d\n", dp(0, 0));
      |                           ^~
Language: C++

#include <cstdio>
#include <vector>
using namespace std;

#define MAX_N 100
typedef long long Int;
int N, A[MAX_N];
Int table[MAX_N][21];

Int dp(int p, int res){
	if(res > 20 || res < 0) return 0;
	if(p == N - 1){
		return (res == A[p])? 1 : 0;
	}
	if(table[p][res] > -1) return table[p][res];
	return table[p][res] = dp(p + 1, res + A[p]) + dp(p + 1, res - A[p]);
}

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%d", A + i);
	}
	
	memset(table, -1, sizeof(table));
	
	printf("%I64d\n", dp(0, 0));
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'memset' was not declared in this scope
   25 |         memset(table, -1, sizeof(table));
      |         ^~~~~~
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>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
using namespace std;

int a[100];
__int64 dp[100][21];
int n;

__int64 rec(int i, int j)
{
	if (j < 0 || 20 < j)
	{
		return 0;
	}

	if (i == n - 2)
	{
		if (j == a[i])
		{
			return 1;
		}
		return 0;
	}

	if (dp[i][j] > -1)
	{
		return dp[i][j];
	}
	
	dp[i][j] = rec(i + 1, j + a[i + 1]) + rec(i + 1, j - a[i + 1]);
	return dp[i][j];
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << rec(0, a[0]) << endl;
	return 0;
}

Compiler output:
a.cc:11:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   11 | __int64 dp[100][21];
      | ^~~~~~~
      | __int64_t
a.cc:14:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | __int64 rec(int i, int j)
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:46:16: error: 'dp' was not declared in this scope
   46 |         memset(dp, -1, sizeof(dp));
      |                ^~
a.cc:47:17: error: 'rec' was not declared in this scope
   47 |         cout << rec(0, a[0]) << endl;
      |                 ^~~
Language: C++

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
using namespace std;

int a[100];
__int64 dp[100][21];
int n;

__int64 rec(int i, int j)
{
	if (j < 0 || 20 < j)
	{
		return 0;
	}

	if (i == n - 2)
	{
		if (j == a[i])
		{
			return 1;
		}
		return 0;
	}

	if (dp[i][j] > -1)
	{
		return dp[i][j];
	}
	
	dp[i][j] = rec(i + 1, j + a[i + 1]) + rec(i + 1, j - a[i + 1]);
	return dp[i][j];
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << rec(0, a[0]) << endl;
	return 0;
}

Compiler output:
a.cc:12:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   12 | __int64 dp[100][21];
      | ^~~~~~~
      | __int64_t
a.cc:15:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   15 | __int64 rec(int i, int j)
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:47:16: error: 'dp' was not declared in this scope
   47 |         memset(dp, -1, sizeof(dp));
      |                ^~
a.cc:48:17: error: 'rec' was not declared in this scope
   48 |         cout << rec(0, a[0]) << endl;
      |                 ^~~
Language: C++

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

int* nums;
int done[21][100];
int isOK[21][100];//0ならともにダメ　1なら+のみ -1なら-のみ　2なら両方
const int true = 1;
const int false = 0;
int ans = 0;
	int n;

void solve(int,int);
int main()
{

	scanf("%d",&n);
	nums = (int*)malloc(sizeof(int)*n);
	int i,j;
	for(i=0;i<n;i++)
	{
		scanf("%d",&nums[i]);
	}
	for(i=0;i<21;i++)
	{
		for(j=0;j<100;j++)
		{
			done[i][j] = false;
			isOK[i][j] = 0;
		}
	}
	solve(nums[0],1);
	printf("%d",ans);
	free(nums);
}
void solve(int sum,int next)
{

	if(next == n-1)
	{
		if(done[sum][nums[next]])
		{
			ans += abs(isOK[sum][nums[next]]);
		}
		else
		{
		int count = 0;
		int f =0;
		if(sum + nums[next]<21){f=1;count++;}
		if(sum - nums[next]>-1){f=-1;count++;}
		if(count ==2  | count ==0)isOK[sum][nums[next]]==count;
		if(count ==1){isOK[sum][nums[next]] = f;}
		done[sum][nums[next]]=true;
		ans += count;
		}
	}
	else
	{
		if(done[sum][nums[next]])
		{
			switch(isOK[sum][nums[next]])
			{
				case 2:
					solve(sum+nums[next],next+1);
					solve(sum+nums[next],next+1);
					break;
				case 1:
					solve(sum+nums[next],next+1);
					break;
				case -1:
					solve(sum+nums[next],next+1);
					break;
			}
		}
		if(sum + nums[next]<21)
		{
			solve(sum+nums[next],next+1);
		}
		if(sum - nums[next]>-1)
		{
			solve(sum-nums[next],next+1);
		}
	}

}

Compiler output:
a.cc:7:11: error: expected unqualified-id before 'true'
    7 | const int true = 1;
      |           ^~~~
a.cc:8:11: error: expected unqualified-id before 'false'
    8 | const int false = 0;
      |           ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int ban[500],a;
int ans;
__int64  x;
int dfs(int sum,int hukasa){
	if(hukasa==a-1){
	if(sum==ban[a-1]){
	//cout<<sum;
	x++;
	return 1;
	}
	return 0;
	}
	int res=0;
	if(sum+ban[hukasa]<=20)res+=dfs(sum+ban[hukasa],hukasa+1);
		//return res;
	if(sum-ban[hukasa]>=0)res+=dfs(sum-ban[hukasa],hukasa+1);
	return res;
}
int main(){
	cin>>a;
	for(int i=0;i<a;i++)cin>>ban[i];

	cout<<dfs(0,0)<<endl;
	//cout<<x<<endl;
	return 0;
}

Compiler output:
a.cc:7:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    7 | __int64  x;
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int dfs(int, int)':
a.cc:12:9: error: 'x' was not declared in this scope
   12 |         x++;
      |         ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int ban[500],a;
int dp[101][101]={{0},{0}};
int ans;
__int64  x;
int dfs(int sum,int hukasa){
	if(dp[sum][hukasa]!=-1)return dp[sum][hukasa];
	if(hukasa==a-1){
	if(sum==ban[a-1]){
	//cout<<sum;
	x++;
	return 1;
	}
	return 0;
	}
	int res=0;
	if(sum+ban[hukasa]<=20){
	res+=dfs(sum+ban[hukasa],hukasa+1);
	}	//return res;
	if(sum-ban[hukasa]>=0)res+=dfs(sum-ban[hukasa],hukasa+1);
	dp[sum][hukasa]=res;
	return res;
}
int main(){
	cin>>a;
	for(int i=0;i<a;i++)cin>>ban[i];
	for(int i=0;i<100;i++)for(int j=0;j<100;j++)dp[i][j]=-1;
	cout<<dfs(0,0)<<endl;
	//cout<<x<<endl;
	return 0;
}

Compiler output:
a.cc:8:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    8 | __int64  x;
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int dfs(int, int)':
a.cc:14:9: error: 'x' was not declared in this scope
   14 |         x++;
      |         ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int ban[500],a;
unsigned __int64  dp[101][1001]={{0},{0}};
int ans;
unsigned __int64 dfs(int sum,int hukasa){
	if(dp[sum][hukasa]!=-1)return dp[sum][hukasa];
	if(hukasa==a-1){
	if(sum==ban[a-1]){
	//cout<<sum;
	return 1;
	}
	return 0;
	}
	unsigned __int64 res=0;
	if(sum+ban[hukasa]<=20){
	res+=dfs(sum+ban[hukasa],hukasa+1);
	}	//return res;
	if(sum-ban[hukasa]>=0)res+=dfs(sum-ban[hukasa],hukasa+1);
	dp[sum][hukasa]=res;
	return res;
}
int main(){
	cin>>a;
	for(int i=0;i<a;i++)cin>>ban[i];
	for(int i=0;i<101;i++)for(int j=0;j<1001;j++)dp[i][j]=-1;
	cout<<dfs(0,0)<<endl;
	//cout<<x<<endl;
	return 0;
}

Compiler output:
a.cc:6:19: error: expected initializer before 'dp'
    6 | unsigned __int64  dp[101][1001]={{0},{0}};
      |                   ^~
a.cc:8:18: error: expected initializer before 'dfs'
    8 | unsigned __int64 dfs(int sum,int hukasa){
      |                  ^~~
a.cc: In function 'int main()':
a.cc:28:54: error: 'dp' was not declared in this scope
   28 |         for(int i=0;i<101;i++)for(int j=0;j<1001;j++)dp[i][j]=-1;
      |                                                      ^~
a.cc:29:15: error: 'dfs' was not declared in this scope
   29 |         cout<<dfs(0,0)<<endl;
      |               ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long int ll;
typedef pair<int, int> P;


ll  solve(int i, int j)
{
	if (j < 0 || 20 < j)return 0;
	if (dp[i][j] >= 0)return dp[i][j];//探索済み
	if (i==n-1)
	{
		if (j == a[n - 1])return 1;
		else return 0;
	}
	else
	{
		dp[i][j] = solve(i + 1, j + a[i]) + solve(i + 1, j - a[i]);
		return dp[i][j];
	}
}
int main()
{
	int n, a[105];
	ll  dp[105][23];
	int ans;
	cin >> n;
	REP(i, n)cin >> a[i];
	REP(i, 105)REP(j, 25)dp[i][j] = -1;
	ans = solve(1, a[0]);
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'll solve(int, int)':
a.cc:19:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |         if (dp[i][j] >= 0)return dp[i][j];//探索済み
      |             ^~
      |             dup
a.cc:20:16: error: 'n' was not declared in this scope
   20 |         if (i==n-1)
      |                ^
a.cc:22:26: error: 'a' was not declared in this scope
   22 |                 if (j == a[n - 1])return 1;
      |                          ^
a.cc:27:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |                 dp[i][j] = solve(i + 1, j + a[i]) + solve(i + 1, j - a[i]);
      |                 ^~
      |                 dup
a.cc:27:45: error: 'a' was not declared in this scope
   27 |                 dp[i][j] = solve(i + 1, j + a[i]) + solve(i + 1, j - a[i]);
      |                                             ^
Language: C++

#include <cstdio>
using namespace std;

typedef __int64 Int;

int main(){
	const int MAX_N = 100;
	int N;
	int a[MAX_N];
	Int dp[MAX_N + 1][21];
	
	for(int i = 0; i <= MAX_N; i++){
		for(int j = 0; j <= 20; j++){
			dp[i][j] = 0;
		}
	}
	
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		scanf("%d", a + i);
	}
	
	dp[0][0] = 1;
	for(int i = 1; i < N; i++){
		for(int j = 0; j <= 20; j++){
			if(j - a[i - 1] >= 0) dp[i][j] += dp[i - 1][j - a[i - 1]];
			if(j + a[i - 1] <= 20) dp[i][j] += dp[i - 1][j + a[i - 1]];
		}
	}
	
	printf("%I64d\n", dp[N - 1][a[N - 1]]);
	
	return 0;
}

Compiler output:
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    4 | typedef __int64 Int;
      |         ^~~~~~~
      |         __int64_t
a.cc: In function 'int main()':
a.cc:10:9: error: 'Int' was not declared in this scope; did you mean 'int'?
   10 |         Int dp[MAX_N + 1][21];
      |         ^~~
      |         int
a.cc:14:25: error: 'dp' was not declared in this scope
   14 |                         dp[i][j] = 0;
      |                         ^~
a.cc:23:9: error: 'dp' was not declared in this scope
   23 |         dp[0][0] = 1;
      |         ^~
Language: C++

#include <iostream>
#include <vector>

std::vector<int> seq_number;
int count; // count of the number
int answer;

//depth-first search
void dfs(int i, int computation){
	if(i==count-2){
		if(computation == seq_number.back()) ++answer;
	}else{
		if(computation >= 0){
			dfs(i+1, computation+seq_number[i]);
			dfs(i+1, computation-seq_number[i]);
		}
	}
}

int main(){
	
	std::cin >> count
	seq_number.resize(count);
	for(int i=0; i<count; ++i){
		std::cin >> seq_number[i];
	}
	answer = 0;
	dfs(0,0);
	std:: cout << answer << std::endl;
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: expected ';' before 'seq_number'
   22 |         std::cin >> count
      |                          ^
      |                          ;
   23 |         seq_number.resize(count);
      |         ~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <iterator>
#include <algorithm>

int main(){
	int num;

	while(std::cin >> num){
		//input
		std::vector<int> factor;
		for(int i = 0; i < num; ++i){
			int buf;
			std::cin >> buf;
			factor.push_back(buf);
		}

		std::array<int, 21> count = {0}; //0~20
		std::array<int, 21> tmp_count = {0};
		int cnt_number = 0;
		for(auto fct_itr = factor.begin(); fct_itr != factor.end(); ++fct_itr){

			for(auto cnt_itr = count.begin(); cnt_itr != count.end(); ++cnt_itr){
				if(cnt_number >= *fct_itr){
					tmp_count[cnt_number - *fct_itr] += *cnt_itr;
				}
				if(cnt_number + *fct_itr <= 20){
					tmp_count[cnt_number + *fct_itr] += *cnt_itr;
				}
				cnt_number++;
			}
		std::copy(tmp_count.begin(), tmp_count.end(), count,begin());
		tmp_count = {0};
		cnt_number = 0;

		}
		
		std::cout << count.front() << endl;
		~factor();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:69: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   33 |                 std::copy(tmp_count.begin(), tmp_count.end(), count,begin());
      |                                                                     ^~~~~
      |                                                                     std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:39:47: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   39 |                 std::cout << count.front() << endl;
      |                                               ^~~~
      |                                               std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:40:24: error: no match for call to '(std::vector<int>) ()'
   40 |                 ~factor();
      |                  ~~~~~~^~
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <iterator>
#include <algorithm>

int main(){
	int num;

	while(std::cin >> num){
		//input
		std::vector<int> factor;
		for(int i = 0; i < num; ++i){
			int buf;
			std::cin >> buf;
			factor.push_back(buf);
		}

		std::array<int, 21> count = {0}; //0~20
		std::array<int, 21> tmp_count = {0};
		int cnt_number = 0;
		for(auto fct_itr = factor.begin(); fct_itr != factor.end(); ++fct_itr){

			for(auto cnt_itr = count.begin(); cnt_itr != count.end(); ++cnt_itr){
				if(cnt_number >= *fct_itr){
					tmp_count[cnt_number - *fct_itr] += *cnt_itr;
				}
				if(cnt_number + *fct_itr <= 20){
					tmp_count[cnt_number + *fct_itr] += *cnt_itr;
				}
				cnt_number++;
			}
		std::copy(tmp_count.begin(), tmp_count.end(), count.begin());
		tmp_count = {0};
		cnt_number = 0;

		}
		
		std::cout << count.front() << endl;
		~factor();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:47: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   39 |                 std::cout << count.front() << endl;
      |                                               ^~~~
      |                                               std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:40:24: error: no match for call to '(std::vector<int>) ()'
   40 |                 ~factor();
      |                  ~~~~~~^~
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <iterator>
#include <algorithm>

int main(){
	int num;

	while(std::cin >> num){
		//input
		std::vector<int> factor;
		for(int i = 0; i < num; ++i){
			int buf;
			std::cin >> buf;
			factor.push_back(buf);
		}

		std::array<int, 21> count = {0}; //0~20
	
		for(auto fct_itr = factor.begin(); fct_itr != factor.end(); ++fct_itr){
			std::array<int, 21> tmp_count = {0};
			int cnt_number = 0;
			for(auto cnt_itr = count.begin(); cnt_itr != count.end(); ++cnt_itr){
				if(cnt_number >= *fct_itr){
					tmp_count[cnt_number - *fct_itr] += *cnt_itr;
				}
				if(cnt_number + *fct_itr <= 20){
					tmp_count[cnt_number + *fct_itr] += *cnt_itr;
				}
				cnt_number++;
			}
		std::copy(tmp_count.begin(), tmp_count.end(), count.begin());

		}
		
		std::cout << count.front() << endl;
		~factor();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:47: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   37 |                 std::cout << count.front() << endl;
      |                                               ^~~~
      |                                               std::endl
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:38:24: error: no match for call to '(std::vector<int>) ()'
   38 |                 ~factor();
      |                  ~~~~~~^~
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <iterator>
#include <algorithm>

int main(){
	int num;

	while(std::cin >> num){
		//input
		std::vector<int> factor;
		for(int i = 0; i < num; ++i){
			int buf;
			std::cin >> buf;
			factor.push_back(buf);
		}

		std::array<int, 21> count = {0}; //0~20
	
		for(auto fct_itr = factor.begin(); fct_itr != factor.end(); ++fct_itr){
			std::array<int, 21> tmp_count = {0};
			int cnt_number = 0;
			for(auto cnt_itr = count.begin(); cnt_itr != count.end(); ++cnt_itr){
				if(cnt_number >= *fct_itr){
					tmp_count[cnt_number - *fct_itr] += *cnt_itr;
				}
				if(cnt_number + *fct_itr <= 20){
					tmp_count[cnt_number + *fct_itr] += *cnt_itr;
				}
				cnt_number++;
			}
		std::copy(tmp_count.begin(), tmp_count.end(), count.begin());

		}
		
		std::cout << count.front() << std::endl;
		~factor();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:24: error: no match for call to '(std::vector<int>) ()'
   38 |                 ~factor();
      |                  ~~~~~~^~
Language: C++

#include <iostream>
using namespace std;

typedef long long ll;

int main() {
  int n; cin >> n;
  ll dp[101][21];
  int t[101];
  memset(dp,0,sizeof(dp));
  for ( int i = 1; i <= n; i++ ) cin >> t[i];

  dp[1][t[1]] = 1;

  for ( int i = 2; i < n; i++ ) {
    for ( int j = 0; j <= 20; j++ ) {
      if ( j + t[i] <= 20 ) dp[i][j+t[i]] += dp[i-1][j];
      if ( j - t[i] >= 0 ) dp[i][j-t[i]] += dp[i-1][j];
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
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;
Language: C++

#include <iostream>
#include <string>
using namespace std;

typedef long long ll;

int main() {
  int n; cin >> n;
  ll dp[101][21];
  int t[101];
  memset(dp,0,sizeof(dp));
  for ( int i = 1; i <= n; i++ ) cin >> t[i];

  dp[1][t[1]] = 1;

  for ( int i = 2; i < n; i++ ) {
    for ( int j = 0; j <= 20; j++ ) {
      if ( j + t[i] <= 20 ) dp[i][j+t[i]] += dp[i-1][j];
      if ( j - t[i] >= 0 ) dp[i][j-t[i]] += dp[i-1][j];
    }
  }

  cout << dp[n-1][t[n]] << 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:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include <stdio.h>

long long memo[101][21];
int data[101];
int N;

long long fanc(int flo,int num)
{
	long long ret;
	if(memo[flo][num]!=-1)
	{
		return memo[flo][num];
	}
	if(flo==0)
	{
		return fanc(flo+1,num+data[flo]);
	}
	if(flo==N-1)
	{
		return memo[flo][num];
	}
	
	
	if(num+data[flo]<=20)
	{
		ret+=fanc(flo+1,num+data[flo]);
	}
	if(num-data[flo]>=0)
	{
		ret+=fanc(flo+1,num-data[flo]);
	}
	return memo[flo][num]=ret;
}

int main()
{
	int i,j;
	scanf("%d",&N);
	for(i=0;i<N;++i)scanf("%d",&data[i]);
	
	for(i=0;i<N;++i)
	{
		for(j=0;j<21;++j)
		{
			memo[i][j]=-1;
		}
	}
	memo[N][data[N]]=1;
	if(data[0]==0){memo[]}
	printf("%d\n",fanc(0,0))
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:29: error: expected primary-expression before ']' token
   49 |         if(data[0]==0){memo[]}
      |                             ^
a.cc:50:33: error: expected ';' before '}' token
   50 |         printf("%d\n",fanc(0,0))
      |                                 ^
      |                                 ;
   51 | }
      | ~
Language: C++

#include<iostream>
using namespace std;
long long int k[21][101],n,num,sum;
main(){
cin>>n;
for(int i=0;i<n;i++){cin>>num[i];}
k[num[0]][0]=1;
for(int i=1;i<n-1;i++){for(int j=0;j<21;j++){
if(j+num[i]<21){k[j+num[i]][i]+=k[j][i-1];}
if(j-num[i]>=0){k[j-num[i]][i] += k[j][i-1];}
}}
sum=k[num[n-1]][n-2];
cout<<sum<<endl;}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:30: error: invalid types 'long long int[int]' for array subscript
    6 | for(int i=0;i<n;i++){cin>>num[i];}
      |                              ^
a.cc:7:6: error: invalid types 'long long int[int]' for array subscript
    7 | k[num[0]][0]=1;
      |      ^
a.cc:9:9: error: invalid types 'long long int[int]' for array subscript
    9 | if(j+num[i]<21){k[j+num[i]][i]+=k[j][i-1];}
      |         ^
a.cc:9:24: error: invalid types 'long long int[int]' for array subscript
    9 | if(j+num[i]<21){k[j+num[i]][i]+=k[j][i-1];}
      |                        ^
a.cc:10:9: error: invalid types 'long long int[int]' for array subscript
   10 | if(j-num[i]>=0){k[j-num[i]][i] += k[j][i-1];}
      |         ^
a.cc:10:24: error: invalid types 'long long int[int]' for array subscript
   10 | if(j-num[i]>=0){k[j-num[i]][i] += k[j][i-1];}
      |                        ^
a.cc:12:10: error: invalid types 'long long int[long long int]' for array subscript
   12 | sum=k[num[n-1]][n-2];
      |          ^
Language: C++

#include<iostream>
using namespace std;
long long int k[21][101],n,q[100],sum;
main(){cin>>n;
for(int i=0;i<n;i++){cin>>q[i];}
k[num[0]][0]=1;
for(int i=1;i<n-1;i++){for(int j=0;j<21;j++){
if(j+num[i]<21){k[j+q[i]][i]+=k[j][i-1];}
if(j-num[i]>=0){k[j-q[i]][i]+=k[j][i-1];}
}}
cout<<k[q[n-1]][n-2]<<endl;}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){cin>>n;
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'num' was not declared in this scope; did you mean 'sum'?
    6 | k[num[0]][0]=1;
      |   ^~~
      |   sum
Language: C++

#include <iostream>
#define int long long

using namespace std;

int a[101];
int n;

int memo[101][21];

int fanc(int lo,int sum)
{
	if (sum < 0 || 20 < sum){ return 0; }

	if (lo == n - 1){ return (a[lo] == sum); }

	if (memo[lo][sum] != -1)
	{
		return memo[lo][sum];
	}
	else
	{
		return memo[lo][sum] = fanc(lo + 1, sum + a[lo]) + fanc(lo + 1, sum - a[lo]);
	}
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;

	memset(memo,-1,sizeof(memo));

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

	cout << fanc(0,0) << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'memset' was not declared in this scope
   33 |         memset(memo,-1,sizeof(memo));
      |         ^~~~~~
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 | #define int long long
Language: C++

#include <iostream>
using namespace std;

int n;
int x[100];
long long int dp[101][21];

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

  for(int i = 0; i <= n; i++){
    for(int j = 0; j <= 20; j++){
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;

  for(int i = 1; i < n; i++){
    for(int j = 0; j <= 20; j++){
      int minus = j - x[i-1];
      int plus = j + x[i-1];
      if (minus >= 0){
        dp[i][j] += dp[i-1][minus];
      }
      if (plus <= 20){
        dp[i][j] += dp[i-1][plus];
      }
    }
  }

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

Compiler output:
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>

int compare_int(const void* a, const void* b) { return *(int*) a - *(int*) b; }

int n, s[100], ans;
__int64 dp[100][1000];

__int64 func(int a, int sum) {
	if (a == n-1)
		return sum == ans ? 1 : 0;
	__int64 cnt = 0;
	if (sum - s[a + 1] >= 0) {
		if (!dp[a + 1][sum - s[a + 1]]) {
			dp[a + 1][sum - s[a + 1]] = func(a + 1, sum - s[a + 1]);
		}
		cnt += dp[a + 1][sum - s[a + 1]];
	}
	if (sum + s[a + 1] <= 20) {
		if (!dp[a + 1][sum + s[a + 1]]) {
			dp[a + 1][sum + s[a + 1]] = func(a + 1, sum + s[a + 1]);
		}
		cnt += dp[a + 1][sum + s[a + 1]];
	}
	return cnt;
}

int main() {
	scanf("%d", &n);
	n--;
	for (int i = 0; n > i; i++) {
		scanf("%d", &s[i]);
	}
	scanf("%d", &ans);
	printf("%lld\n", func(0, s[0]));
	return 0;
}

Compiler output:
a.cc:9:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    9 | __int64 dp[100][1000];
      | ^~~~~~~
      | __int64_t
a.cc:11:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   11 | __int64 func(int a, int sum) {
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:37:26: error: 'func' was not declared in this scope
   37 |         printf("%lld\n", func(0, s[0]));
      |                          ^~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

int main(void) {
	int n, a[100] = {0};
	LL dp[100][21] = {0};
	cin >> n;
	REP(i, n) scanf("%d", &a[i]);
	
	dp[n-1][a[n-1]] = 1;
	for (int i = n - 2; i >= 0; --i) {
		for (int j = 0; j <= 20; ++j) {
			if (j + a[i] <= 20) dp[i][j] += dp[i+1][j+a[i]];
			if (j - a[i] >= 0) dp[i][j] += dp[i+1][j-a[i]];
		}
	}
	cout << dp[0][0] << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         REP(i, n) scanf("%d", &a[i]);
      |             ^
a.cc:12:9: error: 'REP' was not declared in this scope
   12 |         REP(i, n) scanf("%d", &a[i]);
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

int main(){
	int n,number,start,plus,minus;

	while(std::cin >> n){

		std::vector<int> numbers;

		for(int i=0; i<n; ++i){
			std::cin >> number;
			numbers.push_back(number);
		}

		int whole = (int)pow(2.0,(double)(n-2));
		std::vector<int> process;
		std::vector<int> exception(whole, 0);

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

				if(j == 0){ //first step

					process.push_back(numbers.at(j));

				}else{

					start = (int)pow(2.0,(double)(j-1));

					for(int k=0; k<start; ++k){
						plus = process.at(start-1+k)+numbers.at(j);
						minus = process.at(start-1+k)-numbers.at(j);

						if(plus > 20 || plus < 0){
							process.push_back(plus);
							for(int l=(int)process.size()*pow(2.0,(double)(n-1-(j+1))); l<(int)process.size()*pow(2.0,(double)(n-1-(j+1)))+pow(2.0,(double)(n-1-(j+1))); ++l){
								exception.at(l-whole) = 1;
							}			
							process.push_back(minus);	

						}else if(minus > 20 || minus < 0){
							process.push_back(plus);

							process.push_back(minus);
							for(int l=(int)process.size()*pow(2.0,(double)(n-1-(j+1))); l<(int)process.size()*pow(2.0,(double)(n-1-(j+1)))+pow(2.0,(double)(n-1-(j+1))); ++l){
								exception.at(l-whole) = 1;
							}	

						}else{
							process.push_back(plus);
							process.push_back(minus);
						}

					}
					
				}
			}


		int size = (int)process.size();
		int sum = 0;
		int j = 0;

		for(int i=size-whole; i<size; ++i){
			if(process.at(i) == numbers.back() && exception.at(j) != 1){
				++sum;
			}
			++j;
		}

		std::cout << sum << std::endl;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:10: error: expected '}' at end of input
   74 |         }
      |          ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

int main(){
	int n,number,start,plus,minus;

	while(std::cin >> n){

		std::vector<int> numbers;

		for(int i=0; i<n; ++i){
			std::cin >> number;
			numbers.push_back(number);
		}

		int whole = (int)pow(2.0,(double)(n-2));
		std::vector<int> process;
		std::vector<int> exception(whole, 0);

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

				if(j == 0){ //first step

					process.push_back(numbers.at(j));

				}else{

					start = (int)pow(2.0,(double)(j-1));

					for(int k=0; k<start; ++k){
						plus = process.at(start-1+k)+numbers.at(j);
						minus = process.at(start-1+k)-numbers.at(j);

						if(plus > 20 || plus < 0){
							process.push_back(plus);
							for(int l=(int)process.size()*pow(2.0,(double)(n-1-(j+1))); l<(int)process.size()*pow(2.0,(double)(n-1-(j+1)))+pow(2.0,(double)(n-1-(j+1))); ++l){
								exception.at(l-whole) = 1;
							}			
							process.push_back(minus);	

						}else if(minus > 20 || minus < 0){
							process.push_back(plus);

							process.push_back(minus);
							for(int l=(int)process.size()*pow(2.0,(double)(n-1-(j+1))); l<(int)process.size()*pow(2.0,(double)(n-1-(j+1)))+pow(2.0,(double)(n-1-(j+1))); ++l){
								exception.at(l-whole) = 1;
							}	

						}else{
							process.push_back(plus);
							process.push_back(minus);
						}

					}
					
				}
			}


		int size = (int)process.size();
		unsigned_int64 sum = 0;
		int j = 0;

		for(int i=size-whole; i<size; ++i){
			if(process.at(i) == numbers.back() && exception.at(j) != 1){
				++sum;
			}
			++j;
		}

		std::cout << sum << std::endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:17: error: 'unsigned_int64' was not declared in this scope
   63 |                 unsigned_int64 sum = 0;
      |                 ^~~~~~~~~~~~~~
a.cc:68:35: error: 'sum' was not declared in this scope
   68 |                                 ++sum;
      |                                   ^~~
a.cc:73:30: error: 'sum' was not declared in this scope
   73 |                 std::cout << sum << std::endl;
      |                              ^~~
Language: C++

#include <iostream>
using namespace std;

#define N 101

int main()
{

	int n, ans;
	int arr[N];
	__int64 table[N][21];

	cin >> n;
	for(int i = 0; i < n - 1; i++) cin >> arr[i];

	for(int i = 0; i < n - 1; i++) {
		for(int j = 0; j < 21; j++) table[i][j] = 0;
	}

	cin >> ans;

	table[0][arr[0]] = 1;

	for(int i = 1; i < n - 1; i++) {
		for(int j = 0; j < 21; j++) {
			if(table[i - 1][j] >= 1) {
				if(j - arr[i] >= 0) {
					table[i][j - arr[i]] += table[i - 1][j];
				}
				if(j + arr[i] <= 20) {
					table[i][j + arr[i]] += table[i - 1][j];
				}
			}
		}
	}

	cout << table[n - 2][ans] << endl;

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   11 |         __int64 table[N][21];
      |         ^~~~~~~
      |         __int64_t
a.cc:17:45: error: 'table' was not declared in this scope; did you mean 'mutable'?
   17 |                 for(int j = 0; j < 21; j++) table[i][j] = 0;
      |                                             ^~~~~
      |                                             mutable
a.cc:22:9: error: 'table' was not declared in this scope; did you mean 'mutable'?
   22 |         table[0][arr[0]] = 1;
      |         ^~~~~
      |         mutable
Language: C++

while True:
    N = int(input())
    if N == 0:
        break
    a = list(map(int, input().split()))

    ## dp[i][j]: i???????????°????????§??§j????????????????????°
    dp = [[0 for j in range(21)] for i in range(N-1)]

    dp[0][a[0]] = 1
    for i in range(1, N-1):
        for j in range(21):
            if (j - a[i]) in range(21):
                dp[i][j] += dp[i-1][j-a[i]]
            if (j + a[i]) in range(21):
                dp[i][j] += dp[i-1][j+a[i]]
            
    print(dp[N-2][a[N-1]])

Compiler output:
a.cc:7:5: error: stray '##' in program
    7 |     ## dp[i][j]: i???????????°????????§??§j????????????????????°
      |     ^~
a.cc:7:30: error: extended character ° is not valid in an identifier
    7 |     ## dp[i][j]: i???????????°????????§??§j????????????????????°
      |                              ^
a.cc:7:39: error: extended character § is not valid in an identifier
    7 |     ## dp[i][j]: i???????????°????????§??§j????????????????????°
      |                                       ^
a.cc:7:42: error: extended character § is not valid in an identifier
    7 |     ## dp[i][j]: i???????????°????????§??§j????????????????????°
      |                                          ^
a.cc:7:64: error: extended character ° is not valid in an identifier
    7 |     ## dp[i][j]: i???????????°????????§??§j????????????????????°
      |                                                                ^
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while True:
      | ^~~~~
Language: C++

n = int(input())
a = list(map(int, input().split()))
dp = [[0] * 21 for i in range(n)]
dp[0][0] = 1
for i in range(n - 1):
    for j in range(21):
		if dp[i][j] == 0:
			continue
        if 0 <= j + a[i] <= 20:
            dp[i + 1][j + a[i]] += dp[i][j]
        if 0 <= j - a[i] <= 20:
            dp[i + 1][j - a[i]] += dp[i][j]
print(dp[n - 1][a[n - 1]])

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

#include <iostream>

using namespace std;

void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
{
	int plas = total + num[current + 1];
	if ((current + 1) == max && plas == ans)
	{
		(*count)++;
	}
	if (current != max) {
		if (plas < 20 && plas >= 0)
		{
			Recurrent(count, num, current + 1, plas, max, ans);
		}
	}
	int mainas = total - num[current + 1];
	if ((current + 1) == max && mainas == ans)
	{
		(*count)++;
	}
	if (current != max)
	{
		if (mainas < 20 && mainas >= 0)
		{
			Recurrent(count, num, current + 1, mainas, max, ans);
		}
	}
}

int main()
{
	int n;
	cin >> n;
	int* num = new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> num[i];
	}

	__int64 count = 0;
	Recurrent(&count, num, 0, num[0], n - 2, num[n - 1]);

	cout << count << endl;

	return 0;
}

Compiler output:
a.cc:5:6: error: variable or field 'Recurrent' declared void
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |      ^~~~~~~~~
a.cc:5:16: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                ^~~~~~~
      |                __int64_t
a.cc:5:25: error: 'count' was not declared in this scope
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                         ^~~~~
a.cc:5:32: error: expected primary-expression before 'int'
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                                ^~~
a.cc:5:42: error: expected primary-expression before 'int'
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                                          ^~~
a.cc:5:55: error: expected primary-expression before 'int'
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                                                       ^~~
a.cc:5:66: error: expected primary-expression before 'int'
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                                                                  ^~~
a.cc:5:75: error: expected primary-expression before 'int'
    5 | void Recurrent(__int64 *count, int *num, int current, int total, int max, int ans)
      |                                                                           ^~~
a.cc: In function 'int main()':
a.cc:42:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   42 |         __int64 count = 0;
      |         ^~~~~~~
      |         __int64_t
a.cc:43:20: error: 'count' was not declared in this scope
   43 |         Recurrent(&count, num, 0, num[0], n - 2, num[n - 1]);
      |                    ^~~~~
a.cc:43:9: error: 'Recurrent' was not declared in this scope
   43 |         Recurrent(&count, num, 0, num[0], n - 2, num[n - 1]);
      |         ^~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdlib>
#include <cmath>
#include<stdio.h>
#include<queue>
#include<stack>
#include<set>
#define MAX 1000000000000000000LL
long long inf=1000000007;
using namespace std;
using ll=long long;

int main(){
    int n; cin>>n;
    int num[101];
    ll dp[101][21]={};
    for(int i=1; i<=n; i++){
        cin>>num[i];
    }
    dp[1][num[1]]=1;
    
    for(int i=2; i<n; i++){
        for(int j=0; j<=20; j++){
            if(num[i]<=j)dp[i][j]+=dp[i-1][j-num[i]];
            if(num[i]+j<=20)dp[i][j]+=dp[i-1][j+num[i]];
        }
    }
    
    cout<<dp[n-1][num[n]]<<endl;
    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:16:11: note: to match this '{'
   16 | int main(){
      |           ^
Language: C++

#include <iostream>

using namespace std;

int n;
int a[105];
long long memo[105][22];

long long solve(int i, int j) {
    long long result = 0;
    if (memo[i][j] != -1) {
        return memo[i][j];
    }
    if (i == 0) {
        result = j == a[0] ? 1 : 0;
    } else {
        if (j + a[i] <= 20) {
            result += solve(i - 1, j + a[i]);
        }
        if (j - a[i] >= 0) {
            result += solve(i - 1, j - a[i]);
        }
    }
    memo[i][j] = result;
    return result;
}

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

    cout << solve(n - 2, a[n - 1]) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'memset' was not declared in this scope
   29 |     memset(memo, -1, sizeof(memo));
      |     ^~~~~~
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 |
Language: C++

#include <bits/stdc++.h>

using namespace std;

int N;
int num[102];
__int64 a[102][21];

__int64 dp(int d,int sum){
    if(sum > 20 || sum < 0) return 0;

    if(a[d][sum] >= 0) return a[d][sum];

    if(d == N-1){
        if(sum == num[N]){
            return a[d][sum] = 1;
        }else{
            return a[d][sum] = 0;
        }
    }

    __int64 b = 0;
    int n = num[d+1]; 
    b += dp(d+1 , sum + n) + dp(d+1 , sum - n);
    return a[d][sum] = b;
}

int main(){
    fill_n(num,101,0);
    fill_n(*a,101*21,-1);

    cin >>N;
    for(int i = 1;i <= N;i++){
        cin >> num[i];
    }

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

Compiler output:
a.cc:7:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    7 | __int64 a[102][21];
      | ^~~~~~~
      | __int64_t
a.cc:9:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    9 | __int64 dp(int d,int sum){
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:30:13: error: 'a' was not declared in this scope
   30 |     fill_n(*a,101*21,-1);
      |             ^
a.cc:37:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |     cout << dp(0,0) << endl;
      |             ^~
      |             dup
Language: C++

#include <bits/stdc++.h>

using namespace std;

int N;
int num[102];
long long int a[102][22];

long long int dp(int d,int sum){
    if(sum > 20 || sum < 0) return 0;

    if(a[d][sum] >= 0) return a[d][sum];

    if(d == N-1){
        if(sum == num[N]){
            return a[d][sum] = 1;
        }else{
            return a[d][sum] = 0;
        }
    }

    long long int b = 0;
    int n = num[d+1]; 
    if(d ==0){
        b += dp(d+1 , sum + n)
    }else{
        b += dp(d+1 , sum + n) + dp(d+1 , sum - n);
        return a[d][sum] = b;
    }
}

int main(){
    fill_n(num,101,0);
    fill_n(*a,101*22,-1);

    cin >>N;
    for(int i = 1;i <= N;i++){
        cin >> num[i];
    }

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

Compiler output:
a.cc: In function 'long long int dp(int, int)':
a.cc:25:31: error: expected ';' before '}' token
   25 |         b += dp(d+1 , sum + n)
      |                               ^
      |                               ;
   26 |     }else{
      |     ~                          
a.cc:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^