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

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;
string s;
int cnt[3];
bool ok(string s,int a, int b, int c){
	if(s == "ABC")return true;
	string nxt;
	char to;
	int abc;
	if(a < b && a < c)to = 'A', abc=a,b-=a,c-=a;
	else if(b < a && b < c)to = 'B', abc=b,a-=b, c-=b;
	else if(c < a && c < b)to = 'C', abc=c,a-=c, b-=c;
	else return false;
	int p = 0;
	while(p < s.size()){
		if(p+2 < s.size() && s[p] == 'A' && s[p+1] == 'B' && s[p+2] == 'C'){
			nxt += to;
			p += 3;
			acb--;
		}
		else{
			nxt += s[p];
			p++;
		}
	}
	if(abc != 0)return false;
	return ok(nxt, a, b, c);
}

int main(){
	cin >> s;
	for(int i = 0;i < s.size();i++){
		cnt[s[i]-'A']++;
	}
	if(ok(s, cnt[0], cnt[1], cnt[2]))cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'bool ok(std::string, int, int, int)':
a.cc:22:25: error: 'acb' was not declared in this scope; did you mean 'abc'?
   22 |                         acb--;
      |                         ^~~
      |                         abc
Language: C++

def f(s)
    return s == 'ABC' if s.size <= 3
    x = s.gsub('ABC', 'X')
    return false if x !~ /X/
    a = %w(A B C)
    a.delete(?A) if x =~ /A/
    a.delete(?B) if x =~ /B/
    a.delete(?C) if x =~ /C/
    return a.any? {|c| f(x.gsub(?X, c))}
end

s = gets.chomp
puts f(s) ? 'Yes' : 'No'



Compiler output:
a.cc:2:17: warning: multi-character character constant [-Wmultichar]
    2 |     return s == 'ABC' if s.size <= 3
      |                 ^~~~~
a.cc:3:16: warning: multi-character character constant [-Wmultichar]
    3 |     x = s.gsub('ABC', 'X')
      |                ^~~~~
a.cc:13:13: warning: multi-character character constant [-Wmultichar]
   13 | puts f(s) ? 'Yes' : 'No'
      |             ^~~~~
a.cc:13:21: warning: multi-character character constant [-Wmultichar]
   13 | puts f(s) ? 'Yes' : 'No'
      |                     ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def f(s)
      | ^~~
a.cc:10:1: error: 'end' does not name a type
   10 | end
      | ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int INF = 1 << 30;

int main()
{
  int N, M, K, D[16], A[100][100];
  int black[100];
  memset(black, -1, sizeof(black);

  cin >> N >> M >> K;
  for(int i = 0; i < M; i++) {
    cin >> D[i];
    black[--D[i]] = i;
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < K; j++) {
      cin >> A[i][j];
      --A[i][j];
    }
  }

  int dp[1 << 16];
  fill_n(dp, 1 << 16, INF);
  dp[(1 << M) - 1] = 0;
  for(int i = (1 << M) - 1; i > 0; i--) {
    for(int j = 0; j < K; j++) {
      int bitMask = 0;
      for(int k = 0; k < N; k++) {
        if((i >> k) & 1 && ~black[A[k][j]]) bitMask |= 1 << black[A[k][j]];
      }
      dp[bitMask] = min(dp[bitMask], dp[i] + 1);
    }
  }
  cout << dp[0] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:34: error: expected ')' before ';' token
   11 |   memset(black, -1, sizeof(black);
      |         ~                        ^
      |                                  )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k,i,j,l,a,b,e,inf=1<<28;
  cin>>n>>m>>k;
  int dp[1<<m],d[n];
  map<int,int> r;
  vector<int> G[n][k];
  for(b=0;b<(1<<m);b++) dp[b]=inf;
  for(i=0;i<m;i++) cin>>d[i],r[d[i]-1]=i;
  for(i=0;i<n;i++)
    for(j=0;j<k;j++)
      cin>>e,G[e-1][j].push_back(i);
  typedef pair<int,int> P;
  queue<P> q;
  q.push(P(0,0));
  while(!q.empty()){
    a=q.front().first;b=q.front().second;q.pop();
    if(dp[b]<=a) continue;
    dp[b]=a;
    for(j=0;j<k;j++){
      int o=0;
      for(i=0;i<n;i++){
	if(r.find(i)!=r.end()&&((b>>r[i])&1)==0) continue;
	for(l=0;l<G[i][j].size();l++)
	  if(r.find(G[i][j][l])!=r.end()) o|=(1<<r[G[i][j][l]]);
      if(a+1<dp[o]) q.push(P(a+1,o));
    }
  }
  cout << dp[(1<<m)-1] << endl;
  return 0;
}

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

#vreeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeev

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #vreeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeev
    1 | #vreeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeev
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define MAX_V 100000
using namespace std;
typedef pair<int,int> P;
int n,m,w[100001];
vector<int> v[100001],v1[100001];
unodered_set<P> st;
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void DFS(int p){
  for(int i=0;i<v[p].size();i++){
    P pp=P(min(v[p][i],p),max(v[p][i],p));
    if(st.find(pp)==st.end()){
      st.insert(pp);
      G[p].push_back(v[p][i]);
      rG[v[p][i]].push_back(p);
      DFS(v[p][i]);
    }
  }
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++)if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}

int C[100001],F[100001],U[100001],ans;
bool UU[100001];

bool DFS1(int p){
  if(U[p])return 0;
  U[p]=1;
  bool f=F[cmp[p]]>=2;
  for(int i=0;i<G[p].size();i++)
    f=max(f,DFS1(G[p][i]));
  ans+=w[p]*f;
  return UU[p]=f;
}

int DFS2(int p){
  if(UU[p])return 0;
  UU[p]=1;
  int res=0;
  for(int i=0;i<v[p].size();i++)
    res+=DFS2(v[p][i]);
  return w[p]+res;
}

int main(){
  cin>>V>>m;
  for(int i=0;i<V;i++)cin>>w[i];
  for(int j=0,a,b;j<m;j++){
    cin>>a>>b;a--,b--;
    v[a].push_back(b),v[b].push_back(a);
  }
  DFS(0);
  scc();
  for(int i=0;i<V;i++)F[cmp[i]]++;
  DFS1(0);
  int mx=0;
  for(int i=0;i<V;i++)
    if(!UU[i])mx=max(mx,DFS2(i));
  
  cout<<ans+mx<<endl;
  return 0;
}

Compiler output:
a.cc:7:1: error: 'unodered_set' does not name a type
    7 | unodered_set<P> st;
      | ^~~~~~~~~~~~
a.cc: In function 'void DFS(int)':
a.cc:18:8: error: 'st' was not declared in this scope; did you mean 'std'?
   18 |     if(st.find(pp)==st.end()){
      |        ^~
      |        std
Language: C++

#include<bits/stdc++.h>
#define MAX_V 100000
using namespace std;
int n,m,w[100001];
vector<int> v[100001],v1[100001];
unodered_set<int> st[100001];
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void DFS(int p){
  for(int i=0;i<v[p].size();i++){
    int mn=min(v[p][i],p),mx=max(v[p][i],p);
    if(st[mn].find(mx)==st.end()){
      st[mn].insert(mx);
      G[p].push_back(v[p][i]);
      rG[v[p][i]].push_back(p);
      DFS(v[p][i]);
    }
  }
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++)if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}

int C[100001],F[100001],U[100001],ans;
bool UU[100001];

bool DFS1(int p){
  if(U[p])return 0;
  U[p]=1;
  bool f=F[cmp[p]]>=2;
  for(int i=0;i<G[p].size();i++)
    f=max(f,DFS1(G[p][i]));
  ans+=w[p]*f;
  return UU[p]=f;
}

int DFS2(int p){
  if(UU[p])return 0;
  UU[p]=1;
  int res=0;
  for(int i=0;i<v[p].size();i++)
    res+=DFS2(v[p][i]);
  return w[p]+res;
}

int main(){
  cin>>V>>m;
  for(int i=0;i<V;i++)cin>>w[i];
  for(int j=0,a,b;j<m;j++){
    cin>>a>>b;a--,b--;
    v[a].push_back(b),v[b].push_back(a);
  }
  DFS(0);
  scc();
  for(int i=0;i<V;i++)F[cmp[i]]++;
  DFS1(0);
  int mx=0;
  for(int i=0;i<V;i++)
    if(!UU[i])mx=max(mx,DFS2(i));
  
  cout<<ans+mx<<endl;
  return 0;
}

Compiler output:
a.cc:6:1: error: 'unodered_set' does not name a type
    6 | unodered_set<int> st[100001];
      | ^~~~~~~~~~~~
a.cc: In function 'void DFS(int)':
a.cc:17:8: error: 'st' was not declared in this scope; did you mean 'std'?
   17 |     if(st[mn].find(mx)==st.end()){
      |        ^~
      |        std
Language: C++

#include<bits/stdc++.h>
#define MAX_V 100000
using namespace std;
int n,m,w[100001];
vector<int> v[100001],v1[100001];
unodered_set<int> st[100001];
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs;
bool used[MAX_V];
int cmp[MAX_V];

void DFS(int p){
  for(int i=0;i<v[p].size();i++){
    int mn=min(v[p][i],p),mx=max(v[p][i],p);
    if(st[mn].find(mx)==st[mn].end()){
      st[mn].insert(mx);
      G[p].push_back(v[p][i]);
      rG[v[p][i]].push_back(p);
      DFS(v[p][i]);
    }
  }
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++)if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++)if(!used[v])dfs(v);
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],k++);
  return k;
}

