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[20],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(i,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) || slove(i+1,m-a[i]);
	return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         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: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(i,q[i],a,n);
      |                   ~~~~~^~~~~~~~~~~~
a.cc:24:25: error: 'cout' was not declared in this scope
   24 |                         cout << "yes" << endl;
      |                         ^~~~
a.cc:24:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:42: error: 'endl' was not declared in this scope
   24 |                         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:26:25: error: 'cout' was not declared in this scope
   26 |                         cout << "no" << endl;
      |                         ^~~~
a.cc:26:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:41: error: 'endl' was not declared in this scope
   26 |                         cout << "no" << endl;
      |                                         ^~~~
a.cc:26:41: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
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: too few arguments to function 'void slove(int, int, int*, int)'
   37 |         res =slove(i+1,m) || slove(i+1,m-a[i]);
      |              ~~~~~^~~~~~~
a.cc:4:6: note: declared here
    4 | void slove(int i,int m,int a[],int n);
      |      ^~~~~
a.cc:37:35: error: too few arguments to function 'void slove(int, int, int*, int)'
   37 |         res =slove(i+1,m) || slove(i+1,m-a[i]);
      |                              ~~~~~^~~~~~~~~~~~
a.cc:4:6: note: declared here
    4 | void slove(int i,int m,int a[],int n);
      |      ^~~~~