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

#include<iostream>
#include<cstdio>
#include<functional>
#include<cstdlib>
#include<stdexcept>
#include<numeric>
#include<cmath>
#include<fstream>
#include<memory>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<deque>
#include<sstream>
#include<iomanip>
#include<sstream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<climits>
#include<map>
#include<set>
#include<list>
#include<cassert>
#include<deque>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define INF 1<<27
#define all(n) n.begin(),n.end()
#define F first
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define S second
#define ppins(a,b,c,d) PP(P(a,b),P(c,d))
#define pb push_back
#define My "NARIYOSHI_XX"
#define pf push_front
#define LIM 100000
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef long long ll;
typedef unsigned long long ull;

bool calc(set<int>& B,set<int>& A,string ope,stack<set<int> >& ele)
{
  set<int> C;
  for(set<int>::iterator it_B = B.begin();it_B != B.end();it_B++)
    {
      for(set<int>::iterator it_A = A.begin();it_A != A.end();it_A++)
	{
	  if(ope == "+")
	    {
	      C.insert(((*it_A)+(*it_B))%256);
	    }
	  else if(ope == "-")
	    {
	      C.insert(((*it_A)-(*it_B)+256)%256);
	    }
	  else if(ope == "*")
	    {
	      C.insert(((*it_A)*(*it_B))%256);
	    }
	  else if(ope == "/")
	    {
	      if(!(*it_B))
		{
	
		  return false; 
		}
	      C.insert(((*it_A)/(*it_B))%256);
	    }
	  else 
	    assert(false);
	}
    }
  index[My] = C;
  ele.push(C);
  return true;
}

int main(){
  int m,n;
  map<string,set<int> > index;
  stack<set<int> > ele;
  deque<string> st;
  bool fin = false;

  cin >> m;
  for(int i=0;i<m;i++)
    {
      string name;
      int lb,ub;
      cin >> name >> lb >> ub;
      for(int j = lb;j <= ub;j++)
	index[name].insert(j);
    }

  cin >> n;
  for(int i=0;i<n;i++)
    {
      string e;
      cin >> e;
     
      if(e != "/" && e != "*" && e != "-" && e != "+")
	{
	  if(index.find(e) != index.end())
	    {
	      ele.push(index[e]);
	    }
	  else
	    {
	      set<int> FAGS;
	      FAGS.insert((atoi)(e.c_str()));
	      ele.push(FAGS);
	    }
	}
      else 
	{
	  set<int> A,B;
	  B = ele.top(),ele.pop();
	  A = ele.top(),ele.pop();
	  if(!calc(B,A,e,ele))
	    fin = true;	    
	}

    }

  if(fin)
    {
      cout << "error" << endl;
      return 0;
    }
  
    cout << "correct" << endl;

return 0;
}

Compiler output:
a.cc: In function 'bool calc(std::set<int>&, std::set<int>&, std::string, std::stack<std::set<int> >&)':
a.cc:78:8: error: invalid types '<unresolved overloaded function type>[const char [13]]' for array subscript
   78 |   index[My] = C;
      |        ^
Language: C++

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>
#include <climits>
#include <bitset>
#include <cassert>
#include <unordered_map>
#include <agents.h>
#else
// END CUT HERE
#include <bits/stdc++.h>
// BEGIN CUT HERE
#endif
// END CUT HERE

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;

const int N = 55;
ll dp[2][55][55][55];

map<string, vector<int>> dpm;
map<string, vector<string>> mp;

vector<int> func(string s){
	int x = 0;
	for (auto c : s){
		rep(i, 4) if (c == "ATGC"[i]) x |= 1 << i;
	}
	return vector<int>(1, x);
}

vector<int> operator+(const vector<int> &lhs, const vector<int> &rhs) {
	vector<int> res = lhs;
	for (auto e : rhs) res.push_back(e);
	return res;
}

vector<int> parse(string s){
	if (s[0] == '[') return func(s);
	auto &res = dpm[s];
	if (!res.empty()) return res;

	auto &vs = mp[s];
	for (auto &s : vs){
		res = res + parse(s);
		if (res.size() > 200) return res;
	}
	return res;
}

