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

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;

int mid(int a, int b, int c)
{
    if (a <= b && b <= c) {
        return b;
    } else if (b <= a && a <= c) {
        return a;
    } else {
        return c;
    }
}

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> a(N);
    REP (i, N) {
        scanf("%d", &a[i]);
    }
    if (N == 2) {
        printf("2\n");
    } else {
        int left = mid(a[N - 2], a[N - 1], a[N]);
        int mid = mid(a[N], a[N - 1], a[N + 1]);
        int right = mid(a[N], a[N + 1], a[N + 2]);
        if (left == mid) {
            printf("%d\n", mid);
        } else if (mid == right) {
            printf("%d\n", mid);
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:22: error: 'mid' cannot be used as a function
   30 |         int mid = mid(a[N], a[N - 1], a[N + 1]);
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:24: error: 'mid' cannot be used as a function
   31 |         int right = mid(a[N], a[N + 1], a[N + 2]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int Median(int a,int b, int c){
	if(a>b && b>c){
		return b;
	}else if(c>b && b>a){
		return b;
	}

	if(b>a && a>c){
		return a;
	}else if(c>a &&a>b){
		return a;
	}
	if(b>c && c>a){
		return c;
	}else if( a>c && c>b){
		return c;
	}
}

int main(){
	int N;
	cin>>N;
	vector<int> a(2*N-1);
	for(int i=0;i<2*N-1;i++){
		cin>>a[i];
	}
	vector<int> before(2*N-1);
	int ret=0;
	for(int i=N;i>1;i--){
		vector<int> next(2*i-1);
		for(int j=1;j<2*i-2;j++){
			//cout<<i<<" "<<j<<endl;
			if(i==N){
				//next[j]=min(max(a[j-1],a[j]),max(a[j],a[j+1]));
				next[j]=Median(a[j-1],a[j],a[j+1]);
			}else{
				//next[j]=min(max(before[j-1],before[j]),max(before[j],before[j+1]));
				next[j]=Median(next[j-1],next[j],next[j+1]);
			}
		}
		if(i<=2){
			ret=Median(next[1],next[2],next[3]));
		}

		//cout<<endl;
	}
	if(N<3){
		cout<<Median(a[0],a[1],a[2])<<endl;
	}else{
		cout<<ret<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:60: error: expected ';' before ')' token
   58 |                         ret=Median(next[1],next[2],next[3]));
      |                                                            ^
      |                                                            ;
a.cc: In function 'int Median(int, int, int)':
a.cc:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
Language: C++

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

#define ll long long
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x << endl
#define N 200005

#define newLine	printf("\n");

#define sll(X) scanf("%lld", &X);
#define pll(X) printf("%lld", X);
#define printAll(X, n)	for(int i=0;i<n;i++)	printf("%lld ", X[i]); newLine;
#define scanAll(X, n)	for(int i=0;i<n;i++)	scanf("%lld", &X[i]);

int getMedian(int a, int b, int c)
{
	std::vector<int> v;
	v.clear();
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);
	sort(v.begin(), v.end());
	return v[1];
}

ll n, arr[200005];
std::vector<int> x, eles[2];
set<int> st;

int main() {
	
	sll(n);
	scanAll(arr, 2*n - 1);

	int ind = n - 1;

	for(int i = 0; i < 2*n - 3; i++)
	{
		x.push_back(getMedian(arr[i], arr[i + 1], arr[i + 2]));
		// cout << i << " " << ind << "\n";
		if(i >= ind - 1 && i <= ind + 1)
		{
			// cout << arr[i] << " " ;
			eles[0].push_back(arr[i]);
		}
	}

	// for(int i = 0; i < x.size(); i++)
	// 	cout << x[i] << " ";
	// cout << "\n";

	ind--;

	for(int i = ind - 1; i <= ind + 1; i++)
	{
		// cout << x[i] << " " ;
		for(int j = 0; j < 3; j++)
		{
			if(eles[0][j] == x[i])
			{
				st.insert(x[i]);
			}
		}
	}

	if(st.size() == 1)
	{
		printf("%d\n",*st.begin() );
		return 0;
	}
	return 1;
	else if(st.size() >= 2)
	{
		printf("%d\n", getMedian(x[ind - 1], x[ind], x[ind + 1]));
		return 0;
	}
	
	return 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:9: error: 'else' without a previous 'if'
   73 |         else if(st.size() >= 2)
      |         ^~~~
Language: Java


#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <queue>

using namespace std;

#define ll long long
#define MOD 1000000007LL


class Main {
public:
	int topNum(vector<int>& as) {

		vector<int> oldVec = as;
		vector<int> newVec;
		for (int i = (as.size() + 1) / 2;i >= 2;i--) {
			newVec.clear();
			for (int j = 1;j <= oldVec.size() - 2;j++) {
				newVec.push_back(median3(oldVec[j - 1], oldVec[j], oldVec[j + 1]));
			}
			oldVec = newVec;
		}

		return newVec[0];
	}

	int median3(int x, int y, int z)
	{
		if (x < y) {
			if (y < z) {
				return y;
			}
			else if (z < x) {
				return x;
			}
			return z;
		}
		else {
			if (z < y) {
				return y;
			}
			else if (x < z) {
				return x;
			}
			return z;
		}
	}
};


int main()
{
	Main m;
	int n;
	vector<int> as;

	cin >> n;
	for (int i = 0;i < 2 * n - 1;i++) {
		int inp;
		cin >> inp;
		as.push_back(inp);
	}

	cout << m.topNum(as) << endl;

    return 0;
}



Compiler output:
Main.java:2: error: illegal character: '#'
#include <string>
^
Main.java:3: error: illegal character: '#'
#include <sstream>
^
Main.java:4: error: illegal character: '#'
#include <iostream>
^
Main.java:5: error: illegal character: '#'
#include <vector>
^
Main.java:6: error: illegal character: '#'
#include <math.h>
^
Main.java:7: error: illegal character: '#'
#include <algorithm>
^
Main.java:8: error: illegal character: '#'
#include <functional>
^
Main.java:9: error: illegal character: '#'
#include <map>
^
Main.java:10: error: illegal character: '#'
#include <climits>
^
Main.java:11: error: illegal character: '#'
#include <queue>
^
Main.java:15: error: illegal character: '#'
#define ll long long
^
Main.java:15: error: class, interface, enum, or record expected
#define ll long long
        ^
Main.java:16: error: illegal character: '#'
#define MOD 1000000007LL
^
Main.java:20: error: illegal start of type
public:
      ^
Main.java:21: error: <identifier> expected
	int topNum(vector<int>& as) {
	                      ^
Main.java:66: error: not a statement
	cin >> n;
	    ^
Main.java:69: error: not a statement
		cin >> inp;
		    ^
Main.java:73: error: not a statement
	cout << m.topNum(as) << endl;
	                     ^
Main.java:60: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
  (use --enable-preview to enable unnamed classes)
19 errors
Language: C++

#include<bits/stdc++.h>
#define re register
using namespace std;
const int MAXN=1e5+5;
int N,swtch[2],matrix[5][MAXN],temp[MAXN];
int main(){
    cin>>N;
    for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
    for(re int i=1;i<=N;i++){
        temp[i]=matrix[2][i]/3+1;
        if(!((matrix[1][i]-matrix[2][i]==-1 && matrix[2][i]-matrix[3][i]==-1 
		&& matrix[1][i]%3==1) || (matrix[1][i]-matrix[2][i]==1 
		&& matrix[2][i]-matrix[3][i]==1 
		&& !(matrix[1][i]%3))) || (abs(i-temp[i])&1)){cout<<"No"<<endl; return 0;}
        swtch[i&1]^=(matrix[1][i]>matrix[2][i]);
    }
    for(re int i=1;i<=N;i++){while(temp[i]!=i){swtch[i&1^1]^=1; swap(temp[i],temp[temp[i]]);}}
   	cout<<swtch[0]||swtch[1] ? "No" : "Yes"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |     for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
      |                ^
a.cc:8:41: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    8 |     for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
      |                                         ^
a.cc:9:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |     for(re int i=1;i<=N;i++){
      |                ^
a.cc:17:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |     for(re int i=1;i<=N;i++){while(temp[i]!=i){swtch[i&1^1]^=1; swap(temp[i],temp[temp[i]]);}}
      |                ^
a.cc:18:48: error: invalid operands of types 'const char [4]' and '<unresolved overloaded function type>' to binary 'operator<<'
   18 |         cout<<swtch[0]||swtch[1] ? "No" : "Yes"<<endl;
      |                                           ~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> stat(n);
    vector<int> perm(n);
    vector<bool> check(n,0);
    for(int i = 0;i<n;i++)
    {
        int cin__;
        cin >> cin__;
        stat[i] = cin__%3;
        perm[i] = cin__/3;
        if(check[perm[i]]==1)
        {
            cout << "No";
            return 0;
        }
        check[perm[i]]++;
    }
    for(int i = 0;i<n;i++)
    {
        int cin__;
        cin >> cin__;
        if(cin__%3!=2)
        {
            cout << "No";
            return 0;
        }
        if(cin__/3!=perm[i])
        {
            cout << "No";
            return 0;
        }
    }
    for(int i = 0;i<n;i++)
    {
        int cin__;
        cin >> cin__;
        if(cin__%3!=(1-stat[i]))
        {
            cout << "No";
            return 0;
        }
        if(cin__/3!=perm[i])
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   23 |         check[perm[i]]++;
      |         ~~~~~~~~~~~~~~^~
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int n,t[2],a[5][100010],to[100010];
char buffer[10000010],*hed;
inline char Getchar(){
    return *hed++;
}
inline int rd(){
    register int x=0;
    char c;
    do c=Getchar();
    while(!isdigit(c));
    do{
        x=(x<<1)+(x<<3)+(c^48);
        c=Getchar();
    }while(isdigit(c));
    return x;
}
inline int abs(int x){
    return x>=0?x:-x;
}
int main(){
    int len=fread(buffer,1,10000000,stdin);
    hed=buffer;
    n=rd();
    for(int i=1;i<=3;i++)
        for(int j=1;j<=n;j++)
            a[i][j]=rd();
    for(register int i=1;i<=n;i++){
        to[i]=a[2][i]/3+1;
        if(!((a[1][i]-a[2][i]==-1&&a[2][i]-a[3][i]==-1&&a[1][i]%3==1)||(a[1][i]-a[2][i]==1&&a[2][i]-a[3][i]==1&&!(a[1][i]%3)))||(abs(i-to[i])&1)){
            puts("No");
            return 0;
        }
        t[i&1]^=(a[1][i]>a[2][i]);
    }
    for(register int i=1;i<=n;i++){
        while(to[i]!=i){
            t[i&1^1]^=1;
            swap(to[i],to[to[i]]);
        }
    }
    puts(t[0]||t[1]?"No":"Yes");
    return 0;
}

Compiler output:
a.cc: In function 'int rd()':
a.cc:10:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |     register int x=0;
      |                  ^
a.cc:13:12: error: 'isdigit' was not declared in this scope
   13 |     while(!isdigit(c));
      |            ^~~~~~~
a.cc: In function 'int main()':
a.cc:30:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |     for(register int i=1;i<=n;i++){
      |                      ^
a.cc:38:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |     for(register int i=1;i<=n;i++){
      |                      ^
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
int n,t[2],a[5][100010],to[100010];
char buffer[10000010],*hed,*tal;
inline char Getchar(){
	return *hed++;
}
inline int rd(){
	register int x=0;
	char c;
	do c=Getchar();
	while(!isdigit(c));
	do{
		x=(x<<1)+(x<<3)+(c^48);
		c=Getchar();
	}while(isdigit(c));
	return x;
}
inline int abs(int x){
	return x>=0?x:-x;
}
int main(){
	int len=fread(buffer,1,10000000,stdin);
	hed=buffer,tal=buffer+len;
	n=rd();
	for(int i=1;i<=3;i++)
		for(int j=1;j<=n;j++)
			a[i][j]=rd();
	for(register int i=1;i<=n;i++){
		to[i]=a[2][i]/3+1;
		if(!((a[1][i]-a[2][i]==-1&&a[2][i]-a[3][i]==-1&&a[1][i]%3==1)||(a[1][i]-a[2][i]==1&&a[2][i]-a[3][i]==1&&!(a[1][i]%3)))||(abs(i-to[i])&1)){
			puts("No");
			return 0;
		}
		t[i&1]^=(a[1][i]>a[2][i]);
	}
	for(register int i=1;i<=n;i++){
		while(to[i]!=i){
			t[i&1^1]^=1;
			swap(to[i],to[to[i]]);
		}
	}
	puts(t[0]||t[1]?"No":"Yes");
	return 0;
}

Compiler output:
a.cc: In function 'int rd()':
a.cc:10:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 |         register int x=0;
      |                      ^
a.cc:13:16: error: 'isdigit' was not declared in this scope
   13 |         while(!isdigit(c));
      |                ^~~~~~~
a.cc: In function 'int main()':
a.cc:30:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         for(register int i=1;i<=n;i++){
      |                          ^
a.cc:38:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |         for(register int i=1;i<=n;i++){
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int a[3][MAXN];
int f[2][MAXN];
void add(int p, int index) {
    for (;p < MAXN; p += p&-p)
        ++f[index][p];
}
int find(int p, int index) {
    int res = 0;
    for (;p; p -= p&-p)
        res += f[index][p];
    return res;
}z
int32_t main () {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < 3; ++i)
        for (int j = 0; j < n; ++j)
            cin >> a[i][j];
    vector <int> vctr;
    bool b[2] = {0, 0};
    for (int i = 0; i < n; ++i) {
        int mx = max(a[0][i], max(a[1][i], a[2][i]));
        int mn = min(a[0][i], min(a[1][i], a[2][i]));
        if (mx - mn > 2)
            return cout << "No", 0;
        if (mx % 3)
            return cout << "No", 0;
        if (2 * a[1][i] != a[0][i] + a[2][i])
            return cout << "No", 0;
        if ((mx - i) % 2 == 0)
            return cout << "No", 0;
        vctr.push_back(mx / 3);
        if (a[0][i] == mx)
            b[i & 1] = 1 - b[i & 1];
        // cout << (a[0][i] == mx) << ' ';
    }
    // cout << b[0] << ' ' << b[1];
    for (int i = n - 1; i >= 0; --i) {
        if (find(vctr[i], i & 1) & 1)
            b[(i + 1) & 1] = 1 - b[(i + 1) & 1];
        add(vctr[i], i & 1);
        // cout << vctr[i] << ' ';
    }
    if (b[0] || b[1])
        return cout << "No", 0;
    cout << "Yes";
    return 0;
}

Compiler output:
a.cc:15:2: error: 'z' does not name a type
   15 | }z
      |  ^
Language: C++

#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

class Segment_Tree{
	private:
	int n;
	vi date;
	int Rec(int a,int b,int k,int l,int r){
		if(r<=a||b<=l) return 0;
		if(a<=l&&r<=b) return date[k];
		int m=(l+r)/2;
		return Rec(a,b,k*2+1,l,m)+Rec(a,b,k*2+2,m,r);
	}
	public:
	Segment_Tree(int n_){
		n=1;
		while(n<n_) n*=2;
		date=vi(2*n-1);
	}
	void Update(int k,int x){
		k+=n-1;
		date[k]+=x;
		while(k>0){
			k=(k-1)/2;
			date[k]=date[k*2+1]+date[k*2+2];
		}
	}
	int Query(int a,int b){
		return Rec(a,b,0,0,n);
	}
	int Open(int k){
		return date[k+n-1];
	}
};

int n;
vi a[3],b[2];

bool f(vi c,int t){
	Segment_Tree st(n);
	for(auto i:c){
		(t+=st.Query(i,n))%=2;
		st.Update(i,1);
	}
	return t==0;
}

int main(){
	cin>>n;
	a[0]=a[1]=a[2]=vi(n);
	for(int i=0;i<3;i++) for(int j=0;j<n;j++) cin>>a[i][j];
	bool B=1;
	for(int i=0;i<n;i++) if(abs(a[0][i]-a[1][i])>1||abs(a[1][i]-a[2][i])>1||a[1][j]%3!=2) B=0;
	if(!B){
		cout<<"No"<<endl;
		return 0;
	}
	int t[2]={0,0};
	for(int i=0;i<n;i++){
		int A=a[0][i]-1;
		if(A%3==2) t[i%2]++;
		b[i%2].push_back(A/3);
	}
	if(f(b[0],t[1])&&f(b[1],t[0])) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:86: error: 'j' was not declared in this scope
   77 |         for(int i=0;i<n;i++) if(abs(a[0][i]-a[1][i])>1||abs(a[1][i]-a[2][i])>1||a[1][j]%3!=2) B=0;
      |                                                                                      ^
Language: C++


#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 100001;

void bad()
{
	cout << "No";
	exit(0);
}

int n;
VVI a;
VPII pos;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);

	cin >> n;
	a.assign(3, VI(n));
	FOR(i, 0, 3)
		FOR(j, 0, n)
		cin >> a[i][j];

	pos.assign(3 * n + 1, MP(0, 0));
	FOR(i, 0, 3)
		FOR(j, 0, n)
		pos[a[i][j]] = MP(i, j);

	int ser1 = 0, ser2 = 0, bik1 = 0, bik2 = 0;
	FOR(i, 0, n)
	{
		PII one = pos[3 * i + 1];
		PII two = pos[3 * i + 2];
		PII three = pos[3 * i + 3];
		if (one.Y != two.Y || one.Y != three.Y)
			bad();
		if (two.X != 1)
			bad();

		int bulo = i, stalo = one.Y;
		if (abs(stalo - bulo) & 1)
			bad();

		if (i & 1)
		{
		
			if (abs(bulo - stalo) % 4 == 0){
				if(one.X != 0)
++ser1;
		}
else{
++bik1;
if(one.X ==0)
++ser1;
}
}
		else
		{
			if(abs(bulo - stalo)%4==0){
if(one.X)
++ser2;
}
else
{
++bik2;
if(!one.X)
++ser2;
}
	}	

	if (abs(ser1 - bik2) & 1)
		bad();

	if (abs(ser2 - bik1) & 1)
		bad();

	cout << "Yes";
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define int long long
struct node{
	int k, p, sz;
	node * l;
	node * r;
	node(int k): k(k), p(rand()), l(NULL), r(NULL), sz(0){}
};
int sz(node *t){
	if(t == NULL) return 0;
	return t->sz;
}
void updsz(node *t){
	if(t == NULL) return;
	t->sz = sz(t->l)+sz(t->r)+1;
}
void split(node *t, node*& l, node*& r, int k){
	if(t == NULL){
		l = r = NULL;
	} else if(k <= t->k){
		split(t->l,l,t->l,k);
		r = t;
	} else {
		split(t->r,t->r,r,k);
		l = t;
	}
	updsz(t);
}
void merge(node *&t, node *l, node *r){
	if(l == NULL){
		t = r;
	} else if(r == NULL){
		t = l;
	} else if(l->p <= r->p){
		merge(l->r,l->r,r);
		t = l;
	} else {
		merge(r->l,l,r->l);
		t = r;
	}
	updsz(t);
}
void ins(node *&t, node *c){
	if(t == NULL){
		t = c;
	} else if(c->p >= t->p){
		split(t,c->l,c->r,c->k);
		t = c;
	} else if(c->k <= t->k){
		ins(t->l,c);
	} else {
		ins(t->r,c);
	}
	updsz(t);
}
void del(int k, node *&t){
	if(t->k == k){
		merge(t,t->l,t->r);
	} else if(t->k > k){
		del(k,t->l);
	} else {
		del(k,t->r);
	}
	updsz(t);
}
node* find(node *t, int k){
	if(t == NULL) return t;
	if(t->k == k) return t;
	if(t-> k < k){
		return find(t->r,k);
	} else {
		return find(t->l,k);
	}
}
int cnt(node *t, int k){ // <= k
	if(t == NULL) return 0;
	if(t->k <= k){
		return 1 + sz(t->l) + cnt(t->r,k);
	} else {
		return cnt(t->l,k);
	}
}
void pt(node *r){
	if(r == NULL) return;
	cout << r->k << " " << r->p << " " << r->sz << endl;
	pt(r->l);
	pt(r->r);
}

node* kth(node *t, int k){ // 0-based indexing
	if(k == sz(t->l)){
		return t;
	} else if(k < sz(t->l)){
		return kth(t->l,k);
	} else {
		return kth(t->r, k-1-sz(t->l));
	}
}



LL inv(vector<int> a){
	node * treap = NULL;
	node * t1, * t2;
	LL ans = 0;
	for(int i = 0; i < a.size(); i++){
		split(treap, t1, t2, a[i]);
		ans += sz(t2);
		node * cur = new node(a[i]);
		merge(t1, t1, cur);
		merge(treap, t1, t2);
	}
	return ans % 2;
}
int main(){
	int n;
	cin >> n;
	int a[3][n];
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < n; j++){
			cin >> a[i][j];
		}
	}
	int ok = 1;
	vector<int> b;
	int neg[2];
	neg[0] = neg[1] = 0;
	for(int j = 0; j < n; j++){
		if(abs(a[0][j] - a[1][j]) > 1) ok = 0;
		if(abs(a[2][j] - a[1][j]) < 1) ok = 0;
		int t = a[0][j] < a[1][j];
		b.push_back((a[1][j] + 1)/3);
		if(!t) neg[j%2]++;
	}
	for(int j = 0; j < n; j++){
		if(b[j] % 2 == j%2) ok = 0;
	}
	if(!ok){
		cout << "No" << endl;
		return 0;
	}
	vector<int> e[2];
	for(int i = 0; i < n; i++){
		e[i%2].push_back(b[i]);
	}
	if(inv(e[0]) % 2 != neg[1] % 2) ok = 0;
	if(inv(e[1]) % 2 != neg[0] % 2) ok = 0;
	if(!ok){
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return 0;
}


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

#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int map[3][100000];
bool flag[100000];
int get(vector<int>v)
{
	int r = 0;
	for (int i = 0; i < v.size(); i++)if (v[i] < 0)r ^= 1, v[i] = -v[i];
	for (int i = 0; i < v.size(); i++)v[i] = (v[i] - 1) / 2;
	fill(flag, flag + 100000, false);
	for (int i = 0; i < v.size(); i++)
	{
		if (!flag[i])
		{
			int now = i;
			int c = 0;
			for (;;)
			{
				if (flag[now])break;
				flag[now] = true;
				c++;
				now = v[now];
			}
			if (c % 2 == 0)r ^= 2;
		}
	}
	return r;
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < 3; i++)for (int j = 0; j < num; j++)scanf("%d", &map[i][j]);
	vector<int>vec;
	vector<int>v1, v2;
	for (int i = 0; i < num; i++)
	{
		if (map[0][i] + 1 == map[1][i] && map[1][i] + 1 == map[2][i] && map[2][i] % 3 == 0)vec.push_back(map[2][i] / 3);
		else if (map[2][i] + 1 == map[1][i] && map[1][i] + 1 == map[0][i] && map[0][i] % 3 == 0)vec.push_back(-map[0][i] / 3);
		else goto l01;
	}
	for (int i = 0; i < num; i++)
	{
		if (i % 2 == 0)
		{
			if (vec[i] % 2 == 0)goto l01;
			else v1.push_back(vec[i]);
		}
		else
		{
			if (vec[i] % 2 == 0)v2.push_back(vec[i]);
			else goto l01;
		}
	}
	int s = get(v1), t = get(v2);
	if (((s & 1) == 0) == ((t & 2) == 0) && ((s & 2) == 0) == ((t & 1) == 0))printf("Yes\n");
	else
	{
	l01:;
		printf("No\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:9: error: jump to label 'l01'
   62 |         l01:;
      |         ^~~
a.cc:49:50: note:   from here
   49 |                         if (vec[i] % 2 == 0)goto l01;
      |                                                  ^~~
a.cc:58:26: note:   crosses initialization of 'int t'
   58 |         int s = get(v1), t = get(v2);
      |                          ^
a.cc:58:13: note:   crosses initialization of 'int s'
   58 |         int s = get(v1), t = get(v2);
      |             ^
a.cc:62:9: error: jump to label 'l01'
   62 |         l01:;
      |         ^~~
a.cc:43:27: note:   from here
   43 |                 else goto l01;
      |                           ^~~
a.cc:58:26: note:   crosses initialization of 'int t'
   58 |         int s = get(v1), t = get(v2);
      |                          ^
a.cc:58:13: note:   crosses initialization of 'int s'
   58 |         int s = get(v1), t = get(v2);
      |             ^
Language: C++

  #include <stdio.h>
   int main()
   {
      char name[21];
		
      printf("お名前を入力して下さい\t");
      gets(name);
      printf("\nあなたのお名前は %s です。\n", name);
      return 0;
   }

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

#include<stdio.h>
#include <stdlib.h>
int main()
{
      char str[100];
     char *p = gets(str);
     printf("%s\n",str);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |      char *p = gets(str);
      |                ^~~~
      |                getw
Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define dfor(i,a,b) for(int i=(a);i<(b);++i)
#define drfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define drep(i,n) dfor(i,0,n)
#define drrep(i,n) drfor (i,n,0)
#define dump(x)  cout << #x << " = " << (x) << endl;

const double EPS = 1e-10;
const double PI = acos(-1.0);

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector< pair<int, bool> > v1, v2;
	int i,j,cnt=0;

	cin >> i;
	while (true) {
		cin >> j;
		v1.push_back(make_pair(j / 6 + 1, (j % 3) == 1));
		i--;
		if (i == 0) break;
		cin >> j;
		v2.push_back(make_pair(j / 6 , (j % 3) == 1));
		i--;
		if (i == 0) break;
	}
	drep(i, v1.size()) {
		if ((((i+1) % 2) == (v1[i].first) % 2)!=v1[i].second) {
			cnt++;
		}
	}
	drep(i, v2.size()) {
		if ((((i+1) % 2) == (v2[i].first) % 2)!=v2[i].second) {
			cnt++;
		}
	}
	if ((cnt%2)==0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}


Compiler output:
a.cc:20:19: error: 'acos' was not declared in this scope
   20 | const double PI = acos(-1.0);
      |                   ^~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
int n,m,head[100100],cnt,col[100100],tot[3],TE;
typedef long long ll;
ll res;
struct node{
	int to,next,val;
}edge[200100];
void ae(int u,int v){
	edge[cnt].next=head[u],edge[cnt].to=v,edge[cnt].val=1,head[u]=cnt++;
	edge[cnt].next=head[v],edge[cnt].to=u,edge[cnt].val=-1,head[v]=cnt++;
}
bool Dye(int x){
	tot[col[x]]++;
	bool ret=true;
	for(int i=head[x];i!=-1;i=edge[i].next){
		TE+=(edge[i].val==1);
		if(col[edge[i].to]==-1){
			col[edge[i].to]=(col[x]+edge[i].val+3)%3;
			ret&=Dye(edge[i].to);
		}
		else ret&=(col[edge[i].to]==(col[x]+edge[i].val+3)%3);
	}
	return ret;
}
int main(){
	scanf("%d%d",&n,&m),memset(head,-1,sizeof(head)),memset(col,-1,sizeof(col));
	for(int i=1,x,y;i<=m;i++)scanf("%d%d",&x,&y),ae(x,y);
	for(int i=1;i<=n;i++){
		if(col[i]!=-1)continue;
		memset(tot,0,sizeof(tot)),TE=0;
		col[i]=0;
		if(!Dye(i)){res+=1ll*(tot[0]+tot[1]+tot[2])*(tot[0]+tot[1]+tot[2]);continue;}
		if(!tot[0]||!tot[1]||!tot[2]){res+=TE;continue;}
		res+=1ll*tot[0]*tot[1]+1ll*tot[1]*tot[2]+1ll*tot[2]*tot[0];
	}

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

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) { pa[x] = y; }
}


#define T vel
T mul(T & a, T & b) {//calcureate a(b(x))
	int sz = a.size();
	vel c(sz);
	rep(i, sz) { c[i] = a[b[i]]; }
	return c;
}
T rui1(T & a, int n) {
	if (n == 1) { return a; }
	T x = rui1(a, n / 2);
	x = mul(x, x);
	if (n % 2 == 1) { x = mul(x, a); }
	return x;
}
void solve(V<V<pin>>& way, vel& con,vel &dist,int now_pot,veb &seen,bool& fl) {
	if (!seen[now_pot]) {
		seen[now_pot]=true;
		con.push_back(now_pot);
		for (auto next : way[now_pot]) {
			int ne_dist = dist[now_pot] + next.second;
			ne_dist %= 3;
			int ne_pot = next.first;
			if (dist[ne_pot] == -1) {
				dist[ne_pot] = ne_dist;
				solve(way, con, dist, ne_pot, seen, fl);
			}
			else {
				if (dist[ne_pot] != ne_dist) {
					fl = true;
				}
			}
		}
	}
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
constexpr int max_n = 1e5 + 5;
 
vector<pair<int, int> > graf[max_n];
long long wynik, zliczanie[5];
int odwiedzony[max_n];
 
void bfs(int x){
    bool crush = false,  = false;
    zliczanie[1] = 1;
    zliczanie[2] = 0;
    zliczanie[0] = 0;
    odwiedzony[x] = 1;
    vector<int> kolejka;
    kolejka.push_back(x);
    for (unsigned int i = 0; i < kolejka.size(); i++){
        if (i > 0 && kolejka[i - 1] == kolejka[i])
            cykl = true;
        for (pair<int, int> j : graf[kolejka[i]]){
            int pom = odwiedzony[kolejka[i]] + j.second;
            if (pom <= 0)
                pom += 3;
            if (!odwiedzony[j.first]){
                odwiedzony[j.first] = pom;
                zliczanie[pom % 3]++;
                kolejka.push_back(j.first);
            }
            else if (odwiedzony[j.first] % 3 !=  pom %  3){
                crush = true;
            }
        }
    }
    if (crush){
        wynik += (zliczanie[0] + zliczanie[1] + zliczanie[2]) * (zliczanie[0] + zliczanie[1] + zliczanie[2]);
    }
    else{
        if (!zliczanie[0] || !zliczanie[1] || !zliczanie[2]){
            wynik += zliczanie[0] + zliczanie[1] + zliczanie[2] - 1;
            if (cykl)
                wynik++;
        }
        else
            wynik += zliczanie[0] * zliczanie[1] + zliczanie[1] * zliczanie[2] + zliczanie[2] * zliczanie[0];
        cout << zliczanie[0] << " " << zliczanie[1] << " " << zliczanie[2] << "\n";
    }
}
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, a, b;
    cin >> n >> m;
    for (int i = 0; i < m; i++){
        cin >> a >> b;
        graf[a].emplace_back(b, 1);
        graf[b].emplace_back(a, -1);
    }
    for (int i = 1; i <= n; i++){
        if (!odwiedzony[i])
            bfs(i);
    }
    cout << wynik << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'void bfs(int)':
a.cc:12:26: error: expected unqualified-id before '=' token
   12 |     bool crush = false,  = false;
      |                          ^
a.cc:21:13: error: 'cykl' was not declared in this scope
   21 |             cykl = true;
      |             ^~~~
a.cc:42:17: error: 'cykl' was not declared in this scope
   42 |             if (cykl)
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define MXN 200005
vector<int> v[100005],rv[100005];
int vis[100005];
LL cnt=0;
vector<int> stk;
void dfs(int x){
    if(vis[x])return;
    vis[x]=1;
    cnt++;
    stk.pb(x);
    for(auto it:v[x]){
        dfs(it);
    }
    for(auto it:rv[x]){
        dfs(it);
    }
}
void dfs2(int x,int step){
    if(vis[x]&(1<<step))return ;
    vis[x]|=(1<<step);
    for(auto it:v[x]){
        dfs2(it,(step+1)%3);
    }
    for(auto it:rv[x]){
        dfs2(it,(step+2)%3);
    }
}
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    pii p[100005];
    for(int i = 0;i<m;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        v[x].pb(y);
        rv[y].pb(x);
    }
    LL ans=0;
    for(int i = 1;i<=n;i++){
        if(!vis[i]){
            cnt=0;
            stk.clear();
            dfs(i);
            for(auto it:stk)
            vis[it]=0;
            dfs2(i,0);
            int ok=0;
            for(auto it:stk){
                if(__builtin_popcount(vis[it])!=1){
                    ok=1;
                    ans+=cnt*cnt;
                    assert(__builtin_popcount(vis[it])!=0)
                    break;
                }
            }
            if(!ok){
                LL tot[3]={0,0,0};
                for(auto it:stk){
                    if(vis[it]==1)tot[0]++;
                    if(vis[it]==2)tot[1]++;
                    if(vis[it]==4)tot[2]++;
                }
                ans+=tot[0]*tot[1]+tot[1]*tot[2]+tot[2]*tot[0];
            }
        }
    }
    printf("%lld\n",ans);
}
/*

b[i]*K!/(i)!*(K-i)!
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:74:21: error: expected ';' before 'break'
   74 |                     break;
      |                     ^~~~~
Language: C++

//Ilm kave oi, you know ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 3;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e12;
int n, m, sz, cyc, visited[MAXN], md0, md1, md2, e;
vector<pair<int, int> > H[MAXN];
void dfs(int u, int num)
{
	sz++;
	visited[u] = num;
	if(num == 0)	
		md0++;
	else
	if(num == 1)
		md1++;
	else
		md2++;
	
	for (auto v : H[u])
	{
		e++;
		int nw = num;
		if(v.second == 0)
			nw = (nw + 1) % 3;
		else
			nw = (nw + 2) % 3;
		if(visited[v.first] == -1)
			dfs(v.first, nw);
		else
		if(visited[v.first] != nw)
			cyc = 1;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int u, v;
		cin >> u >> v;
		H[u].push_back({v, 0});
		H[v].push_back({u, 1});
	}
	memset(visited, -1, sizeof visited);
	ll ans = 0;
	for (int i = 1; i <= n; i++)
		if(visited[i] == -1)
		{
			sz = 0, cyc = 0, md0 = 0, md1 = 0, md2 = 0, e = 0, dfs(i, 0);
			if(cyc == 1)
				ans += 1LL * sz * sz;
			else
			if(mod0 && mod1 && mod2)
				ans += 1LL * md0 * md1 + 1LL * md1 * md2 + 1LL * md2 * md0;
			else
				ans += e / 2;
		}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:28: error: 'mod0' was not declared in this scope; did you mean 'modf'?
   60 |                         if(mod0 && mod1 && mod2)
      |                            ^~~~
      |                            modf
a.cc:60:36: error: 'mod1' was not declared in this scope; did you mean 'modf'?
   60 |                         if(mod0 && mod1 && mod2)
      |                                    ^~~~
      |                                    modf
a.cc:60:44: error: 'mod2' was not declared in this scope; did you mean 'modf'?
   60 |                         if(mod0 && mod1 && mod2)
      |                                            ^~~~
      |                                            modf
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=100010;
int n,m,fg,d[N],t[3],S,w;long long ans;vector<pair<int,int> > e[N];
void dfs(int x){
	t[d[x]]++;S++;
	ref(i,0,((int)e[x].size())-1){
		int y=e[x][i].first;w++;
		int D=(3+d[x]+e[x][i].second)%3;
		if(d[y]==-1)d[y]=D,dfs(y);else if(d[y]!=D)fg=1;
	}
}
int main(){
	cin>>n>>m;
	ref(i,1,m){int x,y;cin>>x>>y;
		e[x].push_back(make_pair(y,1));
		e[y].push_back(make_pair(x,-1));
	}
	ref(i,1,n)d[i]=-1;
	ref(i,1,n)if(d[i]<0){
		fg=d[i]=S=w=T[0]=T[1]=T[2]=0,dfs(i);
		if(fg)ans+=1LL*S*S;else
		if(!t[0]||!t[1]||!t[2])ans+=w/2;else
		ans+=1LL*t[0]*t[1]+1LL*t[1]*t[2]+1LL*t[2]*t[0];
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:29: error: 'T' was not declared in this scope
   22 |                 fg=d[i]=S=w=T[0]=T[1]=T[2]=0,dfs(i);
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int n,m,k,t,cnt[3],c[maxn];
bool vis[maxn],flag,edge;
vector<pair<int,int>>e[maxn];
void dfs(int x)
{
    cnt[c[x]]++;
    for(int i=0;i<e[x].size();i++)
    {
        int to=e[x][i].first,w=e[x][i].second;
        if(w==1)edge++;
        if(!vis[to])
        {
            vis[to]=true;
            c[to]=(c[x]+w)%3;
            dfs(to);
        }
        else if(c[to]!=(c[x]+w)%3)flag=false;
    }
}
int main()
{
    int i,j;
    scanf("%d%d",&n,&m);
    while(m--)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        e[x].push_back({y,1}),e[y].push_back({x,2});
    }
    long long ret=0;
    for(i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            vis[i]=true;
            c[i]=0;
            cnt[0]=cnt[1]=cnt[2]=0;
            flag=true;
            edge=0;
            dfs(i,0);
            if(!flag)
            {
                ret+=1LL*(cnt[0]+cnt[1]+cnt[2])*(cnt[0]+cnt[1]+cnt[2]);
            }
            else if(!cnt[2]||!cnt[1]||!cnt[0])
            {
                ret+=edge;
            }
            else ret+=1LL*cnt[0]*cnt[1]+1LL*cnt[1]*cnt[2]+1LL*cnt[2]*cnt[0];
        }
    }
    printf("%lld\n",ret);
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:13:17: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   13 |         if(w==1)edge++;
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:43:16: error: too many arguments to function 'void dfs(int)'
   43 |             dfs(i,0);
      |             ~~~^~~~~
a.cc:7:6: note: declared here
    7 | void dfs(int x)
      |      ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair

using namespace std;

map<pii, bool> hash;

const int Maxn = 100010;

int n, m, fa[Maxn], fg[Maxn], siz[Maxn], work[Maxn], color[Maxn], cnt[3], vis[Maxn];

vector<int> edge[Maxn], back[Maxn];

int find(int x) {
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}

void unit(int x, int y) {
	x = find(x), y = find(y);
	if(x == y) return;
	siz[y] += siz[x];
	fg[y] |= fg[x]; fa[x] = y;
}

void dfs(int u, int co) {
	vis[u] = 1; color[u] = co; cnt[co]++;
	for(int it = 0; it < edge[u].size(); ++it) {
		if(!vis[edge[u][it]]) {
			dfs(edge[u][it], (co+1)%3);
		}
	}
	for(int it = 0; it < back[u].size(); ++it) {
		if(!vis[back[u][it]]) {
			dfs(back[u][it], (co+2)%3);
		}
	}
}

long long ans;

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i)
		fa[i] = i, siz[i] = 1;
	for(int i = 1; i <= m; ++i) {
		int u, v;
		scanf("%d%d", &u, &v);
		edge[u].pb(v);
		back[v].pb(u);
		hash[mp(u, v)] = 1;
		unit(u, v);
		if(hash[mp(v, u)]) fg[find(u)] = 1;
	}
	for(int i = 1; i <= n; ++i)
		if(find(i) == i) {
			if(fg[i]) {
				work[i] = 1;
				ans += 1ll*siz[i]*siz[i];
			} else {
				memset(cnt, 0, sizeof cnt);
				dfs(i, 0);
				if(cnt[0] && cnt[1] && cnt[2]) {
					work[i] = 1;
					ans += 1ll*cnt[0]*cnt[1]+1ll*cnt[1]*cnt[2]+1ll*cnt[0]*cnt[2];
				}
			}
		}
	for(int i = 1; i <= n; ++i)
		if(!work[find(i)]) {
			for(int it = 0; it < edge[i].size(); ++it)
				if(!work[find(edge[i][it])])
					ans++;
		}
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:17: error: reference to 'hash' is ambiguous
   58 |                 hash[mp(u, v)] = 1;
      |                 ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 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/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:14:16: note:                 'std::map<std::pair<int, int>, bool> hash'
   14 | map<pii, bool> hash;
      |                ^~~~
a.cc:60:20: error: reference to 'hash' is ambiguous
   60 |                 if(hash[mp(v, u)]) fg[find(u)] = 1;
      |                    ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:14:16: note:                 'std::map<std::pair<int, int>, bool> hash'
   14 | map<pii, bool> hash;
      |                ^~~~
Language: C++

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

int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
long long cnt,cmt,c[3],ans;

void travel(int x,int k){
	if (!h[x][0]&&!h[x][1]&&!h[x][2]) cnt++;
	h[x][k]=1;c[k]++;
	for (int t=p[x];t;t=next[t])
		if (!h[y[t]][(k+z[t])%3]){
			if (!w[t]) cmt++;
			travel(y[t],(k+z[t])%2);
		}
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++){
		x[2*i-1]=y[2*i]=read();
		y[2*i-1]=x[2*i]=read();
		z[2*i-1]=1;z[2*i]=2;
		next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*i-1;
		next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
	}
	for (int i=1;i<=n;i++)
		if (!h[i][0]&&!h[i][1]&&!h[i][2]){
			cnt=0;cmt=0;c[0]=c[1]=c[2]=0;travel(i,0);
			if (h[i][1]) ans+=cnt*cnt;
			else if (c[1]&&c[2]) ans+=c[0]*c[1]+c[1]*c[2]+c[2]*c[0];
			else ans+=cmt;
		}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'void travel(int, int)':
a.cc:11:29: error: reference to 'next' is ambiguous
   11 |         for (int t=p[x];t;t=next[t])
      |                             ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:5:29: note:                 'int next [1111116]'
    5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
      |                             ^~~~
a.cc: In function 'int main()':
a.cc:31:17: error: reference to 'next' is ambiguous
   31 |                 next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*i-1;
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:5:29: note:                 'int next [1111116]'
    5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
      |                             ^~~~
a.cc:32:17: error: reference to 'next' is ambiguous
   32 |                 next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:5:29: note:                 'int next [1111116]'
    5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
      |                             ^~~~
Language: C++

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
int main(int argc, char* argv[])
{
	char s[100];
	gets(s);
	cout<<s<<endl;
	return 0;
}

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

#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int N,M;
	cin>>N>>M;
	int i,j;

	char **X=new char*[N];
	for (i=0;i<N;i++){
		X[i]=new char[N+1];
		memset(X[i],'w',N);
		X[i][N]='\0';
	}
	int a,b;
	for (j=0;j<M;j++){
		cin>>a>>b;
		X[a-1][b-1]='b';
	}
	int x,y,z;
	for (x=0;x<N;x++){
		for (y=0;y<N;y++){
			for (z=0;z<N;z++){
				if (X[x][y]=='b' && X[y][z]=='b' && X[z][x]=='w'){
					X[z][x]='b';
				}
			}
		}
	}
	int aw=0;
	for (i=0;i<N;i++){
		for (j=0;j<N;j++){
			if (X[i][j]=='b'){
				aw++;
			}
		}
	}
	cout<<aw<<endl;
	for (i=0;i<N;i++){
		delete[] X[i];
	}
	delete[] X;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:12:17: error: 'memset' was not declared in this scope
   12 |                 memset(X[i],'w',N);
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;