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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int TAM = 100004;

vector <ll> adj [TAM];
ll val [TAM], pt [TAM];
int n;

void form( int x ){
    int nxt;
    for( int i = 0 ; i < adj[x].size() ; i ++ ){
        nxt = adj[x][i];
        if( nxt == pt[x] ) continue;
        pt[nxt] = x;
        //cout << " parent " << nxt << " = " << pt[nxt] << endl ;
        form(nxt);
    }
}

ll dn, up;
void solve ( ll cap , ll sum ){
    dn = sum - cap;
    up = cap - dn;
}

bool pos = 1;

ll find_up( int x ){
    //cout << " IN " << x << endl ;
    if( adj[x].size() == 1 ) return val[x];
    ll sum = 0, cap = val[x];
    int nxt;
    ll v;
    for( int i = 0 ; i < adj[x].size() ; i ++ ){
        nxt = adj[x][i];
        if( nxt == pt[x] ) continue;
        v = find_up(nxt);
        sum += v
        if( v > cap ) pos = 0;
        //cout << x << " -> " << nxt << " = " << v << endl ;
    }
    solve( cap , sum );
    if( dn + up != cap or dn < 0 or up < 0 ) pos = 0;
    return up;
}

int main(){

    int a, b;
    scanf("%d",&n);
    for( int i = 1 ; i <= n ; i ++ )
        scanf("%lld",&val[i]);
    for( int i = 0 ; i < n-1 ; i ++ ){
        scanf("%d%d",&a,&b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    if( n == 2 ){
        if( val[1] == val[2] ) printf("YES\n");
        else printf("NO\n");
        return 0;
    }

    int rt;
    for( int i = 1 ; i <= n ; i ++ ){
        if( adj[i].size() > 1 ){
            pt [i] = i;
            form(i);
            rt = i;
            break;
        }
    }
    if( !find_up(rt) and pos ) printf("YES\n");
    else printf("NO\n");

    return 0;
}


Compiler output:
a.cc: In function 'll find_up(int)':
a.cc:39:17: error: expected ';' before 'if'
   39 |         sum += v
      |                 ^
      |                 ;
   40 |         if( v > cap ) pos = 0;
      |         ~~
Language: C

#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
vector<int> e[111111];
long long int A[111111];
bool dfs(int x,int fat){
	if(e[x].size() == 1){
		return true;
	}
	long long int sum = 0, mx = 0;
	for(vector<int>::iterator it = e[x].begin(); it!=e[x].end(); it++){
		int y = *it;
		if(y == fat)continue;
		if(!dfs(y, x))
			return false;
		sum += A[y];
		mx = max(mx, A[y]);
	}
	mx = min(sum - mx, sum/2);

	long long int dec = sum - A[x];
	if(dec < 0 || dec > mx)
		return false;
	A[x] -= dec;
	if(x == fat)return A[x] == 0;
//	A[fat] -= dec;
	return true;
}
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		int x;
		scanf("%d",&x);
		A[i] = x;
	}
	for(int i=1; i<n; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	if(n == 2){
		puts(A[1] == A[2] ? "YES" : "NO");
		return 0;
	}
	int r = -1;
	for(int i=1; i<=n; i++)
		if(e[i].size() != 1){
			r = i;
			break;
		}
	puts(dfs(r,r) ? "YES" : "NO");
	return 0;
}

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

#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll a[100001];
vector<int> G[100001];
bool used[100001];
bool flag[100001];
int cnt[100001];
ll query[100001];
bool nex[100001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	for(int i=0;i<n-1;i++){
		int f,t;
		scanf("%d%d",&f,&t);
		f--;
		t--;
		G[f].push_back(t);
		G[t].push_back(f);
	}
	queue<int> que;
	bool cont=true;
	for(int i=0;i<n;i++){
		if(G[i].size()==1){
			que.push(i);
			flag[i]=true;
			cnt[i]=1;
			query[i]=a[i];
		}
	}
	while(cont){
		queue<int> que2;
		cont=false;
		while(que.size()){
			int v=que.front();
			que.pop();
			if(used[v])continue;
			used[v]=true;
			if(cnt[v]==1){
				if(query[v]!=a[v]){
					printf("NO\n");
					return 0;
				}
			}else{
				if(query[v]<a[v] || a[v]*2LL<query[v]){
					printf("NO\n");
					return 0;
				}
				query[v]=a[v]*2LL-query[v];
			}
			if(query[v]==0)continue;
			for(int i=0;i<G[v].size();i++){
				if(!used[G[v][i]]){
					if(flag[G[v][i]]){
						ll nv=query[G[v][i]];
						if(cnt[G[v][i]]==1){
							if(nv!=a[G[v][i]]){
								printf("NO\n");
								return 0;
							}
						}else{
							if(nv<a[G[v][i]] || a[G[v][i]]*2<nv){
								printf("NO\n");
								return 0;
							}
							nv=a[G[v][i]]*2LL-query[G[v][i]];
						}
						if(query[v]!=nv){
							printf("NO\n");
							return 0;
						}else{
							used[G[v][i]]=true;
							query[v]=0;
							query[G[v][i]]=0;
						}
					}else{
						if(query[v]>a[v]){
							printf("NO\n");
							return 0;
						}
						cnt[G[v][i]]++;
						query[G[v][i]]+=query[v];
						query[v]=0;
						if(!nex[G[v][i]] && cnt[G[v][i]]+1==G[G[v][i]].size()){
							que2.push(G[v][i]);
							nex[G[v][i]]=true;
						}
					}
				}
			}
			if(query[v]!=0){
				printf("NO\n");
				return 0;
			}
		}
		memset(flag,false,sizeof(flag));
		while(que2.size()){
			cont=true;
			int v=que2.front();
			que2.pop();
			que.push(v);
			flag[v]=true;
		}
	}
	for(int i=0;i<n;i++){
		if(!flag[v]){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:125:26: error: 'v' was not declared in this scope
  125 |                 if(!flag[v]){
      |                          ^
Language: C++



#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>

#define in std::cin
#define out std::cout

int64_t N;
std::unordered_set<int64_t> graph[MAX_N];//木
int64_t need[100000] = {};
int64_t use[100000] = {};
bool is_lef[100000] = {};
int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	for (int64_t i = 0; i < N; ++i)
	{
		in >> need[i];
	}
	for (int64_t i = 0; i < N-1; ++i)
	{
		int a, b;
		in >> a >> b; --a; --b;
		graph[a].insert(b);
		graph[b].insert(a);
	}

	std::queue<int64_t> que;
	for (int64_t i = 0; i < N; ++i)
	{
		if (graph[i].size() == 1) {
			is_lef[i] = true;
			if (i != 0) {
				que.push(i);
			}
		}
		else {
			need[i] *= 2;
		}
	}
	while (!que.empty())
	{
		auto pos = que.front(); que.pop();
		auto p = *graph[pos].begin();
		auto add = need[pos] - use[pos];
		if ((!is_lef[pos] && add * 2 > need[pos]) || (!is_lef[p] && add * 2 > need[p])) {
			out << "NO" << endl; return 0;
		}
		use[p] += add; use[pos] += add;
		graph[p].erase(pos);
		if (p != 0 && graph[p].size() == 1) {
			que.push(p);
		}
	}
	out << ((need[0] == use[0]) ? ("YES") : ("NO")) << endl;
	return 0;
}
#endif


Compiler output:
a.cc:28:35: error: 'MAX_N' was not declared in this scope
   28 | std::unordered_set<int64_t> graph[MAX_N];//木
      |                                   ^~~~~
a.cc: In function 'int main()':
a.cc:47:17: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   47 |                 graph[a].insert(b);
      |                 ^~~~~
      |                 isgraph
a.cc:54:21: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   54 |                 if (graph[i].size() == 1) {
      |                     ^~~~~
      |                     isgraph
a.cc:67:27: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
   67 |                 auto p = *graph[pos].begin();
      |                           ^~~~~
      |                           isgraph
Language: C++

#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int n;
vector<vector<int> > graph(100001);
vector<bool> ischecked(100001, false);
vector<long long int> stonenum(100001);

int cansolve(int node)
{
	if(graph[node].size() == 1) return stonenum[node];
	ischecked[node] = true;
	int ans = 2 * stonenum[node];
	for(int i = 0; i < graph[node].size(); i++){
		int child = graph[node][i];
		if(ischecked[child]) continue;
		int tmp = cansolve(child);
		else ans -= tmp;
		if(tmp == -1 || tmp > ans || ans < 0) return -1;
	}
	if(ans > stonenum[node]) return -1;
	return ans;
}

int main()
{
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> stonenum[i];
	}
	int a, b;
	for(int i = 0; i < n - 1; i++){
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int root = 0;
	while(root < n && graph[root].size() == 1) root++;
	if(cansolve(root)) cout << "NO" << endl;
	else cout << "YES" << endl;
	// cout << stonenum[0] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int cansolve(int)':
a.cc:37:17: error: 'else' without a previous 'if'
   37 |                 else ans -= tmp;
      |                 ^~~~
Language: C++

#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
using namespace std;
const int NICO = 1000000 + 10;
typedef long long LL;
int a[NICO], b[NICO], deg[NICO], root;
int n, vis[NICO], ok = 1;
LL val[NICO];
vector<int> vec[NICO];
void dfs(int x)
{
    vis[x] = 1, LL sum = 0;
    if(deg[x] == 1) return;
    for(int i=0;i<vec[x].size();i++)
    {
        int cur = vec[x][i];
        if(vis[cur]) continue;
        dfs(cur);
        sum += val[cur];
    }
    LL tmp = 2 * val[x] - sum;
    if(x == root)
    {
        if(tmp != 0) ok = 0;
    } else
    if(vec[x].size() == 2)
    {
        if(sum != val[x]) ok = 0;
    } else
    if(tmp > val[x] || tmp < 0)
    {
        ok = 0;
    }
    cout << x << " : " << tmp << endl;
    val[x] = tmp;
    return;
}
int main()
{
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        cin >> val[i]; 
    }
    for(int i=1;i<=n-1;i++)
    {
        cin >> a[i] >> b[i];
        deg[a[i]]++,  deg[b[i]]++;
        vec[a[i]].push_back(b[i]);
        vec[b[i]].push_back(a[i]);
    }
    root = -1;
    for(int i=1;i<=n;i++)
    {
        if(deg[i] > 1 && root == -1)
        {
            root = i; break;
        }
    }
    if(root == -1)
    {
        cout << ((val[1] == val[2])?"YES":"NO") << endl;
    } else {
        dfs(root);
        cout << (ok?"YES":"NO") << endl;
    }
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:14:20: error: expected primary-expression before 'sum'
   14 |     vis[x] = 1, LL sum = 0;
      |                    ^~~
a.cc:21:9: error: 'sum' was not declared in this scope
   21 |         sum += val[cur];
      |         ^~~
a.cc:23:27: error: 'sum' was not declared in this scope
   23 |     LL tmp = 2 * val[x] - sum;
      |                           ^~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

typedef __int64 LL;

int N;
int A[100010];
vector<int> V[100010];
bool b = 1;

LL dfs(int p , int q){
	if((int)V[q].size() == 1) return A[q];
	LL z = 0;
	repv(int,it,V[q]){
		if(*it == p) continue;
		LL w = dfs(q,*it);
		if(w > (LL)A[q]) b = 0;
		z += w;
	}
	if(p < 0 && z != (LL)2 * A[q]) b = 0;
	if(z < (LL)A[q] || (LL)2 * A[q] < z) b = 0;
	return 2 * A[q] - z;
}

int main(){
	scanf("%d" , &N);
	repp(i,1,N+1){
		scanf("%d" , A + i);
	}
	repp(i,1,N){
		int x,y;
		scanf("%d%d" , &x , &y);
		V[x].PB(y);
		V[y].PB(x);
	}
	if(N == 2){
		printf("%s\n" , A[1] == A[2] ? "YES" : "NO");
		return 0;
	}
	int r = 1;
	while((int)V[r].size() == 1) ++r;
	dfs(-1,r);
	printf("%s\n" , b ? "YES" : "NO");
	return 0;
}


Compiler output:
a.cc:24:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   24 | typedef __int64 LL;
      |         ^~~~~~~
      |         __int64_t
a.cc:31:1: error: 'LL' does not name a type
   31 | LL dfs(int p , int q){
      | ^~
a.cc: In function 'int main()':
a.cc:62:9: error: 'dfs' was not declared in this scope
   62 |         dfs(-1,r);
      |         ^~~
Language: C++

#include <iostream>
#include <vector>

#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

typedef struct {
  int a;
  vector<int> ns;
} node;

int n;
vector<node> nodes;

bool dfs(int cur, int parent)
{
  node n = nodes[cur];
  int sum = 0;
  rep(i, n.ns.size()) {
    int next = n.ns[i];
    if(next != parent) {
      if(dfs(next, cur))
	sum += nodes[next].a;
      else
	return false;
    }
  }
  if(parent == -1) {
    node t = nodes[n.ns[0]];
    if(n.ns.size() == 1) {
      return n.a == t.a;
    } else {
      return (2 * n.a - sum == 2 * t.a)
    }
  } else {
    if(sum == 0) return true;
    if(2 * n.a < sum || n.a > sum)
      return false;
    else {
      nodes[cur].a = 2 * n.a - sum;
      return true;
    }
  }
}

int main()
{
  cin >> n;

  nodes.resize(n);
  rep(i, n)
    cin >> nodes[i].a;

  rep(i, n - 1) {
    int s, t;
    cin >> s >> t;
    nodes[s-1].ns.push_back(t-1);
    nodes[t-1].ns.push_back(s-1);
  }

  if(dfs(0, -1))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:34:40: error: expected ';' before '}' token
   34 |       return (2 * n.a - sum == 2 * t.a)
      |                                        ^
      |                                        ;
   35 |     }
      |     ~
Language: C++

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[101010];
vector<int> E[101010];

ll dfs(int cur,int pre) {
	
	if(E[cur].size()==1) {
		return A[cur];
	}
	
	ll tot=0;
	FORR(e,E[cur]) if(e!=pre) tot+=dfs(e,cur);
	FORR(r,C) tot+=r;
	
	ll X=2*A[cur]-tot;
	if(X<0) {
		_P("NO\n");
		exit(0);
	}
	return X;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>A[i];
	FOR(i,N-1) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	
	if(N==2) {
		if(A[0]==A[1]) return _P("YES\n");
		return _P("NO\n");
	}
	int root=-1;
	FOR(i,N) if(E[i].size()>1) root=i;
	
	if(dfs(root,-1)==0) _P("YES\n");
	else _P("NO\n");
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Compiler output:
a.cc: In function 'll dfs(int, int)':
a.cc:27:16: error: 'C' was not declared in this scope
   27 |         FORR(r,C) tot+=r;
      |                ^
a.cc:8:33: note: in definition of macro 'FORR'
    8 | #define FORR(x,arr) for(auto& x:arr)
      |                                 ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

#define sz 1000000

vector <int> a[sz];
int n, v, u, d[sz];

int dfs(int v, int pr = -1) {
	vector <int> g;
	for (int i = 0; i < a[v].size(); i++) {
		if (a[v][i] == pr) continue;
		g.pb(dfs(a[v][i], v));
	}
	if (a[v].size() == 1) {
		return d[v];
	}
	sort(g.begin(), g.end());
	LL res = 0, s = 0;
	for (int i = 0; i < g.size(); i++) {
		s += g[i];
	}
	LL x = g.back();
	s -= x;
	if (s < x) {
		LL p = (x - s);
		res += p;
		g[g.size() - 1] -= p;
		d[v] -= p;
	}
	
	if (s & 1) {
		s--;
		res++;
		d[v]--;
	}
	
	d[v] -= s / 2;
	if (d[v] < 0 || d[v] & 1) {
		cout << "NO";
		exit(0);
	}
	
	res += (d[v] * 2 - s);
	
	if (s < 0) {
		cout << "NO";
		exit(0);
	}
	
	return res;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> d[i];
	for (int i = 0; i < n - 1; i++) {
		cin >> v >> u;
		a[v].push_back(u);
		a[u].push_back(v);
	}
	
	for (int i = 1; i <= n; i++) {
		if (a[i].size() > 1) {
			dfs(i);
			cout << "YES";
			return 0;
		}
	}
	
	if (d[1] != d[2]) {
		cout << "NO";
		return 0;
	}
	cout << "YES";
	
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:16:19: error: 'class std::vector<int>' has no member named 'pb'
   16 |                 g.pb(dfs(a[v][i], v));
      |                   ^~
Language: C++

#include<cstdio>
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<utility>
using namespace std;
int a[100009],b[100009],st[100009],isl[100009],par[100009],cnt[100009],used[100009];
vector<int> con[100009];
queue<int> check;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>st[i];
		par[i]=-1;
	}
	for(int i=0;i<n-1;i++){
		cin>>a[i]>>b[i];
		con[a[i]].push_back(b[i]);
		con[b[i]].push_back(a[i]);
		cnt[a[i]]++;cnt[b[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(cnt[i]==1){isl[i]++;par[i]=con[i][0];check.push(i);}
	}
	int p;
	do{
		int f=check.front();check.pop();
		if(used[f])goto nex;
		cout<<f<<endl;
		p=par[f];
		int sum=0,num=0,cn=0;
		for(int i=0;i<con[p].size();i++){
			if(isl[con[p][i]]==0)cn++;
			if(cn>1)goto nex;
		}
		for(int i=0;i<con[p].size();i++){
			if(isl[con[p][i]]==0)par[p]=con[p][i];
			else{
				sum+=st[con[p][i]];
				num++;
			}
		}
		if(num>1){
			if(sum>2*st[p]){cout<<"NO"<<endl;return 0;}
			else if(sum<st[p]){cout<<"NO"<<endl;return 0;}
			else st[p]=2*st[p]-sum;
		}
		if(num==1){
			if(sum!=st[p]){cout<<"NO"<<endl;return 0;}
		}
		check.push(p);
		nex:sum=0;
		isl[f]=1;
		}while(!check.empty());
	if(st[p]==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:17: error: jump to label 'nex'
   55 |                 nex:sum=0;
      |                 ^~~
a.cc:31:33: note:   from here
   31 |                 if(used[f])goto nex;
      |                                 ^~~
a.cc:34:33: note:   crosses initialization of 'int cn'
   34 |                 int sum=0,num=0,cn=0;
      |                                 ^~
a.cc:34:27: note:   crosses initialization of 'int num'
   34 |                 int sum=0,num=0,cn=0;
      |                           ^~~
a.cc:34:21: note:   crosses initialization of 'int sum'
   34 |                 int sum=0,num=0,cn=0;
      |                     ^~~
Language: C++

#include <bits/stdc++.h>
 
#define int long long
using namespace std;
 
int N, A[100000];
vector< int > g[100000];
 
int rec(int idx, int par = -1)
{
  if(g[idx].size() == 1) return (A[idx]);
  priority_queue< int > que;
  que.push(0);
  int sum = 0;
  for(auto &to : g[idx]) {
    if(to == par) continue;
    auto get = rec(to, idx);
    sum += get;
    que.emplace(get);
  }
  while(que.size() > 1) {
    int p = que.top();
    que.pop();
    int q = que.top();
    que.pop();
    que.push(p - q);
  }
  int zan = (sum - que.top()) / 2;
 
  //cout << idx + 1 << " " << zan << endl;
  if(sum < A[idx] || sum - zan > A[idx]) throw 1LL;
 
  return (sum - (sum - A[idx]) * 2);
}
 
signed main()
{
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
 
  int root = -1;
  for(int i = 0; i < N; i++) {
    if(g[i].size() >= 2) [
root = i;
break;
}
  }
 
  if(root == -1) {
    if(A[0] == A[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  } else {
    try {
      if(rec(root) != 0) throw 1LL;
      cout << "YES" << endl;
    } catch(int x) {
      cout << "NO" << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:9: error: expected ',' before ';' token
   51 | root = i;
      |         ^
      |         ,
a.cc:51:9: error: expected identifier before ';' token
a.cc:51:9: error: expected ']' before ';' token
   51 | root = i;
      |         ^
      |         ]
a.cc: In lambda function:
a.cc:51:9: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:56:3: error: expected unqualified-id before 'if'
   56 |   if(root == -1) {
      |   ^~
a.cc:59:5: error: expected unqualified-id before 'else'
   59 |   } else {
      |     ^~~~
a.cc:67:1: error: expected declaration before '}' token
   67 | }
      | ^
Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>

typedef long long ll;
using namespace std;

int getint(){
	int f=1,x=0;
	char ch=getchar();
	while('0'>ch||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
#define N 212345
struct edge {
	int to,next;
}e[N<<1];
int n;
int head[N],tot=0; 
void insert(int x,int y){
	e[++tot].to=y; e[tot].next=head[x]; head[x]=tot;
	e[++tot].to=x; e[tot].next=head[y]; head[y]=tot; return ;
}
bool flag=true;
int a[N],sum[N],du[N];
int q[N],fa[N];
int f[N];
void solve(){
	int fp=0,rp=1;
	q[1]=1;fa[1]=1;
	while(fp!=rp){
		int x=q[++fp]; 
		for(int i=head[x];i;i=e[i].next){
			int y=e[i].to; 
			if(y!=fa[x]){
				fa[y]=x; q[++rp]=y;
			}
		}
	}
	for(int x=n;x>=1;x--){
		if(du[x]==1) {sum[x]=f[x]=a[x];continue;}
		int s=0;
		for(int i=head[x];i;i=e[i].next){
			int y=e[i].to;
			if(y!=fa[x]){
				s+=f[y]; 
				sum[x]+=sum[y];
			} 
		} 
		f[x]=2*a[x]-s; if(f[x]<0||f[x]>sum[y]) flag=false;
	}
}
int main(){
	n=getint();
	for(int i=1;i<n;i++) {
		int x=getint(),y=getint(); du[x]++; du[y]++;
	}
	for(int i=1;i<=n;i++) a[i]=getint();
	solve();
	if(flag)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:52:52: error: 'y' was not declared in this scope
   52 |                 f[x]=2*a[x]-s; if(f[x]<0||f[x]>sum[y]) flag=false;
      |                                                    ^
Language: C++

//In the Name of God
//Ya Ali

#include<bits/stdc++.h>

#define int long long

#define pb push_back
#define ld long double

#define err(A) cout<<#A<<" = "<<(A)<<endl

using namespace std;

const int maxn=131072;

int n;

vector<int> g[maxn];

int a[maxn];

int root;

int s;

int dfs(int v,int par=-1)
{
  int s=0;
  int c=0;
  int c1=0;
  int mx=0;
  for(int u:g[v])
    if(u!=par)
      {
	c++;
	tmp=dfs(u,v);
	mx=max(mx,tmp);
	if(tmp) c1++;
      }
  
  if(!c)
    return a[v];
  if(s<a[v] or a[v]*2-s);
  if(c1==1)
    {
      if(a[v]!=s)
	{
	  cout<<"NO"<<endl;
	  exit(0);
	}
      else
	return s;
    }
  if(mx>a[v])
    {
      cout<<"NO"<<endl;
      exit(0);
    }
  return 2*a[v]-s;
}

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

  for(int i=0;i<n;i++)
    cin>>a[i];
  
  for(int v,u,i=0;i<n-1;i++)
    {
      cin>>v>>u;
      v--,u--;
      g[v].pb(u);
      g[u].pb(v);
    }

  if(n==2)
    {
      if(a[0]==a[1])
	cout<<"YES"<<endl;
      else
	cout<<"NO"<<endl;
      return 0;
    }

  for(int i=0;i<n;i++)
    if(g[i].size()>1)
      root=i;

  if(!dfs(root))
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    
  return 0;
}


Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:37:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   37 |         tmp=dfs(u,v);
      |         ^~~
      |         tm
Language: C++

//In the name of GOD
//SMani24
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e5 + 10;
int n, a[N];

void read_input() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
}
void write_output(int cnt) {
	int sum = 0;
	int tf = 0, f = -1;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (a[i] % 2) {
			tf++;
			f = a[i];
		}
	}
	if ((sum - n) % 2) {
		if (cnt % 2)
			cout << "Second" << endl;
		else
			cout << "First" << endl;
		exit(0);
	}
	else if (tf == 1 && f != 1) {
		int gcd = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] % 2)
				a[i]--;
			gcd = __gcd(gcd, a[i]);
		}
		for (int i = 0; i < n; i++)
			a[i] /= gcd;
		write_output(cnt + 1);
	}
	if (cnt % 2)
		cout << "First\n";
	else
		cout << "Second\n";
	exit(0)
}

int32_t main() {
	read_input(), write_output(0);
	return 0;
}


Compiler output:
a.cc: In function 'void write_output(long long int)':
a.cc:47:16: error: expected ';' before '}' token
   47 |         exit(0)
      |                ^
      |                ;
   48 | }
      | ~
Language: C++

//BE NAM NAMI HAGH
#include<bits/stdc++.h>
using namespace std;

#define X first
#define Y second

const int MAXN = 1e5 + 5;
int seg[MAXN << 2];
int a[MAXN];
long long s;
int n, gc;

void input();
void build(int, int, int);
void get(int, int, int, int, int);
void solve();

int main() {
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	input();
	solve();
	return 0;
}

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

void build(int v, int s, int e) {
	if (e - s == 1) {
		seg[v] = a[s];
		return;
	}
	int mid = (s + e) / 2;
	build(v << 1, s, mid);
	build(v << 1 | 1, mid, e);
	seg[v] = __gcd(seg[v << 1], seg[v << 1 | 1]);
}

void get(int l, int r, int v, int s, int e) {
	if (r <= s || e <= l)
		return;
	if (l <= s && e <= r) {
		if (gc)
			gc = __gcd(gc, seg[v]);
		else
			gc = seg[v];
		return;
	}
	int mid = (s + e) / 2;
	get(l, r, v << 1, s, mid);
	get(l, r, v << 1 | 1, mid, e);
}

void solve() {
	if ((s ^ n) & 1) {
		cout << "First" << endl;
		return;
	}
	build(1, 0, n);
	for (int i = 0; i < n; i++) {
		gc = 0;
		get(0, i, 1, 0, n);
		get(i + 1, n, 1, 0, n);
		if ((a[i] % gc == 1) && (((sz - 1) / gc) & 1)) {
			cout << "First" << endl;
			return;
		}
	}
	cout << "Second" << endl;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:70:44: error: 'sz' was not declared in this scope; did you mean 's'?
   70 |                 if ((a[i] % gc == 1) && (((sz - 1) / gc) & 1)) {
      |                                            ^~
      |                                            s
Language: C++

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

const int maxn = 1e5 + 58;
int a[maxn];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (n % 2 == 0) {
		if (sum % 2) cout << "First";
		else cout << "Second";
	}
	else {
		if (n == 1) cout << "Second";
		else if (sum % 2 == 0) cout << "First";
		else {
			vector <int> S;
			for (int i = 0; i < n; i++) {
				S.push_back(__builtin_ctz(a[i]));
			}
			sort(S.begin(), S.end());
			if (S[0] != S[1] && S[1] == S.back()) {
				bool f = 0;
				for (int i = 0; i < n; i++) {
					f = f | (__builtin_ctz(a[i]) == S[0] && __builtin_ctz(a[i] - 1) == S.back());
				}
				if (f) cout << "First";
				else cout << "Second";
			}
			else cout << "Second";
		}
	}
}
//besmellah
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 58;
int a[maxn];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	if (n % 2 == 0) {
		if (sum % 2) cout << "First";
		else cout << "Second";
	}
	else {
		if (n == 1) cout << "Second";
		else if (sum % 2 == 0) cout << "First";
		else {
			vector <int> S;
			for (int i = 0; i < n; i++) {
				S.push_back(__builtin_ctz(a[i]));
			}
			sort(S.begin(), S.end());
			if (S[0] != S[1] && S[1] == S.back()) {
				bool f = 0;
				for (int i = 0; i < n; i++) {
					f = f | (__builtin_ctz(a[i]) == S[0] && __builtin_ctz(a[i] - 1) == S.back());
				}
				if (f) cout << "First";
				else cout << "Second";
			}
			else cout << "Second";
		}
	}
}


Compiler output:
a.cc:47:11: error: redefinition of 'const int maxn'
   47 | const int maxn = 1e5 + 58;
      |           ^~~~
a.cc:5:11: note: 'const int maxn' previously defined here
    5 | const int maxn = 1e5 + 58;
      |           ^~~~
a.cc:48:5: error: redefinition of 'int a [100058]'
   48 | int a[maxn];
      |     ^
a.cc:6:5: note: 'int a [100058]' previously declared here
    6 | int a[maxn];
      |     ^
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main() {
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main() {
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = INT64_MAX;

ll dp[100], bstX[35000][20], bstY[35000][20];

vector<vector<ll>> gr, psh;
vector<set<ll>> s;

ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

set<ll> ss;

void debug();

int main()
{
	fastInp;

	ll n;
	cin >> n;

	vector<ll> vec(n);

	ll s = 0;
	for (int i = 0; i < n; i++) {
		cin >> vec[i];
		s += vec[i] - 1;
	}
	
	if (n % 2 == 0) {
		debug();
		if (s % 2 == 0) {
			cout << "Second";
		}
		else {
			cout << "First";
		}
	}
	else {

	}

	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cc0WhQPK.o: in function `main':
a.cc:(.text+0x133): undefined reference to `debug()'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 325501;
const int MOD = 1e9 + 7;

int n;
long long a[N];

void pt(int x)
{
    if (x) cout << "First";
    else cout << "Second";
    exit(0);
}

void solve(int k)
{
    long long s = 0, cnt = 0, kek = 0;
    for (int i = 0; i < n; i++)
    {
        s += (a[i] - 1);
        cnt += a[i] % 2;
        kek += a[i] == 1;
    }
    //cout << s << endl;
    if (s % 2 == 1)
    {
        pt(k);
    }
    if (cnt > 1)
    {
        pt(1 ^ k);
    }
    if (cnt == 0)
        exit(75);
    if (cnt == 1 && kek == 1) pt(1 ^ k);
    int g = 0;
    for (int i = 0; i < n; i++)
    {
    	if (a[i] % 2) a[i]--;
    	g = __gcd(g, a[i]);
    }
    for (int i = 0; i < n; i++) a[i] /= g;
    k ^= 1;
    solve(k);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    solve(1);
}


Compiler output:
a.cc: In function 'void solve(long long int)':
a.cc:117:13: error: '__gcd' was not declared in this scope
  117 |         g = __gcd(g, a[i]);
      |             ^~~~~
a.cc:117:13: note: suggested alternatives:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   'std::__gcd'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
In file included from /usr/include/c++/14/bits/random.tcc:33,
                 from /usr/include/c++/14/random:50,
                 from a.cc:17:
/usr/include/c++/14/numeric:134:5: note:   'std::__detail::__gcd'
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
Language: C++

#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 325501;
const int MOD = 1e9 + 7;

int n;
long long a[N];

void pt(int x)
{
    if (x) cout << "First";
    else cout << "Second";
    exit(0);
}

void solve(int k)
{
    long long s = 0, cnt = 0, kek = 0;
    for (int i = 0; i < n; i++)
    {
        s += (a[i] - 1);
        cnt += a[i] % 2;
        kek += a[i] == 1;
    }
    //cout << s << endl;
    if (s % 2 == 1)
    {
        pt(k);
    }
    if (cnt > 1)
    {
        pt(1 ^ k);
    }
    int op = 100;
    for (int i = 0; i < n; i++)
    {
    	if (a[i] % 2) a[i]--;
    	if (a[i] == 0) return 1;
    	int c = 0, x = a[i];
    	while (x % 2 == 0) c++, x /= 2;
    	op = min(op, c);
    }
    for (int i = 0; i < n; i++)
    for (int j = 0; j < op; j++)
    a[i] /= 2;
    k ^= 1;
    solve(k);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    solve(1);
}


Compiler output:
a.cc: In function 'void solve(long long int)':
a.cc:114:31: error: return-statement with a value, in function returning 'void' [-fpermissive]
  114 |         if (a[i] == 0) return 1;
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
typedef vector <pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(),x.end()
#define SZ(x) (ll) x.size()
#define f first
#define s second
#define MAXN 100100

ll A[MAXN];
ll a,N;

ll gcd(ll a, ll b){
	if (a<b)swap(a,b);
	if (b == 0)return a;
	return gcd(b, a%b);
}

ll query(){
	// for (ll i=1;i<=N;++i)cout<<A[i]<<' ';cout<<'\n';
	a = 0;
	for (ll i=1;i<=N;++i)a += A[i]-1;
	if (a%2 == 1){
		return 1;
	}
	// Other case is if everything except 1 thing is even
	ll ind = -1;
	for (ll i=1;i<=N;++i){
		if (A[i] == 1)return 2;
		if (A[i]%2 == 1){
			if (ind == -1)ind = i;
			else {
				return 2;
			}
		}
	}
	if (ind == -1){return 2;}
	--A[ind];
	ll l = A[1];
	for (ll i=2;i<=N;++i)l = gcd(l, A[i]);
	assert(l != 1);
	
	for (ll i=1;i<=N;++i)A[i] /= l;
	return 3 - query();
}

int main(){
	cin>>N;
	for (ll i=1;i<=N;++i)cin>>A[i];
	if (query() == 1)cout<<"First";
	else cout<<"Second";
}

Compiler output:
a.cc:4:17: error: 'll' was not declared in this scope; did you mean 'LL'?
    4 | typedef vector <ll> vi;
      |                 ^~
      |                 LL
a.cc:4:19: error: template argument 1 is invalid
    4 | typedef vector <ll> vi;
      |                   ^
a.cc:4:19: error: template argument 2 is invalid
a.cc:5:15: error: 'll' was not declared in this scope; did you mean 'LL'?
    5 | typedef pair <ll, ll> pi;
      |               ^~
      |               LL
a.cc:5:19: error: 'll' was not declared in this scope; did you mean 'LL'?
    5 | typedef pair <ll, ll> pi;
      |                   ^~
      |                   LL
a.cc:5:21: error: template argument 1 is invalid
    5 | typedef pair <ll, ll> pi;
      |                     ^
a.cc:5:21: error: template argument 2 is invalid
a.cc:18:1: error: 'll' does not name a type; did you mean 'ld'?
   18 | ll A[MAXN];
      | ^~
      | ld
a.cc:19:1: error: 'll' does not name a type; did you mean 'ld'?
   19 | ll a,N;
      | ^~
      | ld
a.cc:21:1: error: 'll' does not name a type; did you mean 'ld'?
   21 | ll gcd(ll a, ll b){
      | ^~
      | ld
a.cc:27:1: error: 'll' does not name a type; did you mean 'ld'?
   27 | ll query(){
      | ^~
      | ld
a.cc: In function 'int main()':
a.cc:56:14: error: 'N' was not declared in this scope
   56 |         cin>>N;
      |              ^
a.cc:57:14: error: 'll' was not declared in this scope; did you mean 'ld'?
   57 |         for (ll i=1;i<=N;++i)cin>>A[i];
      |              ^~
      |              ld
a.cc:57:21: error: 'i' was not declared in this scope; did you mean 'vi'?
   57 |         for (ll i=1;i<=N;++i)cin>>A[i];
      |                     ^
      |                     vi
a.cc:57:35: error: 'A' was not declared in this scope
   57 |         for (ll i=1;i<=N;++i)cin>>A[i];
      |                                   ^
a.cc:58:13: error: 'query' was not declared in this scope
   58 |         if (query() == 1)cout<<"First";
      |             ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

int n;
int a[100005];

bool check() {
	bool ok = false;
	int br = 0;
	int pos = -1;
	for (int i=0 ; i<n ; i++) {
		br += a[i] % 2;
		if (a[i] % 2 and a[i]!=1) pos = i;
		if (a[i] > 1) ok = true;
	}
	if (!ok) return false;
	int par = n - br;
	if (par%2) return true;
	if (br > 1 or pos == -1) {
		return false;
	}
	a[pos]--;
	while (1) {
		bool con = true;
		for (int i=0 ; i<n ; i++) {
			a[i] /= 2;
			if (a[i]%2) con = false;
		}
		if (!con) break;
	}
	return !check();
}

int main() {
	scanf("%d", &n);
	book ok = true;
	for (int i=0 ; i<n ; i++) {
		scanf("%d", a+i);
		if (a[i]%2) ok = false;
	}
	if (n == 1) {
		if (a[0]%2) printf("Second\n");
		else printf("First\n");
		return 0;
	}
	if (n == 2) {
		if (abs(a[0] - a[1]) % 2) printf("First\n");
		else printf("Second\n");
		return 0;
	}
	if (ok) {
		while (1) {
			bool con = true;
			for (int i=0 ; i<n ; i++) {
				a[i] /= 2;
				if (a[i]%2) con = false;
			}
			if (!con) break;
		}
	}
	if (check()) printf("First\n");
	else printf("Second\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:9: error: 'book' was not declared in this scope; did you mean 'bool'?
   50 |         book ok = true;
      |         ^~~~
      |         bool
a.cc:53:29: error: 'ok' was not declared in this scope
   53 |                 if (a[i]%2) ok = false;
      |                             ^~
a.cc:65:13: error: 'ok' was not declared in this scope
   65 |         if (ok) {
      |             ^~
Language: C++

#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int a[100005], pr[100005], sf[100005];
int n;
int dfs() {
	LL K = 0;
	rep(i, 1, n) K += a[i] - 1;
	if(K & 1) return 1;
	rep(i, 1, n) pr[i] = __gcd(pr[i - 1], a[i]);
	per(i, n, 1) sf[i] = __gcd(sf[i + 1], a[i]);
	rep(i, 1, n) {
		if(a[i] == 1) continue;
		K = __gcd(__gcd(pr[i - 1], sf[i + 1]), a[i] - 1);
		if(K != 1) {
			--a[i];
			rep(j, 1, n) a[j] /= K; 
			int bj = dfs();
			rep(j, 1, n) a[j] *= K;
			++a[i];
			return bj ^ 1;
		}
	}
	return 0;
}
int main() {
	scanf("%lld", &n);
	rep(i, 1, n) {
		scanf("%lld", &a[i]);
	}
	if(n == 1) puts("First");
	else if(n == 2) puts("First");
	else puts(dfs() ? "First" : "Second");
	return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java

public class Suger extends Condiments {

    Suger(Bevarage bvr)
    {
        this.bvr=bvr;
        des=" , Suger";
    }
    int cost() {
return bvr.cost()+5;
    }
    
}

Compiler output:
Main.java:1: error: class Suger is public, should be declared in a file named Suger.java
public class Suger extends Condiments {
       ^
Main.java:1: error: cannot find symbol
public class Suger extends Condiments {
                           ^
  symbol: class Condiments
Main.java:3: error: cannot find symbol
    Suger(Bevarage bvr)
          ^
  symbol:   class Bevarage
  location: class Suger
Main.java:5: error: cannot find symbol
        this.bvr=bvr;
            ^
  symbol: variable bvr
Main.java:6: error: cannot find symbol
        des=" , Suger";
        ^
  symbol:   variable des
  location: class Suger
Main.java:9: error: cannot find symbol
return bvr.cost()+5;
       ^
  symbol:   variable bvr
  location: class Suger
6 errors
Language: Java

public class Mocha extends Condiments{

    Mocha(Bevarage bvr)
    {
        this.bvr=bvr;
        des=" , Mocha";
    }
    int cost() {
return bvr.cost()+10;
    }
    
}


Compiler output:
Main.java:1: error: class Mocha is public, should be declared in a file named Mocha.java
public class Mocha extends Condiments{
       ^
Main.java:1: error: cannot find symbol
public class Mocha extends Condiments{
                           ^
  symbol: class Condiments
Main.java:3: error: cannot find symbol
    Mocha(Bevarage bvr)
          ^
  symbol:   class Bevarage
  location: class Mocha
Main.java:5: error: cannot find symbol
        this.bvr=bvr;
            ^
  symbol: variable bvr
Main.java:6: error: cannot find symbol
        des=" , Mocha";
        ^
  symbol:   variable des
  location: class Mocha
Main.java:9: error: cannot find symbol
return bvr.cost()+10;
       ^
  symbol:   variable bvr
  location: class Mocha
6 errors
Language: Java

public class DarkRoast extends Bevarage{

    DarkRoast()
    {
        des="Finest Dark roast";
    }
    @Override
    int cost() {
        return 30;
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

Compiler output:
Main.java:11: error: reached end of file while parsing
    }
     ^
1 error
Language: Java

abstract public class Condiments extends Bevarage {
    Bevarage bvr;
    String getDES()
    {
    return bvr.getDES()+des;
    }
    
}


Compiler output:
Main.java:1: error: class Condiments is public, should be declared in a file named Condiments.java
abstract public class Condiments extends Bevarage {
                ^
Main.java:1: error: cannot find symbol
abstract public class Condiments extends Bevarage {
                                         ^
  symbol: class Bevarage
Main.java:2: error: cannot find symbol
    Bevarage bvr;
    ^
  symbol:   class Bevarage
  location: class Condiments
Main.java:5: error: cannot find symbol
    return bvr.getDES()+des;
                        ^
  symbol:   variable des
  location: class Condiments
4 errors
Language: Java

public class Main {

    
    public static void main(String[] args) {
        Bevarage bvr= new DarkRoast();
        bvr= new Mocha(bvr);
         bvr= new Mocha(bvr);
          bvr= new Suger(bvr);
         System.out.println("total cost :  "+bvr.cost());
    }
    
}

Compiler output:
Main.java:5: error: cannot find symbol
        Bevarage bvr= new DarkRoast();
        ^
  symbol:   class Bevarage
  location: class Main
Main.java:5: error: cannot find symbol
        Bevarage bvr= new DarkRoast();
                          ^
  symbol:   class DarkRoast
  location: class Main
Main.java:6: error: cannot find symbol
        bvr= new Mocha(bvr);
                 ^
  symbol:   class Mocha
  location: class Main
Main.java:7: error: cannot find symbol
         bvr= new Mocha(bvr);
                  ^
  symbol:   class Mocha
  location: class Main
Main.java:8: error: cannot find symbol
          bvr= new Suger(bvr);
                   ^
  symbol:   class Suger
  location: class Main
5 errors
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1, i##_end_ = (n); i <= i##_end_; ++i)
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const int maxn = 300300;
int n, a[maxn];

bool eval() {
    int odd = 0, even = 0, p = -1;
    for(int i = 1; i <= n; ++i) {
        if(a[i] & 1) {
            odd++;
            if(a[i] != 1) p = i;
        }
        else even++;
    }`
    if(even & 1) {
        puts("First");
        return true;
    } else {
        if(odd > 1) { 
            puts("Second"); 
            return true; 
        } else {
            assert(odd == 1);
            if(p == -1) {
                ll tot = 0;
                for(int i = 1; i <= n; ++i)
                    tot += a[i] - 1;
                if(tot & 1) puts("First");
                else puts("Second");
                return true;
            }
            a[p]--;
            int g = a[1];
            for(int i = 2; i <= n; ++i)
                g = __gcd(g, a[i]);
            for(int i = 1; i <= n; ++i)
                a[i] /= g;
            return false;
        }
    }
}

int main() {
    scanf("%d", &n);
    rep(i, n) scanf("%d", &a[i]);
    if(n == 1) { 
        puts((a[1] & 1) ? "Second" : "First");  
        return 0; 
    }

    while(!eval()) continue;
    
    return 0;
}

Compiler output:
a.cc:18:6: error: stray '`' in program
   18 |     }`
      |      ^