int main(){
	int A, T, G, C;
	cin >> A >> T >> G >> C;
	int m;
	cin >> m;
	cin.ignore();

	string str;
	rep(i, m){
		string s;
		getline(cin, s);
		stringstream ss(s);
		string t;
		ss >> t;
		t = t.substr(0, t.size() - 1);
		if (str.empty()) str = t;
		while (ss >> s){
			mp[t].push_back(s);
		}
	}

	auto &x = parse(str);

	int n = A + T + G + C;
	if (x.size() != n){
		cout << 0 << endl;
		return 0;
	}
	
	const ll mod = 1e9 + 7;
	dp[0][0][0][0] = 1;

	auto upd = [&](ll &a, ll &b){
		a = (a + b) % mod;
	};

	rep(i, n){
		int cur = i & 1, nxt = !cur;
		rep(j, A + 1) rep(k, T + 1) rep(l, G + 1) dp[nxt][j][k][l] = 0;
		rep(j, A + 1) rep(k, T + 1) rep(l, G + 1){
			if (x[i] & 1) upd(dp[nxt][j + 1][k][l], dp[cur][j][k][l]);
			if (x[i] & 2) upd(dp[nxt][j][k + 1][l], dp[cur][j][k][l]);
			if (x[i] & 4) upd(dp[nxt][j][k][l + 1], dp[cur][j][k][l]);
			if (x[i] & 8) upd(dp[nxt][j][k][l], dp[cur][j][k][l]);
		}
	}
	cout << dp[n & 1][A][T][G] << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:24: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
  101 |         auto &x = parse(str);
      |                   ~~~~~^~~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>

using namespace std;

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

class Rule{
	public:
	bool isempty(char c){
		return c==':' || c==' ' || c=='\n' || c==0;
	}
	Rule(char* str){
		int len = strlen(str);
		rep(i,len){
			if(isempty(str[i]))str[i]=0;
		}
		int count = 0;
		rep(i,len){
			if(!isempty(str[i])){
				if(i==0)name = string(str+i);
				else if(isempty(str[i-1]))to.push_back(str+i);
				count++;
			}
		}
	}
	string name;
	vector<string> to;
};

class S{
	public:
	bool a,t,g,c;
	S(string str){
		a=t=g=c=false;
		rep(i,str.size()){
			if(str[i]=='A')a=true;
			if(str[i]=='T')t=true;
			if(str[i]=='G')g=true;
			if(str[i]=='C')c=true;
		}
	}
};

int na,ng,nt,nc;
vector<Rule> rules;
map<string,int> rmap;

void input(){
	cin>>na>>nt>>ng>>nc;
	int r;
	cin>>r;
	rep(i,r){
		char str[3000];
		gets(str);
		rules.push_back(Rule(str));
		rmap[rules[i].name]=i;
	}
}

vector<S> state;

bool isend(string& str){
	return str[0]=='[';
}
void make_state_req(int num){
	rep(i,rules[num].to.size()){
		string next = rules[num].to[i];
		if(isend(next)){
			state.push_back(S(next));
		}else{
			make_state_req(rmap[next]);
		}
	}
}

void printstate(){
	rep(i,state.size()){
		cout<<state[i].a<<" "<<state[i].t<<" "<<state[i].g<<" "<<state[i].c<<endl;
	}
}

void make_state(){
	make_state_req(0);
}


const int N = 50;
const int MOD = 1000000007;

int memo[N][N][N][N];

int solve_dp_req(int na,int nt,int ng, int nc){
	int sum = na+nt+ng+nc;
	if(sum>state.size())return 0;
	if(na<0 || nt<0 || ng<0 || nc<0)return 0;
	if(sum==0)return 1;
	if(memo[na][nt][ng][nc]!=-1)return memo[na][nt][ng][nc]=1;
	
	int ans = 0;
	if(state[sum-1].a) ans = (ans + solve_dp_req(na-1, nt, ng, nc))%MOD;
	if(state[sum-1].t) ans = (ans + solve_dp_req(na, nt-1, ng, nc))%MOD;
	if(state[sum-1].g) ans = (ans + solve_dp_req(na, nt, ng-1, nc))%MOD;
	if(state[sum-1].c) ans = (ans + solve_dp_req(na, nt, ng, nc-1))%MOD;
	
	//printf("%d %d %d %d : %d\n",na,nt,ng,nc,ans);
	return memo[na][nt][ng][nc]=ans;
}
int solve_dp(){
	rep(i,N)rep(j,N)rep(k,N)rep(p,N)memo[i][j][k][p]=-1;
	return solve_dp_req(na,nt,ng,nc);
}

int solve(){
	make_state();
	//printstate();
	return solve_dp();
}

int main(){
	input();
	printf("%d\n",solve());
}

Compiler output:
a.cc: In constructor 'Rule::Rule(char*)':
a.cc:19:27: error: 'strlen' was not declared in this scope
   19 |                 int len = strlen(str);
      |                           ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<map>
  +++ |+#include <cstring>
    7 | 
a.cc: In function 'void input()':
a.cc:60:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   60 |                 gets(str);
      |                 ^~~~
      |                 getw
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * YAML
 */
public class P2438 {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		P2438 main = new P2438();

		StringTokenizer query = new StringTokenizer(br.readLine(), ".");
		List<String> yaml = new ArrayList<>();
		Obj[] objs = new Obj[50_000];

		//read
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			yaml.add(line);
		}

		//parse
		for (int i = 0; i < yaml.size(); i++) {
			String line1 = yaml.get(i);

			//parent
			int n = 0;
			for (int j = 0; j < line1.length(); j++) {
				if (line1.charAt(j) == ' ') n++;
				else break;
			}
			if (objs[n] == null) {
				objs[n] = main.new Obj();
			}

			//prop
			words = line1.substring(n).split(":");
			if (words.length == 1) {
				//prop: object
				String line2 = yaml.get(i + 1);
				//self
				int m = 0;
				for (int j = 0; j < line2.length(); j++) {
					if (line2.charAt(j) == ' ') m++;
					else break;
				}
				if (objs[m] == null) {
					objs[m] = main.new Obj();
				}
				String key = words[0];
				objs[n].props.put(key, main.new Prop<Obj>(objs[m]));
			} else {
				//prop: string
				String key = words[0];
				String string = words[1].substring(1);
				objs[n].props.put(key, main.new Prop<String>(string));
			}
		}

		Obj obj = objs[0];
		Prop prop = null;
		while (query.hasMoreTokens()) {
			if ((prop = obj.get(query.nextToken())) != null) {
				if (prop.value instanceof Obj) {
					obj = (Obj) prop.value;
				} else {
					if (query.hasMoreTokens()) {
						prop = null;
						break;
					}
				}
			}
		}

		String ans = "";
		if (prop == null) {
			ans = "no such property";
		} else if (prop.value instanceof String) {
			ans = "string \"" + prop.value + "\"";
		} else if (prop.value instanceof Obj) {
			ans = "object";
		}
		System.out.println(ans);

	} //end main


	class Obj {
		Map<String, Prop> props;

		Obj() {
			props = new HashMap<>();
		}

		Prop get(String key) {
			return props.get(key);
		}
	}

	class Prop<T> {
		T value;

		Prop(T value) {
			this.value = value;
		}
	}
}

