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

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define int long long
#define INT_MAX LLONG_MAX

map<string,int> num;
int par[5000],_rank[5000];
 
void init(int n){
    for(int i=0;i<n;i++) par[i]=i,_rank[i]=1;
}
 
int find(int a){
    if(par[a]==a) return a;
    else return par[a] = find(par[a]);
}
 
void unite(int _a,int _b){
    int a = find(_a);
    int b = find(_b);
    if(a==b) return;
    if(_rank[a]>_rank[b]){
        par[b] = a;
    }
    else{
        par[a] = b;
        if(_rank[a]==_rank[b]) _rank[b]++;
    }
}

unsigned main(){
	int N;
	cin>>N;
	string A[5000];
	int X[5000];
	for(int i=0;i<N;i++){
		cin>>A[i]>>X[i];
		num[A[i]] = i;
	}
	int M;
	cin>>M;
	init(N);
	for(int i=0;i<M;i++){
		string S,T;
		cin>>S>>T;
		unite(num.find(S)->second,num.find(T)->second);
	}
	int min_[5000]; fill_n(min_,N,INT_MAX);
	for(int i=0;i<N;i++){
		int p = find(i);
		min_[p] = min(X[p],X[i]);
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		ans += min_[find(i)];
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:19:9: warning: "INT_MAX" redefined
   19 | #define INT_MAX LLONG_MAX
      |         ^~~~~~~
In file included from /usr/include/c++/14/climits:42,
                 from a.cc:5:
/usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition
  120 | #define INT_MAX __INT_MAX__
      |         ^~~~~~~
cc1plus: error: '::main' must return 'int'
Language: C++

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define int long long

map<string,int> num;
int par[5000],_rank[5000];
 
void init(int n){
    for(int i=0;i<n;i++) par[i]=i,_rank[i]=1;
}
 
int find(int a){
    if(par[a]==a) return a;
    else return par[a] = find(par[a]);
}
 
void unite(int _a,int _b){
    int a = find(_a);
    int b = find(_b);
    if(a==b) return;
    if(_rank[a]>_rank[b]){
        par[b] = a;
    }
    else{
        par[a] = b;
        if(_rank[a]==_rank[b]) _rank[b]++;
    }
}

unsigned main(){
	int N;
	cin>>N;
	string A[5000];
	int X[5000];
	for(int i=0;i<N;i++){
		cin>>A[i]>>X[i];
		num[A[i]] = i;
	}
	int M;
	cin>>M;
	init(N);
	for(int i=0;i<M;i++){
		string S,T;
		cin>>S>>T;
		unite(num.find(S)->second,num.find(T)->second);
	}
	int min_[5000]; fill_n(min_,N,LLONG_MAX);
	for(int i=0;i<N;i++){
		int p = find(i);
		min_[p] = min(X[p],X[i]);
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		ans += min_[find(i)];
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
#define int long long

map<string,int> num;
int par[5000],_rank[5000];
 
void init(int n){
    for(int i=0;i<n;i++) par[i]=i,_rank[i]=1;
}
 
int find(int a){
    if(par[a]==a) return a;
    else return par[a] = find(par[a]);
}
 
void unite(int _a,int _b){
    int a = find(_a);
    int b = find(_b);
    if(a==b) return;
    if(_rank[a]>_rank[b]){
        par[b] = a;
    }
    else{
        par[a] = b;
        if(_rank[a]==_rank[b]) _rank[b]++;
    }
}

unsigned main(){
	int N;
	cin>>N;
	string A[5000];
	int X[5000];
	for(int i=0;i<N;i++){
		cin>>A[i]>>X[i];
		num[A[i]] = i;
	}
	int M;
	cin>>M;
	init(N);
	for(int i=0;i<M;i++){
		string S,T;
		cin>>S>>T;
		unite(num.find(S)->second,num.find(T)->second);
	}
	int min_[5000]; fill_n(min_,N,LLONG_MAX);
	for(int i=0;i<N;i++){
		int p = find(i);
		min_[p] = min(X[p],X[i]);
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		ans += min_[find(i)];
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

map<string,long long> num;
long long par[5000],_rank[5000];
 
void init(long long n){
    for(long long i=0;i<n;i++) par[i]=i,_rank[i]=1;
}
 
long long find(long long a){
    if(par[a]==a) return a;
    else return par[a] = find(par[a]);
}
 
void unite(long long _a,long long _b){
    long long a = find(_a);
    long long b = find(_b);
    if(a==b) return;
    if(_rank[a]>_rank[b]){
        par[b] = a;
    }
    else{
        par[a] = b;
        if(_rank[a]==_rank[b]) _rank[b]++;
    }
}

int main(){
	long long N;
	cin>>N;
	string A[5000];
	long long X[5000];
	for(long long i=0;i<N;i++){
		cin>>A[i]>>X[i];
		num[A[i]] = i;
	}
	long long M;
	cin>>M;
	init(N);
	for(long long i=0;i<M;i++){
		string S,T;
		cin>>S>>T;
		unite(num.find(S)->second,num.find(T)->second);
	}
	long long min_[5000]; fill_n(min_,N,LLONG_MAX);
	for(long long i=0;i<N;i++){
		long long p = find(i);
		min_[p] = min(X[p],X[i]);
	}
	long long ans = 0;
	for(long long i=0;i<N;i++){
		ans += min_[find(i)];
	}
	prlong longf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: 'prlong' was not declared in this scope; did you mean 'ulong'?
   69 |         prlong longf("%d\n",ans);
      |         ^~~~~~
      |         ulong
Language: C++

map<string, int> cost;
map<string, bool> done;
int N, M;

int search(string s)
{
  int ans = cost[s];
  done[s] = true;
  for(int i = 0; i < tb[s].size(); i++)
    if(done.find(tb[s][i]) == done.end())
      ans = min(ans, search(tb[s][i]));
  return ans;
}

int main()
{
  cin >> N;
  for(int i = 0; i < N; i++)
  {
    string a;
    int x;
    cin >> a >> x;
    cost[a] = x;
  }
  cin >> M;
  for(int i = 0; i < M; i++)
  {
    string s1, s2;
    cin >> s1 >> s2;
    tb[s1].push_back(s2);
    tb[s2].push_back(s1);
  }
  int ans = 0;
  for(auto it = cost.begin(); it != cost.end(); ++it)
  {
    done.clear();
    ans += search(it->first);
  }
  cout << ans << endl;
}

Compiler output:
a.cc:1:1: error: 'map' does not name a type
    1 | map<string, int> cost;
      | ^~~
a.cc:2:1: error: 'map' does not name a type
    2 | map<string, bool> done;
      | ^~~
a.cc:5:12: error: 'string' was not declared in this scope
    5 | int search(string s)
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:17:3: error: 'cin' was not declared in this scope
   17 |   cin >> N;
      |   ^~~
a.cc:20:5: error: 'string' was not declared in this scope
   20 |     string a;
      |     ^~~~~~
a.cc:22:12: error: 'a' was not declared in this scope
   22 |     cin >> a >> x;
      |            ^
a.cc:23:5: error: 'cost' was not declared in this scope; did you mean 'const'?
   23 |     cost[a] = x;
      |     ^~~~
      |     const
a.cc:28:5: error: 'string' was not declared in this scope
   28 |     string s1, s2;
      |     ^~~~~~
a.cc:29:12: error: 's1' was not declared in this scope
   29 |     cin >> s1 >> s2;
      |            ^~
a.cc:29:18: error: 's2' was not declared in this scope
   29 |     cin >> s1 >> s2;
      |                  ^~
a.cc:30:5: error: 'tb' was not declared in this scope
   30 |     tb[s1].push_back(s2);
      |     ^~
a.cc:34:17: error: 'cost' was not declared in this scope; did you mean 'const'?
   34 |   for(auto it = cost.begin(); it != cost.end(); ++it)
      |                 ^~~~
      |                 const
a.cc:36:5: error: 'done' was not declared in this scope
   36 |     done.clear();
      |     ^~~~
a.cc:37:28: error: 'search' cannot be used as a function
   37 |     ans += search(it->first);
      |                            ^
a.cc:39:3: error: 'cout' was not declared in this scope
   39 |   cout << ans << endl;
      |   ^~~~
a.cc:39:18: error: 'endl' was not declared in this scope
   39 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
using namespace std;
map <string,int> cost;
multimap <string,string>  rule;
set <string> his;
void update(string a){
  multimap<string,string>::iterator it=rule.find(a);
  while(it != rule.end() && it->first == a) {
    if(cost[it->second]>cost[a])cost[it->second]=cost[a], update(it->second);
    it++;
  }
}
int mk_rule(string a){
  if(his.count(a) == 0){
    his.insert(a);    
    multimap<string,string>::iterator it=rule.find(a);
    while(it != rule.end() && it->first == a) cost[a]= min(cost[a],mk_rule(it->second)),it++;
    update(ls[i]);
  }
  return cost[a];
}
int main(){
  int n,m,b;
  cin >> n;
  string a,c,ls[5002];
  for(int i=0;i<n;i++) cin >> ls[i] >> b, cost[ls[i]] = b;

  cin >> m;
  for(int i=0;i<m;i++){
    cin >> a >> c;
    rule.insert(pair<string,string>(a,c));
    rule.insert(pair<string,string>(c,a));
  }
  int ans=0;
  for(int i=0;i<n;i++) ans += mk_rule(ls[i]);
  cout << ans <<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int mk_rule(std::string)':
a.cc:22:12: error: 'ls' was not declared in this scope
   22 |     update(ls[i]);
      |            ^~
a.cc:22:15: error: 'i' was not declared in this scope; did you mean 'it'?
   22 |     update(ls[i]);
      |               ^
      |               it
Language: C++

#include "bits/stdc++.h"
using namespace std;

#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

//?´?????????????????§????
//Union-Find??¨
struct UnionFind {
	vector<int> p; //parent
	int sz; //size ???????????°
	vector<int> mi;
	UnionFind(int n) :p(n, -1), sz(n), mi(n) {}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (size(x) < size(y)) swap(x, y);
		p[x] += p[y]; p[y] = x; sz--;
		mi[x] = min(mi[x],mi[y]);
		dump(x); dump(c);
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }
	//?????????????´???°
	int size(int x) { return -p[root(x)]; }
	int solve() {
		int ret = 0;
		rep(i, 0, mi.size())
			ret += mi[root(i)];
		return ret;
	}
};

signed main() {
	int N; cin >> N;
	UnionFind UF(N);
	map<string, int> mp;
	rep(i, 0, N) {
		string a; int x; cin >> a >> x;
		mp[a] = i;
		UF.mi[i] = x;
	}
	int M; cin >> M;
	rep(i, 0, M) {
		string s, t; cin >> s >> t;
		UF.unite(mp[s], mp[t]);
	}
	cout << UF.solve() << endl;
	dumpc(UF.p);
	dumpc(UF.mi);
	return 0;
}

Compiler output:
a.cc: In member function 'bool UnionFind::unite(long long int, long long int)':
a.cc:28:31: error: 'c' was not declared in this scope
   28 |                 dump(x); dump(c);
      |                               ^
a.cc:6:40: note: in definition of macro 'dump'
    6 | #define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
      |                                        ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define F first
#define S second
#define PB push_back 
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef int ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int SIZE=1+5*1e+3;
const LL p=7+1e+9;
map<string,int> toI;
int DP[SIZE][SIZE];
int fx[SIZE],jump[SIZE];
int N,L;
LL search(int now,int s){
	LL ans=0;
	if(now==N) return 1;
	if(s>=L) return 0;
	if(DP[now][s]!=-1) return (LL)DP[now][s];
	ans=search(now,s+1);
	if((s-fx[now])%jump[now]==0) ans+=search(now+1,s+1);
	return (LL)DP[now][s]=(int)(ans%p);
}
int main(){
	cin >> N >> L;
	REP(i,SIZE)
		REP(j,SIZE)
			DP[i][j]=-1;
	REP(i,N)
		cin >> fx[i];
	REP(i,N)
		cin >> jump[i];
	cout << search(0,fx[0]) << endl;
}	

Compiler output:
a.cc: In function 'LL search(int, int)':
a.cc:28:16: error: lvalue required as left operand of assignment
   28 |         return (LL)DP[now][s]=(int)(ans%p);
      |                ^~~~~~~~~~~~~~
Language: C++

#include <stdio.h>
#pragma warning(disable : 4996)
#define mod 1000000007
int N, L, x[5000], a[5000], dp[5001][5001];
void rec(int r, int pos) {
	if (dp[r][pos]) return; dp[r][pos] = 1;
	for (int i = x[r]; i < pos; i += a[r]) {
		if (r == 0) dp[r][pos]++;
		else rec(r - 1, i), dp[r][pos] = (dp[r][pos] + dp[r - 1][i]) % mod;
	}
}
int main() {
	scanf("%d%d", &N, &L);
	for (int i = 0; i < N; i++) scanf("%d", &x[i]);
	for (int i = 0; i < N; i++) scanf("%d", &a[i]), a[i] = a[i] ? a[i] : L;
	printf("%d\n", rec(N - 1, L));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: invalid use of void expression
   16 |         printf("%d\n", rec(N - 1, L));
      |                        ~~~^~~~~~~~~~
Language: C++

13 7
0 1
1 2
2 3
1 4
3 5
1 6
2 7
0 8
7 9
5 10
8 11
1 12
1 2 143
0 8 7
0 10 6
1 1 42
1 6 37
0 3 6
1 6 38

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

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

int n,q,a,b,c;

vector<int> G[MAX];
int sz[MAX],cd[MAX],mv[MAX],pr[MAX],de[MAX];

vector<int> H;
int hl[MAX],hr[MAX];

// calc hl[] hr[] mv[]
void dfsB(int pos){
  hl[pos]=H.size();
  H.push_back(pos);
  if(cd[pos]!=-1){
    mv[cd[pos]]=mv[pos];
    dfsB(cd[pos]);
  }

  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    if(to==pr[pos]||to==cd[pos])continue;
    dfsB(to);
  }
  hr[pos]=H.size();
}

// calc cd[] pr[] de[] , init mv[]
void dfsA(int pos){
  if(de[pos] >= 100000 ){
    while(de[pos]>0)de[pos]++
  }
  cd[pos]=-1;
  sz[pos]=1;
  mv[pos]=pos;
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    if(to==pr[pos])continue;
    pr[to]=pos;
    de[to]=de[pos]+1;
    dfsA(to);
    sz[pos]+=sz[to];
    if(cd[pos]==-1||sz[cd[pos]]<sz[to])cd[pos]=to;
  }
}


void init(){
  H.clear();
  for(int i=0;i<n;i++){
    G[i].clear();
  }
}


char ch(int x){ return 'A'+x; }

struct segtree{
  int n;
  vector<ll> A,B;
  void init(int N){
    A.clear(),B.clear();    
    for(n=1;n<N;n*=2);
    A.resize(n+n),B.resize(n+n);
  }
  void add(int a,int b,int x,int k,int l,int r){
    if(b<=l || r<=a)return;
    if(a<=l && r<=b){A[k]+=x;return;}
    B[k]+=(min(b,r)-max(a,l))*x;
    int m=(l+r)/2;
    add(a,b,x,k*2+1,l,m);
    add(a,b,x,k*2+2,m,r);
  }
  void add(int a,int b,int x){add(a,b,x,0,0,n);}
  ll sum(int a,int b,int k,int l,int r){
    if(b<=l || r<=a)return 0;
    if(a<=l && r<=b)return A[k]*(r-l)+B[k];
    int m=(l+r)/2;
    return sum(a,b,k*2+1,l,m)+sum(a,b,k*2+2,m,r)+A[k]*(min(b,r)-max(a,l));
  }
  ll sum(int a,int b){return sum(a,b,0,0,n);}
};

segtree t;

int main(){
  while(scanf("%d %d",&n,&q)==2){
    t.init(n);
    init();
    for(int i=0;i<n-1;i++){
      scanf("%d %d",&a,&b);
      G[a].push_back(b);
      G[b].push_back(a);
    }

    for(int i=0;i<n;i++)sort(G[i].begin(),G[i].end());
    
    pr[0]=-1;
    de[0]=0;
    dfsA(0);
    dfsB(0);
    
    
    while(q--){
      scanf("%d %d %d",&a,&b,&c);
      if(a==1){
        t.add(hl[b],hr[b],c);
        t.add(hl[b],hl[b]+1,-c);
      }else{
        ll ans=0;
        while(mv[b]!=mv[c]){
          if(de[mv[b]]<de[mv[c]])swap(b,c);
          ans+=t.sum( hl[mv[b]] , hl[b]+1);
          b=pr[mv[b]];          
        }
        if(hl[b]>hl[c])swap(b,c);
        ans+=t.sum(hl[b]+1,hl[c]+1);
        printf("%lld\n",ans);
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'void dfsA(int)':
a.cc:34:30: error: expected ';' before '}' token
   34 |     while(de[pos]>0)de[pos]++
      |                              ^
      |                              ;
   35 |   }
      |   ~
Language: C

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

int main(void) {
	int i;
	char s[21];
	char *p;
	int cnt;

	scanf("%s", s, &len);

	p = s;
	cnt = 0;
	while (1) {
		p = strchr(p, 'A');
		if (p == NULL)
			break;
		p = strchr(p, 'Z');
		if (p == NULL)
			break;
		cnt++;
	}

	if (!cnt)
		puts("-1");
	else {
		for (i = 0; i < cnt; i++)
			printf("AZ");
		putchar('\n');
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:25: error: 'len' undeclared (first use in this function)
   10 |         scanf("%s", s, &len);
      |                         ^~~
main.c:10:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
using namespace std;

int main(){
	char input[21];
	int i = 0;
	int b = 0;
	int check = 0;

	cin >> input
			i = 0; b = 0; check = 0;
		while(1){
			if(b == 0 && input[i] == 'A' && input[i+1] == 'Z'){
				cout << input[i];
				b = 1;
				check = 1;
			}else if(b == 1 && input[i] == 'Z'){
				cout << input[i];
				b = 0;
			}
			if(input[i] == '\0') break;
			i++;
			
		}
		if(check == 0) cout << -1;
		cout << endl;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: expected ';' before 'i'
   10 |         cin >> input
      |                     ^
      |                     ;
   11 |                         i = 0; b = 0; check = 0;
      |                         ~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<string>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;

void solve(){
  string s;int state=0;bool used=true;
  cin>>s;
  rep(i,s.size()){
    if(s[i]=='A'){state=1;}
    if(s[i]=='Z'&&state){state=0;cout<<"AZ";used=false;}
  }
  cout<<(used?-1:"")<<endl;
}
int main(void){
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:20:14: error: operands to '?:' have different types 'int' and 'const char*'
   20 |   cout<<(used?-1:"")<<endl;
      |          ~~~~^~~~~~
Language: C++

#include<iostream>
int main(){
string s,t;cin>>s;
int cnt=0,i=0;
while(i<s.size()){
if(cnt&1)if(s[i]=='Z')cnt++;
else if(s[i]=='A')cnt++;
}
cnt/=2;
if(cnt==0)cout<<-1;
else{
while(cnt--)cout<<"AZ";
cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:1: error: 'string' was not declared in this scope
    3 | string s,t;cin>>s;
      | ^~~~~~
a.cc:3:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:3:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 | string s,t;cin>>s;
      |            ^~~
      |            std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:3:17: error: 's' was not declared in this scope
    3 | string s,t;cin>>s;
      |                 ^
a.cc:10:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 | if(cnt==0)cout<<-1;
      |           ^~~~
      |           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:13: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 | while(cnt--)cout<<"AZ";
      |             ^~~~
      |             std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:13:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 | cout<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:13:7: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   13 | cout<<endl;
      |       ^~~~
      |       std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:14:2: error: expected '}' at end of input
   14 | }
      |  ^
a.cc:2:11: note: to match this '{'
    2 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
string s,t;cin>>s;
int cnt=0,i=0;
while(i<s.size()){
if(cnt&1)if(s[i]=='Z')cnt++;
else if(s[i]=='A')cnt++;
}
cnt/=2;
if(cnt==0)cout<<-1;
else{
while(cnt--)cout<<"AZ";
cout<<endl;
}

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

c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}

Compiler output:
a.cc:1:1: error: 'c' does not name a type
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      | ^
a.cc:1:5: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |     ^~~~
a.cc: In function 'int main()':
a.cc:1:19: error: 'c' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                   ^
a.cc:1:21: error: 'getchar' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                     ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
a.cc:1:36: error: 'n' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                                    ^
a.cc:1:64: error: 'n' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                                                                ^
a.cc:1:80: error: 'printf' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                                                                                ^~~~~~
a.cc:1:80: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:1:93: error: 'puts' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                                                                                             ^~~~
a.cc:1:108: error: 'puts' was not declared in this scope
    1 | c,n;main(){while((c=getchar())!=10)n+=(n&1)?(c==90):(c==65);if(n/=2){while(n--)printf("AZ");puts("");}else puts("-1");return 0;}
      |                                                                                                            ^~~~
Language: C++

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

int main(void){
	string s;
	bool f=false,b=false;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if(!f&&s[i]=='A') f=!f;
		else if(f&&s[i]=='Z'){cout<<"AZ";b=true;f=!f}
	}
	if(!b)cout<<-1;
	cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:61: error: expected ';' before '}' token
   11 |                 else if(f&&s[i]=='Z'){cout<<"AZ";b=true;f=!f}
      |                                                             ^
      |                                                             ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string row;
  int ac=0;
  int azc=0;
  cin>>row;
  for(int i=0;i<(int)row.size();i++){
    char ch=row[i];
  }

 

  for(int i=0;i<(int)row.size();i++){
    if(row[i]=='Z'&&ac==0)continue;
    if(row[i]=='A'){
      ac++;
    }
    if(row[i]=='Z'&&ac>0&&f==1){
      azc++;
      ac=0;
    }
  }
  
    if(azc==0)cout<<-1<<endl;
   
    else for(int i=0;i<azc;i++){
      cout<<"AZ";
      if(i==azc-1)cout<<endl;
    }
  
  
  return 0;
  
}




Compiler output:
a.cc: In function 'int main()':
a.cc:19:27: error: 'f' was not declared in this scope
   19 |     if(row[i]=='Z'&&ac>0&&f==1){
      |                           ^
Language: C++

#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

struct Edge{
    int to,cost;
    Edge(int to,int cost) :to(to),cost(cost){}
    Edge(){}
};
struct Lost{
    int s,t;
    Lost(int s,int t) :s(s),t(t){}
    Lost(){}
};
struct State{
    int v;
    int cost;
    int bit1,bit2;
    State(int v,int cost,int bit1,int bit2):
        v(v),cost(cost),bit1(bit1),bit2(bit2){}
    State(){}

    bool operator>(const State rth) const {
        return this->cost>rth.cost;
    }
};
int n,m,k,p;
vector<Edge> G[1003];
Lost lost[10];
int dp[1003][1<<6][1<<6];

int dijk() {
    rep(i,1003) rep(j,1<<6) rep(c,1<<6) dp[i][j][c]=INF;
    dp[p][0][0]=0;
    priority_queue<State,vector<State> ,greater<State> > que;
    que.push(State(p,0,0,0));

    while(que.size()) {
        State s=que.top(); que.pop();
        if(d[s.v][s.bit1][s.bit2]<s.cost) continue;

        rep(i,G[s.v].size()) {
            Edge e=G[s.v][i];
            rep(a,k) {
                if(lost[a].s==e.to) {
                    if(dp[e.to][s.bit1|1<<a][s.bit2]>dp[s.v][s.bit1][s.bit2]+e.cost) {
                        dp[e.to][s.bit1|1<<a][s.bit2]=dp[s.v][s.bit1][s.bit2]+e.cost;
                        que.push(State(e.to,dp[e.to][s.bit1|1<<a][s.bit2],s.bit1|1<<a,s.bit2));
                    }
                }
                if(lost[a].t==e.to&&(s.bit1>>a)&1) {
                    if(dp[e.to][s.bit1][s.bit2|1<<a]>dp[s.v][s.bit1][s.bit2]+e.cost) {
                        dp[e.to][s.bit1][s.bit2|1<<a]=dp[s.v][s.bit1][s.bit2]+e.cost;
                        que.push(State(e.to,dp[e.to][s.bit1][s.bit2|1<<a],s.bit1,s.bit2|1<<a));
                    }
                }
            }
            if(dp[e.to][s.bit1][s.bit2]>dp[s.v][s.bit1][s.bit2]+e.cost) {
                dp[e.to][s.bit1][s.bit2]=dp[s.v][s.bit1][s.bit2]+e.cost;
                que.push(State(e.to,dp[e.to][s.bit1][s.bit2],s.bit1,s.bit2));
            }
        }
    }

    int ans=INF;
    rep(i,n) ans=min(ans,dp[i][(1<<k)-1][(1<<k)-1]);

    return ans;
}

int main() {
    cin>>n>>m>>k>>p;
    p--;
    rep(i,m) {
        int x,y,w;
        cin>>x>>y>>w;
        x--,y--;
        G[x].pb(Edge(y,w));
        G[y].pb(Edge(x,w));
    }
    rep(i,k) {
        int s,t;
        cin>>s>>t;
        s--,t--;
        lost[i].s=s;
        lost[i].t=t;
    }
    int ans=dijk();
    if(ans==INF) cout<<"Cannot deliver"<<endl;
    else cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int dijk()':
a.cc:69:12: error: 'd' was not declared in this scope
   69 |         if(d[s.v][s.bit1][s.bit2]<s.cost) continue;
      |            ^
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#include<functional>
#include<algorithm>
using namespace std;

#define INF 1LL<<60
#define MAX_N 2000
#define MAX_COMB 729
#define MAX_K 6
#define BLACK 2
#define GRAY 1
#define WHITE 0

vector<pair<long long, long long>>x[MAX_N];

long long n, m, K, p, a, b, c;
long long A[MAX_N], B[MAX_N];
long long power[16] = { 1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969,14348907 };
long long dist[MAX_N][MAX_COMB], color[MAX_N][MAX_COMB];
long long pattern[MAX_K], pattern2[MAX_K];
priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> Q[MAX_COMB];

long long dijkstra() {
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_COMB; j++) {
			dist[i][j] = INF;
			color[i][j] = BLACK;
		}
	}
	dist[K][0] = 0;
	color[K][0] = GRAY;
	Q[0].push(make_pair(0, K));
	while (true) {
		long long sumcnt = 0;
		for (int i = 0; i < power[p]; i++) {
			sumcnt += Q[i].size();
		}
		if (sumcnt == 0) {
			long long minx = INF;
			for (int i = 0; i < MAX_N; i++) {
				minx = min(minx, dist[i][power[K] - 1]);
			}
			return minx;
		}
		for (int i = 0; i < power[k]; i++) {
			if (!Q[i].empty()) {
				pair<long long, long long>query = Q[i].top();
				Q[i].pop();
				for (int j = 0; j < K; j++) {
					pattern[j] = (i / power[j]) % 3;
					pattern2[j] = pattern[j];
				}
				for (int j = 0; j < x[query.second].size(); j++) {
					for (int k = 0; k < K; k++) {
						pattern2[k] = pattern[k];
					}
					for (int k = 0; k < K; k++) {
						if (x[query.second][j].first == A[k] && pattern2[k] == 0) {
							pattern2[k] = 1;
						}
						if (x[query.second][j].first == B[k] && pattern2[k] == 1) {
							pattern2[k] = 2;
						}
					}
					long long cnt2 = 0;
					for (int k = 0; k < K; k++) {
						cnt2 += pattern2[k] * power[k];
					}
					if (dist[x[query.second][j].first][cnt2]>dist[query.second][i] + x[query.second][j].second) {
						dist[x[query.second][j].first][cnt2] = dist[query.second][i] + x[query.second][j].second;
						Q[cnt2].push(make_pair(dist[x[query.second][j].first][cnt2], x[query.second][j].first));
					}
				}
			}
		}
	}
}

int main() {
	cin >> n >> m >> K >> p;
	for (int i = 0; i < n; i++) {
		cin >> a >> b >> c;
		x[a].push_back(make_pair(b, c));
	}
	for (int i = 0; i < p; i++) {
		cin >> A[i] >> B[i];
	}
	cout << dijkstra() << endl;
	return 0;
}

Compiler output:
a.cc: In function 'long long int dijkstra()':
a.cc:47:43: error: 'k' was not declared in this scope
   47 |                 for (int i = 0; i < power[k]; i++) {
      |                                           ^
Language: C++

#include <vector>
#include <iostream>
#include <queue>
#include <cassert>
#include <tuple>

using namespace std;
typedef long long ll;

template<class D, int S>
struct WaveletTree {
    static const int N = 1<<S;
    typedef pair<D, int> P;
    int n;
    P x[N];
    int d[S+1][N];
    int lc[S][N];

    void built(int l, int r, int dps) {
        if (dps == S) return;
        int pl = l, md = (l+r)/2, pr = md;
        for (int i = l; i < r; i++) {
            if (d[dps][i] < md) {
                d[dps+1][pl++] = d[dps][i];
            } else {
                d[dps+1][pr++] = d[dps][i];
            }
            lc[dps][i] = pl-l;
        }
        built(l, md, dps+1);
        built(md, r, dps+1);
    }

    void init(int nn = N) {
        n = nn;
        for (int i = 0; i < N; i++) {
            x[i].second = i;
        }
        sort(x, x+n);
        for (int i = 0; i < N; i++) {
            d[0][x[i].second] = i;
        }
        built(0, N, 0);
    }
    //[l, r)??§k???????????°????????????
    int get(int l, int r, int k, int dps, int idx) {
        assert(1 <= k && k <= r-l);
        if (dps == S) {
            return d[dps][l];
        }
        int ls = (l > idx ? lc[dps][l-1] : 0);
        int c = lc[dps][r-1] - ls;
        if (k <= c) {
            return get(idx+ls, idx+ls+c, k, dps+1, idx);
        } else {
            int sz = 1<<(S-dps-1);
            return get(l+sz-ls, r+sz-(ls+c), k-c, dps+1, idx+sz);
        }
        return -1;
    }
    D get(int l, int r, int k) {
        return x[get(l, r, k, 0, 0)].first;
    }
    //[l, r)??§x?????????????????§?????????????????????????????????lower_bound
    int find(int l, int r, int x, int dps, int idx) {
        if (r <= l) return 1;
        if (dps == S) {
            return (x <= l) ? 1 : 2;
        }
        int ls = (l > idx ? lc[dps][l-1] : 0);
        int c = lc[dps][r-1] - ls;
        int sz = 1<<(S-dps-1);
        int md = idx+sz;
        if (x <= md) {
            return find(idx+ls, idx+ls+c, x, dps+1, idx);
        } else {
            return c+find(l+sz-ls, r+sz-(ls+c), x, dps+1, idx+sz);
        }
    }
    int find(int l, int r, D u) {
        return find(l, r, lower_bound(x, x+n, P(u, -1)) - x, 0, 0);
    }
};

WaveletTree<int, 17> st;
//StarrySkyTree<17> st;
int x[1<<17];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
        st.x[i].first = x[i];
//        st.add(i, x[i]);
    }
    st.init(n);
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int l, r, e;
        cin >> l >> r >> e; l--;
        int mi = min(x[l], x[r-1]);
        int ma = max(x[l], x[r-1]);
        mi -= e;
        ma += e+1;
        int res = st.find(l, r, mi) + ((r-l) - st.find(l, r, ma));
        cout << res << endl;
    }
    return 0;
}    

Compiler output:
a.cc: In instantiation of 'void WaveletTree<D, S>::init(int) [with D = int; int S = 17]':
a.cc:97:12:   required from here
   97 |     st.init(n);
      |     ~~~~~~~^~~
a.cc:39:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   39 |         sort(x, x+n);
      |         ~~~~^~~~~~~~
      |         short
Language: C++

#include <cctype>
#include <vector>
#include <string>
#include <iostream>

using namespace std;

char S[111][22]; int T[111], P[111];

int main()
{
    int N, H, Q = 0, R = 0; scanf("%d%d", &N, &H);
    
    for(int i = 0; i < N; i++)
    {
        scanf("%s%d", S[i], &T[i]);
    }
    
    char F[2];
    
    for(int i = 0; i < N; i++)
    {
        int ptr = 0;
        
        while(ptr != strlen(S[i]))
        {
            printf("? %s\n", S[i]);
            
            scanf("%d", &F); R++;
            
            if(tolower(S[i][ptr]) == tolower(F[0]))
            {
                S[i][ptr] = '_'; ptr++; Q++;
            }
            else
            {
                P[i]++;
                
                if(P[i] > T[i])
                {
                    H--; break;
                }
            }
        }
                   
        if(H <= 0)
        {
            printf("! Game Over\n"); return 0;
        }
    }
    
    int r = Q * 1000 / R;
    
    printf("! Game Clear %d.%d\n", r / 10, r % 10);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:22: error: 'strlen' was not declared in this scope
   25 |         while(ptr != strlen(S[i]))
      |                      ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 |
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;

#define MAX_N 10000

string S[MAX_N];
int pass[MAX_N];
int miss[MAX_N];
int over[MAX_N];
int misscnt, totalcnt;
int n, m;
int cnt1;
char a[2];

void hantei(int c, string S, int p, char v) {
	if (S[p] == v || abs(S[p] - v) == 32) { pass[c]++; }
	else {
		misscnt++;
		miss[c]++;
		if (miss[cnt1] > over[cnt1]) { m--; }
	}
	totalcnt++;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> S[i] >> over[i];
	}
	while (true) {
		cout << "? ";
		for (int i = 0; i < pass[cnt1]; i++) {
			cout << '_';
		}
		for (int i = pass[cnt1]; i < S[cnt1].size(); i++) {
			cout << S[cnt1][i];
		}
		cout << endl;
		cin >> a;
		hantei(cnt1, S[cnt1], pass[cnt1], a);
		if (pass[cnt1] >= S[cnt1].size()) { cnt1++; }
		if (cnt1 == n) { goto owata; }
		if (m == 0) { goto over; }
	}
over:;
	cout << "! Game Over" << endl;
	goto Exit;
owata:;
	cout << fixed << setprecision(1) << "! Game Clear " << (double)((int)(1000 * (totalcnt - misscnt) / totalcnt) / 10.0) << endl;
Exit:;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:51: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   43 |                 hantei(cnt1, S[cnt1], pass[cnt1], a);
      |                                                   ^
      |                                                   |
      |                                                   char*
a.cc:18:42: note:   initializing argument 4 of 'void hantei(int, std::string, int, char)'
   18 | void hantei(int c, string S, int p, char v) {
      |                                     ~~~~~^
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<iomanip>
using namespace std;

#define MAX_N 10000

string S[MAX_N];
int pass[MAX_N];
int miss[MAX_N];
int over[MAX_N];
int misscnt, totalcnt;
int n, m;
char a;

void hantei(int c, string T, int p, char v) {
	if (T[p] == v || abs(T[p] - v) == 32) { S[c][p] = '_'; pass[c]++; }
	else {
		misscnt++;
		miss[c]++;
		if (miss[cnt1] > over[cnt1]) { m--; }
	}
	totalcnt++;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> S[i] >> over[i];
	}
	for (int cnt1 = 0; cnt1 < n;cnt1++) {
		cout << "? ";
		cout << S[cnt1] << endl;
		cin >> a;
		hantei(cnt1, S[cnt1], pass[cnt1], a);
		if (pass[cnt1] >= S[cnt1].size()) { cnt1++; }
		if (cnt1 == n) { goto owata; }
	}
over:;
	if (m <= 0) {
		cout << "! Game Over" << endl;
	}
	goto Exit;
owata:;
	cout << fixed << setprecision(1) << "! Game Clear " << (double)((int)(1000 * (totalcnt - misscnt) / totalcnt) / 10.0) << endl;
Exit:;
	return 0;
}

Compiler output:
a.cc: In function 'void hantei(int, std::string, int, char)':
a.cc:23:26: error: 'cnt1' was not declared in this scope
   23 |                 if (miss[cnt1] > over[cnt1]) { m--; }
      |                          ^~~~
Language: C++

#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<cctype>
using namespace std;

#define MAX_N 10000

string S[MAX_N];
int pass;
int miss[MAX_N];
int over[MAX_N];
int misscnt, totalcnt;
int n, m;
char a;

void hantei(int c, string T, int p, char v) {
	if (tolower(v) == tolower(T[p])) { S[c][p] = '_'; pass[c]++; }
	else {
		misscnt++;
		miss[c]++;
		if (miss[c] > over[c]) { m--; }
	}
	totalcnt++;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> S[i] >> over[i];
	}
	for (int cnt1 = 0; cnt1 < n; cnt1++) {
		pass = 0;
		while (pass != S[cnt1].size()) {
			cout << "? ";
			cout << S[cnt1] << endl;
			cin >> a;
			hantei(cnt1, S[cnt1], pass, a);
		}
		if (m <= 0) { 
			cout << "! Game Over" << endl; return 0; 
		}
	}
	cout << fixed << setprecision(1) << "! Game Clear " << (double)((int)(1000 * (totalcnt - misscnt) / totalcnt) / 10.0) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void hantei(int, std::string, int, char)':
a.cc:20:63: error: invalid types 'int[int]' for array subscript
   20 |         if (tolower(v) == tolower(T[p])) { S[c][p] = '_'; pass[c]++; }
      |                                                               ^
Language: C++

#include<bits.stdc++.h>
using namespace std;
string S[999],a,i;
int pass,miss[999],over[999];,misscnt,totalcnt,n,m;
int main(){
	cin>>n>>m;
	for(i=0;i<n;i++){
		cin>>S[i]>>over[i];
	}
	for(i=0;i<n;i++){
		pass=0;
		while(pass!=S[i].size()){
			cout<<"? "<<S[i]<<endl;
			cin>>a;
			totalcnt++;
			if(tolower(a[0])==tolower(S[i][pass])){ 
				S[i][pass]='_';pass++;misscnt++; 
			}
			else{
				miss[i]++;
				if(miss[i]>over[i]){
					m--;break;
				}
			}
		}
		if(m<=0){ 
			cout<<"! Game Over"<<endl;return 0; 
		}
	}
	cout<<setprecision(1)<<"! Game Clear "<<(double)((int)(1000*misscnt/totalcnt)/10.0)<<endl;
}

Compiler output:
a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory
    1 | #include<bits.stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <math.h>
#include <queue>
#include <vector>
using namespace std;
bool seached[100005];
int inf=99999999;
int N,sum=0,maxdis=-1,dp[1000][1000],ans=0;
struct Vertex
{
	Vertex(){par=NULL;}
	int id,dis;
	Vertex *par;
	vector<Vertex*> e;
	
}*head=NULL,*info=NULL;
void find(Vertex *x,int &val)
{
	if (x->id==val) info=x;
	else if (info->id!=val)
	{
		for (int i=0;i<(x->e.size());i++)
		{
			find(x->e[i],val);
		}
	}
}
void Insert(Vertex *x,int par)
{
	find(head,par);
	int Id=x->id,i=0;
	info->e.push_back(x);
// 	for (;i<(info->e.size())&&Id<(info->e[i]->id);i++);
// 	info->e.insert(info->e.begin()+i,x);
	x->dis=info->dis+1;
}
void bfs()
{
	queue<Vertex*> que;
	que.push(head);
	Vertex *pre=head,*n=NULL;
	while(que.size())
	{
		if(n!=NULL)pre=n;
		n=que.front();que.pop();
		int mm=pre->id,nn=n->id;
		ans+=dp[mm][nn];
		for (int i=0;i<(n->e.size());i++)
		{
			que.push(n->e[i]);
		}
	}
}
int main()
{
	//freopen("test.txt","r",stdin);
	cin>>N;
	memset(dp,0x11,sizeof(dp));
	head=new Vertex();
	head->id=1,head->dis=0;
	int pp;
	for (int i=2;i<=N;i++)
	{
		Vertex *x=new Vertex();
		x->id=i;
		cin>>pp;
		dp[i][pp]=1;
		dp[pp][i]=1;
		Insert(x,pp);
	}
	
	for (int i=1;i<N;i++)
	{
		dp[i][i]=0;
	}
	for(int i=1;i<=N;i++)
	{
		for (int j=1;j<=N;j++)
		{
			for (int k=1;k<=N;k++)
			{
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
			}
		}
	}
	bfs();
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:9: error: 'memset' was not declared in this scope
   58 |         memset(dp,0x11,sizeof(dp));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | #include <vector>
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

string s;
bool f;
string func = "(),RL";
typedef pair<string, bool> psb;

string max_(string& a, string& b)
{

	if (a.size() > b.size()) return a;
	else if (a.size() < b.size()) return b;
	else return max(a, b);
}

pair<string, bool> solve(int l, int r)
{
	string tmp = s.substr(l, r - l);
	bool ff = true;
	REP(i, func.size())
	{
		if (tmp.find(func[i]) != string::npos) ff = false;
	}
	if (ff)
	{
		string res;
		if (tmp[0] == '0'&& tmp.size() > 1) return psb(res, false);
		FOR(i, l, r)
		{
			if (s[i] == '?') res.push_back('9');
			else res.push_back(s[i]);
		}
		return psb(res, true);
	}
	if  (r-l >= 6 &&
		(s[l] != 'R' || s[l] != 'L' || s[l] != '?') &&
		(s[l+1] == '(' || s[l+1] == '?') &&
		(s[r-1] == ')' || s[r-1] == '?'))
	{
		string res;
		FOR(i, l + 3, r - 2)
		{
			if (s[i] != ','&&s[i] != '?') continue;
			psb lhs = solve(l + 2, i);
			psb rhs = solve(i + 1, r - 1);
			if (lhs.second&&rhs.second)
			{
				string L = lhs.first, R = rhs.first;
				if (s[l] == 'R') res = max_(res, R);
				if (s[l] == 'L') res = max_(res, L);
				if (s[l] == '?') res = max_(res, max_(R, L));
			}
		}
		if (res == "") return psb(res, false);
		else return psb(res, true);
	}
	else return psb("", false);
}

int main()
{
	cin >> s;
	f = true;
	psb ans = solve(0, s.size());
	if (!ans.second) puts("invalid");
	else cout << ans.first << endl;
	return 0;
}

Compiler output:
a.cc: In function 'std::pair<std::__cxx11::basic_string<char>, bool> solve(int, int)':
a.cc:69:70: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   69 |                                 if (s[l] == '?') res = max_(res, max_(R, L));
      |                                                                  ~~~~^~~~~~
a.cc:26:32: note:   initializing argument 2 of 'std::string max_(std::string&, std::string&)'
   26 | string max_(string& a, string& b)
      |                        ~~~~~~~~^
Language: C

#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
	char a[201][201];
	int n;
	scanf("%d",&n);
	getchar();
	for(int i=0;i<n;i++)
	gets(a[i]);
	int t=0,flag=0;
	for(int i=0;i<n;i++)
	{
		int m=strlen(a[i]);
		for(int j=0;j<m;j++)
		{
			if(a[i][j]=='(')
			t++;
			else if(a[i][j]==')')
			t--;
			if(t<0)
			{
				flag=1;
				break;
			}
		}
	}
	if(t!=0)
	flag=1;
	if(flag)
	printf("No\n");
	else
	printf("Yes\n");
	return 0;
}


Compiler output:
main.c:3:1: error: unknown type name 'using'
    3 | using namespace std;
      | ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    3 | using namespace std;
      |                 ^~~
main.c: In function 'main':
main.c:11:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   11 |         gets(a[i]);
      |         ^~~~
      |         fgets
Language: C

#include<iostream>
#include<cstring>
#include<stack>
#include<cstring> 

using namespace std;

const int MAXN=1000;

char map[MAXN][MAXN];

int main()
{
	int n;
	int flag=1;
	stack<char> stk;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>map[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<MAXN;j++)
		{
			if(map[i][j]=='(')
				stk.push(map[i][j]);
			else if(map[i][j]==')')
			{
				if(!stk.empty())
				{
					stk.pop();
				}
				else
					flag=0;
			}
		}
	}
	if(flag&&stk.empty())
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


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

#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	string a;
	char b[101][101];
	int n;
	cin>>n;
	getchar();
	for(int i=0;i<n;i++)
	{
		getline(cin,a,'\n');
		for(int j=0;j<a.size();j++)
		b[i][j]=a[j];
	}
	int t=0,flag=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<101;j++)
		{
			if(b[i][j]=='(')
			t++;
			else if(b[i][j]==')')
			t--;
			if(t<0)
			{
				flag=1;
				break;
			}
			
		}
	}
	if(t!=0)
	flag=1;
	if(flag)
	printf("No\n");
	else
	printf("Yes\n");
	return 0;
}


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

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char a[201][201];
	int n;
	cin>>n;
	getchar();
	for(int i=0;i<n;i++)
	gets(a[i]);
	int t=0,flag=0;
	for(int i=0;i<n;i++)
	{
		int m=strlen(a[i]);
		for(int j=0;j<m;j++)
		{
			if(a[i][j]=='(')
			t++;
			else if(a[i][j]==')')
			t--;
			if(t<0)
			{
				flag=1;
				break;
			}
		}
	}
	if(t!=0)
	flag=1;
	if(flag)
	cout<<"No"<<endl;
	else
	cout<<"Yes"<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   12 |         gets(a[i]);
      |         ^~~~
      |         getw