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

#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
int n, w[200000];
vector<int> v[200000], u[200000];
string s;
int b[200000];
bool f(int x, int y, int z){
    for(int i=0;i<v[x].size();i++){
        int t=v[x][i];
        if(y==0&&s[t]=='A'){
            if(f(t, y+1, z))return true;
        }else if((y==1||y==2)&&s[t]=='B'){
            if(f(t, y+1, z))return true;
        }else if(y==3&&t==z){
            return true;
        }
    }
    return false;
}
bool g(int x, int y, int z){
    for(int i=0;i<v[x].size();i++){
        int t=v[x][i];
        if(y==0&&s[t]=='B'){
            if(g(t, y+1, z))return true;
        }else if((y==1||y==2)&&s[t]=='A'){
            if(g(t, y+1, z))return true;
        }else if(y==3&&t==z){
            return true;
        }
    }
    return false;
}

void h(int x, int y, int z){
    for(int i=0;i<v[x].size();i++){
        if(i>0){
            if(v[x][i]==v[x][i-1])continue;
        }
        int t=v[x][i];
        if(y==0&&s[t]=='A'){
            h(t, y+1, z);
        }else if((y==1||y==2)&&s[t]=='B'){
            h(t, y+1, z);
        }else if(y==3&&s[t]=='A'){
            u[z].push_back(t);
            //cout<<z<<" ---- "<<t<<endl;
        }
    }
}

bool k(int x, int y){
    b[x]=y;
    sort(u[x].begin(), u[x].end());
    for(int i=0;i<u[x].size();i++){
        if(i>0){
            if(u[x][i]==u[x][i-1])continue;
        }
        if(b[u[x][i]]==y)return true;
        if(b[u[x][i]]==-1&&k(u[x][i], y))return true;
    }
    return false;
}