int C[100001],F[100001],U[100001],ans;
bool UU[100001];

bool DFS1(int p){
  if(U[p])return 0;
  U[p]=1;
  bool f=F[cmp[p]]>=2;
  for(int i=0;i<G[p].size();i++)
    f=max(f,DFS1(G[p][i]));
  ans+=w[p]*f;
  return UU[p]=f;
}

int DFS2(int p){
  if(UU[p])return 0;
  UU[p]=1;
  int res=0;
  for(int i=0;i<v[p].size();i++)
    res+=DFS2(v[p][i]);
  return w[p]+res;
}

int main(){
  cin>>V>>m;
  for(int i=0;i<V;i++)cin>>w[i];
  for(int j=0,a,b;j<m;j++){
    cin>>a>>b;a--,b--;
    v[a].push_back(b),v[b].push_back(a);
  }
  DFS(0);
  scc();
  for(int i=0;i<V;i++)F[cmp[i]]++;
  DFS1(0);
  int mx=0;
  for(int i=0;i<V;i++)
    if(!UU[i])mx=max(mx,DFS2(i));
  cout<<ans+mx<<endl;
  return 0;
}

Compiler output:
a.cc:6:1: error: 'unodered_set' does not name a type
    6 | unodered_set<int> st[100001];
      | ^~~~~~~~~~~~