Compiler output:
Main.java:11: error: class P2438 is public, should be declared in a file named P2438.java
public class P2438 {
       ^
1 error
Language: Java

import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * YAML
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		Main main = new Main();

		StringTokenizer query = new StringTokenizer(br.readLine(), ".");
		List<String> lines = new ArrayList<>();
		Obj[] objs = new Obj[50_000];

		//read
		while ((line = br.readLine()) != null && !line.isEmpty()) {
			lines.add(line);
		}

		//parse
		for (int i = 0; i < lines.size(); i++) {
			String line1 = lines.get(i);

			//parent
			int n = 0;
			for (int j = 0; j < line1.length(); j++) {
				if (line1.charAt(j) == ' ') n++;
				else break;
			}
			if (objs[n] == null) {
				objs[n] = main.new Obj();
			}

			//prop
			words = line1.substring(n).split(":");
			if (words.length == 1) {
				//prop: object
				String line2 = lines.get(i + 1);
				//self
				int m = 0;
				for (int j = 0; j < line2.length(); j++) {
					if (line2.charAt(j) == ' ') m++;
					else break;
				}
				if (objs[m] == null) {
					objs[m] = main.new Obj();
				}
				String key = words[0];
				objs[n].props.put(key, main.new Prop<Obj>(objs[m]));
			} else {
				//prop: string
				String key = words[0];
				String string = words[1].substring(1);
				objs[n].props.put(key, main.new Prop<String>(string));
			}
		}

		Obj obj = objs[0];
		Object value = null;
		while (query.hasMoreTokens()) {
			value = obj.get(query.nextToken());
			if (value == null) break;
			if (value instanceof Obj) {
				obj = (Obj) value;
			} else {
				if (query.hasMoreTokens()) {
					value = null;
				}
			}
		}

		String ans = "";
		if (value == null) {
			ans = "no such property";
		} else if (value instanceof String) {
			ans = "string \"" + value + "\"";
		} else if (value instanceof Obj) {
			ans = "object";
		}
		System.out.println(ans);

	} //end main

	class Obj {
		Map<String, Prop> props;

		Obj() {
			props = new HashMap<>();
		}

		Object get(String key) {
			return props.get(key).value;
		}
	}

	class Prop<T> {
		T value;

		Prop(T value) {
			this.value = value;
		}
	}
}

Compiler output:
Main.java:1: error: package com.sun.istack.internal does not exist
import com.sun.istack.internal.NotNull;
                              ^
Main.java:2: error: package com.sun.istack.internal does not exist
import com.sun.istack.internal.Nullable;
                              ^
2 errors
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* F(char *b,int n,FILE *f){char *r=fgets(buf,n,f);if(!r)return NULL;buf[strlen(b)-1]=0;return r;}
char Q[29999],*q[9],L[29999];
int n;
dfs(old_indent,depth){
	int indent=0;
	if(!F(L,sizeof(L),stdin)){puts("no such property");exit(0);}
	for(;L[indent]==' ';indent++);
	if(old_indent>=indent){puts("no such property");exit(0);}
	char *name=strtok(L+indent,":"),*value=name+strlen(name)+1;
	if(!strcmp(name,q[depth])){
		if(depth==n-1){
			if(*value)
				printf("string \"%s\"\n",value+1),exit(0);
			else
				puts("object"),exit(0);
		}
		dfs(indent,depth+1);
	}
	dfs(old_indent,depth);
}
main(){F(Q,sizeof(Q),stdin);q[0]=strtok(Q+1,".");for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;dfs(-1,0);}

Compiler output:
main.c: In function 'F':
main.c:4:46: error: 'buf' undeclared (first use in this function)
    4 | char* F(char *b,int n,FILE *f){char *r=fgets(buf,n,f);if(!r)return NULL;buf[strlen(b)-1]=0;return r;}
      |                                              ^~~
