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

#include <stdio.h>

#define MAX 2000;
int A[MAX],B[MAX];

int main(void){
  int i,j,k,l,n;

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

  scanf("%d",&j);
  for(k=0;k<q;k++){
    scanf("%d",&B[i]);

  }

  for(l=0;l<q;l++){
    if(!rec(0,B[i])){
      printf("no\n");
    }

  }



  return 0;




}


int rec(int p,int q){
 
  if(q < 0){
    return 0;
  }
  else if(q==0){
    printf("yes\n");
    return 1;
  }

  if(p >= n)return 0;
  if(rec(p+1,q-A[p]))return 1;
  if(rec(p+1,q)) return 1;

  return 0;

 
}

Compiler output:
main.c:3:17: error: expected ']' before ';' token
    3 | #define MAX 2000;
      |                 ^
main.c:4:7: note: in expansion of macro 'MAX'
    4 | int A[MAX],B[MAX];
      |       ^~~
main.c:4:17: error: expected identifier or '(' before ']' token
    4 | int A[MAX],B[MAX];
      |                 ^
main.c: In function 'main':
main.c:11:17: error: 'A' undeclared (first use in this function)
   11 |     scanf("%d",&A[i]);
      |                 ^
main.c:11:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:13: error: 'q' undeclared (first use in this function)
   15 |   for(k=0;k<q;k++){
      |             ^
main.c:16:17: error: 'B' undeclared (first use in this function)
   16 |     scanf("%d",&B[i]);
      |                 ^
main.c:21:9: error: implicit declaration of function 'rec' [-Wimplicit-function-declaration]
   21 |     if(!rec(0,B[i])){
      |         ^~~
main.c: In function 'rec':
main.c:47:11: error: 'n' undeclared (first use in this function)
   47 |   if(p >= n)return 0;
      |           ^
main.c:48:16: error: 'A' undeclared (first use in this function)
   48 |   if(rec(p+1,q-A[p]))return 1;
      |                ^
Language: C

#include <stdio.h>
int rec(int,int);
#define MAX 200
int A[MAX],B[MAX],n,count=0;

int main(void){
  int i,j,k,l;

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

  scanf("%d",&j);
  for(k=0;k<j;k++){
    scanf("%d",&B[k]);

  }

  for(l=0;l<j;l++){
    rec(0,B[l]);
      if(count == 1){
	printf("yes\n");

      }

      else{
      printf("no\n");
    }
      count == 0;

  }



  return 0;




}


int rec(int a,int b){
 

  if (b == 0){
    count=1;
    return 1;

  } 

  else if(a < n){
  
    rec(a+1,b-A[p]);
    rec(a+1,b);
  }
  return 0;

 
}

Compiler output:
main.c: In function 'rec':
main.c:55:17: error: 'p' undeclared (first use in this function)
   55 |     rec(a+1,b-A[p]);
      |                 ^
main.c:55:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int A[2000],q,n;

int solve(int a,int M){

  if(M==0){
    return 1;
  }else if(M<0 || a>n){
    return 0;
  }

  if(solve(a+1,M)){
    return 1;
  }
  if(solve(a+1,M-A[a])){
    return 1;
  }
}

int main(){
  int i,S[2000];

  scanf("%d",&n);

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

  scanf("%d",&q);
  for(i=0; i<q; i++){
    scanf("%d",&S[i]);
  }

  for(i=0; i<q; i++){
    if(solve(0,Mi[i])==1 ){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }
}

Compiler output:
main.c: In function 'main':
main.c:36:16: error: 'Mi' undeclared (first use in this function); did you mean 'i'?
   36 |     if(solve(0,Mi[i])==1 ){
      |                ^~
      |                i
main.c:36:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<cstdio>
#include<iostream>

int A[2000],n;

bool solve(int i,int m){
  if(i==n) return m==0;
  if( solve(i+1,m) ) return true;
  if( solve(i+1,m-A[i]) ) return true;
  return false;

}

int main(){

  int m,q;
  scanf("%d",&n);
  for(int i=0;i<n;i++)
    scanf("%d",&A[i]);
  scanf("%d",&m);
  for(int i=0;i<m;i++){
    scanf("%d",&q);
    if(solve(0,q)==true) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

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

cnt = 0
def merge(array):
    global cnt
    mid = (len(array))
    if mid > 1:
        left = merge(array[:(int)(mid/2)])
        right = merge(array[(int)(mid/2):])
        array = []
        while len(left) != 0 and len(right) != 0:
            if left[0] < right[0]:
                array.append(left.pop(0))
                cnt += 1
            else:
                array.append(right.pop(0))
                cnt += 1
        if len(left) != 0:
            cnt += len(left)
            array.extend(left)
        elif len(right) != 0:
            cnt += len(right)
            array.extend(right)
    return array

input()

l = merge(list(map(int,input().split())))
print(*l)
print(cnt)



Compiler output:
a.cc:1:1: error: 'cnt' does not name a type; did you mean 'int'?
    1 | cnt = 0
      | ^~~
      | int
Language: C++

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

int a[21],n;
int solve(int i, int k){
    if(k == 0)  return 1;
    if(i >= n)  return 0;
    return (solve(i+1, k)||solve(i+1, k-a[i]));
}

int main()
{
    cin>>n;
    for(int i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }
    int op;
    while(op--){
        int q;
        scanf("&d",&q);
        if(solve(0, q));
        printf("yes\n");
        else 
        printf("no\n");
    }
    return 0;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'else' without a previous 'if'
   24 |         else
      |         ^~~~
Language: C++

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

using namespace std;

string intToBinStr(int i, int digit)
{
	string str;
	while (i > 0)
	{
		str.push_back('0' + (i & 1));
		i >>= 1;
	}
	reverse(str.begin(), str.end());
	while (str.size() < digit)
	{
		str.insert(0, "0");
	}
	return str;
}

int ctoi(char ch)
{
	if ('0' <= ch && ch <= '9')
	{
		return (int)(ch - '0');
	}
	else
	{
		return 0;
	}
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int sum;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int q;
	cin >> q;
	vector<int> m(q);
	vector<bool> can_make(q, false);
	for (int i = 0; i < q; i++)
	{
		cin >> m[i];
	}
	string mask;
	for (int i = 1; i < pow(2, n); i++)
	{
		sum = 0;
		mask = intToBinStr(i, n);
		for (int j = 0; j < n; j++)
		{
			sum += ctoi(mask[j]) * a[j];
		}
		for (int j = 0; j < q; j++)
		{
			can_make[j] = can_make[j] | (sum == m[j]);
		}
	}
	for (int i = 0; i < q; i++)
	{
		if (can_make[i] == true)
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'std::string intToBinStr(int, int)':
a.cc:16:9: error: 'reverse' was not declared in this scope
   16 |         reverse(str.begin(), str.end());
      |         ^~~~~~~
Language: C++

#include<stdio.h>

int n, A[50];

例
A = {1, 5, 7} とした時
solve(0, 8)は "配列の0番目から足す / 足さない として 8が作れるか" という意味
それはつまり
1. {5, 7} で 8が作れるか（1を足さないパターン）

int solve(int i, int m)
{
	if( m == 0 ) return 1;
	if( i >= n ) return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main()
{
	int q, M, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &M);
		if(solve(0, M)) printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


Compiler output:
a.cc:5:1: error: '\U00004f8b' does not name a type
    5 | 例
      | ^~
a.cc:6:15: error: '\U00003068\U00003057\U0000305f\U00006642' does not name a type
    6 | A = {1, 5, 7} とした時
      |               ^~~~~~~~
a.cc:9:11: error: '\U00003067' does not name a type
    9 | 1. {5, 7} で 8が作れるか（1を足さないパターン）
      |           ^~
a.cc: In function 'int main()':
a.cc:32:20: error: 'solve' was not declared in this scope
   32 |                 if(solve(0, M)) printf("yes\n");
      |                    ^~~~~
Language: C++

#include <iostream>
#include <cstdio.h>

int A[100];
int n;

int solve(int i, int m)
{
	if(m == 0) {return 1;}
	if(i >= n) { return 0;}
	
	return solve(i + 1, m) || solve(i+1, m-A[i]);
}

int main()
{
	scanf("%d", &n);
	
	for(int i=0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}
	
	int q, m;
	
	scanf("%d", &q);
		
	for(int i=0; i < q; i++)
	{
		scanf("%d", &m);
		if(solve(0, m) == 1)
		{
			printf("yes\n");
		}
		else if(solve(0, m) == 0)
		{
			printf("no\n");
		}
	}
	
	return 0;
}


Compiler output:
a.cc:2:10: fatal error: cstdio.h: No such file or directory
    2 | #include <cstdio.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

def test(i, s, target):
    if s == target:
        return 1
    if s > target or i == n:
        return 0
    if s + sum(a[i:]) < target:
        return 0

    return test(i+1, s, target) or test(i+1, s+a[i], target)

for target in m:
    ans = 'yes' if test(0, 0, target) else 'no'
    print(ans)


Compiler output:
a.cc:17:11: warning: multi-character character constant [-Wmultichar]
   17 |     ans = 'yes' if test(0, 0, target) else 'no'
      |           ^~~~~
a.cc:17:44: warning: multi-character character constant [-Wmultichar]
   17 |     ans = 'yes' if test(0, 0, target) else 'no'
      |                                            ^~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
#include<stdio.h>

bool exhaustiveSearch(int i, int n, int m, int A[]) {
  if (A[i] == m) return true;
  if (i >= n - 1) return false;
  return exhaustiveSearch(i + 1, n, m, A) || exhaustiveSearch(i + 1, n, m - A[i], A);
}

int main() {
  int i, n, A[20], q, m;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);

  scanf("%d", &q);
  for ( i = 0; i < q; i++ ) {
    scanf("%d", &m);
    if (exhaustiveSearch(0, n, m, A)) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }

  return 0;
}



Compiler output:
a.cc:1:3: error: 'u' does not name a type
    1 |   u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
      |   ^
Language: C++

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

int n,A[50];

int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res=solve(i+1,m)||solve(i+1,m-a[i]);
    return res;
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int q;
    vector<int>m(q);
    for(int i=0;i<q;i++){
        cin>>m[i];
        if(solve(0,M)){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}    


Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:10:39: error: 'a' was not declared in this scope
   10 |     int res=solve(i+1,m)||solve(i+1,m-a[i]);
      |                                       ^
a.cc: In function 'int main()':
a.cc:23:20: error: 'M' was not declared in this scope
   23 |         if(solve(0,M)){
      |                    ^
Language: C++

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

int n,A[50];

int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res=solve(i+1,m)||solve(i+1,m-A[i]);
    return res;
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int q;
    vector<int>m(q);
    for(int i=0;i<q;i++){
        cin>>m[i];
        if(solve(0,M)){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:23:20: error: 'M' was not declared in this scope
   23 |         if(solve(0,M)){
      |                    ^
Language: C++

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

int n,A[50];

int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res=solve(i+1,m)||solve(i+1,m-A[i]);
    return res;
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    int q;
    vector<int>m(q);
    for(int i=0;i<q;i++){
        cin>>m[i];
        if(solve(0,m[i]){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:23:25: error: expected ')' before '{' token
   23 |         if(solve(0,m[i]){
      |           ~             ^
      |                         )
a.cc:29:5: error: expected primary-expression before '}' token
   29 |     }
      |     ^
Language: C++

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

int n,A[50];

int solve(int i,int m){
    if(m==0)return 1;
    if(i>=n)return 0;
    int res=solve(i+1,m) || solve(i+1,m-A[i]);
    return res;
}

int main(){
    int i,q;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>A[i];
    }
    int q;
    cin>>q;
    vector<int>m(q);
    for(i=0;i<q;i++){
        cin>>m[i];
        if(solve(0,m[i])){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: redeclaration of 'int q'
   20 |     int q;
      |         ^
a.cc:15:11: note: 'int q' previously declared here
   15 |     int i,q;
      |           ^
Language: C++

#include<iostream>
using namespace std;
bool solve(int i, int A[], int n, int m){
    if(m==0)    return true;
    else if(m<0 && i>=n)    return false;
    else{
        return solve(int i+1, int A[], int n, int m-A[i]);
    }
}
int main(){
    int n;
    cin>>n;
    int A[n];
    for(int i=0; i<n; i++){
        cin>>A[i];
    }
    int q;
    cin>>q;
    int m[q];
    for(int i=0; i<q; i++)
        cin>>m[i];
    for(int i=0; i<q; i++){
        if(solve(0, A, n, m[i]))    cout<<"yes"<<endl;
        else    cout<<"no"<<endl;
    }
}


Compiler output:
a.cc: In function 'bool solve(int, int*, int, int)':
a.cc:7:22: error: expected primary-expression before 'int'
    7 |         return solve(int i+1, int A[], int n, int m-A[i]);
      |                      ^~~
a.cc:7:31: error: expected primary-expression before 'int'
    7 |         return solve(int i+1, int A[], int n, int m-A[i]);
      |                               ^~~
a.cc:7:40: error: expected primary-expression before 'int'
    7 |         return solve(int i+1, int A[], int n, int m-A[i]);
      |                                        ^~~
a.cc:7:47: error: expected primary-expression before 'int'
    7 |         return solve(int i+1, int A[], int n, int m-A[i]);
      |                                               ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace  std;
int A[2000], n;
int solve (int i,int m)
{
    if(m==0) return 1;
    if(i >=n) return 0;
    int res = solve(i+1,m) || solve(i+1, m-A[i]);
    return res;
}
int main()
{
    
    cin >>n;
    for(int i = 0;i<n;i++)
    {
        cin >>A[I];
    }
    int q;
    cin >>q;
    for(int i = 0;i<q;i++)
    {
        int m;
        cin >>m;
        if(solve(0,m)) printf("yes\n");
        else printf("no\n");
    }
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'I' was not declared in this scope
   20 |         cin >>A[I];
      |                 ^
Language: C++

A#include <iostream>

using namespace std;

#define MAX 20

int dat[MAX];

int n;

bool solve(int i,int m){

    if(i>=n)
        return m==0;
    if(solve(i+1,m))
        return true;
    if(solve(i+1, m-dat[i]))
        return true;
    return false;
}

int main(){
    int m;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>dat[i];
    }
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m;
        if(solve(0,m)){
            cout<<"yes\n";
        }else{
            cout<<"no\n";
        }
    }
    return 0;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | A#include <iostream>
      |  ^
a.cc:1:1: error: 'A' does not name a type
    1 | A#include <iostream>
      | ^
a.cc: In function 'int main()':
a.cc:24:5: error: 'cin' was not declared in this scope
   24 |     cin>>n;
      |     ^~~
a.cc:32:13: error: 'cout' was not declared in this scope
   32 |             cout<<"yes\n";
      |             ^~~~
a.cc:34:13: error: 'cout' was not declared in this scope
   34 |             cout<<"no\n";
      |             ^~~~
Language: C++

#include <iostream>

using namespace std;

#define MAX 20

int dat[MAX];

int n;
int dp[100][20];

bool solve(int i,int m){
    if(dp[i][m]!=-1)
	return dp[i][m]
    if(i>=n){
	dp[i][m] = (m==0);
        return m==0;
    }
    if(solve(i+1,m)){
	dp[i][m] = 1;
        return true;
    }
    if(solve(i+1, m-dat[i])){
	dp[i][m] = 1;
        return true;
    }
    dp[i][m] = 0;
    return false;
}

int main(){
    int m;
    cin>>n;
    for(int i=0;i<100;i++){
	for(int j=0;j<20;j++){
	    dp[i][j]=-1;
	}
    }

    for(int i=0;i<n;i++){
        cin>>dat[i];
    }
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m;
        if(solve(0,m)){
            cout<<"yes\n";
        }else{
            cout<<"no\n";
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'bool solve(int, int)':
a.cc:14:24: error: expected ';' before 'if'
   14 |         return dp[i][m]
      |                        ^
      |                        ;
   15 |     if(i>=n){
      |     ~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i < int(n); i++)
typedef vector<int> VI;


int main() {
	int n;
  cin >> n;
  VI a(n);
  rep(i, n) cin >> a[i];

  int q;
  cin >> q;

  const int M_MAX = 2001:
  VI canMake(M_MAX);
  rep(st, 1 << n) {
    int val = 0;
    rep(i, n) if (st & (1 << i)) val += a[i];
    if (val < M_MAX) canMake[val] = true;
  }

  rep (qi, q) {
    int m;
    cin >> m;
    if (canMake[m]) cout << "yes\n";
    else cout << "no\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: expected ',' or ';' before ':' token
   18 |   const int M_MAX = 2001:
      |                         ^
a.cc:23:22: error: 'canMake' was not declared in this scope
   23 |     if (val < M_MAX) canMake[val] = true;
      |                      ^~~~~~~
a.cc:29:9: error: 'canMake' was not declared in this scope
   29 |     if (canMake[m]) cout << "yes\n";
      |         ^~~~~~~
Language: C++

int a[20];
bool dfs(int m,int sum,int i)
{
	if (sum + a[i] > m)return false;
	if (sum + a[i] == m)return true;
	return dfs(m, sum + a[i], i + 1) || dfs(m, sum, i + 1);
}

void A()
{
	int n;
	scanf/*_s*/("%d", &n);

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

	int q;
	scanf_s("%d", &q);
	for (int i = 0; i < q; i++)
	{
		int m = 0;
		scanf/*_s*/("%d", &m);
		if (dfs(m, 0, 0))
		{
			printf("yes");
		}
		else
		{
			printf("no");
		}
	}
}

int main()
{
	A();
	return 0;
}

Compiler output:
a.cc: In function 'void A()':
a.cc:12:9: error: 'scanf' was not declared in this scope
   12 |         scanf/*_s*/("%d", &n);
      |         ^~~~~
a.cc:20:9: error: 'scanf_s' was not declared in this scope
   20 |         scanf_s("%d", &q);
      |         ^~~~~~~
a.cc:27:25: error: 'printf' was not declared in this scope
   27 |                         printf("yes");
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int a[20];
a.cc:31:25: error: 'printf' was not declared in this scope
   31 |                         printf("no");
      |                         ^~~~~~
a.cc:31:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

int a[20];
int n;
bool dfs(int m,int sum,int i)
{
	if (i >= n)return false;
	if (sum + a[i] > m)return false;
	if (sum + a[i] == m)return true;
	return dfs(m, sum + a[i], i + 1) || dfs(m, sum, i + 1);
}

void A()
{
	scanf/*_s*/("%d", &n);

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

	int q;
	scanf/*_s*/("%d", &q);
	for (int i = 0; i < q; i++)
	{
		int m = 0;
		scanf/*_s*/("%d", &m);
		if (dfs(m, 0, 0))
		{
			printf("yes");
		}
		else
		{
			printf("no");
		}
	}
}

int main()
{
	A();
	return 0;
}

Compiler output:
a.cc: In function 'void A()':
a.cc:13:9: error: 'scanf' was not declared in this scope
   13 |         scanf/*_s*/("%d", &n);
      |         ^~~~~
a.cc:28:25: error: 'printf' was not declared in this scope
   28 |                         printf("yes");
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int a[20];
a.cc:32:25: error: 'printf' was not declared in this scope
   32 |                         printf("no");
      |                         ^~~~~~
a.cc:32:25: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#include <vector>
#include <stack>
using namespace std;

//常に心してかかれ
//簡単なことを簡単にできるように練習する

	int n;
	int A[20+1];
	int q;
	int m[200+1];
//模範解答
bool solve(int i,int m){//solve(i,m):A[i]?A[n-1]でmが作れるかどうか
	bool res;
	if(m == 0)
		return true;
	if(i >= n)
		return false;
	res = solve(i+1,m) || solve(i+1,m-A[i]);
	return res;
}

int main(){
	scanf("%d",&n);
	//printf("%d\n",n);//確認用
	for(int i=0;i<n;i++){
		scanf("%d",&A[i]);
		//printf("%d ",A[i]);//確認用
	}
	//printf("\n");//確認用
	scanf("%d",&q);
	//printf("%d\n",q);//確認用
	for(int i=0;i<q;i++){
		scanf("%d",&m[i]);
		//printf("%d ",m[i]);//確認用
	}

	for(int i=0;i<q;i++){
		if(solve(0,m[i]))
			cout <<"yes" <<endl;
		else 
			cout <<"no" <<endl;

	return 0;
}

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

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

int sum(vector<int> v){
    int sum = 0;
    for(int i=0;i<v.size();i++){
        sum +=v[i];
    }
    return sum;
}

bool gtsum(vector<int> v, x){
    if(sum(v)<x)
        return true;
    else
        return false;
}
bool hantei(vector<int> v, int x){
    if(x<0)
        return false;
    if(gtsum(v,x))
        return false;
    if(v.empty()){
        if(x==0)
            return true;
        else
            return false;
    }
    else{
        vector<int>::iterator it = v.begin();
        int first = *it;
        v.erase(it);
        vector<int> rest = v;
        return hantei(rest,x-first) || hantei(rest,x);
    }
}





int main(){
    int n; cin >> n;
    vector<int> v;
    for(int i=0;i<n;i++){
        int a; cin >> a;
        v.push_back(a);
    }
    int m; cin >> m;
    for(int i=0;i<m;i++){
        int x; cin >> x;
        if(hantei(v,x))
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}

Compiler output:
a.cc:13:27: error: 'x' has not been declared
   13 | bool gtsum(vector<int> v, x){
      |                           ^
a.cc: In function 'bool gtsum(std::vector<int>, int)':
a.cc:14:15: error: 'x' was not declared in this scope
   14 |     if(sum(v)<x)
      |               ^
a.cc:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
Language: C++

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


using namespace std;

int PP[50]={};

int tyok(int n,int i,int M){

	if(M==0)return 1;
	if(i>=n)return 0;
	int W=tyok(n,i+1,M)||tyok(n,i+1,M-PP[i]);
	return W;
}

int main(){
	int n,M,y;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>PP[i];
	cin>>y;
	for(int i=0;i<y;i++){
		cin>>M;
		if(tyok(n,0,M))cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;

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

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

void fnInput(int &rnElmCnt, vector<int> &rvnElm, int &rnTrgCnt , vector<int> &rvnTrg )
{
  cin >> rnElmCnt;

  rvnElm.resize(rnElmCnt);
  for (int i = 0; i < rnElmCnt; i++)
    cin >> rvnElm[i];

  cin >> rnTrgCnt;

  rvnTrg.resize(rnTrgCnt);
  for (int i = 0; i < rnTrgCnt; i++)
    cin >> rvnTrg[i];
}

void fnDPtblMake(vector<vector<int>> &rvvnDP, const vector<int> &cnrvnElm, int nMaxTrg)
{
  rvvnDP[cnrvnElm.size()][0] = 1;
  for (int j = 1; j <= nMaxTrg; j++)
    rvvnDP[cnrvnElm.size()][j] = 0;

  for (int i = cnrvnElm.size() - 1; i >= 0; i--)
    for (int j = 0; j <= nMaxTrg; j++)
      if (cnrvnElm[i] <= j)
        rvvnDP[i][j] = rvvnDP[i + 1][j] || rvvnDP[i + 1][j - cnrvnElm[i]];
      else
        rvvnDP[i][j] = rvvnDP[i + 1][j];

}

void fnExhSch(const vector<int> &cnrvnElm, const vector<int> &cnrvnTrg)
{
  // vector<vector<int>> vvnDP(21, vector<int>(2001, -1));

  int nMaxTrg = cnrvnTrg[0]; 
  for (int i = 1; i < cnrvnTrg.size(); i++)
    nMaxTrg = max(nMaxTrg, cnrvnTrg[i]);

  fnDPtblMake(vvnDP, cnrvnElm, nMaxTrg);

  for (int i = 0; i < cnrvnTrg.size(); i++)
    if (vvnDP[0][cnrvnTrg[i]])
      cout << "yes" << endl;
    else
      cout << "no" << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int nElmCnt, nTrgCnt;
  vector<int> vnElm, vnTrg;

  fnInput(nElmCnt, vnElm, nTrgCnt, vnTrg);
  fnExhSch(vnElm, vnTrg);

  return 0;
}

Compiler output:
a.cc: In function 'void fnExhSch(const std::vector<int>&, const std::vector<int>&)':
a.cc:43:15: error: 'vvnDP' was not declared in this scope
   43 |   fnDPtblMake(vvnDP, cnrvnElm, nMaxTrg);
      |               ^~~~~
Language: C++

#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
long powint(int a,int n)
{
   int i;
   long tmp=1;
   for(i=0;i<n;i++)
      tmp *= a;
   return tmp;
}

   
int main()
{
   static int i,j,k,l;
   int n;
   int f,g;
   int a[20];
   int q;
   int m[200];

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

   scanf("%d",&q);
   for (i = 0; i < q; i++)
      scanf("%d",&m[i]);;

   for (i = 0; i < q; i++) {
      for (j = 1; j < powint(2,n);j++) {
         g = 0;
         f = j;
         for (k = 0; k < n; k++) {
            if(f % 2) g += a[k];
            f /= 2;
         }
         if(g == m[i]) {
            m[i] = 3000;
            break;
         }
      }
   }
   for (i = 0; i < q; i++) {
      if (m[i] == 3000)
         printf("yes\n");
      else 
         printf("no\n");
   }

Compiler output:
a.cc: In function 'int main()':
a.cc:53:5: error: expected '}' at end of input
   53 |    }
      |     ^
a.cc:18:1: note: to match this '{'
   18 | {
      | ^
Language: C++

#exhaustive.rb
#

s=Array.new(20)
table=Array.new(2000,0)
table[0]=1
table2=Array.new(2000,0)

n=STDIN.gets.split[0].to_i
str=STDIN.gets.split
sum=0
0.upto(n-1) {|i|
  table2=table
  num = str[i].to_i
  0.upto(sum){|j|
    break if j+num > 2000 
    #printf("%d %d %d|",j,num,j+num) if table[j]==1
    table2[j+num]=1 if table[j]==1
  } 
  sum += num
  table=table2
}

q=STDIN.gets.split[0].to_i
str=STDIN.gets.split


0.upto(q-1){|i|
  m=str[i].to_i

  puts (table[m]==1)?"Yes":"No"
}
  

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #exhaustive
    1 | #exhaustive.rb
      |  ^~~~~~~~~~
a.cc:17:6: error: invalid preprocessing directive #printf
   17 |     #printf("%d %d %d|",j,num,j+num) if table[j]==1
      |      ^~~~~~
a.cc:4:1: error: 's' does not name a type
    4 | s=Array.new(20)
      | ^
a.cc:24:1: error: 'q' does not name a type
   24 | q=STDIN.gets.split[0].to_i
      | ^
Language: C++

n = input()
  
A = map(int, raw_input().split())

q = input()
   
M = map(int, raw_input().split())
  
def solve(i, m):
  if m == 0:
    return True
  if i >= n:
    return False
  res = solve(i+1, m) or solve(i+1, m - A[i])
  return res
  
  
for m in M:
  if solve(0,m):
    print "yes"
  else:
    print "no"

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

n = input()
A = map(int,raw_input().split())
Q = input()
m = map(int,raw_input().split())

def s(i, m):
  if m == 0:
    return True
  if i >= n or m > sum(A):
    return False
  r = s(i + 1, m) or s(i + 1, m) or s(i + 1, m - A[i])
  return r

  for j in range(Q):
    if s(0, m) == True:
      print "yes"
    else:
      print "no"
  
  

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



import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	int n,q,solvePoint;
	int[] A,m;
	boolean[] isSolve;
	
	public void run(){
		
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		A = new int[n];
		
		for (int i = 0; i < n; i++) {
			A[i]= sc.nextInt();
		}
		q = sc.nextInt();
		m = new int[q];
		
		for (int i = 0; i < m.length; i++) {
			m[i]= sc.nextInt();
		}
		isSolve = new boolean[q];
		Arrays.fill(isSolve,false);
		
		solvePoint = 0;
		
		for (int i = 0; i < m.length; i++) {
			solve(0, m[i]);
			solvePoint++;
			if(isSolve[i]){
				System.out.println("yes");
			}
			else{
				System.out.println("no");
			}
		}
		
	}
	public void solve(int i,int mi){
		
		if(i==n){
			if (mi==0) {
				isSolve[solvePoint]= true;
			}
			return;
		}
		
		solve(i+1,mi);
		solve(i+1,mi-A[i]);
	}
}

Compiler output:
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Arrays;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Scanner;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main {
      | ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int solve(int i, int m){
	if (m == 0) return 1;
	if (i >= n) return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main(){
	int n, q, A[20], m;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	cin >> q;
	while (cin >> m){
		if (solve(0, m)) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:6:18: error: 'n' was not declared in this scope
    6 |         if (i >= n) return 0;
      |                  ^
a.cc:7:55: error: 'A' was not declared in this scope
    7 |         int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
      |                                                       ^
Language: C++

#include <iostream>

int n,A[50];

//??\?????????M???????????????????´????????????????????????°??¢??°
int solve (int i, int m){
    if( m == 0 ) return 1;
    if( i >= n ) return 0;
    int res = solve (i + 1,m) || solve(i+1,m-A[i]);
    return res;
}

int main (){
    int q,M,i;

    cin >> n;
    for (int i = 0; i < n ; ++i) {
        cin >> A[i];
    }
    cin >> q;
    for (int i = 0; i < q ; ++i) {
        cin >> m;
        if(solve (0,M)) cout << "yes" << endl;
        else cout << "no" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   16 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:16: error: 'm' was not declared in this scope
   22 |         cin >> m;
      |                ^
a.cc:23:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   23 |         if(solve (0,M)) cout << "yes" << endl;
      |                         ^~~~
      |                         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:23:42: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   23 |         if(solve (0,M)) cout << "yes" << endl;
      |                                          ^~~~
      |                                          std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:24:14: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |         else cout << "no" << endl;
      |              ^~~~
      |              std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 |         else cout << "no" << endl;
      |                              ^~~~
      |                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <stdio.h>
#define N 20
#define Q 200
#define a 2000
#define M 2000

int A[];
int m[];

int main(){
  int n,q,i;

  scanf("%d",&n);
  if(n>N){
    printf("error!\n");exit(1);
  }
  for(i=0 ; i<n ; i++){
    scanf(%d,&A[i]);
  }
  
  scanf("%d",&q);
  if(q>Q){
    printf("error!\n");exit(2);
  }
 for(i=0 ; i<n ; i++){
    scanf(%d,&m[i]);
  }

 for(i=n ; i>0 ; i--){
   for(j=0 ; j<q ; j++){
     resursive(i,j)

 resursive()

	      int resursive(int n,int m){
A[n]

Compiler output:
a.cc:7:5: error: storage size of 'A' isn't known
    7 | int A[];
      |     ^
a.cc:8:5: error: storage size of 'm' isn't known
    8 | int m[];
      |     ^
a.cc: In function 'int main()':
a.cc:15:24: error: 'exit' was not declared in this scope
   15 |     printf("error!\n");exit(1);
      |                        ^~~~
a.cc:2:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
    1 | #include <stdio.h>
  +++ |+#include <cstdlib>
    2 | #define N 20
a.cc:18:11: error: expected primary-expression before '%' token
   18 |     scanf(%d,&A[i]);
      |           ^
a.cc:18:12: error: 'd' was not declared in this scope
   18 |     scanf(%d,&A[i]);
      |            ^
a.cc:23:24: error: 'exit' was not declared in this scope
   23 |     printf("error!\n");exit(2);
      |                        ^~~~
a.cc:23:24: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
a.cc:26:11: error: expected primary-expression before '%' token
   26 |     scanf(%d,&m[i]);
      |           ^
a.cc:26:12: error: 'd' was not declared in this scope
   26 |     scanf(%d,&m[i]);
      |            ^
a.cc:30:8: error: 'j' was not declared in this scope
   30 |    for(j=0 ; j<q ; j++){
      |        ^
a.cc:31:6: error: 'resursive' was not declared in this scope
   31 |      resursive(i,j)
      |      ^~~~~~~~~
a.cc:36:5: error: expected '}' at end of input
   36 | A[n]
      |     ^
a.cc:30:24: note: to match this '{'
   30 |    for(j=0 ; j<q ; j++){
      |                        ^
a.cc:36:5: error: expected '}' at end of input
   36 | A[n]
      |     ^
a.cc:29:22: note: to match this '{'
   29 |  for(i=n ; i>0 ; i--){
      |                      ^
a.cc:36:5: error: expected '}' at end of input
   36 | A[n]
      |     ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^
Language: C++

//ALDS1_5A_2
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int n,k;
vector<int> A(2000);
vector<bool> dp(200,false);

bool solve(){
 dp.at(0)=true;
 for(int i=0;i<n;i++){
  for(int j=0;j<=k;j++){
   if(dp.at(j)==true && j-A.at(i)>==0){
    dp.at(j-A.at(i))=true;
   }
  }
 }
 if(dp(at(0)) return true;
 return false;
}

int main(){
 int q;
 scanf("%d",&n);
 for(int i=0;i<n;i++) scanf("%d",A.at(i));
 scanf("%d",&q);
 for(int i=0;i<q;i++){
  scanf("%d",&k);
  if(solve()) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:16:36: error: expected primary-expression before '=' token
   16 |    if(dp.at(j)==true && j-A.at(i)>==0){
      |                                    ^
a.cc:21:8: error: 'at' was not declared in this scope
   21 |  if(dp(at(0)) return true;
      |        ^~
a.cc:22:2: error: expected primary-expression before 'return'
   22 |  return false;
      |  ^~~~~~
a.cc:21:27: error: expected ')' before 'return'
   21 |  if(dp(at(0)) return true;
      |    ~                      ^
      |                           )
   22 |  return false;
      |  ~~~~~~                    
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: C++

//ALDS1_5A_2
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

int n,k;



bool solve(){
 dp.at(0)=true;
 for(int i=0;i<n;i++){
  for(int j=0;j<=k;j++){
   if(dp.at(j)==true && j-A.at(i)>==0){
    dp.at(j-A.at(i))=true;
   }
  }
 }
 if(dp(at(0)) return true;
 return false;
}

int main(){
 int q;
 scanf("%d",&n);
 vector<int> A(n);
 for(int i=0;i<n;i++) scanf("%d",A.at(i));
 scanf("%d",&q);
 for(int i=0;i<q;i++){
  scanf("%d",&k);
  vector<bool> dp(k,false);
 if(solve()) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:13:2: error: 'dp' was not declared in this scope
   13 |  dp.at(0)=true;
      |  ^~
a.cc:16:27: error: 'A' was not declared in this scope
   16 |    if(dp.at(j)==true && j-A.at(i)>==0){
      |                           ^
a.cc:16:36: error: expected primary-expression before '=' token
   16 |    if(dp.at(j)==true && j-A.at(i)>==0){
      |                                    ^
a.cc:21:8: error: 'at' was not declared in this scope
   21 |  if(dp(at(0)) return true;
      |        ^~
a.cc:22:2: error: expected primary-expression before 'return'
   22 |  return false;
      |  ^~~~~~
a.cc:21:27: error: expected ')' before 'return'
   21 |  if(dp(at(0)) return true;
      |    ~                      ^
      |                           )
   22 |  return false;
      |  ~~~~~~                    
a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
   23 | }
      | ^
Language: C++

#include <iostream>
#include <list> //???????????????????????????
#include <vector>//????????¢??????????????????
#include <climits>
using namespace std;


bool solve(int i, int m , vector <int> A){
	if (m == 0){
		return true;
	}
	
	int n= A.size();
	
	if (i >= n){
		return false;
	}
	
	bool res = solve(i + 1, m, A) || solve(i + 1, m - A[i], A);
	return res;

}

void main(void){
	int n;
	cin >> n;
	vector <int> A(n);
	for(int i=0 ; i < n; i++){
		cin >> A[i];
	}
	int q;
	cin >> q;
	vector <int> mi(q);
	for(int i=0 ; i < q; i++){
		cin >> mi[i];
		
		
	}
	
	
	//for(int i =0 ; i < n ; i++){
	for(int j =0 ; j < q ; j++){
		//solve(0,mi[j],A);
		if(solve(0,mi[j],A)){
			cout << "yes" << endl;
		}else cout << "no" << endl;
	}
		
	//}

}

Compiler output:
a.cc:24:1: error: '::main' must return 'int'
   24 | void main(void){
      | ^~~~
Language: C++

#include <iostream>
#include <list> //???????????????????????????
#include <vector>//????????¢??????????????????
#include <climits>
using namespace std;


bool solve(int i, int m , vector <int> A){
	if (m == 0){
		return true;
	}
	
	int n= A.size();
	
	if (i >= n){
		return false;
	}
	
	bool res = solve(i + 1, m, A) || solve(i + 1, m - A[i], A);
	return res;

}

void main(void){
	int n;
	cin >> n;
	vector <int> A(n);
	for(int i=0 ; i < n; i++){
		cin >> A[i];
	}
	int q;
	cin >> q;
	vector <int> mi(q);
	for(int i=0 ; i < q; i++){
		cin >> mi[i];
		
		
	}
	
	
	
	for(int j =0 ; j < q ; j++){
		//solve(0,mi[j],A);
		if(solve(0,mi[j],A)){
			cout << "yes" << endl;
		}else cout << "no" << endl;
	}
		
	

}

Compiler output:
a.cc:24:1: error: '::main' must return 'int'
   24 | void main(void){
      | ^~~~
Language: C++

#include <iostream>
#include <list> //???????????????????????????
#include <vector>//????????¢??????????????????
#include <climits>
using namespace std;


bool solve(int i, int m , vector <int> A){
	if (m == 0){
		return true;
	}
	
	int n= A.size();
	
	if (i >= n){
		return false;
	}
	
	bool res = solve(i + 1, m, A) || solve(i + 1, m - A[i], A);
	return res;

}

void main(void){
	int n;
	cin >> n;
	vector <int> A(n);
	for(int i=0 ; i < n; i++){
		cin >> A[i];
	}
	int q;
	cin >> q;
	vector <int> mi(q);
	for(int i=0 ; i < q; i++){
		cin >> mi[i];
		
		
	}
	
	
	
	for(int j =0 ; j < q ; j++){
		//solve(0,mi[j],A);
		if(solve(0,mi[j],A)){
			cout << "yes" << endl;
		}else {cout << "no" << endl;}
	}
		
	

}

Compiler output:
a.cc:24:1: error: '::main' must return 'int'
   24 | void main(void){
      | ^~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
 
using namespace std;


int n, q = 0;
vector<int>A;
vector<int>M;


bool solve(int depth, int value)
{
    if(depth == (n - 1)) return (value == 0);

    if(solve(depth + 1, value)) return true;
    
    if(solve(depth + 1, value - A[depth])) return true;
    
    return false;
}


int main(void)
{
    //input
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        int tmp;
        scanf("%d", &tmp);
        A.push_back(tmp);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; ++i) {
        int tmp;
        scanf("%d", &tmp);
        M.push_back(tmp);
    }
    
    for (int i = 0; i < q; ++i) {
        if(solve(0, M)) cout << "yes" << endl;
        else            cout << "no" << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:21: error: cannot convert 'std::vector<int>' to 'int'
   53 |         if(solve(0, M)) cout << "yes" << endl;
      |                     ^
      |                     |
      |                     std::vector<int>
a.cc:24:27: note:   initializing argument 2 of 'bool solve(int, int)'
   24 | bool solve(int depth, int value)
      |                       ~~~~^~~~~
Language: C++

#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <iostream>
using namespace std;
int saiki(int, int);
int n, A[20], m, q[200] = { 0 }, x;
int main(void)
{
	scanf_s("%d", &n);
	for (int i = 0; i < n; i++) { scanf_s("%d", &A[i]); }
	scanf_s("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf_s("%d", &x);
		q[i] = saiki(0, 0);
	}
	for (int i = 0; i < m; i++) {
		if (q[i]) { printf("yes\n"); }
		else { printf("no\n"); }
	}
}
int saiki(int s, int l)
{
	for (int i = l; i < n; i++) {
		if (A[i] + s == x) { return 1; }
		if (A[i] + s < x) { 
			if (saiki(A[i] + s, i + 1)) return 1;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   13 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#define scanf scanf_s

#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <iostream>
using namespace std;
int saiki(int, int);
int n, A[20], m, q[200] = { 0 }, x;
int main(void)
{
	scanf_s("%d", &n);
	for (int i = 0; i < n; i++) { scanf_s("%d", &A[i]); }
	scanf_s("%d", &m);
	for (int i = 0; i < m; i++) {
		scanf_s("%d", &x);
		q[i] = saiki(0, 0);
	}
	for (int i = 0; i < m; i++) {
		if (q[i]) { printf("yes\n"); }
		else { printf("no\n"); }
	}
}
int saiki(int s, int l)
{
	for (int i = l; i < n; i++) {
		if (A[i] + s == x) { return 1; }
		if (A[i] + s < x) { 
			if (saiki(A[i] + s, i + 1)) return 1;
		}
	}
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from a.cc:3:
/usr/include/c++/14/cstdio:134:11: error: 'scanf' has not been declared in '::'
  134 |   using ::scanf;
      |           ^~~~~
Language: C++

/*Exhaustive Search*/
#include<iostream>
using namespcae std;
bool solve(int i,int m){
  if(m == 0) return true;
  if(i >= n) return false;
  res = solve(i+1, m) || solve(i+1, m-a[i]);
  return res;
}
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) 
    cin >> a[i];
  int q;
  cin >> q;
  while(q--){
    int m;
    cin >> m;
    if(solve(0,m)) 
      cout << "yes";
    else
      cout << "no";
    cout << endl;
  }
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespcae'
    3 | using namespcae std;
      |       ^~~~~~~~~
a.cc: In function 'bool solve(int, int)':
a.cc:6:11: error: 'n' was not declared in this scope
    6 |   if(i >= n) return false;
      |           ^
a.cc:7:3: error: 'res' was not declared in this scope
    7 |   res = solve(i+1, m) || solve(i+1, m-a[i]);
      |   ^~~
a.cc:7:39: error: 'a' was not declared in this scope
    7 |   res = solve(i+1, m) || solve(i+1, m-a[i]);
      |                                       ^
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:22:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 |       cout << "yes";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |       cout << "no";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   25 |     cout << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:25:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   25 |     cout << endl;
      |             ^~~~
      |             std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

/*Exhaustive Search*/
#include<iostream>
using namespace std;
bool solve(int i,int m){
  if(m == 0) return true;
  if(i >= n) return false;
  res = solve(i+1, m) || solve(i+1, m-a[i]);
  return res;
}
int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) 
    cin >> a[i];
  int q;
  cin >> q;
  while(q--){
    int m;
    cin >> m;
    if(solve(0,m)) 
      cout << "yes";
    else
      cout << "no";
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'bool solve(int, int)':
a.cc:6:11: error: 'n' was not declared in this scope
    6 |   if(i >= n) return false;
      |           ^
a.cc:7:3: error: 'res' was not declared in this scope
    7 |   res = solve(i+1, m) || solve(i+1, m-a[i]);
      |   ^~~
a.cc:7:39: error: 'a' was not declared in this scope
    7 |   res = solve(i+1, m) || solve(i+1, m-a[i]);
      |                                       ^
Language: C++

/*Exhaustive Search*/
#include<iostream>
using namespace std;
bool solve(int i, int m, int n,int A[]){
  if(m == 0) 
    return true;
  else if(i >= n) 
    return false;
  else 
    return res = solve(i+1, m, n, A) || solve(i+1, m-a[i], n, A);
}
int main(){
  int n, m, q;
  cin >> n;
  int A[n];
  for(int i = 0; i < n; i++) 
    cin >> A[i];
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> m;
    if(solve(0, m, n, A)) 
      cout << "yes";
    else
      cout << "no";
    cout << endl;
  }
}

Compiler output:
a.cc: In function 'bool solve(int, int, int, int*)':
a.cc:10:12: error: 'res' was not declared in this scope
   10 |     return res = solve(i+1, m, n, A) || solve(i+1, m-a[i], n, A);
      |            ^~~
a.cc:10:54: error: 'a' was not declared in this scope
   10 |     return res = solve(i+1, m, n, A) || solve(i+1, m-a[i], n, A);
      |                                                      ^