int main(void){
    int m;
    cin>>n>>m>>s;
    for(int i=0;i<m;i++){
        int a, b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        if(a!=b)v[b].push_back(a);
    }
    for(int i=0;i<n;i++){
        sort(v[i].begin(), v[i].end());
    }
    for(int i=0;i<n;i++){
        w[i]=0;
        if(s[i]=='A'){
            if(f(i, 0, i)){
                cout<<"Yes"<<endl;
                return 0;
            }else if(f(i, 1, i)){
                w[i]=1;
            }
        }else if(g(i, 1, i)){
            w[i]=2;
        }
        if(w[i]>0){
            //cout<<i<<"of w : "<<w[i]<<endl;
            for(int j=0;j<v[i].size();j++){
                if(w[v[i][j]]==w[i]){
                    cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        if(s[i]=='A'){
            h(i, 0, i);
        }
    }
    fill(b, b+n, -1);
    for(int i=0;i<n;i++){
        if(b[i]==-1){
            if(k(i, i)){
                cout<<"Yes"<<endl;
                //cout<<i<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'bool k(int, int)':
a.cc:55:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   55 |     sort(u[x].begin(), u[x].end());
      |     ^~~~
      |     short
a.cc: In function 'int main()':
a.cc:79:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   79 |         sort(v[i].begin(), v[i].end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <list>
#include <math.h>
#include <string.h>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define INF (1LL<<60)
#define int long long
#define ll long long
#define mod 1000000007


#include <intrin.h>
int dp[21][1 << 21];

signed main(){

	int N, M;
	string s;
	cin >> N >> M;
	cin >> s;

	vector<vector<int>> v(N);
	vector<int> A(N), B(N);

	for (int i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		v[a].push_back(b);
		v[b].push_back(a);
		if (s[b] == 'A') A[a]++; else B[a]++;
		if (s[a] == 'A') A[b]++; else B[b]++;
	}

	stack<int> st;	// 隣接する点がすべて同じアルファベットの頂点の集合
	for (int i = 0; i < N; i++){
		if (A[i]==0 || B[i]==0) st.push(i);
	}

	int lef = N;
	while (st.size()>0){
		int t = st.top(); st.pop();
		lef--;

		// 頂点tを取り除く
		for (auto& j : v[t]){
			if (j != t){
				if (s[t] == 'A') A[j]--; else B[j]--;

				// これによってtの隣接する点がすべて同じアルファベットになっていたら追加
				if (A[j] == 0 || B[j] == 0) st.push(j);
			}
		}

	}

	if (lef)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Compiler output:
a.cc:23:10: fatal error: intrin.h: No such file or directory
   23 | #include <intrin.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(a)
#define ub(vec,a) upper_bound(a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
set<int> E[200000];
string s;
bool u;
int N,M;
int label[200000];
void dfs(int x, int y){
    if(E[x].find(y)==E[x].end()) return;
    if(label[x]==4){
        if(s[x]=='A'&&s[y]=='A') label[x]=0;
        if(s[x]=='A'&&s[y]=='B') label[x]=1;
        if(s[x]=='B'&&s[y]=='B') label[x]=2;
        if(s[x]=='B'&&s[y]=='A') label[x]=3;
    }
    if((s[x]=='A'&&s[y]=='A'&&label[y]==1)||(s[x]=='A'&&s[y]=='B'&&label[y]==2)||
       (s[x]=='B'&&s[y]=='B'&&label[y]==3)||(s[x]=='B'&&s[y]=='A'&&label[y]==0)){
        u=true;
      	E[x].erase(y);
        return;
    }
    else{
        E[x].erase(y);
        set<int> v;
        v=E[y];
        for(auto itr=v.begin();itr!=v.end();itr++){
            if(s[x]!=s[y]&&s[y]==s[*itr]) dfs(y,*itr);
            else if(s[x]==s[y]&&s[y]!=s[*itr]) dfs(y,*itr);
        }
        if(label[x]==1||label[x]==3) label[x]=4;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M;
    cin>>s;
    rep(i,0,M){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        E[a].insert(b);
        E[b].insert(a);
    
    rep(i,0,N){
        while(sz(E[i])){
            rep(i,0,N) label[i]=4;
            u=false;
            auto itr=E[i].begin();
            int k=*itr;
            dfs(i,k);
            if(u){
                cout <<"Yes"<<"\n";
                return 0;
            }
        }
    }
    cout <<"No"<<"\n";
}

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

#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(a)
#define ub(vec,a) upper_bound(a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
set<int> E[200000];
string s;
bool u;
int N,M;
int label[200000];
void dfs(int x, int y){
    if(E[x].find(y)==E[x].end()) return;
    if(label[x]==4){
        if(s[x]=='A'&&s[y]=='A') label[x]=0;
        if(s[x]=='A'&&s[y]=='B') label[x]=1;
        if(s[x]=='B'&&s[y]=='B') label[x]=2;
        if(s[x]=='B'&&s[y]=='A') label[x]=3;
    }
    if((s[x]=='A'&&s[y]=='A'&&label[y]==1)||(s[x]=='A'&&s[y]=='B'&&label[y]==2)||
       (s[x]=='B'&&s[y]=='B'&&label[y]==3)||(s[x]=='B'&&s[y]=='A'&&label[y]==0)){
        u=true;
      	E[x].erase(y);
        return;
    }
    else{
        E[x].erase(y);
        set<int> v;
        v=E[y];
        for(auto itr=v.begin();itr!=v.end();itr++){
            if(s[x]!=s[y]&&s[y]==s[*itr]) dfs(y,*itr);
            else if(s[x]==s[y]&&s[y]!=s[*itr]) dfs(y,*itr);
        }
        if(label[x]=1||label[x]=3) label[x]=4;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M;
    cin>>s;
    rep(i,0,M){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        E[a].insert(b);
        E[b].insert(a);
    }
    rep(i,0,N){
        while(sz(E[i])){
            rep(i,0,N) label[i]=4;
            u=false;
            auto itr=E[i].begin();
            int k=*itr;
            dfs(i,k);
            if(u){
                cout <<"Yes"<<"\n";
                return 0;
            }
        }
    }
    cout <<"No"<<"\n";
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:43:22: error: lvalue required as left operand of assignment
   43 |         if(label[x]=1||label[x]=3) label[x]=4;
      |                     ~^~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
using namespace std;
char s[200005];
vector<int> v[200005];
int cnt[200005][2];
struct cmp
{
	bool operator()(const int &a,const int &b) const
	{
		int ca=min(cnt[a][0],cnt[a][1]),cb=min(cnt[b][0],cnt[b][1]);
		if (ca==cb)
		return (a<b);
		return (ca<cb);
	}
};
set<int,cmp> st;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	getchar();
	gets(s);
	while (m--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		v[a].push_back(b);
		v[b].push_back(a);
		cnt[a][s[b]-'A']++;
		cnt[b][s[a]-'A']++;
	}
	for (int i=0;i<n;i++)
	st.insert(i);
	while (!st.empty())
	{
		int node=*st.begin();
		if (min(cnt[node][0],cnt[node][1]))
		break;
		st.erase(node);
		for (int u:v[node])
		{
			if (st.find(u)==st.end())
			continue;
			st.erase(u);
			cnt[u][s[node]-'A']--;
			st.insert(u);
		}
	}
	printf(st.empty()? "No":"Yes");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   24 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;++i)

const int N = 2e5+7;
int n,m;
char s[N];

int type[N];
bool vis[N];

set<int> vc[N];

void add(int x, int y)
{
    int sz = vc[x].size();
    vc[x].insert(y);

    if(sz!=vc[x].size())
        wei[x][type[y]]++;// 0 is red
}

queue<int> Q;
bool topsort()
{
    int ans=0;
    rep(i,1,n+1)
    {
        if(wei[i][0]==0 || wei[i][1]==0){
            Q.push(i);
            vis[i]=1;
            ans++;
        }
    }

    while(Q.size()){
        int cur = Q.front();
        Q.pop();

        for(auto v:vc[cur]){
            wei[v][type[cur]]--;
            if(vis[v]) continue;
            if(wei[v][0]<=0 || wei[v][1]<=0){
                Q.push(v);
                vis[v]=1;
                ans++;
            }

        }
    }
    return ans!=n;
}

int main()
{
    scanf("%d%d",&n,&m);
    scanf("%s",s);
    rep(i,0,n)
    {
        type[i+1]=(s[i]-'A');
    }
    rep(i,1,m+1)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        add(x,y);
        add(y,x);
    }
    if(topsort())puts("YES");
    else puts("NO");

    return 0;
}


Compiler output:
a.cc: In function 'void add(int, int)':
a.cc:20:9: error: 'wei' was not declared in this scope
   20 |         wei[x][type[y]]++;// 0 is red
      |         ^~~
a.cc: In function 'bool topsort()':
a.cc:29:12: error: 'wei' was not declared in this scope
   29 |         if(wei[i][0]==0 || wei[i][1]==0){
      |            ^~~
a.cc:41:13: error: 'wei' was not declared in this scope
   41 |             wei[v][type[cur]]--;
      |             ^~~
Language: C++

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

const int MAX = (int)2e5 + 5;

vector<int> graph[MAX];
bool visited[MAX];
string charNodes;
int cnt[MAX][2];
queue<int> invalidNodes;

void bfs(){
	while(!invalidNodes.empty()){
		int currentNode = invalidNodes.front();
		invalidNodes.pop();
		
		for(int i = 0; i < graph[currentNode].size(); i++){
			int currentNeighbour = graph[currentNode][i];
			
			if(visited[currentNeighbour]) continue;
			
			cnt[currentNeighbour][charNodes[currentNode] - 'A']--;
			
			if(cnt[currentNeighbour][0] == 0 || cnt[currentNeighbour][1] == 0){
				invalidNodes.push(currentNeighbour);
				visited[currentNeighbour] = 1;
			}
				
		}
	}
}

int main() {
	int n, m;
	cin >> n >> m;
	cin >> charNodes;
	
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		--a; --b;
		
		graph[a].push_back(b);
		graph[b].push_back(a);
		
		cnt[a][charNodes[b] - 'A']++;
		cnt[b][charNodes[a] - 'A']++;
	}
	
	
	for(int i = 0; i < n; i++){
		if(cnt[i][0] == 0 || cnt[i][1] == 0){
			invalidNodes.push(i);
			visited[currentNode] = 1;
		}
	}
	
	bfs();
	
	for(int i = 0; i < n; i++){
		if(!visited[i]){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:33: error: 'currentNode' was not declared in this scope
   54 |                         visited[currentNode] = 1;
      |                                 ^~~~~~~~~~~
Language: C++

#include<Cstdio>
inline void read(int&r)
{
	register char c;r=0;
	do c=getchar();while(c<'0'||c>'9');
	do r=r*10+c-'0',c=getchar();while(c>='0'&&c<='9');
}

char s[200001];
int first[200001];
int a[200001],b[200001],q[400001];
struct ac{ int to,nx; }e[400001];
void readedge()
{
	static int L=1,u,v;read(u),read(v);
	e[L].to=v,e[L].nx=first[u],first[u]=L++;
	e[L].to=u,e[L].nx=first[v],first[v]=L++;
	(s[u]=='A'?a:b)[v]++;
	(s[v]=='A'?a:b)[u]++;
}

int main()
{
	int n,u,t=0,i,j;
	scanf("%d%d%s",&n,&t,s+1);
	while(t--)readedge();
	for(u=1,t=0;u<=n;u++)if(!a[u]||!b[u])q[t++]=u;
	for(i=0;i<t;i++)
		for(j=first[u=q[i]];j;j=e[j].nx)
			if(!--(s[u]=='A'?a:b)[e[j].to]&&(s[u]=='A'?b:a)[e[j].to])
				q[t++]=e[j].to;
	puts(t==n?"No":"Yes");
}

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

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

using namespace std;

void finish()
{
    cout << "Yes" << endl;
    exit(0);
}

int n, m;
string str;
vector< vector<int> > gr, color;

void dfs(int u, int col)
{
    char nxtch = (col == 3 || col == 0) ? 'A' : 'B';
    int nxtcol = (col + 1) % 4;

    for (int v : gr[u]) {
        if (str[v] != nxtch) continue;
        if (color[v][nxtcol] == 2) continue;
        if (color[v][nxtcol] == 1) finish();
        color[v][nxtcol] = 1;
        dfs(v, nxtcol);
    }

    color[u][col] = 2;
}

signed main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m;
    cin >> str;
	gr.resize(n);
	for (int i = 0; i < m; ++i) {
        int u, v; cin >> u >> v; --u; --v;
        gr[u].push_back(v);
        gr[v].push_back(u);
	}

	color.assign(n, vector<int>(4, 0));

    for (int u = 0; u < n; ++u) {
        if (str[u] == 'A') {
            if (!color[u][0] && !color[u][1]) {
				color[u][0] = 1;
				dfs(u, 0);
            }
        } else {
            if (!color[u][2] && !color[u][3]) {
				color[u][2] = 1;
				dfs(u, 2);
            }
        }
    }

    cout << "No" << endl;
}


Compiler output:
a.cc:17:1: error: 'vector' does not name a type
   17 | vector< vector<int> > gr, color;
      | ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:24:18: error: 'gr' was not declared in this scope
   24 |     for (int v : gr[u]) {
      |                  ^~
a.cc:26:13: error: 'color' was not declared in this scope; did you mean 'col'?
   26 |         if (color[v][nxtcol] == 2) continue;
      |             ^~~~~
      |             col
a.cc:27:13: error: 'color' was not declared in this scope; did you mean 'col'?
   27 |         if (color[v][nxtcol] == 1) finish();
      |             ^~~~~
      |             col
a.cc:28:9: error: 'color' was not declared in this scope; did you mean 'col'?
   28 |         color[v][nxtcol] = 1;
      |         ^~~~~
      |         col
a.cc:32:5: error: 'color' was not declared in this scope; did you mean 'col'?
   32 |     color[u][col] = 2;
      |     ^~~~~
      |     col
a.cc: In function 'int main()':
a.cc:40:9: error: 'gr' was not declared in this scope
   40 |         gr.resize(n);
      |         ^~
a.cc:47:9: error: 'color' was not declared in this scope; did you mean 'tolower'?
   47 |         color.assign(n, vector<int>(4, 0));
      |         ^~~~~
      |         tolower
a.cc:47:25: error: 'vector' was not declared in this scope
   47 |         color.assign(n, vector<int>(4, 0));
      |                         ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include <cstring>
  +++ |+#include <vector>
    6 | 
a.cc:47:32: error: expected primary-expression before 'int'
   47 |         color.assign(n, vector<int>(4, 0));
      |                                ^~~
Language: C++

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

string S;
vector<vector<int>> v(200010);
int N,M,visited[400010] = {0};

bool dfs(int n){
	visited[n] = 1;
	for(int i=0;i<v[n].size();i++){
		if(visited[v[n][i]]==-1){
//			cout << "Yes" << endl;
//			exit(0);
			return true;
		}
		else if(visited[v[n][i]]==0) dfs(v[n][i]);
	}
	visited[n] = 1;
	return false;
}

int main(){
	cin  >> N >> M >> S;
	int a,b;
	for(int i=0;i<M;i++){
		cin >> a >> b;
		if(S[a]==S[b]){
			v[a].push_back(b+N);
			v[b].push_back(a+N);
		}else{
			v[b].push_back(a+N);
			v[a].push_back(b+N);
		}
	}
	for(int i=1;i<=N;i++){
		if(visited[i]==0 && dfs(i)){
			cout << "Yes" << endl;
			return 0;
	}
	cout << "No" << endl;
}

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

import java.io.*;
import java.util.*;
 
public class Main {
	static final StdIn in = new StdIn();
	
	public static void main(String[] args) {
		int n=in.nextInt(), m=in.nextInt();
		char[] s = in.next().toCharArray();
		for(int i=0; i<n; ++i)
			s[i]-='A';
		List<Integer>[] adj = new List[n];
		for(int i=0; i<n; ++i)
			adj[i]=new ArrayList<Integer>();
		int[][] d = new int[n][2];
		for(int i=0; i<m; ++i) {
			int u=in.nextInt()-1, v=in.nextInt()-1;
			adj[u].add(v);
			adj[v].add(u);
			++d[u][s[v]];
			++d[v][s[u]];
		}
		boolean[] g = new boolean[n];
		int[] qu = new int[n];
		int qt=0;
		for(int i=0; i<n; ++i) {
			if(d[i][0]<=0||d[i][1]<=0) {
				g[i]=true;
				qu[qt++]=i;
			}
		}
		for(int qh=0; qh<n; ++qh) {
			if(qh>=qt) {
				System.out.println("Yes");
				return;
			}
			int u=qu[qh];
			for(int v : adj[u]) {
				if(g[v])
					continue;
				--d[v][s[u]];
				if(d[v][s[u]]<=0) {
					g[v]=true;
					qu[qt++]=v;
				}
			}
		}
		System.out.println("No");
	}
	
	static class Reader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		String next() {
			while(st==null||!st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(Exception e) {}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
	static final StdIn in = new StdIn();
	             ^
  symbol:   class StdIn
  location: class Main
Main.java:5: error: cannot find symbol
	static final StdIn in = new StdIn();
	                            ^
  symbol:   class StdIn
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
Language: C++

// Michael Pfeifer
// Version 04, 2018/02/17

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

const ld  pi   = 4.0*atanl(1.0);
const int iinf = 1e9 + 10;
const ll  inf  = 1e18 + iinf + 10;
const int mod  = 1000000007;
const ld  prec = .000001;

#define enld endl
#define pb push_back
#define debug(x) cout<<#x<<" -> "<<x<<'\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define umap unordered_map
#define uset unordered_set

template<class TIn>
using indexed_set = tree<
        TIn, null_type, less<TIn>,
        rb_tree_tag, tree_order_statistics_node_update>;

void fast() {
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}

void file() {
    auto a = freopen("a.in",  "r", stdin);
    auto b = freopen("a.out", "w", stdout);
    if(!a || !b) cout << "uh oh" << endl;
}





string s;

vector<pair<int,int>> edges;
vector<bool> selfloop;
vector<vector<int>> adj;
vector<bool> valid;

bool both(int curr) {
    bool a = false;
    bool b = false;
    for(auto next : adj[curr]) {
        if(valid[next]) {
            if(s[next] == 'A') a = true;
            if(s[next] == 'B') b = true;
        }
    }

    return a && b;
}

int main() {
    //file();
    //fast();

    int n, m;
    cin >> n >> m;
    cin >> s;

    selfloop.resize(n, false);
    adj.resize(n);
    valid.resize(n, true);

    for(int i = 0; i < m; i++) {
        int n1, n2;
        cin >> n1 >> n2;
        n1--; n2--;

        edges.pb({n1,n2});
        if(n1 == n2) selfloop[n1] == true;

        adj[n1].pb(n2);
        adj[n2].pb(n1);
    }

    queue<int> removal;
    for(int i = 0; i < n; i++) {
        if(!both(i)) {
            removal.push(i);
        }
    }

    int removed = 0;
    while(!removal.empty()) {
	if(!valid[curr]) continue;
	valid[curr] = false;
        removed++;

        int curr = removal.front();
        removal.pop();

        for(auto next : adj[curr]) {
            if(!valid[next]) continue;

            if(!both(next)) {
                removal.push(next);
            }
        }
    }

    if(removed < n) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:106:19: error: 'curr' was not declared in this scope
  106 |         if(!valid[curr]) continue;
      |                   ^~~~
a.cc:107:15: error: 'curr' was not declared in this scope
  107 |         valid[curr] = false;
      |               ^~~~
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

vector<ll> G[214514];
vector<P> p;
ll vis[214514][3]; // 1-おとずれた 2-いまいってるとこ
ll n, m;
string s;

ll DFS(ll now, ll from) {
  if (vis[now][from] == 1) {
    return 1;
  }
  // cout << now << " " << from << endl;
  if (vis[now][2] == 2) {
    // cout << now << " " << from << endl;
    return 3;
  }
  vis[now][from] = 2;
  bool b = 0, c = 0;
  for (auto &a : G[now]) {
    if (from == 2) {
      int res = DFS(a, s[now] - 'A');
      if (res == 3) {
        if (s[a] == 'A')
          b = 1;
        else
          c = 1;
      }
    } else if (from == 0 && s[a] == 'B') {
      int res = DFS(a, s[now] - 'A');
      if (res == 3) {
        vis[now][from]=2;
        return 3;
      }
    } else if (from == 1 && s[a] == 'A') {
      int res = DFS(a, s[now] - 'A');
      if (res == 3) {
        vis[now][from]=2;
        return =3;
      }
    }
  }
  vis[now][from] = 1;

  if (from == 2 && b == 1 && c == 1) {
    return 3;
  }
  return 0;
}

int main() {

  cin >> n >> m >> s;

  REP(i, m) {
    ll a, b;
    cin >> a >> b;
    p.pb(P(a - 1, b - 1));
    G[a - 1].pb(b - 1);
    G[b - 1].pb(a - 1);
  }

  REP(i, n) {
    if (vis[i][2] == 0) {
      if (DFS(i, 2) == 3) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
}


Compiler output:
a.cc: In function 'll DFS(ll, ll)':
a.cc:50:16: error: expected primary-expression before '=' token
   50 |         return =3;
      |                ^
Language: C++

#include<cstdio>
inline void read(int&r)
{
	register char c;r=0;
	do c=getchar();while(c<'0'||c>'9');
	do r=r*10+c-'0',c=getchar();while(c>='0'&&c<='9');
}

int fs[200001],fd[200001];
struct edge{ int to,nx; }s[400001],d[400001];
inline void addedges(int u,int v)
{
	static int L=1;
	s[L].to=v,s[L].nx=fs[u],fs[u]=L++;
	s[L].to=u,s[L].nx=fs[v],fs[v]=L++;
}
inline void addedged(int u,int v)
{
	static int L=1;
	d[L].to=v,d[L].nx=fd[u],fd[u]=L++;
	d[L].to=u,d[L].nx=fd[v],fd[v]=L++;
}

char c[200002];

int a[200001];
bool dfs(int u,int v)
{
	int j,k;
	for(j=fs[u];j;j=s[j].nx)
		for(k=fd[s[j].to];k;k=d[k].nx)
			if(a[k]==v)
				return true;
	return false;
}
bool dfs(int u)
{
	int j;t=0;
	for(j=fs[u];j;j=s[j].nx)
		a[s[j].to]=u;
	for(j=fd[u];j;j=d[j].nx)
		if(dfs(d[j].to,u))
			return true;
}

int main()
{
	int n,m,u,v;
	scanf("%d%d%s",&n,&m,c+1);
	while(m--)
		read(u),read(v),
			c[u]==c[v]?addedges(u,v):addedged(u,v);
	for(u=1;u<=n;u++)
		if(dfs(u))
			return puts("Yes"),0;
	return puts("No"),0;
}


Compiler output:
a.cc: In function 'void read(int&)':
a.cc:4:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    4 |         register char c;r=0;
      |                       ^
a.cc: In function 'bool dfs(int)':
a.cc:38:15: error: 't' was not declared in this scope
   38 |         int j;t=0;
      |               ^
a.cc:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<vector<int> > edges;
vector<int> vis;
int found = 0;
void dfs(int v, int st){
    if(vis[v] == 2) found = 1;
    if(vis[v]) return;
    vis[v] = 2;
    for(int a : edges[v]){
        dfs(a, st);
    }
}
void dfs2(int v, int st){
    if(vis[v] == 2) return;
    vis[v] = 1;
    for(int a : edges[v]){
        dfs2(a, st);
    }
}
int check(int v){
    if(vis[v]) return 0;
    dfs(v, v);
    dfs2(v);
    if(found) return 1;
    return 0;
}
int main(){
    int n, m;
    string s;
    cin >> n >> m >> s;
    vis.resize(4*n, 0);
    edges.resize(4*n);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        for(int q = 0; q < 2; q++){
            int num = 0;
            if(s[a] == 'A' && s[b] == 'A') num = 0;
            if(s[a] == 'A' && s[b] == 'B') num = 1;
            if(s[a] == 'B' && s[b] == 'B') num = 2;
            if(s[a] == 'B' && s[b] == 'A') num = 3;
            edges[4*a + num].push_back(4*b + (num+1) % 4);
            swap(a, b);
        }
    }
    int ok = 0;
    for(int j = 0; j < 4*n; j++){
        if(check(j)){
            ok = 1;
        }
    }
    if(ok){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Compiler output:
a.cc: In function 'int check(int)':
a.cc:25:9: error: too few arguments to function 'void dfs2(int, int)'
   25 |     dfs2(v);
      |     ~~~~^~~
a.cc:15:6: note: declared here
   15 | void dfs2(int v, int st){
      |      ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define np(v) next_permutation(v.begin(), v.end())
#define pll pair < long long, long long>
#define all(a) a.begin(), a.end()
#define ull unsigned long long
#define vll vector <long long>
#define pii pair < int, int >
#define sz(a) (int)a.size()
#define sqr(x) ((x) * (x))
#define y1 stupid_cmath
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second

const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);

int n, m;
string s;
int used[200200];
bool ok[200200];
bool mark;
vector <int> g[200200];
set <int> st[200200];

void dfs(int v, int col, int lvl){
	if(used[v]){
		if((lvl - used[v]) % 4 == 0 && lvl - used >= 4) {
			cout << "Yes" << endl;			
			exit(0);
		}
		return;
	}
	used[v] = lvl;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(!col){
			if(s[to] != s[v]) dfs(to, col ^ 1, lvl + 1);		
		}else{
			if(s[to] == s[v]) dfs(to, col ^ 1, lvl + 1);
		}
	}
}

void dfs1(int v, int p){
	used[v] = 1;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(s[v] != s[to]){
			if(v != p && st[to].find(p) != st[to].end() && ok[to]){
				cout << "Yes" << endl;
				exit(0);	
			}
		}else{
			if(!used[to]){
				dfs1(to, v);
			}
		}
	}
}


int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	cin >> s;
	for(int i = 0, u, v; i < m; ++i){
		cin >> u >> v;
		u--, v--;
		if(u == v) {
			ok[u] = 1;
			continue;
		}
		st[u].insert(v);
		st[v].insert(u);
		g[u].pb(v);
		g[v].pb(u);
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < g[i].size(); ++j){
			int to = g[i][j];
			if(s[to] != s[i] && ok[i] && ok[to]) return cout << "Yes" << endl, 0;
		}
	}
	for(int i = 0; i < n; ++i){
		if(!used[i]){
			dfs(i, 0, 1);
		}
	}
	memset(used, 0, sizeof used);
	mark = 1;
	for(int i = 0; i < n; ++i){
		if(!used[i]){
			dfs1(i, i);
		}
	}
	cout << "No" << endl;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:37:52: error: invalid operands of types 'int' and 'int [200200]' to binary 'operator-'
   37 |                 if((lvl - used[v]) % 4 == 0 && lvl - used >= 4) {
      |                                                ~~~ ^ ~~~~
      |                                                |     |
      |                                                int   int [200200]
Language: C++

#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

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

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7


//変数
int N, M;
string s;
vector<vector<int>> edges;
vector<bool> looks;
bool finalResult = false;




//サブ関数
//入力
void input()
{
	cin >> N >> M >> s;
	edges.resize(N);
	looks.resize(N, false);
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
}


bool change = true;
void good_points(vector<bool>& goods) {
	change = false;
	REP(i, N) {
		bool A = false;
		bool B = false;
		for (auto to : edges[i]) {
			if (s[to] == 'A' && goods[to])A = true;
			if (s[to] == 'B' && goods[to])B = true;
		}
		if (goods[i] != (A&B))change = true;
		goods[i] = (A&B);
	}
	return goods;
}

//計算
void calc()
{
	vector<bool> goods(N, true);
	while (change) {
		good_points(goods);
	}
	for (auto f : goods)if (f)finalResult = true;
}


//出力
void output()
{
	cout << (finalResult ? "Yes" : "No") << endl;
}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Compiler output:
a.cc: In function 'void good_points(std::vector<bool>&)':
a.cc:77:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   77 |         return goods;
      |                ^~~~~
Language: C++

#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
#define x first
#define y second
#define mp make_pair
#define pb push_back 
int g,n,m,i,j,k,a,b,c,ans,cc[500000],bb[500000],aa,bbb;
char so[500000],q,w;
vector<int > e[500000];
int dfs(int x,int y,int zz){
	int z=0,ii;
	bb[x]=1;
	if (zz==1){
		for (int ii=0;ii<e[x].size();ii++){
			if (bb[e[x][ii]]==0 && so[e[x][ii]-1]!=so[x-1]) z=max(z,dfs(e[x][ii],y,2));
		}
	}else if (zz==2){
		for (int ii=0;ii<e[x].size();ii++){
			if (so[e[x][ii]-1]==so[x-1]) z=max(z,dfs(e[x][ii],y,3));
		}
	}else if (zz==3){
		for (int ii=0;ii<e[x].size();ii++){
			if (so[e[x][ii]-1]!=so[x-1]) z=max(z,dfs(e[x][ii],y,4));
		}
	}else if (zz==4){
		for (int ii=0;ii<e[x].size();ii++){
			if (e[x][ii]==y) z=1;
		}
	}
	return z;
}
int main(){
	scanf("%d %d",&n,&m);
	scanf("\n");
	gets(so);
	for (int i=1;i<=m;i++){
		scanf("%d %d",&a,&b);
		if (a==b) e[a].pb(b);
		else{
			e[a].pb(b);
			e[b].pb(a);
		}
	}
	q='A';
	w='B';
	for (int i=1;i<=n;i++){
		if (so[i-1]=='A') aa=max(aa,dfs(i,i,1));
		if (aa==1) break;
	}
	if (aa==1) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   39 |         gets(so);
      |         ^~~~
      |         getw
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REV(i,j,k) for(int i=j;i>=k;i--)
#define FORR(i,j,k,l) for(int i=j;i<=k;i+=l)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c)    scanf("%d %d %d", &a, &b, &c)
#define clean(mat,n)   FOR(i,0,n) mat[i].clear()
#define minn          (long long)-1000000000000000000
#define maxx          (long long) 1000000000000000000
#define mod          1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define LL           long long
#define NL '\n'
#define cnd tree[idx]
#define lnd (idx<<1)
#define rnd ((idx<<1)+1)
#define PB push_back
#define F first
#define S second
#define MAX 200010
#define MP make_pair
#define valid(nx,ny)  ((nx >= 0) && (nx < row) && (ny >= 0) && (ny < col))
typedef pair<int,int> PR;

int n, m;
vector<int> mat[MAX];
string str;
int col[MAX];

PR getVal(int u,int v)
{
    if(u > v) swap(u, v);
    return MP(u, v);
}

int rec(int p,int root,int ty)
{
    if(col[root] != 1) return 0;

    int temp = 0;

    if(ty == 0)
    {
        for(auto x : mat[p])
        if(col[x] == 1 && !temp) temp = max(temp, rec(x, root, 1));
    }
    else if(ty == 1)
    {
        for(auto x : mat[p])
            if(col[x] == 2 && !temp) temp = max(temp, rec(x, root, 2));
    }
    else if(ty == 2)
    {
        for(auto x : mat[p])
            if(col[x] == 2 && !temp) temp = max(temp, rec(x, root, 3));
    }
    else if(ty == 2)
    {
        for(auto x : mat[p])
            if(x == root) temp = 1;
    }

    return temp;
}

int main()
{
    ios::sync_with_stdio(false);
    inf;
    //outf;
    int a, b;

    cin >> n >> m;
    cin >> str;
    FOR(i,0,n-1)
    {
        int x = str[i] - 'A'; x++;
        col[i + 1] = x;
    }

    FOR(i,0,m-1)
    {
        cin >> a >> b;
        mopa[getVal(a, b)] = 1;
        mat[a].PB( b );
        mat[b].PB( a );
    }

    FOR(i,1,n)
    {
        if(rec(i, i, 0))
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:92:9: error: 'mopa' was not declared in this scope
   92 |         mopa[getVal(a, b)] = 1;
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 500;
ll a[N][N];
int di[4] = {-1, 1, 0, 0};
int dj[4] = {0, 0, 1, -1};
ll LCM(ll x, ll y){
    return x / __gcd(x, y) * y;
}
bool valid(int i, int j){
    return (i >= 0 && i < N && j >= 0 && j < N);
}
void gen(){
    set<int> used;
    ll cur = 2;
    for(int i = 0; i < N; i++){
        for(int j = i % 2; j < N; j += 2){
            a[i][j] = cur++;
            used.insert(a[i][j]);
        }
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(a[i][j] != 0) continue;
            ll val = 1;
            for(int d = 0; d < 4; d++){
                int ni = i + di[d], nj = j + dj[d];
                if(valid(ni, nj)){
                    val = LCM(val, a[ni][nj]);
                }
            }
            a[i][j] = val + 1;
            while(used.count(a[i][j])) a[i][j] += val;
            used.insert(a[i][j]):
        }
    }
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    gen();
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cout << a[i][j] << " ";
        }
        cout << '\n';
    }
}


Compiler output:
a.cc: In function 'void gen()':
a.cc:35:33: error: expected ';' before ':' token
   35 |             used.insert(a[i][j]):
      |                                 ^
      |                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
cin>>n;
for(int i = 0; i < n; i++) {
  	for(int j = 0; j < n; j++){
		cout<<10000000-i-j;
		cout<<(j==n-1 ? "\n": " " );
    }
}

Compiler output:
a.cc:4:1: error: 'cin' does not name a type
    4 | cin>>n;
      | ^~~
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for(int i = 0; i < n; i++) {
      | ^~~
a.cc:5:16: error: 'i' does not name a type
    5 | for(int i = 0; i < n; i++) {
      |                ^
a.cc:5:23: error: 'i' does not name a type
    5 | for(int i = 0; i < n; i++) {
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n ;cin>>n;
for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
	cout<<10000000-i-j;
  	cout<<(j==n-1 ? "\n": " " );}

Compiler output:
a.cc:3:8: error: 'cin' does not name a type
    3 | int n ;cin>>n;
      |        ^~~
a.cc:4:1: error: expected unqualified-id before 'for'
    4 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      | ^~~
a.cc:4:15: error: 'i' does not name a type
    4 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |               ^
a.cc:4:19: error: 'i' does not name a type
    4 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                   ^
a.cc:4:36: error: 'j' does not name a type
    4 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                                    ^
a.cc:4:40: error: 'j' does not name a type
    4 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                                        ^
Language: C++

#include <bits/stdc++.h>
int n ;cin>>n;
for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
	cout<<10000000-i-j;
  	cout<<(j==n-1 ? "\n": " " );}

Compiler output:
a.cc:2:8: error: 'cin' does not name a type
    2 | int n ;cin>>n;
      |        ^~~
a.cc:3:1: error: expected unqualified-id before 'for'
    3 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      | ^~~
a.cc:3:15: error: 'i' does not name a type
    3 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |               ^
a.cc:3:19: error: 'i' does not name a type
    3 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                   ^
a.cc:3:36: error: 'j' does not name a type
    3 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                                    ^
a.cc:3:40: error: 'j' does not name a type
    3 | for(int i = 0;i<n;i++) for(int j=0;j<n;j++){
      |                                        ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>
#include <functional>

using namespace std;


#define int long long 

const int LIM = 2e6 + 7;
const int N = 500;

int pr[LIM];
vector<int> primes;


void init() {
    fill(pr, pr + LIM, 1);
    for (int i = 2; i < LIM; i++) {
        if (pr[i]) {
            primes.push_back(i);
            for (int j = 2 * i; j < LIM; j += i) {
                pr[j] = 0;
            }
        }
    }
}

int ans[N][N];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    init();
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            ans[i][j] = 1;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) & 1) {
                ans[i][j] *= primes[i + j];
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i - j) % 2 != 0) {
                ans[i][j] *= primes[(i - j) + N];
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) % 2 == 0) {
                assert(ans[i][j] == 1);
                if (i > 0) {
                    ans[i][j] = __lcm(ans[i][j], ans[i - 1][j]);
                }
                if (j > 0) {
                    ans[i][j] = __lcm(ans[i][j], ans[i][j - 1]);
                }
                if (i + 1 < N) {
                    ans[i][j] = __lcm(ans[i][j], ans[i + 1][j]);
                }
                if (j + 1 < N) {
                    ans[i][j] = __lcm(ans[i][j], ans[i][j + 1]);
                }
                // cerr << ans[i][j] << '\n';
            }
        }
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << ans[i][j] << ' ';
        }
        cout << '\n';
    }
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:78:33: error: '__lcm' was not declared in this scope
   78 |                     ans[i][j] = __lcm(ans[i][j], ans[i - 1][j]);
      |                                 ^~~~~
a.cc:81:33: error: '__lcm' was not declared in this scope
   81 |                     ans[i][j] = __lcm(ans[i][j], ans[i][j - 1]);
      |                                 ^~~~~
a.cc:84:33: error: '__lcm' was not declared in this scope
   84 |                     ans[i][j] = __lcm(ans[i][j], ans[i + 1][j]);
      |                                 ^~~~~
a.cc:87:33: error: '__lcm' was not declared in this scope
   87 |                     ans[i][j] = __lcm(ans[i][j], ans[i][j + 1]);
      |                                 ^~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=400 +117;
const int MM=10000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
LL ans[NN][NN]={};
LL lcm(LL a,LL b){
	return a/__gcd(a,b)*b;
}
int pr[MM]={},psiz=0;
int np[MM]={};
void getprime(int n){
	np[1]=1;
	for(int i=2;i<=n;++i){
		if(!np[i]){
			pr[psiz++]=i;
		}
		for(int j=0;pr[j]*i<=n;++j){
			np[pr[j]*i]=1;
			if(!(i%pr[j]))break;
		}
	}
}
int main(){
	//open();
	n=read();
	if(n==2){
		printf("2 5\n");
		printf("7 36\n")
		return 0;
	}
	getprime(10000);
	int mn=(1-n)/2,mx=(n-1)/2;
	mx-=mn;
	for(int i=0;i<=n+1;++i){
		for(int j=0;j<=n+1;++j){
			ans[i][j]=1;
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			if((i+j)&1)continue;
			int c=(i-j)/2;
			int d=(i+j)/2;
			LL res=pr[c-mn]*pr[mx+d];
			ans[i][j]=res;
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			if((i+j)&1){
				LL now=1;
				now=lcm(now,ans[i][j-1]);
				now=lcm(now,ans[i][j+1]);
				now=lcm(now,ans[i-1][j]);
				now=lcm(now,ans[i+1][j]);
				ans[i][j]=now+1;
			}
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j){
			printf("%lld ",ans[i][j]);
		}
		putchar('\n');
	}
	close();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:33: error: expected ';' before 'return'
   56 |                 printf("7 36\n")
      |                                 ^
      |                                 ;
   57 |                 return 0;
      |                 ~~~~~~
Language: C++

/*
[agc027] D - Modulo Matrix
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 500;
const int MAX_PRIME = 10000;

ll gcd(ll a, ll b) {
    while (b > 0) {
        swap(a %= b, b);
    }
    return a;
}

ll lcm(ll a, ll b) {
    ll d = gcd(a, b);
    return (a / d) * (b / d) * d;
}

int N;
vector<int> primes;

void eratos() {
    vector<bool> is_prime(MAX_PRIME, true);
    for (int i = 2; i < MAX_PRIME; i++) {
        if (!is_prime[i]) {
            continue;
        }
        primes.push_back(i);
        for (int j = 2 * i; j < MAX_PRIME; j += i) {
            is_prime[j] = false;
        }
    }
}

void solve(vector<vector<ll>>& ans) {
    eratos();

    ans.resize(MAX_N);
    for (int i = 0; i < MAX_N; i++) {
        ans[i].resize(MAX_N);
    }

    for (int i = 0; i < MAX_N; i++) {
        for (int j = (i % 2); j < MAX_N; j += 2) {
            int p = (i + j) / 2;
            int q = (i - j + MAX_N) / 2;
            ans[i][j] =
                primes[(p % 2 == 0) ? (p / 2) : (MAX_N - 1 - p / 2)] *
                primes[(q % 2 == 0) ? (q / 2) : (MAX_N - 1 - q / 2) + MAX_N];
        }
    }

    int di[4] = {0, 1, 0, -1};
    int dj[4] = {-1, 0, 1, 0};
    for (int i = 0; i < MAX_N; i++) {
        for (int j = 1 - (i % 2); j < MAX_N; j += 2) {
            ans[i][j] = 1;
            for (int k = 0; k < 4; k++) {
                if (0 <= i + di[k] && i + di[k] < MAX_N && 0 <= j + dj[k] &&
                    j + dj[k] < MAX_N) {
                    ans[i][j] = lcm(ans[i][j], ans[i + di[k]][j + dj[k]]);
                }
            }
            ans[i][j]++;
            assert(ans[i][j] << 1e15);
        }
    }
}

int main() {
    cin >> N;

    vector<vector<ll>> ans;
    solve(ans);

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

    return 0;
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from a.cc:6:
a.cc: In function 'void solve(std::vector<std::vector<long long int> >&)':
a.cc:85:30: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and 'double' to binary 'operator<<'
   85 |             assert(ans[i][j] << 1e15);