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

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

bool solve(vector<int> &a, int m, int s) {
    if (s <= 0) return false;
    if ( m==0 ) {
        return true;
    } else if (m > 0) {
        return solve(a, m-a[s], s-1) || solve(a, m, s-1);
    } else {
        return false;
    }
}

int main() {
    int n, q;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    cin >> q;
    vector<int> m(q)
    for (int i=0; i<q; i++) cin >> m[i];
    
    for (int i=0; i<q; i++) {
        if ( solve(a, m[i], a.size()-1) ) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    } 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: expected ',' or ';' before 'for'
   23 |     for (int i=0; i<q; i++) cin >> m[i];
      |     ^~~
a.cc:23:19: error: 'i' was not declared in this scope
   23 |     for (int i=0; i<q; i++) cin >> m[i];
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
bool res[40001];

void Brute_Force() {
	for (int i = 0; i < (1 << n); i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			if (i & (1 << j)) {
				sum += A[j];
			}
		}
		res[sum] = true;
	}
}

int main()
{
	int n, q, A[20], m;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> A[i];
	Brute_Force();
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> m;
		cout << (res[m] ? "yes" : "no") << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void Brute_Force()':
a.cc:6:35: error: 'n' was not declared in this scope
    6 |         for (int i = 0; i < (1 << n); i++) {
      |                                   ^
a.cc:10:40: error: 'A' was not declared in this scope
   10 |                                 sum += A[j];
      |                                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n, q, A[20], m;
bool res[40001];

void DP() {
	res[0] = true;
	for (int i = 0; i < n; i++) {
		for (int j = 40000 - A[i]; j >= 0;j--) {
			if (res[j]) {
				res[j + A[j]] = true;
			}
		}
	}
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> A[i];
	Brute_Force();
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> m;
		cout << (res[m] ? "yes" : "no") << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'Brute_Force' was not declared in this scope
   22 |         Brute_Force();
      |         ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

bool Check(const std::vector<int>::const_iterator It, int m)
{
    if(m == 0) return true;
    if(m <  0) return false;
    if(*It == -1) return false;
    return
        Check(It+1, m - *It) ||
        Check(It+1, m);
}

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n;
    std::cin >> n;
    std::vector<int> A;
    A.reserve(std::pow(2, n));
    for(int i = 0; i < n; ++i){
        int a;
        std::cin >> a;
        int size = A.size();
        for(int j = 0; j < size; ++j){
            A.push_back(A[j] + a);
        }
        A.push_back(a);
    }
    std::sort(A.begin(), A.end());
    
    int q;
    std::cin >> q;
    for(int i = 0; i < q; ++i){
        int m;
        std::cin >> m;
        std::cout << (std::binary_search(A.begin(), A.end(), m) ? "yes" : "no") << std::endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:20: error: 'pow' is not a member of 'std'
   22 |     A.reserve(std::pow(2, n));
      |                    ^~~
Language: C++

#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A&lang=jp
#??¨??¢?´¢

def exhaustive_search(target_list,m):
    t = []
    for i in range(len(target_list)):
        result = m - target_list[i]
        if result == 0:
            return True
        elif result > 0:
            t.append(exhaustive_search(target_list[i+1:], result))

    if True in t:
        return True
    
    return False

if __name__ == "__main__":
    input_data = []
    for i in range(4):
        input_data.append(input())

    target_list = [int(d) for d in input_data[1].split()]
    m_list = [int(d) for d in input_data[3].split()]

    for m in m_list:
        if exhaustive_search(target_list,m):
            print("yes")
        else:
            print("no")

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #http
    1 | #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A&lang=jp
      |  ^~~~
a.cc:2:2: error: invalid preprocessing directive #?
    2 | #??¨??¢?´¢
      |  ^
a.cc:2:7: error: extended character ¢ is not valid in an identifier
    2 | #??¨??¢?´¢
      |       ^
a.cc:2:9: error: extended character ¢ is not valid in an identifier
    2 | #??¨??¢?´¢
      |         ^
a.cc:4:1: error: 'def' does not name a type
    4 | def exhaustive_search(target_list,m):
      | ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>

#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
bool dp[20][201];


int main(){
	int n,a,qn,q;
	vector<int> A;
	cin >> n;
	REP(i,n){cin>>a;dp[i][a]=true;A.push_back(a);}
	cin >> qn;

	for(int j=1;j<n;j++){
		for(int k =0,k<202;k++){
			dp[j][k] |= dp[j-1][k]; 
			if(A[j] <= k) dp[j][k] |= dp[j-1][k-A[j]];
		}
	}
	REP(i,qn){
		cin >> q;cout<< ((dp[n-1][q])?"yes":"no") << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:31: error: expected ';' before '<' token
   24 |                 for(int k =0,k<202;k++){
      |                               ^
      |                               ;
a.cc:24:31: error: expected primary-expression before '<' token
Language: C++

#include<stdio.h>

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(){
 
  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 if{
      printf("no\n");
    }

  return 0;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:36:13: error: expected '(' before '{' token
   36 |     }else if{
      |             ^
      |             (
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:20:11: note: to match this '{'
   20 | int main(){
      |           ^
Language: C++

#include<stdio.h>

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(){
 
  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: In function 'int main()':
a.cc:42:2: error: expected '}' at end of input
   42 | }
      |  ^
a.cc:20:11: note: to match this '{'
   20 | int main(){
      |           ^
Language: C++

#include<stdio.h>

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(){
 
  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 if{
      printf("no\n");
    }

  }

  return 0;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:36:13: error: expected '(' before '{' token
   36 |     }else if{
      |             ^
      |             (
Language: C++

#include<stdio.h>

int A[50],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(){
 
  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 if{
      printf("no\n");
    }

  }

  return 0;

} 

Compiler output:
a.cc: In function 'int main()':
a.cc:36:13: error: expected '(' before '{' token
   36 |     }else if{
      |             ^
      |             (
Language: C++

#include<stdio.h>

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 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: In function 'int main()':
a.cc:19:23: error: expected ';' before 'for'
   19 |         scanf("%d",&q)
      |                       ^
      |                       ;
   20 |         for(i=0;i<q;i++){
      |         ~~~            
a.cc:20:24: error: expected ';' before ')' token
   20 |         for(i=0;i<q;i++){
      |                        ^
      |                        ;
Language: C++

#include<stdio.h>
??
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 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:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:11:1: error: expected unqualified-id before '?' token
   11 | ??
      | ^
Language: C++

#include<stdio.h>
??
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 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:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ??
      | ^
Language: C++

#include<stdio.h>
??
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 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:2:1: error: expected unqualified-id before '?' token
    2 | ??
      | ^
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:15:1: error: expected unqualified-id before '?' token
   15 | ??
      | ^
Language: C++

#include <cstdio>
int n;
int A[20];

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

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

Compiler output:
a.cc:5:12: error: 'i' was not declared in this scope
    5 | bool solve(i, m) {
      |            ^
a.cc:5:15: error: 'm' was not declared in this scope
    5 | bool solve(i, m) {
      |               ^
a.cc:5:16: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | bool solve(i, m) {
      |                ^
a.cc: In function 'int main()':
a.cc:19:14: error: 'solve' cannot be used as a function
   19 |     if (solve(0, m))
      |         ~~~~~^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 100;

int n,q;
int a[maxn],m,num;

bool solve(int i,int m)
{
    bool res;
    if(m == 0) return true;
    if(i >= n) return false;

   // cout << i << " " << m << " " <<res <<endl;
    res = solve(i+1,m) || solve(i+1,m-a[i]);
    return res;
}

int main()
{
    scanf("%d",&n);
    fill(a,a + n, 0);
    for(int i = 0; i < n; ++i) scanf("%d",&a[i]);
    scanf("%d",&q);
    sort(a,a+n);
    for(int 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: In function 'int main()':
a.cc:26:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |     sort(a,a+n);
      |     ^~~~
      |     short
Language: C++

#include<stdio.h>

int n,A[20];

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;
}





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;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'solve' was not declared in this scope
   13 |     if(solve(0,M))printf("yes\n");
      |        ^~~~~
Language: C++

from collections import deque

class MyClass():    
    def load(self):
        self.n = input()
        self.A = map(int,raw_input().split())
        self.q = input()
        self.M = map(int,raw_input().split())

    def main(self):
        self.load()
        W = map(self.solve,self.M)
        for w in W:
            print w

    def solve(self,m):
        qA = deque(self.A)
        for j in range(self.n):
            w = self.rec(m,qA)
            if w:
                break
            qA.popleft()            
        if w:
            return "yes"
        else:
            return "no"

    def rec(self,m,A):
        Ac = deque(list(A))
        Ad = deque(list(A))
        m_new = m
        if m_new == 0:
            r1 = True
        elif m_new < 0:
            r1 = False
        else:
            if len(A) == 1:
                r1 = False
            else:
                Ac.popleft()
                r1 = self.rec(m_new,Ac)
        m_new = m - Ad[0]
        if m_new == 0:
            r2 = True
        elif m_new < 0:
            r2 = False
        else:
            if len(A) == 1:
                r2 = False
            else:
                Ad.popleft()
                r2 = self.rec(m_new,Ad)
        if r1 or r2:
            return True
        else:
            return False

if __name__ == "__main__":
    MC = MyClass()
    MC.main()

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

from collections import deque

class MyClass():    
    def load(self):
        self.n = input()
        self.A = map(int,raw_input().split())
        self.q = input()
        self.M = map(int,raw_input().split())

    def main(self):
        self.load()
        W = map(self.solve,self.M)
        for w in W:
            print w

    def solve(self,m):
        qA = deque(self.A)
        for j in range(self.n):
            w = self.rec(m,qA)
            if w:
                break
            qA.popleft()            
        if w:
            return "yes"
        else:
            return "no"

    def rec(self,m,A):
        Ac = deque(list(A))
        Ad = deque(list(A))
        m_new = m
        if m_new < 0:
            r1 = False
        elif m_new == 0:
            r1 = True
        else:
            if len(A) == 1:
                r1 = False
            else:
                Ac.popleft()
                r1 = self.rec(m_new,Ac)
        m_new = m - Ad[0]
        if m_new < 0:
            r2 = False
        elif m_new == 0:
            r2 = True
        else:
            if len(A) == 1:
                r2 = False
            else:
                Ad.popleft()
                r2 = self.rec(m_new,Ad)
        if r1 or r2:
            return True
        else:
            return False
if __name__ == "__main__":
    MC = MyClass()
    MC.main()

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

#include<iostream>

int n, A[21], q, m[201];

bool solve(int i, int m) {
  if ( m == 0 ) return true;
  else if ( i >= n ) return false;
  bool 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];

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

  return 0;
}

Compiler output:
a.cc: In function 'bool solve(int, int)':
a.cc:8:12: error: expected initializer before 'solve'
    8 |   bool res solve(i + 1, m) || solve(i + 1, m - A[i]);
      |            ^~~~~
a.cc:9:10: error: 'res' was not declared in this scope
    9 |   return res;
      |          ^~~
a.cc: In function 'int main()':
a.cc:14:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   14 |   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:20:27: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |     if ( solve(0, m[i]) ) cout << "yes\n";
      |                           ^~~~
      |                           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |     else cout << "no\n";
      |          ^~~~
      |          std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<stdio.h>
#define MAX 20

int A[MAX];

bool check(int n,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, m;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", m);
		if (check(0,m)){
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
}

Compiler output:
a.cc: In function 'bool check(int, int)':
a.cc:8:13: error: 'i' was not declared in this scope
    8 |         if (i >= n)return 0;
      |             ^
a.cc:9:25: error: 'i' was not declared in this scope
    9 |         int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
      |                         ^
a.cc:9:19: error: 'solve' was not declared in this scope
    9 |         int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
      |                   ^~~~~
Language: C++

#include<stdio.h>
#define MAX 20

int A[MAX];

bool check(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, m;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", m);
		if (check(0,m)){
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
}

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

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;

bool judge(const int a[], int n, int m);

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

bool judge(const int a[], int n, int m)
{
	int p = pow(2, n);
	for (int i = 0; i < p; i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			if (i & pow(2, j)) sum += a[j];
		}
		if (sum == m) return true;
	}
	return false;
}

Compiler output:
a.cc: In function 'bool judge(const int*, int, int)':
a.cc:35:31: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator&'
   35 |                         if (i & pow(2, j)) sum += a[j];
      |                             ~ ^ ~~~~~~~~~
      |                             |      |
      |                             int    __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

#include<stdio.h>

#define N 2000;

int a[N],n, sum;

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

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

  sum = 0;
  scanf("%d",&n);

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

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

  }
  return 0;
}

Compiler output:
a.cc:3:15: error: expected ']' before ';' token
    3 | #define N 2000;
      |               ^
a.cc:5:7: note: in expansion of macro 'N'
    5 | int a[N],n, sum;
      |       ^
a.cc:5:8: error: expected unqualified-id before ']' token
    5 | int a[N],n, sum;
      |        ^
a.cc: In function 'int check(int, int)':
a.cc:8:6: error: 'sum' was not declared in this scope
    8 |   if(sum < m)return 0;
      |      ^~~
a.cc:10:11: error: 'n' was not declared in this scope
   10 |   if(i >= n)return 0;
      |           ^
a.cc:11:38: error: 'a' was not declared in this scope
   11 |   return check(i+1,m) || check(i+1,m-a[i]);
      |                                      ^
a.cc: In function 'int main()':
a.cc:17:3: error: 'sum' was not declared in this scope
   17 |   sum = 0;
      |   ^~~
a.cc:18:15: error: 'n' was not declared in this scope
   18 |   scanf("%d",&n);
      |               ^
a.cc:21:17: error: 'a' was not declared in this scope
   21 |     scanf("%d",&a[i]);
      |                 ^
Language: C++

#include<iostream>
using namespace std;
int a[21],n,q,b[210];

int solve(i,m)
{
	if(m==0)return 1;
	else 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;cin>>a[i++]);
	cin>>q;
	for(int i=0;i<n;cin>>b[i++]);
	for(int i=0;i<q;i++)
	{
		if(solve(0,b[i])==1)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}

Compiler output:
a.cc:5:11: error: 'i' was not declared in this scope
    5 | int solve(i,m)
      |           ^
a.cc:5:13: error: 'm' was not declared in this scope; did you mean 'tm'?
    5 | int solve(i,m)
      |             ^
      |             tm
a.cc:5:14: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int solve(i,m)
      |              ^
a.cc: In function 'int main()':
a.cc:21:25: error: 'solve' cannot be used as a function
   21 |                 if(solve(0,b[i])==1)cout<<"yes"<<endl;
      |                    ~~~~~^~~~~~~~
Language: C++

#include<stdio.h>

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 mein() {
	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:
/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++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

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 mein() {
	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:
/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 <cstdio>
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,A[20],q,M;
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",A[i]);
  scanf("%d",&q);
  for(int 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: In function 'int solve(int, int)':
a.cc:5:8: error: 'n' was not declared in this scope
    5 |   if(i>n)return 0;
      |        ^
a.cc:6:37: error: 'A' was not declared in this scope
    6 |   int res=solve(i+1,m)||solve(i+1,m-A[i]);
      |                                     ^
Language: C++

#include <iostream>
#include <utility>
#include <vector>

using namespace std;

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 q;
    cin >> q;
    for (int l = 0; l < q; ++l) {
        int m;
        cin >> m;

        vector<int> available;
        for (int i : v) {
            vector<int> tmp;
            tmp.push_back(i);
            for (int j : available) {
                tmp.push_back(j);
                tmp.push_back(i + j);
            }
            swap(available, tmp);
        }

        if (find(begin(available), end(available), m) != end(available)) {
            cout << "yes" << endl;
        }
        else {
            cout << "no" << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   35 |         if (find(begin(available), end(available), m) != end(available)) {
      |             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:35:17: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   35 |         if (find(begin(available), end(available), m) != end(available)) {
      |             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

\#include<stdio.h>
using namespace std;

void slove(int i,int m,int a[],int n);
int main()
{
	int i,n,qn;
	bool j;
	int a[2000],q[200],s[20];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
	}
	for(i=0;i<n;++){
		s[i]=0;
	}
	for(i=0;i<qn;i++){
		j=slove(0,q[i],a,n);
		if ( j ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	
}

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

Compiler output:
a.cc:1:1: error: stray '\' in program
    1 | \#include<stdio.h>
      | ^
a.cc:1:2: error: stray '#' in program
    1 | \#include<stdio.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | \#include<stdio.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin >> n;
      |         ^~~
a.cc:15:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:18:23: error: expected primary-expression before ')' token
   18 |         for(i=0;i<n;++){
      |                       ^
a.cc:22:24: error: void value not ignored as it ought to be
   22 |                 j=slove(0,q[i],a,n);
      |                   ~~~~~^~~~~~~~~~~~
a.cc:24:25: error: 'cout' was not declared in this scope
   24 |                         cout << "yes" << endl;
      |                         ^~~~
a.cc:24:42: error: 'endl' was not declared in this scope
   24 |                         cout << "yes" << endl;
      |                                          ^~~~
a.cc:26:25: error: 'cout' was not declared in this scope
   26 |                         cout << "no" << endl;
      |                         ^~~~
a.cc:26:41: error: 'endl' was not declared in this scope
   26 |                         cout << "no" << endl;
      |                                         ^~~~
a.cc: At global scope:
a.cc:32:6: error: ambiguating new declaration of 'bool slove(int, int, int*, int)'
   32 | bool slove(int i,int m,int a[],int n)
      |      ^~~~~
a.cc:4:6: note: old declaration 'void slove(int, int, int*, int)'
    4 | void slove(int i,int m,int a[],int n);
      |      ^~~~~
a.cc: In function 'bool slove(int, int, int*, int)':
a.cc:37:19: error: could not convert 'slove((i + 1), m, a, n)' from 'void' to 'bool'
   37 |         res =slove(i+1,m,a,n) || slove(i+1,m-a[i],a,n);
      |              ~~~~~^~~~~~~~~~~
a.cc:37:39: error: could not convert 'slove((i + 1), (m - (*(a + ((sizetype)(((long unsigned int)i) * 4))))), a, n)' from 'void' to 'bool'
   37 |         res =slove(i+1,m,a,n) || slove(i+1,m-a[i],a,n);
      |                                  ~~~~~^~~~~~~~~~~~~~~~
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

void slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200],s[20];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
	}
	for(i=0;i<n;++){
		s[i]=0;
	}
	for(i=0;i<qn;i++){
		j=slove(0,q[i],a,n);
		if ( j ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:19:23: error: expected primary-expression before ')' token
   19 |         for(i=0;i<n;++){
      |                       ^
a.cc:23:24: error: void value not ignored as it ought to be
   23 |                 j=slove(0,q[i],a,n);
      |                   ~~~~~^~~~~~~~~~~~
a.cc:25:25: error: 'cout' was not declared in this scope
   25 |                         cout << "yes" << endl;
      |                         ^~~~
a.cc:25:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:42: error: 'endl' was not declared in this scope
   25 |                         cout << "yes" << endl;
      |                                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:27:25: error: 'cout' was not declared in this scope
   27 |                         cout << "no" << endl;
      |                         ^~~~
a.cc:27:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:41: error: 'endl' was not declared in this scope
   27 |                         cout << "no" << endl;
      |                                         ^~~~
a.cc:27:41: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

void slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200],s[20];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
	}
	for(i=0;i<n;++){
		s[i]=0;
	}
	for(i=0;i<qn;i++){
		j=slove(0,q[i]);
		if ( j ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:19:23: error: expected primary-expression before ')' token
   19 |         for(i=0;i<n;++){
      |                       ^
a.cc:23:24: error: too few arguments to function 'void slove(int, int, int*, int)'
   23 |                 j=slove(0,q[i]);
      |                   ~~~~~^~~~~~~~
a.cc:5:6: note: declared here
    5 | void slove(int i,int m,int a[],int n);
      |      ^~~~~
a.cc:25:25: error: 'cout' was not declared in this scope
   25 |                         cout << "yes" << endl;
      |                         ^~~~
a.cc:25:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:42: error: 'endl' was not declared in this scope
   25 |                         cout << "yes" << endl;
      |                                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:27:25: error: 'cout' was not declared in this scope
   27 |                         cout << "no" << endl;
      |                         ^~~~
a.cc:27:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:41: error: 'endl' was not declared in this scope
   27 |                         cout << "no" << endl;
      |                                         ^~~~
a.cc:27:41: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

void slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
		if ( slove(0,q[i] ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:18:27: error: too few arguments to function 'void slove(int, int, int*, int)'
   18 |                 if ( slove(0,q[i] ){
      |                      ~~~~~^~~~~~~~~
a.cc:5:6: note: declared here
    5 | void slove(int i,int m,int a[],int n);
      |      ^~~~~
a.cc:18:36: error: expected ')' before '{' token
   18 |                 if ( slove(0,q[i] ){
      |                    ~               ^
      |                                    )
a.cc:23:9: error: expected primary-expression before '}' token
   23 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

bool slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
		if ( slove(0,q[i] ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:18:27: error: too few arguments to function 'bool slove(int, int, int*, int)'
   18 |                 if ( slove(0,q[i] ){
      |                      ~~~~~^~~~~~~~~
a.cc:5:6: note: declared here
    5 | bool slove(int i,int m,int a[],int n);
      |      ^~~~~
a.cc:18:36: error: expected ')' before '{' token
   18 |                 if ( slove(0,q[i] ){
      |                    ~               ^
      |                                    )
a.cc:23:9: error: expected primary-expression before '}' token
   23 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

int slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<q;i++){
		cin >>q[i];
		if ( slove(0,q[i] ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         for(i=0;i<q;i++){
      |                 ~^~
a.cc:18:27: error: too few arguments to function 'int slove(int, int, int*, int)'
   18 |                 if ( slove(0,q[i] ){
      |                      ~~~~~^~~~~~~~~
a.cc:5:5: note: declared here
    5 | int slove(int i,int m,int a[],int n);
      |     ^~~~~
a.cc:18:36: error: expected ')' before '{' token
   18 |                 if ( slove(0,q[i] ){
      |                    ~               ^
      |                                    )
a.cc:23:9: error: expected primary-expression before '}' token
   23 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

int slove(int i,int m,int a[],int n);
int main()
{
	int i,qn;
	bool j;
	int q[200];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<qn;i++){
		cin >>q[i];
		if ( slove(0,q[i] ){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:18:27: error: too few arguments to function 'int slove(int, int, int*, int)'
   18 |                 if ( slove(0,q[i] ){
      |                      ~~~~~^~~~~~~~~
a.cc:5:5: note: declared here
    5 | int slove(int i,int m,int a[],int n);
      |     ^~~~~
a.cc:18:36: error: expected ')' before '{' token
   18 |                 if ( slove(0,q[i] ){
      |                    ~               ^
      |                                    )
a.cc:23:9: error: expected primary-expression before '}' token
   23 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

int slove(int i,int m,int a[],int n);
int main()
{
	int i,qn,q;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<qn;i++){
		cin >>q;
		if ( slove(0,q){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:27: error: too few arguments to function 'int slove(int, int, int*, int)'
   16 |                 if ( slove(0,q){
      |                      ~~~~~^~~~~
a.cc:5:5: note: declared here
    5 | int slove(int i,int m,int a[],int n);
      |     ^~~~~
a.cc:16:32: error: expected ')' before '{' token
   16 |                 if ( slove(0,q){
      |                    ~           ^
      |                                )
a.cc:21:9: error: expected primary-expression before '}' token
   21 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

int slove(int i,int m);
int main()
{
	int i,qn,q;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<qn;i++){
		cin >>q;
		if ( slove(0,q){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:32: error: expected ')' before '{' token
   16 |                 if ( slove(0,q){
      |                    ~           ^
      |                                )
a.cc:21:9: error: expected primary-expression before '}' token
   21 |         }
      |         ^
Language: C++

#include<stdio.h>
using namespace std;
int n,a[100];

int slove(int i,int m);
int main()
{
	int i,qn,q;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> qn;
	for(i=0;i<qn;i++){
		cin >>q;
		if ( slove(0,q)){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}	
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
    9 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:17:25: error: 'cout' was not declared in this scope
   17 |                         cout << "yes" << endl;
      |                         ^~~~
a.cc:17:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:42: error: 'endl' was not declared in this scope
   17 |                         cout << "yes" << endl;
      |                                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:19:25: error: 'cout' was not declared in this scope
   19 |                         cout << "no" << endl;
      |                         ^~~~
a.cc:19:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:41: error: 'endl' was not declared in this scope
   19 |                         cout << "no" << endl;
      |                                         ^~~~
a.cc:19:41: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <iostream>
#include <vector>
using namespace std;
vector<int> A;
vector<int> Q;
int n,q;
bool solve(int i,int m){
if(m==0) return true;
if(i>n) return false;
return solve(i+1,m)||solve(i+1,m-A[i]);
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: expected ';' before 'cout'
   26 | if(solve(0,Q[i])
      |                 ^
      |                 ;
   27 | cout<<"yes"<<endl;
      | ~~~~             
a.cc:28:1: error: expected primary-expression before 'else'
   28 | else
      | ^~~~
a.cc:27:19: error: expected ')' before 'else'
   27 | cout<<"yes"<<endl;
      |                   ^
      |                   )
   28 | else
      | ~~~~               
a.cc:26:3: note: to match this '('
   26 | if(solve(0,Q[i])
      |   ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
vector<int> A;
vector<int> Q;
int n,q;
bool solve(int i,int m){
if(m==0) return true;
if(i>n) return false;
return solve(i+1,m)||solve(i+1,m-A[i]);
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: expected ')' before '{' token
   26 | if(solve(0,Q[i]){
      |   ~             ^
      |                 )
a.cc:30:1: error: expected primary-expression before '}' token
   30 | }
      | ^
Language: C++

#include<stdio.h>

int n,A[50];

// 入力値のMから選んだ要素を引いていく再帰関数
int solve(int i,int m){
  if(m == 0) return 1;
  if(i >= n)return 0;
  return res = solve(i + 1,m) || solve(i + 1,m - A[i]);
}

int main(){
  int q,m;

  scanf("%d",&n);

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

  scanf("%d",&n);

  for(int 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: In function 'int solve(int, int)':
a.cc:9:10: error: 'res' was not declared in this scope
    9 |   return res = solve(i + 1,m) || solve(i + 1,m - A[i]);
      |          ^~~
a.cc: In function 'int main()':
a.cc:18:16: error: expected primary-expression before '%' token
   18 |     scanf("%d",%A[i]);
      |                ^
a.cc:25:16: error: 'M' was not declared in this scope
   25 |     if(solve(0,M))printf("yes¥n");
      |                ^