main.c:4:46: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | dfs(old_indent,depth){
      | ^~~
main.c: In function 'dfs':
main.c:7:1: error: type of 'old_indent' defaults to 'int' [-Wimplicit-int]
main.c:7:1: error: type of 'depth' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:24:1: error: return type defaults to 'int' [-Wimplicit-int]
   24 | main(){F(Q,sizeof(Q),stdin);q[0]=strtok(Q+1,".");for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;dfs(-1,0);}
      | ^~~~
Language: C

#include<stdio.h>
#define Prime 1000000007
int main(void){
  int n,i,j;
  char c[202];
  long long dp[202][202]={{1}};
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%s",&c[i]);
for(i=0;i<n;i++){
for(j=0;j<n+1;j++){
    if(c[i]=='D'){
      dp[i+1][j]+=dp[i][j]*j;
      if(j)dp[i+1][j-1]+=dp[i][j]*i*j;
      dp[i+1][j]%=Prime;
      if(j)dp[i+1][j-1]%=Prime;
    }else if(c=='U'){
      dp[i+1][j+1]+=dp[i][j];
      dp[i+1][j]+=dp[i][j]*j;
      dp[i+1][j+1]%=Prime;
      dp[i+1][j]%=Prime;
    }
  }
  printf("%d\n",dp[i][0]);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:19:15: warning: comparison between pointer and integer
   19 |     }else if(c=='U'){
      |               ^~
main.c:27:3: error: expected declaration or statement at end of input
   27 |   return 0;}
      |   ^~~~~~
Language: C

#include<stdio.h>
#define Prime 1000000007
int main(void){
  int n,i,j;
  char c[202][20];
  long long dp[202][202]={{1}};
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%s",&c[i]);
for(i=0;i<n;i++){
for(j=0;j<n+1;j++){
    if(c[i][0]=='D'){
      dp[i+1][j]+=dp[i][j]*j;
      if(j)dp[i+1][j-1]+=dp[i][j]*i*j;
      dp[i+1][j]%=Prime;
      if(j)dp[i+1][j-1]%=Prime;
    }else if(c[i][0]=='U'){
      dp[i+1][j+1]+=dp[i][j];
      dp[i+1][j]+=dp[i][j]*j;
      dp[i+1][j+1]%=Prime;
      dp[i+1][j]%=Prime;
    }
  }
  printf("%d\n",dp[i][0]);
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:27:3: error: expected declaration or statement at end of input
   27 |   return 0;}
      |   ^~~~~~
Language: C++

#include <iostream>

using namespace std;
typedef long long ll;

const int MN = 220;
const ll MD = 1e9+7;

int n;
int d[MN];
ll dp[MN][MN];

ll solve(int i, int j) {
    if (i == 0) {
        if (j == 0) return 1;
        return 0;
    }
    if (dp[i][j] != -1) return dp[i][j];
    ll &res = dp[i][j];
    if (d[i-1] == 0) {
        res = solve(i-1, j);
    } else if (d[i-1] == 1) {
        res = (solve(i-1, j-1)+j*solve(i-1, j)) % MD;
    } else {
        res = ((j+1)*(j+1)*solve(i-1, j+1) + j*solve(i-1, j)) % MD;
    }
    return res;
}

int main() {
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "-") {
            d[i] = 0;
        } else if (s == "U") {
            d[i] = 1;
        } else {
            d[i] = 2;
        }
    }
    cout << solve(n, 0) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:5: error: 'memset' was not declared in this scope
   31 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include<stdio.h>
#define Prime 1000000007
int main(void){
  int n,i,j;
  char c[202][20];
  long long dp[202][202]={{1}};
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    scanf("%s",&c[i]);
for(i=0;i<n;i++){
cnt=0;
for(j=0;j<n+1;j++){
    if(c[i][0]=='D'){
      dp[i+1][j-cnt]+=dp[i][j-cnt]*(j-cnt);
      if(j)dp[i+1][j-1-cnt]+=dp[i][j-cnt]*(j-cnt)*(j-cnt);
      dp[i+1][j-cnt]%=Prime;
      if(j)dp[i+1][j-1-cnt]%=Prime;
    }else if(c[i][0]=='U'){
      dp[i+1][j+1-cnt]+=dp[i][j-cnt];
      dp[i+1][j-cnt]+=dp[i][j-cnt]*(j-cnt);
      dp[i+1][j+1-cnt]%=Prime;
      dp[i+1][j-cnt]%=Prime;
    }else{
      cnt++;
    }
  }}
  printf("%d\n",dp[i][0]);
  return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:1: error: 'cnt' was not declared in this scope; did you mean 'int'?
   13 | cnt=0;
      | ^~~
      | int
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;

ll add(ll a,ll b){
  return (a+b+mod+mod)%mod;
}

ll mul(ll a,ll b){
  return (a*b)%mod;
}

map< vector<int> , ll > dp[201][201];
string S;

ll rec(int dep,int cnt,vector<int> v){
  for(int i=0;i<(int)v.size();i++){
    if(v[i]<0)return 0;
  if(dep==(int)S.size())return 1;
  if(dep>0&&S[dep-1]=='U')cnt++;
  if(dp[ dep ][ cnt ].count(v) )return dp[dep][cnt][v];
  ll res=0;
  if( (v.empty() || v[0]>0) && cnt> 0){
    vector<int> next=v;
    for(int i=0;i<(int)v.size();i++)next[i]--;
    res=add(res, mul(cnt,rec(dep+1,cnt-1,next) ) );
  }
  for(int i=0;i<(int)v.size();i++){

    vector<int> next;
    for(int j=0;j<(int)v.size();j++){
      if(i!=j)next.push_back(v[j]-1);
    }
    sort(next.begin(),next.end());
    if(!next.empty() && next[0]<0)continue;    
    res=add(res, rec(dep+1,cnt,next) );
  }
  return dp[dep][cnt][v]=res;
}

int solve(string str){
  if(str=="")return 1;
  vector<int> vec;
  int cnt=0;
  for(int i=0;i<(int)str.size();i++){
    if(str[i]=='D')vec.push_back(i-1);
  }
  S=str;
  return rec( 0, cnt, vec );
}

int main(){
  int n;
  cin>>n;
  string str="";
  for(int i=0;i<n;i++){
    char ch;
    cin>>ch;
    if(ch=='-')continue;
    str+=ch;
  }
  cout<<solve(str)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'll rec(int, int, std::vector<int>)':
a.cc:42:22: error: a function-definition is not allowed here before '{' token
   42 | int solve(string str){
      |                      ^
a.cc:53:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   53 | int main(){
      |         ^~
a.cc:53:9: note: remove parentheses to default-initialize a variable
   53 | int main(){
      |         ^~
      |         --
a.cc:53:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:53:11: error: a function-definition is not allowed here before '{' token
   53 | int main(){
      |           ^
a.cc:65:2: error: expected '}' at end of input
   65 | }
      |  ^
a.cc:17:38: note: to match this '{'
   17 | ll rec(int dep,int cnt,vector<int> v){
      |                                      ^
a.cc:65:2: warning: control reaches end of non-void function [-Wreturn-type]
   65 | }
      |  ^
Language: C++

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

const long long int MOD = 1000000007LL;
long long int dp[210][210];
int main() {
  int N; cin >> N;

  dp[0][0] = 1;
  for(int i=0; i<N; i++) {
    char c; cin >> c;
    for(int j=0; j<=i; j++) { 
      if(c == '-') {
        dp[i+1][j] = dp[i][j];
      }
      else {
        if(c == 'D') {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }

        int is_u = (c == 'U');
        (dp[i+1][j] += dp[i][j - 1 + is_u]) %= MOD;
        (dp[i+1][j] += dp[i][j     + is_u] * (j + is_u)) %= MOD;
      }
    }
  }

  for(int i=1; i<=N; i++) {
    for(int j=0; j<=N; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }

  
  cout << dp[N][0] << endl;
  return 0;
}

5
U
U
-
D
D
1 0 0 0 0 0 
1 0 0 0 0 0 
1 0 0 0 0 0 
0 1 0 0 0 0 
0 2 1 0 0 0 
0

3
-
U
D
1 0 0 0 
1 0 0 0 
0 1 0 0 
0



Compiler output:
a.cc:41:1: error: expected unqualified-id before numeric constant
   41 | 5
      | ^
Language: C++

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

const long long int MOD = 1000000007LL;
long long int dp[210][210];
int main() {
  int N; cin >> N;

  dp[0][0] = 1;
  for(int i=0; i<N; i++) {
    char c; cin >> c;
    for(int j=0; j<=i+1; j++) { 
      if(c == '-') {
        dp[i+1][j] = dp[i][j];
      }
      else {
        if(c == 'D') {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }

        int is_u = (c == 'U');
        (dp[i+1][j] += dp[i][j     - is_u]) %= MOD;
        (dp[i+1][j] += dp[i][j + 1 - is_u] * (j + 1 - is_u)) %= MOD;
      }
    }
  }

  for(int i=1; i<=N; i++) {
    for(int j=0; j<=N; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }

  
  cout << dp[N][0] << endl;
  return 0;
}

/*
5
U
U
-
D
D
1 0 0 0 0 0 
1 0 0 0 0 0 
1 0 0 0 0 0 
0 1 0 0 0 0 
0 2 1 0 0 0 
0

3
-
U
D
1 0 0 0 
1 0 0 0 
0 1 0 0 
0

*/

8
U
D
D
D
D
D
D
D
0 1 0 0 0 0 0 0 0 
1 2 0 0 0 0 0 0 0 
3 4 0 0 0 0 0 0 0 
7 8 0 0 0 0 0 0 0 
15 16 0 0 0 0 0 0 0 
31 32 0 0 0 0 0 0 0 
63 64 0 0 0 0 0 0 0 
127 128 0 0 0 0 0 0 0 
127



Compiler output:
a.cc:66:1: error: expected unqualified-id before numeric constant
   66 | 8
      | ^
Language: C++

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

const long long int MOD = 1000000007LL;
long long int dp[210][210];
int main() {
  int N; cin >> N;

  dp[0][0] = 1;
  for(int i=0; i<N; i++) {
    char c; cin >> c;
    for(int j=0; j<=i+1; j++) { 
      if(c == '-') {
        dp[i+1][j] = dp[i][j];
      }
      else {
        if(c == 'D') {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }
        else {
          dp[i+1][j] = 1;
        }

        int is_u = (c == 'U');
        long long int add = 0;
        (add += dp[i][j     - is_u]) %= MOD;
        (add += dp[i][j + 1 - is_u] * (j + 1 - is_u)) %= MOD;

        (dp[i+1][j] *= add) %= MOD;
      }
    }
  }

  for(int i=1; i<=N; i++) {
    for(int j=0; j<=N; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }

  
  cout << dp[N][0] << endl;
  return 0;
}

/*
5
U
U
-
D
D
1 0 0 0 0 0 
1 0 0 0 0 0 
1 0 0 0 0 0 
0 1 0 0 0 0 
0 2 1 0 0 0 
0

3
-
U
D
1 0 0 0 
1 0 0 0 
0 1 0 0 
0

*/

8 
U
D
D
D
D
D
D
D
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0


Compiler output:
a.cc:72:1: error: expected unqualified-id before numeric constant
   72 | 8
      | ^
Language: C++

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

const long long int MOD = 1000000007LL;
long long int dp[210][210];
int main() {
  int N; cin >> N;

  dp[0][0] = 1;
  for(int i=0; i<N; i++) {
    char c; cin >> c;
    for(int j=0; j<=i+1; j++) { 
      if(c == '-') {
        dp[i+1][j] = dp[i][j];
      }
      else {
        if(c == 'D') {
          (dp[i+1][j] += dp[i][j] * j) %= MOD;
        }
        else {
          dp[i+1][j] = 1;
        }

        int is_u = (c == 'U');
        long long int add = 0;
        (add += dp[i][j     - is_u]) %= MOD;
        (add += dp[i][j + 1 - is_u] * (j + 1 - is_u)) %= MOD;


        printf("i = %d, j = %d, c = %c, add = %lld\n", i, j, c, add);
        (dp[i+1][j] *= add) %= MOD;
      }
    }
  }

  for(int i=1; i<=N; i++) {
    for(int j=0; j<=N; j++) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }

  
  cout << dp[N][0] << endl;
  return 0;
}

/*
5
U
U
-
D
D
1 0 0 0 0 0 
1 0 0 0 0 0 
1 0 0 0 0 0 
0 1 0 0 0 0 
0 2 1 0 0 0 
0

3
-
U
D
1 0 0 0 
1 0 0 0 
0 1 0 0 
0

*/

8
U
D
D
D
D
D
D
D
i = 0, j = 0, c = U, add = 0
i = 0, j = 1, c = U, add = 1
i = 1, j = 0, c = D, add = 1
i = 1, j = 1, c = D, add = 1
i = 1, j = 2, c = D, add = 0
i = 2, j = 0, c = D, add = 1
i = 2, j = 1, c = D, add = 1
i = 2, j = 2, c = D, add = 0
i = 2, j = 3, c = D, add = 0
i = 3, j = 0, c = D, add = 1
i = 3, j = 1, c = D, add = 1
i = 3, j = 2, c = D, add = 0
i = 3, j = 3, c = D, add = 0
i = 3, j = 4, c = D, add = 0
i = 4, j = 0, c = D, add = 1
i = 4, j = 1, c = D, add = 1
i = 4, j = 2, c = D, add = 0
i = 4, j = 3, c = D, add = 0
i = 4, j = 4, c = D, add = 0
i = 4, j = 5, c = D, add = 0
i = 5, j = 0, c = D, add = 1
i = 5, j = 1, c = D, add = 1
i = 5, j = 2, c = D, add = 0
i = 5, j = 3, c = D, add = 0
i = 5, j = 4, c = D, add = 0
i = 5, j = 5, c = D, add = 0
i = 5, j = 6, c = D, add = 0
i = 6, j = 0, c = D, add = 1
i = 6, j = 1, c = D, add = 1
i = 6, j = 2, c = D, add = 0
i = 6, j = 3, c = D, add = 0
i = 6, j = 4, c = D, add = 0
i = 6, j = 5, c = D, add = 0
i = 6, j = 6, c = D, add = 0
i = 6, j = 7, c = D, add = 0
i = 7, j = 0, c = D, add = 1
i = 7, j = 1, c = D, add = 1
i = 7, j = 2, c = D, add = 0
i = 7, j = 3, c = D, add = 0
i = 7, j = 4, c = D, add = 0
i = 7, j = 5, c = D, add = 0
i = 7, j = 6, c = D, add = 0
i = 7, j = 7, c = D, add = 0
i = 7, j = 8, c = D, add = 0
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 
0



Compiler output:
a.cc:75:1: error: expected unqualified-id before numeric constant
   75 | 8
      | ^
Language: Java

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        solve2440();
    }

    public static void solve2440() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < N; i++) {
            set.add(sc.next());
        }
        int M = sc.nextInt();
        boolean state = false;
        for (int j = 0; j < M; j++) {
            String user = sc.next();
            if (set.contains(user)) {
                state = !state;
                System.out.println(state ? "Opened by " + user : "Closed by " + user);
            } else {
                System.out.println("Unknown " + user);
            }
        }
    }



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


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args){
		run();
	}
	public void run() {
		try {
			// インプットデータ取得
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int cardNo = Integer.parseInt(br.readLine());

			// 施錠は"0"、開錠は"1"
			String openFlg = "0";

			ArrayList<String> cardList = new ArrayList<String>();
			while(br != null){
				for(int i = 0; i < cardNo; i++){
					cardList.add(br.readLine());
				}
				int touchNo = Integer.parseInt(br.readLine());
				for(int j = 0; j < touchNo; j++){
					String usr = br.readLine();
					if(!cardList.contains(usr)){
						System.out.println("Unknown " + usr);
					} else {
						if(openFlg.equals("1")){
							openFlg = "0";
							System.out.println("Closed by " + usr);
						} else {
							openFlg = "1";
							System.out.println("Opened by " + usr);
						}
					}
				}
			}
		} catch (Exception e) {
			e.getStackTrace();
			System.exit(0);
		}
	}
}


Compiler output:
Main.java:8: error: non-static method run() cannot be referenced from a static context
		run();
		^
1 error
Language: Java

import java.util.*;

public class MainTwo {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int lock = 0;
		int n = sc.nextInt();
		String[] u = new String[n];
		for (int i = 0; i < n; i++)
			u[i] = sc.next();
		int m = sc.nextInt();
		String t;
		for (int i = 0; i < m; i++) {
			t = sc.next();
			for (int j = 0; j < n; j++) {
				if (t.equals(u[j]) && lock == 0) {
					System.out.println("Opened by " + t);
					lock = 1;
					break;
				} else if (t.equals(u[j]) && lock == 1) {
					System.out.println("Closed by " + t);
					lock = 0;
					break;
				} else if (j == n - 1)
					System.out.println("unknown " + t);
			}
		}
		sc.close();
	}
}

Compiler output:
Main.java:3: error: class MainTwo is public, should be declared in a file named MainTwo.java
public class MainTwo {
       ^
1 error
Language: C

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

enum{ OPEN, CLOSE };
typedef struct{
    char id[20];
} ID;

int isID(char id[], ID* reg, int regSize){
    int i;

    for(i = 0; i < regSize; i++){
        if(strcmp(id, reg[i].id)!){
            return 1;
        }
    }
    return 0;
}

int main(void){
    int i;
    int n, m;
    int state = CLOSE;

    scanf("%d", &n);
    ID* u = (ID *)malloc(n * sizeof(ID));

    for(i = 0; i < n; i++){
        scanf("%s", u[i].id);
    }

    scanf("%d", &m);
    ID* t = (ID *)malloc(m * sizeof(ID));

    for(i = 0; i < m; i++){
        scanf("%s", t[i].id);
    }

    for(i = 0; i < m; i++){
        if(isID(t[i].id, u, n)){
            if(state == CLOSE){
                printf("Opened by %s\n", t[i].id);
                state = OPEN;
            }
            else{
                printf("Closed by %s\n", t[i].id);
                state = CLOSE;
            }
        }
        else{
            printf("Unknown %s\n", t[i].id);
        }
    }

    free(u);
    free(t);

    return 0;
}

Compiler output:
main.c: In function 'isID':
main.c:14:33: error: expected ')' before '!' token
   14 |         if(strcmp(id, reg[i].id)!){
      |           ~                     ^
      |                                 )
Language: C

#include<stdio.h>
#include<string.h>
int main(){
  int n,d=1,m,i;
  char s[300][20],c[20],w[][20]={"Opened by","Closed by","Unknown"};
  scanf("%d",&n);#include<stdio.h>
#include<string.h>
int main(){
  int n,d=1,m,i;
  char s[300][20],c[20],w[][20]={"Opened by","Closed by","Unknown"};
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s",s[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%s",c);
    for(i=0;i<n&&strcmp(s[i],c);i++);
    printf("%s %s\n",i-n?w[d=1-d]:w[2],c);
  }
  return 0;
}

  for(i=0;i<n;i++)scanf("%s",s[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%s",c);
    for(i=0;i<n&&strcmp(s[i],c);i++);
    printf("%s %s\n",i-n?w[d=1-d]:w[2],c);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:18: error: stray '#' in program
    6 |   scanf("%d",&n);#include<stdio.h>
      |                  ^
main.c:6:19: error: 'include' undeclared (first use in this function)
    6 |   scanf("%d",&n);#include<stdio.h>
      |                   ^~~~~~~
main.c:6:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:27: error: 'stdio' undeclared (first use in this function); did you mean 'stdin'?
    6 |   scanf("%d",&n);#include<stdio.h>
      |                           ^~~~~
      |                           stdin
main.c:8:1: error: expected expression before 'int'
    8 | int main(){
      | ^~~
Language: C

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (m--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (j == N-1) { printf("Unknown %s\n", s); }
        }
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |     scanf("%d", &N);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main() {
main.c:6:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |     scanf("%d", &N);
      |     ^~~~~
main.c:6:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:12: error: 'm' undeclared (first use in this function)
   14 |     while (m--) {
      |            ^
main.c:14:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:17: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   17 |             if (strcmp(s, U[i]) == 0 && lock) {
      |                 ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcmp'
  +++ |+#include <string.h>
    1 | int main() {
main.c:18:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |                 printf("Opened by %s\n", s);
      |                 ^~~~~~
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   23 |                 printf("Closed by %s\n", s);
      |                 ^~~~~~
main.c:23:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:27:17: error: 'j' undeclared (first use in this function)
   27 |             if (j == N-1) { printf("Unknown %s\n", s); }
      |                 ^
main.c:27:29: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   27 |             if (j == N-1) { printf("Unknown %s\n", s); }
      |                             ^~~~~~
main.c:27:29: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

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

int main() {
    int N, M, i, lock;
    char U[300][11];
    char s[11];

    scanf("%d", &N);

    for (i = 0; i < N; i++) { scanf("%s", U[i]); }

    scanf("%d", &M);

    lock = 1;

    while (m--) {
        scanf("%s", s);
        for (i = 0; i < N; i++) {
            if (strcmp(s, U[i]) == 0 && lock) {
                printf("Opened by %s\n", s);
                lock = 0;
                break;
            }
            else if (strcmp(s, U[i]) == 0 && !lock) {
                printf("Closed by %s\n", s);
                lock = 1;
                break;
            }
            if (i == N-1) { printf("Unknown %s\n", s); }
        }
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:17:12: error: 'm' undeclared (first use in this function)
   17 |     while (m--) {
      |            ^
main.c:17:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

set<string> ids;
bool open = false;
int main(){
  int N,M;
  cin >> N;
  for(int i = 0;i < N;i++){
    string str;
    cin >> str;
    ids.insert(str);
  }
  cin >> M;
  for(int i = 0;i < M;i++){
    string str;
    cin >> str;
    if(ids.find(str) == ids.end()){
      cout << "Unknown " << str << endl;
    }
    else{
      if(open){
	cout << "Closed by " << str << endl;
      }
      else{
	cout << "Opened by " << str << endl;
      }
      open = !open;
    }
  }
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0 };
static const int dy[] = { 0, 0, 1, -1 };

static int n, m;
VS ar;
string a;
bool close = true;

int gcd( int m, int n ) {
	if ( n == 0 ) return m;
	return gcd( n, m % n );
}


int main() {
	scanf( "%d", &n );
	ar.resize( n );
	ar.reserve( n );
	for ( int i = 0; i < n; i++ ) {
		cin >> ar[ i ];
	}
	sort( ar.begin(), ar.end() );
	scanf( "%d", &m );
	for ( int i = 0; i < m; i++ ) {
		cin >> a;
		if ( binary_search( ar.begin(), ar.end(), a ) ) {
			if ( close ) {
				printf( "Opened by " );
			}
			else {
				printf( "Closed by " );
			}
			close = !close;
		}
		else {
			printf( "Unknown " );
		}
		cout << a << "\n";
	}
	return 0;
}

Compiler output:
a.cc:41:6: error: 'bool close' redeclared as different kind of entity
   41 | bool close = true;
      |      ^~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:358:12: note: previous declaration 'int close(int)'
  358 | extern int close (int __fd);
      |            ^~~~~
a.cc: In function 'int main()':
a.cc:67:31: error: assignment of function 'int close(int)'
   67 |                         close = !close;
      |                         ~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<string> nlist;
bool isinclude(string tmp){
  REP(i,nlist.size()){
    if(nlist[i]==tmp) return true;
  }
  return false;
}

int main(){
  int n;
  cin >> n;
  REP(i,n){
    string tmp;
    cin >> tmp;
    nlist.pb(tmp);
  }
  int nows = 0;
  cin >> n;
  REP(i,n){
    string tmp;
    cin >> tmp;
    if(find()){
      if(nows == 1){
        cout << "Closed by " << tmp << endl;
      }else{
        cout << "Opened by " << tmp << endl;
      }
      nows = 1 - nows;
    }else{
      cout << "Unknown " << tmp << endl; 
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:12: error: no matching function for call to 'find()'
   43 |     if(find()){
      |        ~~~~^~
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:   candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:   candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 0 provided
Language: C++

#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
using namespace std;

int main(){
map<string,int> hito;
int n,m;
string s;
cin>>n;
for(int q=0;q<n;q++){
cin>>s;
hito[s]=1;
}
cin>>m;
int j=0;
for(int q=0;q<m;q++){
cin>>s;
if(hito.find(s)==hito.end()) cout<<"Unknown "<<s<<endl;
else{
if(j%2==1)cout<<"Closed by "<<s<<endl;
else cout<<"Opened by " <<s<<endl;
j++;
}
}

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

#include <stdio.h>

#define MYSCAN scanf

char u[300][20];
int n;

int match(char t[20]);

int main(void){
	int i;
	int m;
	int mat;
	char t[20];
	int door = -1;

	MYSCAN("%d", &n);
	MYSCAN("\n");
	// テァツ卍サテゥツ個イIDテ」ツ?ョテ・ツ?・テ・ツ環?
	for (i = 0; i < n; i++){
		gets_s(u[i]);
	}

	MYSCAN("%d", &m);
	MYSCAN("\n");
	for (i = 0; i < m; i++){
		// テ」ツつォテ」ツδシテ」ツδ嘉」ツつ津」ツ?凝」ツ?姪」ツ??
		gets_s(t);
		mat = match(t);
		// テァツ卍サテゥツ個イテ」ツ?陛」ツつ古」ツ?ヲテ」ツ?ェテ」ツ?凝」ツ?」テ」ツ?淌」ツつ?
		if (mat == -1){
			printf("Unknown %s\n", t);
		}
		else{
			// テ」ツδ嘉」ツつ「テ」ツ?古ゥツ鳴嘉」ツ?セテ」ツ?」テ」ツ?ヲテ」ツ?淌」ツつ嘉」ツ?づ」ツ?妥」ツつ?
			if (door == -1){
				printf("Opened by %s\n", t);
			}
			// テゥツ鳴凝」ツ??」ツ?ヲテ」ツ?淌」ツつ嘉ゥツ鳴嘉」ツつ?」ツつ?
			else{
				printf("Closed by %s\n", t);
			}
			door *= -1;
		}
	}


	return 0;
}


// テヲツ鳴?・ツュツ療・ツ按療」ツ?古」ツ?づ」ツ?」テ」ツ?ヲテ」ツつ凝」ツ?凝」ツ?ゥテ」ツ??」ツ?凝」ツつ津・ツ按、テ・ツョツ堙」ツ?凖」ツつ凝ゥツ鳴「テヲツ閉ー
// テ・ツ青暗ィツ?エテ」ツ?凖」ツつ凝ヲツ鳴?・ツュツ療・ツ按療」ツ?古」ツ?ェテ」ツ?妥」ツつ古」ツ?ー-1テ」ツつ津ィツソツ氾」ツ??
int match(char t[20]){
	int i, j;

	for (i = 0; i < n; i++){
		for (j = 0; t[j] != '\0' && u[i][j] != '\0'; j++){
			if (t[j] != u[i][j]){ break; }
		}
		if (t[j] == '\0' && u[i][j] == '\0'){
			return i;
		}
	}
	return -1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'gets_s' was not declared in this scope
   21 |                 gets_s(u[i]);
      |                 ^~~~~~
a.cc:28:17: error: 'gets_s' was not declared in this scope
   28 |                 gets_s(t);
      |                 ^~~~~~
Language: C++

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

int main(){
	int n,m;
	vector<string> v(256);
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	cin >> m;
	bool open = false;
	for(int i=0;i<m;i++){
		string t;
		cin	>> t;
		if(find(v.begin(),v.end(),t) != v.end()){
			if(open){
				cout << "Closed by ";
			} else {
				cout << "Opened by ";
			}
			open=(open+1)%2;
			cout << t << endl;
		} else {
			cout << "Unknown " << t << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::string&)'
   18 |                 if(find(v.begin(),v.end(),t) != v.end()){
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~
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:18:24: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT>'
   18 |                 if(find(v.begin(),v.end(),t) != v.end()){
      |                    ~~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int main() {
	vector<string>VS{ "Opened by ","Closed by ","Unknown " };
	set<string>SS;
	int N;
	cin >> N;
	for( size_t i = 0; i < N; i++ ) {
		string S;
		cin >> S;
		SS.insert( S );
	}
	cin >> N;
	bool x = 0;
	for( size_t i = 0; i < N; i++ ) {
		string S;
		cin >> S;
		if( SS.end() == find( SS.begin(), SS.end(), S ) ) {
			cout << VS[2] << S << endl;
		} else {
			cout << VS[x] << S << endl;
			x = 1 - x;
		}
	}
	_sleep(1500);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: '_sleep' was not declared in this scope; did you mean 'usleep'?
   26 |         _sleep(1500);
      |         ^~~~~~
      |         usleep