a.cc: In function 'void DFS(int)':
a.cc:17:8: error: 'st' was not declared in this scope; did you mean 'std'?
   17 |     if(st[mn].find(mx)==st[mn].end()){
      |        ^~
      |        std
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;

vector<vector<int>> edge;
vector<set<int>> nedge;
vector<int> uid, uuid;
vector<int> vis;
vector<int> viscnt;
vector<int> cnts;
vector<int> nw;
bool dfs(int now, int par, int s) {
    vis[now] = s;
    bool ret = false;
    for (int i : edge[now]) {
        if (i == par) continue;
        if (s == 0) {
            ++viscnt[i];
        }
        if (i == s) {
            ret = true;
        }
        else if (vis[i] < s && uid[i] > s) {
            ret |= dfs(i, now, s);
        }
    }
    if (ret) {
        uid[now] = s;
    }
    return ret;
}
bool dfs(int now, int par) {
    bool ret = cnt[now] > 1;
    for (int i : nedge[now]) {
        if (i == par) continue;
        ret |= dfs(i, now);
    }
    if (ret) {
        uuid[now] = 0;
    }
    return ret;
}
int dfs2(int now, int par) {
    int ret = 0;
    for (int i : nedge[now]) {
        if (i == par) continue;
        ret = max(ret, dfs2(i, now));
    }
    return ret + nw[now];
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> w(n);
    for (int i = 0; i < n; ++i) {
        cin >> w[i];
    }
    edge.resize(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    uid.resize(n);
    vis.resize(n, -1);
    for (int i = 0; i < n; ++i) {
        uid[i] = i;
    }
    viscnt.resize(n, 0);
    cnts.resize(n, 0);
    for (int i = 0; i < n; ++i) {
        if (uid[i] == i) {
            if (i == 0 || viscnt[i] > 1)
                dfs(i, -1, i);
        }
        ++cnts[uid[i]];
    }
    nedge.resize(n);
    for (int i = 0; i < n; ++i) {
        for (int j : edge[i]) {
            if (uid[i] != uid[j]) {
                nedge[uid[i]].insert(uid[j]);
            }
        }
    }
    uuid.resize(n);
    for (int i = 0; i < n; ++i) {
        uuid[i] = i;
    }
    dfs(0, -1);
    nw.resize(n, 0);
    for (int i = 0; i < n; ++i) {
        nw[uuid[uid[i]]] += w[i];
    }
    vector<int> used(n, 0);
    int ma = 0;
    for (int i = 0; i < n; ++i) {
        if (i == uid[i] && uuid[i] == 0) {
            for (int j : nedge[i]) {
                if (uuid[j] > 0 && !used[j]) {
                    used[j] = 1;
                    ma = max(ma, dfs2(j, i));
                }
            }
        }
    }
    cout << (nw[0] + ma) << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'bool dfs(int, int)':
a.cc:34:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   34 |     bool ret = cnt[now] > 1;
      |                ^~~
      |                int
Language: C

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
long long num[6000]={};
int main(){
		//freopen("main.in","r",stdin);
		int t; cin >> t;
		while(t--){
				long long x;
				cin >> x;
				int ans = lower_bound(num+1,num+5194+1,x) - num;
				cout << num[ans] << endl;
		}
		return 0;

}

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

#include <bits/stdc++.h>

using namespace std;

using ll=long long;

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>>d(m,vector<int>(n));
    int ans=0;
    for(int i=0;i<m;++i){
        for(int j=0;j<n;++j){
            char c;
            scanf("%c",&c);
            if(c=='W'){
                d[i][j]=0;
                ans++;
            }
            else d[i][j]=1;
        }
    }
    int mi=1e9;
    int re=0;
    for(int i=0;i<=n;++i){
        for(int j=0;j<m;++j){
            if(d[j][i]==0){
                ans--;
            }else{
                ans++;
            }
        }
        if(ans<mi){
            mi=ans;
            re=i;
        }
    }
    printf("%d %d\n",re,re+1);
}



Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int n,m,v[4001],w[4001],u[4001],dp[4001][4001]={0},f;
int main()
{
    int i,j;
    cin>>n>>m;
    for(i=1;i<=n;i++)
    cin>>w[i]>>v[i]>>u[i];
    for(i=1;i<=n;i++)
        u[i]=u[i]*u[i];
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            if(j>=w[i])
                if(dp[i-1][j-w[i]]+v[i]-f[i-1][j-w[i]]>dp[i-1][j])
                    dp[i][j]=dp[i-1][j-w[i]]+v[i]-f[i-1][j-w[i]],f[i][j]=u[i];
                else
                    dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=dp[i-1][j];
    cout<<dp[n][m]<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:42: error: invalid types 'int[int]' for array subscript
   15 |                 if(dp[i-1][j-w[i]]+v[i]-f[i-1][j-w[i]]>dp[i-1][j])
      |                                          ^
a.cc:16:52: error: invalid types 'int[int]' for array subscript
   16 |                     dp[i][j]=dp[i-1][j-w[i]]+v[i]-f[i-1][j-w[i]],f[i][j]=u[i];
      |                                                    ^
a.cc:16:67: error: invalid types 'int[int]' for array subscript
   16 |                     dp[i][j]=dp[i-1][j-w[i]]+v[i]-f[i-1][j-w[i]],f[i][j]=u[i];
      |                                                                   ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

constexpr long long INF64 = 1e18;

using Weight=long long;

struct Edge{
    int src,dst;
    Edge(int src,int dst):
    src(src),dst(dst){}
};

using Edges=vector<Edge>;
using Graph=vector<Edges>;

vector<int> tarjan(const Graph& g) {
	int n = g.size(), idx = 0, k = 0, s = 0;
	vector<int>ord(n, -1), low(n), onS(n), cmp(n), stk(n);
	function<void(int)>dfs;
	dfs = [&](int v) {
		ord[v] = low[v] = idx++;
		stk[s++] = v;
		onS[v] = true;
		for (auto &e : g[v]) {
			int w = e.dst;
			if (ord[w] == -1) {
				dfs(w);
				low[v] = min(low[v], low[w]);
			}
			else if (onS[w]) {
				low[v] = min(low[v], ord[w]);
			}
		}
		if (low[v] == ord[v]) {
			while (1) {
				int w = stk[--s];
				onS[w] = false;
				cmp[w] = k;
				if (w == v)break;
			}
			++k;
		}
	};
	for (int v = 0; v<n; ++v)
		if (ord[v] == -1)dfs(v);
	return cmp;
}

int dfs(const Graph &g,int s,vector<int> &memo){
	int ret=1;
	if(memo[s])return memo[s];
	for(auto e:g[s]){
		ret=max(dfs(g,e.dst,memo)+1,ret);
	}
	//cout<<"t"<<endl;
	return memo[s]=ret;
}

int main(){
	int n;
	cin>>n;
	Graph g(n);
	vector<pair<Weight,int>>contri(n);
	vector<vector<pair<Weight,int>>>friends(n);
	for(int i=0;i<n;++i){
		int a;
		cin>>a;
		contri[i]=make_pair(a,i);
		friends[i].push_back(contri[i]);
	}
	int m;
	cin>>m;
	for(int i=0;i<m;++i){
		int a,b;
		cin>>a>>b;
		--a;
		--b;
		//if(contri[a].first>=contri[b].first)g[a].emplace_back(a,b);
		//if(contri[a].first<=contri[b].first)g[b].emplace_back(b,a);
		friends[a].push_back(contri[b]);
		friends[b].push_back(contri[a]);
	}
	for(auto x:friends){
		sort(x.begin(),x.end(),greater<pair<int,int>>());
		for(int i=0;i<x.size()-1;++i){
			g[x[i].second].emplace_back(x[i].second,x[i+1].second);
			//cout<<x[i].second<<x[i+1].second<<endl;
			if(x[i].first==x[i+1].first){
				g[x[i+1].second].emplace_back(x[i+1].second,x[i].second);
				//cout<<x[i+1].second<<x[i].second<<endl;
			}
		}
	}
	vector<int>idx=tarjan(g);
	for(int x:idx){
		//cout<<x<<endl;
	}
	Graph ng(n);
	for(auto es:g){
		for(auto e:es){
			if(idx[e.src]==idx[e.dst])continue;
			ng[idx[e.src]].emplace_back(idx[e.src],idx[e.dst]);
		}
	}
	vector<Weight>memo(n,0);
	for(auto es:ng){
		if(es.size()>=1)dfs(ng,es[0].src,memo);
	}
	Weight ans=0;
	for(auto x:idx){
		//cout<<memo[x]<<endl;
		if(!memo[x])memo[x]=1;
		ans+=memo[x];
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:109:50: error: invalid initialization of reference of type 'std::vector<int>&' from expression of type 'std::vector<long long int>'
  109 |                 if(es.size()>=1)dfs(ng,es[0].src,memo);
      |                                                  ^~~~
a.cc:51:43: note: in passing argument 3 of 'int dfs(const Graph&, int, std::vector<int>&)'
   51 | int dfs(const Graph &g,int s,vector<int> &memo){
      |                              ~~~~~~~~~~~~~^~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
typedef pair<int, int> pii;

int main(){
  int n, m;
  std::cin >> n;
  vector<pii> c(n);
  vector<int> ans(n, 1), maxi(n, 1), id(n);
  vector<bool> used(n, false);
  for (int i = 0; i < n; i++){
    std::cin >> c[i].first;
    c[i].second = i;
  }
  sort(c.begin(), c.end());
  for (int i = 0; i < n; i++) id[c[i].second] = i;
  
  std::cin >> m;
  vector<vector<int> > g(n);
  for (int i = 0; i < m; i++) {
    int to, from;
    std::cin >> to >> from;
    to--, from--;
    g[from].push_back(to);
    g[to].push_back(from);
  }
  for (int i = 0; i < n; i++) {
    int v = c[i].second;
    int salary = maxi[v];
    used[v] = true;
    bool isMaxi = true, flag = false;
    for (int j = 0; j < g[v].size(); j++) {
      int to = g[v][j];
      if(not used[to])continue;
      flag = true;
      salary = max(salary, maxi[to]);
      isMaxi &= (c[i].first > c[id[to]].first);
    }
    salary += (isMaxi and flag);
    ans[v] = maxi[v] = salary;
    for (int j = 0; j < g[v].size(); j++) {
      int to = g[v][j];
      if(used[to]){
        c[id[to]].first = max(c[id[to].first], c[i].first);
        maxi[to] = max(maxi[to], maxi[v]);
      }
    }
  }
  std::cout << accumulate(ans.begin(), ans.end(), 0) << std::endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:40: error: request for member 'first' in 'id.std::vector<int>::operator[](((std::vector<int>::size_type)to))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   47 |         c[id[to]].first = max(c[id[to].first], c[i].first);
      |                                        ^~~~~
Language: C++

#include <string>
#include <iostream>
using namespace std;
bool chk(string a,string b,int s){
    int i;
    string buf=b;
    char tg;
    for(i=s;i<a.size();i+=2){
        tg=a[i];
        auto idx=find(buf.begin(),buf.end(),tg);
        if(idx!=buf.end()){
            *idx='.';
        }
        else{
            return false;
        }
    }
    return true;
}
int main(){
    int i,iss;
    string a,b;
    cin>>a;
    cin>>b;
    iss=1;
    if(!chk(a,b,0)){iss=0;}
    if(!iss && chk(a,b,1)){iss=1;}
    if(iss){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    return 0;
} 



Compiler output:
a.cc: In function 'bool chk(std::string, std::string, int)':
a.cc:10:22: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, char&)'
   10 |         auto idx=find(buf.begin(),buf.end(),tg);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:10:22: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   10 |         auto idx=find(buf.begin(),buf.end(),tg);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
bool chk(string a,string b,int s){
    int i;
    char buf;
    for(i=s;i<a.size();i+=2){
        buf=a[i];
        auto idx=find(b.begin(),b.end(),buf);
        if((*idx)==buf){
            *idx='.';
        }
        else{
            return false;
        }
    }
    return true;
}

int main(){
    bool c;
    string a,b;
    cin>>a;
    cin>>b;
    c=chk(a,b,0);
    if(!c){c=chk(a,b,1);}
    if(c){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    return 0;
}



Compiler output:
a.cc: In function 'bool chk(std::string, std::string, int)':
a.cc:9:22: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, char&)'
    9 |         auto idx=find(b.begin(),b.end(),buf);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~
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:9:22: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    9 |         auto idx=find(b.begin(),b.end(),buf);
      |                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

S_ = raw_input()
T_ = raw_input() + " "

S1 = S2 = ''
for i in range(len(S_)):
    if i % 2 == 0:
        S1 += S_[i]
    else:
        S2 += S_[i]

for S in [S1, S2]:
    T = T_
    for c in S:
        index = T.find(c)
        if index == -1:
            T = ""
            break
        T = T[index + 1:]
    
    if T != "":
        print "Yes"
        exit()
print "No"


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:13:11: error: empty character constant
   13 | S1 = S2 = ''
      |           ^~
a.cc:3:1: error: 'import' does not name a type
    3 | import sys
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long
string a,b;
char t[1000];
int main(){
cin>>a>>b;
int as=a.size(),bs=b.size();
int num=as/2,pos=0;
bool ok=0;

for(int k=0;k<2;k++){
pos=0;
rep(l,1000)t[l]='';

for(int i=k;i<as;i+=2){
	if(i>=bs){ok=0;break;}
	t[pos++]=a[i];
}

for(int i=0;i<bs;i++){
	int c=0;
	if(b[i]==t[c]){
		for(int j=i;j<bs;j++){
			if(b[j]==t[c])c++;
		}
		if(c==pos)ok=1;
	}

}

}
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

	return 0;
}


Compiler output:
a.cc:29:17: error: empty character constant
   29 | rep(l,1000)t[l]='';
      |                 ^~
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long
string a,b;
char t[2000];
int main(){
cin>>a>>b;
int as=a.size(),bs=b.size();
int num=as/2,pos=0;
bool ok=0,ok2;


for(int k=0;k<2;k++){
int i=0,j=0;
string tmp="";
bool f=k;


while(true){
	if(f&&i<as){//aからとる
		if(a[pos]==a[i]){tmp.push_back(a[i]);pos++;f=!f;}
		i++;
	}

	else if(!f&&j<bs){
		if(a[pos]==b[j]){tmp.push_back(b[j]);pos++;f=!f;}
		j++;
	}
	if(i>=asj>=bs)break;
	if(tmp.size()==as)break;
}


//cout<<tmp<<endl;
	if(tmp==a)ok=1;
}
/*
for(int k=0;k<2;k++){
pos=0;
rep(l,2000)t[l]=' ';

for(int i=k;i<as;i+=2){
	//if(i>=bs){t[pos++]='@';}
	 t[pos++]=a[i];
}

rep(j,pos)cout<<t[j]<<" ";cout<<endl;
for(int i=0;i<bs;i++){
	int c=0;
	if(b[i]==t[c]){
		for(int j=i;j<bs;j++){
			if(b[j]==t[c])c++;
		}
		if(c==pos)ok=1;
	}

}
}
*/
//if(abs(as-bs)>1)ok=0;
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: 'asj' was not declared in this scope; did you mean 'as'?
   44 |         if(i>=asj>=bs)break;
      |               ^~~
      |               as
Language: C++

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

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#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 ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
int key = 0;
int N;
ll ma=0;
ll ans;
ll n;

void saiki(int idx,ll num) {
	if (idx == N) {
		if (ma < min(abs(n - num), (ll)pow(10, N) - abs(n - num))) {
			ma = max(ma, min(abs(n - num), (ll)pow(10, N) - abs(n - num)));
			ans = num;
		}
		else if (ma == min(abs(n - num), (ll)pow(10, N) - abs(n - num))) {
			ans = min(ans,num);
		}
		return;
	}
	REP(i, 10) {
		if (!(key&(1 << i))) {
			key |= (1 << i);
			saiki(idx + 1, num * 10 + i);
			key &= ~(1 << i);
		}
	}
}
int main() {
	string s;
	cin >> s;
	n = atoi(s.c_str);
	ans = n;
	N = to_string(n).length();
	saiki(0, 0);
	REP(i,N)
	cout <<ans/(ll)pow(10,N-i-1)%10;
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:80:20: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   80 |         n = atoi(s.c_str);
      |                  ~~^~~~~
In file included from /usr/include/c++/14/string:54,
                 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,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/fstream:40,
                 from a.cc:7:
/usr/include/c++/14/bits/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
string h,q;
int n,x,ans=0,used[10],w,y;
void dfs(int d,string l){
  if(l==h)return;
  if(d==h.size()){
    int p,pp;
    stringstream ss(l);
    ss>>p;
    pp=min(abs(n-p),(int)pow(10,w)-abs(n-p));
    if(pp>ans){
      ans=pp;
      q=l;
    }
  }
  else{
    if(!d){
      used[y]=1;
      dfs(d+1,l+(char)(y+'0'));
    }
    else for(int i=0;i<=9;i++){
      if(!used[i]){
        used[i]=1;
        dfs(d+1,l+(char)(i+'0'));
        used[i]=0;
      }
    }
  }
}
int main(){
  cin>>h;
  w=h.size();
  if(h[0]>='5')y=h[0]-5-'0';
  else y=h[0]-'0'+5;
  stringstream ss(h);
  ss>>n;
  dfs(0,"");
  cout<<q<<endl;
}

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

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

#define inf 1e12
typedef long long ll;

using namespace std;
ll mini = inf;
string s;
ll x;
string ans;
void perm(string t, int bit, int node, int d) {
    if (node == d) {
        ll b = stoll(t);
        ll p = abs(x-b);
        ll q = abs((ll)pow(10,d)-p);
        ll a = max(p,q);
        if (a < mini) {
            mini = a, ans = t;
        }
        else if (a == mini) {
            mini = min(a, mini);
            if (b < stoll(ans)) ans = t;
        }
        return;
    }
    for (int i = 0; i < 10; i++) {
        if (~bit & 1<<i) {
            char c = '0'+i;
            string y = t+c;
            perm(y, bit|1<<i, node+1, d);
        }
    }
}

int main(void) {
    cin >> s;
    x = stoi(s);
    string t;
    int d = s.size();
    perm(t,0,0,d);
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'void perm(std::string, int, int, int)':
a.cc:19:24: error: 'pow' was not declared in this scope
   19 |         ll q = abs((ll)pow(10,d)-p);
      |                        ^~~
Language: C

char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}

Compiler output:
main.c:1:15: warning: data definition has no type or storage class
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |               ^
main.c:1:15: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:17: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                 ^
main.c:1:19: error: return type defaults to 'int' [-Wimplicit-int]
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                   ^~~~
main.c: In function 'main':
main.c:1:19: error: type of 'r' defaults to 'int' [-Wimplicit-int]
main.c:1:31: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                               ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
main.c:1:31: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                               ^~~~~
main.c:1:31: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:90: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                                                                                          ^~~~~~
main.c:1:90: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:90: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:90: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:111: error: expected ')' before ':' token
    1 | char s[99999];N,l;main(r){for(scanf("%d%s",&N,s);s[l]=='<';l++);for(r=N;s[--r]=='>';);N=!printf("%d\n",N-l>r+1:N-l:r+1);}
      |                                                                                                ~              ^
      |                                                                                                               )
Language: C

char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}

Compiler output:
main.c:1:6: error: size of array 's' has non-integer type
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |      ^
main.c:1:13: warning: data definition has no type or storage class
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |             ^
main.c:1:13: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
main.c:1:15: error: type defaults to 'int' in declaration of 'q' [-Wimplicit-int]
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |               ^
main.c:1:17: error: return type defaults to 'int' [-Wimplicit-int]
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |                 ^~~~
main.c: In function 'main':
main.c:1:17: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:29: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |                             ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
main.c:1:29: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |                             ^~~~~
main.c:1:29: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:92: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | char s[1e6];p,q;main(n){for(scanf("%d%s",&n,&s);p<n&&s[p]==60;)p++;for(;q<n&&s[q]==62;)q++;printf("%d\n",n-p<q?p:q);}
      |                                                                                            ^~~~~~
main.c:1:92: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:92: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:92: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main{

	static PrintWriter out;
	static InputReader ir;

	static void solve(){
		int cnt=0;
		int n=ir.nextInt();
		if(n%2==1)
			out.println("NO");
		else{
			for(int i=0;i<n;i++){
				if(ir.next().charAt(0)=='A')
					cnt++;
				else
					cnnt--;
				if(cnt<0){
					out.println("NO");
					break;
				}
				if(i==n-1)
					out.println("YES");
			}
		}
	}

	public static void main(String[] args) throws Exception{
		ir=new InputReader(System.in);
		out=new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer=new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}

		public boolean hasNextByte() {
			if(curbuf>=lenbuf){
				curbuf= 0;
				try{
					lenbuf=in.read(buffer);
				}catch(IOException e) {
					throw new InputMismatchException();
				}
				if(lenbuf<=0) return false;
			}
			return true;
		}

		private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

		private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}

		private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

		public boolean hasNext(){skip(); return hasNextByte();}

		public String next(){
			if(!hasNext()) throw new NoSuchElementException();
			StringBuilder sb=new StringBuilder();
			int b=readByte();
			while(!isSpaceChar(b)){
				sb.appendCodePoint(b);
				b=readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if(!hasNext()) throw new NoSuchElementException();
			int c=readByte();
			while (isSpaceChar(c)) c=readByte();
			boolean minus=false;
			if (c=='-') {
				minus=true;
				c=readByte();
			}
			int res=0;
			do{
				if(c<'0'||c>'9') throw new InputMismatchException();
				res=res*10+c-'0';
				c=readByte();
			}while(!isSpaceChar(c));
			return (minus)?-res:res;
		}

		public long nextLong() {
			if(!hasNext()) throw new NoSuchElementException();
			int c=readByte();
			while (isSpaceChar(c)) c=readByte();
			boolean minus=false;
			if (c=='-') {
				minus=true;
				c=readByte();
			}
			long res = 0;
			do{
				if(c<'0'||c>'9') throw new InputMismatchException();
				res=res*10+c-'0';
				c=readByte();
			}while(!isSpaceChar(c));
			return (minus)?-res:res;
		}

		public double nextDouble(){return Double.parseDouble(next());}

		public int[] nextIntArray(int n){
			int[] a=new int[n];
			for(int i=0;i<n;i++) a[i]=nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a=new long[n];
			for(int i=0;i<n;i++) a[i]=nextLong();
			return a;
		}

		public char[][] nextCharMap(int n,int m){
			char[][] map=new char[n][m];
			for(int i=0;i<n;i++) map[i]=next().toCharArray();
			return map;
		}
	}
}

Compiler output:
Main.java:22: error: cannot find symbol
					cnnt--;
					^
  symbol:   variable cnnt
  location: class Main
1 error
Language: C

#include <stdio.h>
int main(void){
	int c,sum=0,un=0;
	while((c=getchar())!=EOF){
		if(c=="n"&&sum!=0&&un=1){
			sum=sum-1;
			un=0;
		}
		else if(c!="n")un=0;
		else if(sum==0){
			if(sum=="A"){
				sum=sum++;
			}
		}
		else if(sum!=0){
			if(sum=="A"){
				sum=sum++;
			}
			if(sum=="U"){
				un=1;
			}
		}
	}
	if(sum==0)puts("YES");
	else puts("NO");
	return 0;
}
			
			
			


Compiler output:
main.c: In function 'main':
main.c:5:21: warning: comparison between pointer and integer
    5 |                 if(c=="n"&&sum!=0&&un=1){
      |                     ^~
main.c:5:38: error: lvalue required as left operand of assignment
    5 |                 if(c=="n"&&sum!=0&&un=1){
      |                                      ^
main.c:9:26: warning: comparison between pointer and integer
    9 |                 else if(c!="n")un=0;
      |                          ^~
main.c:11:31: warning: comparison between pointer and integer
   11 |                         if(sum=="A"){
      |                               ^~
main.c:16:31: warning: comparison between pointer and integer
   16 |                         if(sum=="A"){
      |                               ^~
main.c:19:31: warning: comparison between pointer and integer
   19 |                         if(sum=="U"){
      |                               ^~
Language: C

#include <stdio.h>
int main(void){
	int c,sum=0,un=0;
	while((c=getchar())!=EOF){
		if(c=="n"&&sum!=0&&un=1){
			sum=sum-1;
			un=0;
		}
		else if(c!="n")un=0;
		else if(sum==0){
			if(sum=="A"){
				sum=sum++;
			}
		}
		else if(sum!=0){
			if(sum=="A"){
				sum=sum++;
			}
			if(sum=="U"){
				un=1;
			}
		}
	}
	if(sum==0)puts("YES");
	else puts("NO");
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:21: warning: comparison between pointer and integer
    5 |                 if(c=="n"&&sum!=0&&un=1){
      |                     ^~
main.c:5:38: error: lvalue required as left operand of assignment
    5 |                 if(c=="n"&&sum!=0&&un=1){
      |                                      ^
main.c:9:26: warning: comparison between pointer and integer
    9 |                 else if(c!="n")un=0;
      |                          ^~
main.c:11:31: warning: comparison between pointer and integer
   11 |                         if(sum=="A"){
      |                               ^~
main.c:16:31: warning: comparison between pointer and integer
   16 |                         if(sum=="A"){
      |                               ^~
main.c:19:31: warning: comparison between pointer and integer
   19 |                         if(sum=="U"){
      |                               ^~
Language: C

#include <stdio.h>
int main(void){
	int c,sum=0,un=0;
	while((c=getchar())!=EOF){
		if(c=="n"&&un=1){
			if(sum!=0)sum=sum-1;
			un=0;
		}
		else if(c!="n")un=0;
		else if(sum==0&&sum=="A"){
			sum=sum++;
		}
		else if(sum!=0&&sum=="A"){
			sum=sum++;
			if(sum=="U"){
				un=1;
			}
		}
	}
	if(sum==0)puts("YES");
	else puts("NO");
	return 0;
}
			
			
			


Compiler output:
main.c: In function 'main':
main.c:5:21: warning: comparison between pointer and integer
    5 |                 if(c=="n"&&un=1){
      |                     ^~
main.c:5:30: error: lvalue required as left operand of assignment
    5 |                 if(c=="n"&&un=1){
      |                              ^
main.c:9:26: warning: comparison between pointer and integer
    9 |                 else if(c!="n")un=0;
      |                          ^~
main.c:10:36: warning: comparison between pointer and integer
   10 |                 else if(sum==0&&sum=="A"){
      |                                    ^~
main.c:13:36: warning: comparison between pointer and integer
   13 |                 else if(sum!=0&&sum=="A"){
      |                                    ^~
main.c:15:31: warning: comparison between pointer and integer
   15 |                         if(sum=="U"){
      |                               ^~
Language: C

#include <stdio.h>
int main(void){
	int c,sum=0,un=0;
	while((c=getchar())!=EOF){
		if(c=="n"&&un=1){
			if(sum!=0)sum=sum-1;
			un=0;
		}
		else if(c!="n")un=0;
		else if(sum==0&&sum=="A"){
			sum=sum++;
		}
		else if(sum!=0&&sum=="A"){
			sum=sum++;
			if(c=="U"){
				un=1;
			}
		}
	}
	if(sum==0)puts("YES");
	else puts("NO");
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:21: warning: comparison between pointer and integer
    5 |                 if(c=="n"&&un=1){
      |                     ^~
main.c:5:30: error: lvalue required as left operand of assignment
    5 |                 if(c=="n"&&un=1){
      |                              ^
main.c:9:26: warning: comparison between pointer and integer
    9 |                 else if(c!="n")un=0;
      |                          ^~
main.c:10:36: warning: comparison between pointer and integer
   10 |                 else if(sum==0&&sum=="A"){
      |                                    ^~
main.c:13:36: warning: comparison between pointer and integer
   13 |                 else if(sum!=0&&sum=="A"){
      |                                    ^~
main.c:15:29: warning: comparison between pointer and integer
   15 |                         if(c=="U"){
      |                             ^~
Language: C

#include <stdio.h>
int main(void){
	int c,sum=0,un=0;
	while((c=getchar())!=EOF){
		if(c=="n"&&un=1){
			if(sum>0)sum=sum-1;
			un=0;
		}
		else if(c!="n")un=0;
		if(sum>=0&&c=="A"){
			sum=sum++;
		}
		else if(c=="U"){
			un=1;
		}
	}
	if(sum==0)puts("YES");
	else puts("NO");
	return 0;
}
		


Compiler output:
main.c: In function 'main':
main.c:5:21: warning: comparison between pointer and integer
    5 |                 if(c=="n"&&un=1){
      |                     ^~
main.c:5:30: error: lvalue required as left operand of assignment
    5 |                 if(c=="n"&&un=1){
      |                              ^
main.c:9:26: warning: comparison between pointer and integer
    9 |                 else if(c!="n")un=0;
      |                          ^~
main.c:10:29: warning: comparison between pointer and integer
   10 |                 if(sum>=0&&c=="A"){
      |                             ^~
main.c:13:26: warning: comparison between pointer and integer
   13 |                 else if(c=="U"){
      |                          ^~