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

#include <bits/stdc++.h>

using namespace std;

const int N = 505 ;
const int M = 10000;

int noLin , noPrimes ;
vector < int > allPrimes ;
int isPrime[ M ] ;
int diagPrin [ N ] , diagSec[ N ];

long long mat [ N ][ N ];

void genCiur(){
    int i ;

    for ( i = 2 ; i * i < M ; i++ ){

        if ( isPrime [ i ] == 0 ){
            allPrimes.push_back( i );
        }

        for ( int j = i*i ; j < M ; j+=i ){
            isPrime [ j ] = 1 ;
        }
    }
    for ( i < M ; i++ ){
        if ( isPrime [ i ] == 0 ){
            allPrimes.push_back( i );
        }
    }

}


__int128 cmmdc ( __int128 a , __int128 b ){

    while ( b ){
        __int128 t = a % b ;
        a = b ;
        b = t ;
    }
    return a ;

}

__int128 calcLCM ( __int128 a , __int128 b ){

    return a * b / cmmdc ( a , b );

}

int main(){


    scanf("%d",&noLin);

    noPrimes = 2 * noLin  + 1 ;

    genCiur ();

    vector<int>::iterator it = allPrimes.begin();

    for ( int i = 0 ; i < 2 * noLin ; i+=1 ){
        diagPrin [ i ] = *it ;
        it++;
    }
    for ( int i = 0 ; i < 2 * noLin ; i+=2 ){
        diagSec [ i ] = *it ;
        it++;
    }
    for ( int i = 0 ; i < noLin ; i+=1 ){
        for ( int j = 0 ; j < noLin ; j+=1 ){
            int crPrin = j - i + noLin - 1 ;
            int crSec = 2*noLin - i - j - 1 ;

            mat [ i ][ j ] = diagPrin [ crPrin ] * diagSec [ crSec ];
        }
    }

    int jj = 0 ;
    if ( noLin == 2 ){
        int jj= 1 ;
    }

    for ( int i = 0 ; i < noLin ; i++ ){
        for ( int j = jj ; j < noLin ; j++ ){

            __int128  a = 1 , b = 1  ,c = 1 , d = 1 ;

            if ( mat [ i ][ j ] == 0 ){
                if ( i ) {
                    a = mat [ i - 1 ][ j ];
                }
                if ( j ){
                    b = mat [ i ][ j - 1 ];
                }
                if ( i < noLin - 1 ){
                    c = mat [ i + 1 ][ j ];
                }
                if ( j < noLin - 1 ){
                    d = mat [ i ][ j + 1 ];
                }
                a = calcLCM( a, b );
                a = calcLCM( a, c );
                a = calcLCM( a, d );
                mat [ i ][ j ] = a + 1 ;
            }


        }
    }


    for ( int i = 0 ; i < noLin ; i++ ){
        for ( int j = 0 ; j < noLin ; j++ ){
            cout << mat [ i ][ j ] << " " ;
//            printf("%I64d ",mat [ i ][ j ] );
        }
        printf("\n" );
    }



    return 0;
}


Compiler output:
a.cc: In function 'void genCiur()':
a.cc:28:22: error: expected ';' before ')' token
   28 |     for ( i < M ; i++ ){
      |                      ^~
      |                      ;
Language: C++

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// 最大公約数
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int N;
int A[550][550];
deque<int> prime;
unordered_map<int, int> mpA, mpB;
unordered_map<int, bool> ex;
signed main() {
    cin >> N
    for (int i = 2; i <= 1100; i++) {
        prime.push_back(i);
nene:;
    }
    for (int i = 0; i <= N + 1; i++) {
        if (i % 2 == 0) {mpA[2 * i] = prime.front(); prime.pop_front();}
        else {mpA[2 * i] = prime.back(); prime.pop_back();}
    }
    for (int i = 0; i <= N + 10; i++) {
        if (i % 2 == 0) {mpB[2 * i - (N + 4) - N % 2] = prime.front(); prime.pop_front();}
        else {mpB[2 * i - (N + 4) - N % 2] = prime.back(); prime.pop_back();}
    }
    for (int i = 0; i <= N + 1; i++) {
        for (int j = 0; j <= N + 1; j++) {
            if ((i + j) % 2 == 1)continue;
            A[i][j] = mpA[i + j] * mpB[i - j];
            ex[A[i][j]] = true;
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if ((i + j) % 2 == 0) {cout << A[i][j] << " "; continue;}
            int cur = 1;
            for (int k = 0; k < 4; k++) {
                cur = cur / gcd(cur, A[i + dy[k]][j + dx[k]]) * A[i + dy[k]][j + dx[k]];
            }
            int c = 1;
            while (ex[cur * c + 1])c++;
            cout << cur * c + 1 << " ";
            ex[cur * c + 1] = true;
        }
        cout << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: expected ';' before 'for'
   23 |     cin >> N
      |             ^
      |             ;
   24 |     for (int i = 2; i <= 1100; i++) {
      |     ~~~      
a.cc:24:21: error: 'i' was not declared in this scope
   24 |     for (int i = 2; i <= 1100; i++) {
      |                     ^
Language: C++

#include <set>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
const long long lim = 1000000000000000;
const int sublim = (int)sqrt(lim) / 3;
const vector<int> dx = { 1, 0, -1, 0 };
const vector<int> dy = { 0, 1, 0, -1 };
bool valid(vector<int> v1, vector<int> v2) {
	return (v1[0] >= v2[0] && v1[1] >= v2[1] && v1[2] >= v2[2] && v1[3] >= v2[3]) || (v1[0] <= v2[0] && v1[1] <= v2[1] && v1[2] <= v2[2] && v1[3] <= v2[3]);
}
vector<int> solve(int a, int b, int c, int d) {
	vector<vector<int> > v;
	int basemul = 1;
	int ret = 0;
	for (int i = 0; basemul <= sublim; ++i) {
		int bmul = basemul;
		for (int j = 0; bmul <= sublim; ++j) {
			int mul = bmul;
			for (int k = 0; mul <= sublim; ++k) {
				int smul = mul;
				for (int l = 0; smul <= sublim; ++l) {
					++ret;
					smul *= d;
					v.push_back({ i, j, k, l });
				}
				mul *= c;
			}
			bmul *= b;
		}
		basemul *= a;
	}
	sort(v.begin(), v.end());
	vector<bool> used(v.size());
	int cur = v.size() - 1;
	vector<vector<int> > seq;
	while (true) {
		used[cur] = true;
		seq.push_back(v[cur]);
		int ncur = -1;
		for (int i = 0; i < v.size(); ++i) {
			if (!used[i] && valid(v[cur], v[i])) {
				ncur = i;
			}
		}
		if (ncur == -1) break;
		cur = ncur;
	}
	vector<int> ans;
	for (vector<int> i : seq) {
		int mul = 1;
		for (int j = 0; j < i[0]; ++j) mul *= a;
		for (int j = 0; j < i[1]; ++j) mul *= b;
		for (int j = 0; j < i[2]; ++j) mul *= c;
		for (int j = 0; j < i[3]; ++j) mul *= d;
		ans.push_back(mul);
	}
	return ans;
}
long long gcd(long long x, long long y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}
long long lcm(long long x, long long y) {
	return x / gcd(x, y) * y;
}
int main() {
	vector<int> c1 = solve(2, 7, 17, 19);
	vector<int> c2 = solve(3, 5, 11, 13);
	int n;
	cin >> n;
	set<long long> s;
	vector<vector<long long> > v(n, vector<long long>(n));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			int a = i + j, b = i - j + ((n - 1) / 2) * 2;
			if (a % 2 == 0) {
				v[i][j] = 1LL * c1[a / 2] * c2[b / 2];
				s.insert(v[i][j]);
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if ((i + j) % 2 == 1) {
				long long delta = 1;
				for (int k = 0; k < 4; ++k) {
					int tx = i + dx[k], ty = j + dy[k];
					if (0 <= tx && tx < n && 0 <= ty && ty < n) {
						delta = lcm(delta, v[tx][ty]);
					}
				}
				v[i][j] = delta + 1;
				while (s.count(v[i][j])) v[i][j] += delta;
				s.insert(v[i][j]);
				assert(v[i][j] <= lim);
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j) cout << ' ';
			cout << v[i][j];
		}
		cout << '\n';
	}
	return 0;
}

Compiler output:
a.cc:8:25: error: 'sqrt' was not declared in this scope
    8 | const int sublim = (int)sqrt(lim) / 3;
      |                         ^~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <cstring>
#include <set>

#define sz(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3c3c3c3c;
const ll LINF = 1ll*INF*INF*2;

const int N = 510;
int n;

ll ans[N][N];

set<ll> s;

ll gcd(ll x, ll y) {
	while(y) {
		ll t = y;
		y = x%y;
		x = t;
	}
	return x;
}

ll lcm(ll x, ll y) {
	return x/gcd(x,y)*y;
}

int main(void) {
	scanf("%d", &n);

	ll cur=2;
	for(i=0; i<=n; i+=4) {
		for(int j=0; j<=n; j++) {
			ans[i][j] = cur;
			s.insert(cur);
			cur++;
		}
	}
	i-=2; if(i>n) i-=4;
	while(i>0) {
		for(int j=0; j<=n; j++) {
			ans[i][j] = cur;
			s.insert(cur);
			cur++;
		}
		i-=4;
	}

	for(int i=1; i<n; i+=2) {
		for(int j=0; j<=n; j+=2) {
			ll temp = lcm(ans[i-1][j], ans[i+1][j]);
			ll t = temp+1;
			while(s.count(t)) t+=temp;

			ans[i][j] = t;
			s.insert(t);
		}

		for(int j=1; j<n; j+=2) {
			ll temp = lcm(lcm(ans[i-1][j], ans[i+1][j]), lcm(ans[i][j-1], ans[i][j+1]));
			ll t = temp+1;

			while(s.count(t)) t+=temp;
			ans[i][j] = t;
			s.insert(t);
		}
	}

	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) printf("%lld ", ans[i][j]);
		printf("\n");
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:13: error: 'i' was not declared in this scope
   46 |         for(i=0; i<=n; i+=4) {
      |             ^
a.cc:53:9: error: 'i' was not declared in this scope
   53 |         i-=2; if(i>n) i-=4;
      |         ^
Language: C++

 for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j <= n; ++j)
            cout << second_matrix[i][j] << ' ';
        cout << '\n';
    }

Compiler output:
a.cc:1:2: error: expected unqualified-id before 'for'
    1 |  for(int i = 1; i <= n; ++i)
      |  ^~~
a.cc:1:17: error: 'i' does not name a type
    1 |  for(int i = 1; i <= n; ++i)
      |                 ^
a.cc:1:25: error: expected unqualified-id before '++' token
    1 |  for(int i = 1; i <= n; ++i)
      |                         ^~
Language: C++

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

const int MAX = 500;
const int MAX2 = 10000;
int main() {
	int N;
	cin >> N;
	if (N == 2) { // 例外ケース
		cout << 2 << " " << 9 << endl << 4 << " " << 17;
		return 0;
	}
	vector<int> prime;
	static bool num[MAX2];
	for (int i = 0;i < MAX2;++ i) num[i] = true;
	for (int i = 2, c = N << 1;c > 0;++ i) {
		if (num[i]) { // この数は素数！
			prime.push_back(i);
			-- c;
			for (int j = i << 1, l = MAX2 - i;j < l;j += i) num[j] = false;
		}
	}
	static int64_t a[MAX][MAX];
	for (int i = 0;i < N;++ i) {
		for (int j = 0;j < N;++ j) {
			if ((i + j & 1) == 0) { // 素数
				a[i][j] = prime[N / 2 + (i - j) / 2] * prime[N + (i + j) / 2];
			} else { // 上下左右4つの素数の積+1
				if (i == 0 && j == N - 1) a[i][j] = (int64_t)prime[N / 2 + (i - j + 1) / 2] * prime[N + (i + j - 1) / 2] * prime[N + (i + j + 1) / 2] + 1;
				else if (i == N - 1 && j == 0) a[i][j] = (int64_t)prime[N + (i + j - 1) / 2] * prime[N / 2 + (i - j - 1) / 2] * prime[N + (i + j + 1) / 2] + 1;
				else a[i][j] = (int64_t)prime[N / 2 + (i - j + 1) / 2] * prime[N + (i + j - 1) / 2] * prime[N / 2 + (i - j - 1) / 2] * prime[N + (i + j + 1) / 2] + 1;
			}
		}
	}
	/*
	vector<int64_t> chk;
	for (int i = 0;i < N;++ i) { // 要らないけど、整合性チェック
		for (int j = 0;j < N;++ j) {
			int d[] = {0, 1, 0, -1, 0};
			int check[] = {-1, -1, -1, -1};
			for (int k = 0;k < 4;++ k) {
				if (i + d[k] >= 0 && i + d[k] < N && j + d[k + 1] >= 0 && j + d[k + 1] < N) {
					check[k] = max(a[i][j], a[i + d[k]][j + d[k + 1]]) % min(a[i][j], a[i + d[k]][j + d[k + 1]]);
				}
			}
			sort(check, check+4);
			for (int i = 0;i < 3;i ++) {
				if (check[i] >= 0 && check[i] != check[i + 1]) {
					cerr << "err" << endl;
				}
			}
			if (a[i][j] >= 1000000000000000) cerr << "err" << endl;
			chk.push_back(a[i][j]);
		}
	}
	sort(chk.begin(), chk.end());
	for (int i = 1;i < chk.size();++ i) {
		if (chk[i] == chk[i - 1]) cerr << "err" << endl;
	}
	cerr << chk[chk.size() - 1] << endl;
	*/
	
	for (int i = 0;i < N;++ i) {
		for (int j = 0;j < N;++ j) {
			if (j > 0) cout << " ";
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

解説AC
まず、割った余りは……がヤバそうなので先にこれをどうにかする
あるマスについて、常にその値を上下左右の値の最小公倍数+1にするものとしようか
この時、上下左右が相異なる素数ならば、最小公倍数は要するに4つの積なので常に相異なる
そして、これの余りは1だからセーフ
後は素数を配置だけど、500×500/2=12500……あれ、これはヤバい
何がヤバいって12500番目の素数って値幾つだ、一度試してみよう
試した結果、答えは1655131とのこと
ちなみに6250番目は780469
これ、そのまま4乗すると10^15を超えてしまう……でもある程度は行けそう……順番を調整してみよう
解説でやってるような方法を取ってみようか
ここで、500番目の素数は3571で、4乗すると162614549665681=1.6*10^14はセーフ
なら1と1000を、2と999を……のペアを作っていけばセーフっぽい

さて、使う本数を考えていこう
まず左上→右下への線の本数はN+(N&1)-1本
次に右上→左下への線の本数はN本
後はこれを、交差する数の素数番目の和が2Nを超えないようにしてみようか
これは簡単で、左上→右下に小さい数番目から配置する……とかで十分達成可能
*/

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

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

const int MAX = 1000000;
int main() {
	int N;
	cin >> N;
	if (N == 2) { // 例外ケース
		cout << 4 << " " << 7 << endl << 23 << " " << 10; // サンプルケースですね
		return 0;
	}
	vector<int> prime;
	static bool num[MAX];
	for (int i = 0;i < MAX;++ i) num[i] = true;
	for (int i = 2, c = N << 1;c > 0;++ i) {
		if (num[i]) { // この数は素数！
			prime.push_back(i);
			-- c;
			for (int j = i << 1, l = MAX - i;j < l;j += i) num[j] = false;
		}
	}
	for (int i = 0;i < N;++ i) {
		for (int j = 0;j < N;++ j) {
			if (j > 0) cout << " ";
			if ((i + j & 1) == 0) { // 素数
				cout << prime[N / 2 + (i - j) / 2] * prime[N + (i + j) / 2];
			} else { // 上下左右4つの素数の積
				cout << (int64_t)prime[N / 2 + (i - j + 1) / 2] * prime[N + (i + j - 1) / 2] * prime[N / 2 + (i - j - 1) / 2] * prime[N + (i - j - 1) / 2];
			}
		}
		cout << endl;
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

解説AC
まず、割った余りは……がヤバそうなので先にこれをどうにかする
あるマスについて、常にその値を上下左右の値の最小公倍数にするものとしようか
この時、上下左右が相異なる素数ならば、最小公倍数は要するに4つの積なので常に相異なる
そして、これの余りは0だからセーフ
後は素数を配置だけど、500×500/2=12500……あれ、これはヤバい
何がヤバいって12500番目の素数って値幾つだ、一度試してみよう
試した結果、答えは1655131とのこと
ちなみに6250番目は780469
これ、そのまま4乗すると10^15を超えてしまう……でもある程度は行けそう……順番を調整してみよう
解説でやってるような方法を取ってみようか
ここで、500番目の素数は3571で、4乗すると162614549665681=1.6*10^14はセーフ
なら1と1000を、2と999を……のペアを作っていけばセーフっぽい

さて、使う本数を考えていこう
まず左上→右下への線の本数はN+(N&1)-1本
次に右上→左下への線の本数はN本
後はこれを、交差する数の素数番目の和が2Nを超えないようにしてみようか
これは簡単で、左上→右下に小さい数番目から配置する……とかで十分達成可能
*/

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

#include <iostream>

using namespace std;

long long ans[501][501];
long long prime[501];
void initprime() {
	int pn=0;
	long long base=2;
	for (int i=0; i<500;) {
		auto isprime = [&](long long a) {
			for (int k=0; k<i; k++)
				if (a%prime[k] == 0)
					return false;
			return true;
		};
		// cout<<i<<" "<<base<<endl;
		if (isprime(base))
			prime[i++] = base++;
		else
			base++;
	}
}
int main() {
	initprime();
	int n; cin>>n;
	if (n==2) {
		cout<<"4 7\n23 10"<<endl;
		return 0;
	}
	auto idx = [&] (int x, int y) -> int {
		int t = (x+y)/2; // t=0,1,2,3,4,5 when n==6;
		return t%2?(n-1-t/2):t/2; };

	//prime[k] for (i,j) with k=(i+j)/2;
	int pcnt[500]; memset(pcnt, 0, sizeof(pcnt));
	for (int i=0; i<n; i++)
		for (int j=i%2; j<n; j+=2)
			ans[i][j] = prime[idx(i,j)]*(i+1);
	
	// for (int i=0; i<500; i++)
	// 	cout<<pcnt[i]<<" ";
	// cout<<endl;
	auto w = [&] (int x, int y) -> long long{
		if (x<0 || x>=n || y<0 || y>=n)
			return 1;
		return ans[x][y] / prime[idx(x,y)];
	};
	long long tmax=0;
	for (int i=0; i<n; i++)
		for (int j=(i+1)%2; j<n; j+=2) {
			ans[i][j] = w(i,j+1) * w(i-1,j) * w(i+1,j) * prime[idx(i,j-1)] * prime[idx(i,j+1)];
			tmax = max(tmax, ans[i][j]);
		}
	// cout<<tmax<<endl;
	for (int i=0; i<n; i++, cout<<endl)
		for (int j=0; j<n; j++)
			cout<<ans[i][j]<<" ";
	return 0;
}


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

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 2e5 + 10;
ll a[maxn][maxn];
int dx[] = {-1, +1, 0, 0};
int dy[] = {0, 0, +1, -1};
int n;
set<ll> st;
bool isin(int x,int y){
	return (x >= 0 && x < n && y >= 0 && y < n);
}
void doo(int x,int y){
	if(a[x][y]) return;
	set<ll> s;
	for(int i=0; i<4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(isin(nx, ny) && a[nx][ny] != 0)
			s.insert(a[nx][ny]);
	}
	int ans = 1;
	for(auto x : s)
		ans *= x;
	int cur = ans + 1;
	while(1){
		if(st.find(cur) == st.end()){
			a[x][y] = cur;
			st.insert(cur);
			break;
		}
		cur += ans;

	}
}
int32_t main(){
	IOS;
	
	//int n;
	cin >> n;
	int cur = 2;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(i % 2 == j % 2){
				a[i][j] = cur;
				cur++;
			}
		}
	}
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			doo(i, j);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++)
			cout << a[i][j] << " ";
		cout << endl;
	}


}

Compiler output:
/tmp/cc3NEiif.o: in function `isin(int, int)':
a.cc:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x23): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
/tmp/cc3NEiif.o: in function `doo(int, int)':
a.cc:(.text+0x216): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x239): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x2a7): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc3NEiif.o
/tmp/cc3NEiif.o: in function `main':
a.cc:(.text+0x31d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x3b0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x3bf): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x3f3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x402): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc3NEiif.o
a.cc:(.text+0x472): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 2e5 + 10;
ll a[maxn][maxn];
int dx[] = {-1, +1, 0, 0};
int dy[] = {0, 0, +1, -1};
int n;
set<ll> st;
bool isin(int x,int y){
	return (x >= 0 && x < n && y >= 0 && y < n);
}
void doo(int x,int y){
	if(a[x][y]) return;
	set<ll> s;
	for(int i=0; i<4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(isin(nx, ny) && a[nx][ny] != 0)
			s.insert(a[nx][ny]);
	}
	int ans = 1;
	for(auto x : s)
		ans *= x;
	int cur = ans + 1;
	while(1){
		if(st.find(cur) == st.end()){
			a[x][y] = cur;
			st.insert(cur);
			break;
		}
		cur += ans;

	}
}
int32_t main(){
	IOS;
	
	//int n;
	cin >> n;
	int cur = 2;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(i % 2 == j % 2){
				a[i][j] = cur;
				cur++;
			}
		}
	}
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			doo(i, j);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++)
			cout << a[i][j] << " ";
		cout << endl;
	}


}

Compiler output:
/tmp/cc7ursgE.o: in function `isin(long long, long long)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x2a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
/tmp/cc7ursgE.o: in function `doo(long long, long long)':
a.cc:(.text+0x220): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x23d): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x2a3): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc7ursgE.o
/tmp/cc7ursgE.o: in function `main':
a.cc:(.text+0x322): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x3c8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x3da): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x417): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x429): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc7ursgE.o
a.cc:(.text+0x49e): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 2e5 + 10;
ll a[maxn][maxn];
int dx[] = {-1, +1, 0, 0};
int dy[] = {0, 0, +1, -1};
int n;
set<ll> st;
bool isin(int x,int y){
	return (x >= 0 && x < n && y >= 0 && y < n);
}
void doo(int x,int y){
	if(a[x][y]) return;
	set<ll> s;
	for(int i=0; i<4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(isin(nx, ny) && a[nx][ny] != 0)
			s.insert(a[nx][ny]);
	}
	int ans = 1;
	for(auto x : s)
		ans *= x;
	int cur = ans + 1;
	while(1){
		if(st.find(cur) == st.end()){
			a[x][y] = cur;
			st.insert(cur);
			break;
		}
		cur += ans;

	}
}
int32_t main(){
	IOS;
	
	//int n;
	cin >> n;
	int cur = 2;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(i % 2 == j % 2){
				a[i][j] = cur;
				cur++;
			}
		}
	}
	for(int i=0; i<n; i++)
		for(int j=0; j<n; j++)
			doo(i, j);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++)
			cout << a[i][j] << " ";
		cout << endl;
	}


}

Compiler output:
/tmp/cc0ftSZJ.o: in function `isin(long long, long long)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x2a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
/tmp/cc0ftSZJ.o: in function `doo(long long, long long)':
a.cc:(.text+0x220): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x23d): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x2a3): relocation truncated to fit: R_X86_64_PC32 against symbol `st' defined in .bss section in /tmp/cc0ftSZJ.o
/tmp/cc0ftSZJ.o: in function `main':
a.cc:(.text+0x322): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x3c8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x3da): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x417): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x429): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0ftSZJ.o
a.cc:(.text+0x49e): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<set>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iostream>
using namespace std;
int n;
const int N = 60000;
bool f[N];
vector<int> p;
#define i64 long long int
i64 a[1002][1002];
void init(){
	for(int i=2; i<N; i++){
		if(!f[i])p.push_back(i);
		for(auto y : p){
			int x = y * i;
			if(x>=N)break;
			f[x] = true;
			if(i%y==0)break;
		}
	}
	reverse(p.begin(), p.end());
	p.resize(5002);
}
i64 gen(i64 ff,int t){
	if(ff > 0)
		return ff * p[t];
	else{
		ff = -ff;
		return ff * (ff+1) * p[t] * p[t+1] + 1;
	}
}
bool chk(i64 x,i64 y){
	if(x>y)swap(x,y);
	return y%x==1;
}
set<i64> s;
int main(){
	init();
	scanf("%d",&n);
	for (int i = 2, ff = 1; i <= 2 * n; i++) {
		int mid = labs(ff) + 2501;
		for (int x = 1; x < i; x++) {
			a[x][i - x] = gen(ff, mid);
			mid--;
		}
		if (ff > 0) ff = -ff;else
			ff = -ff + 1;
	}
	ios::sync_with_stdio(false);
	for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++){
		s.insert(a[i][j]);
		if(i<n)assert(chk(a[i][j], a[i+1][j]));
		if(j<n)assert(chk(a[i][j],a[i][j+1]));
		cout << a[i][j] << (j < n ? ' ' : '\n');
	}
	assert(s.size() == n*n);
	return 0;
}


Compiler output:
a.cc: In function 'void init()':
a.cc:23:9: error: 'reverse' was not declared in this scope
   23 |         reverse(p.begin(), p.end());
      |         ^~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<random>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll gcd(ll a, ll b) {		// ユークリッドの互除法
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll N;
vector<vector<ll>> ans;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>N;
	ans.resize(N,vector<ll>(N));
	vector<bool> used(10000000,false);
	vector<ll> tmp;
	for(ll i=1;i<=10000000;i++) {
		if(!used[i]) {
			for(ll j=i;j<=10000000; j*=2) {
				if(used[j]) break;
				used[j]=true;
				tmp.pb(j);
			}
		}
	}
	ll pos=0;
	REP(i,N) REP(j,N) {
		if((i+j)%2==0) {
			ans[i][j]=tmp[pos];
			pos++;
		}
	}
	REP(i,N) REP(j,N) {
		if((i+j)%2==1) {
			vector<ll> maw;
			if(i>0) maw.pb(ans[i-1][j]);
			if(i<N-1) maw.pb(ans[i+1][j]);
			if(j>0) maw.pb(ans[i][j-1]);
			if(j<N-1) maw.pb(ans[i][j+1]);
			ll g=maw[0];
			FOR(k,1,maw.size()) g=gcd(g,maw[k]);
			ll hoge=g;
			REP(k,maw.size()) hoge*=maw[k]/g;
			ans[i][j]=maw;
		}
	}
	REP(i,N) DUMP(ans[i]);
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:35: error: cannot convert 'std::vector<long long int>' to '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} in assignment
   59 |                         ans[i][j]=maw;
      |                                   ^~~
      |                                   |
      |                                   std::vector<long long int>
Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int MOD = int(1e9) + 7;

char S[100500];
int P[100500];

int nxt[100500][3];
int ways[100500];

int main()
{
    scanf("%s", S+1);
    int N = strlen(S+1);

    // 1. XYXYXY.. 또는 YXYXYX.. 꼴이면 답 무조건 1
    bool is_alternating = true;
    for(int i = 1; i <= N; i++) {
      if(S[i] == S[i-1]) {
        is_alternating = false;
      }
    }
    if(is_alternating) {
      puts("1");
      continue;
    }

    int prv[3] = {0, -1, -1};
    for(int i = 1; i <= N; i++) {
      P[i] = (P[i-1] + "12"[S[i] - 'a'] - '0') % 3;
      for(int j = prv[P[i]]+1; j <= i; j++) {
        nxt[j][P[i]] = i;
      }
      prv[P[i]] = i;
    }

    for(int p = 0; p < 3; p++) {
      for(int j = prv[p]+1; j <= N; j++) {
        nxt[j][p] = N+1;
      }
    }

    for(int i = 0; i <= N; i++) ways[i] = 0;
    ways[0] = 1;
    for(int i = 0; i <= N; i++) {
      for(int p = 0; p < 3; p++) {
        if(p != P[i]) (ways[nxt[i][p]] += ways[i]) %= MOD;
      }
    }

    int ans = 0;
    for(int i = 1; i <= N; i++) {
      if((P[N] - P[i] + 3) % 3 == 0) {
        (ans += ways[i]) %= MOD;
      }
    }

    printf("%d\n", ans);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: 'strlen' was not declared in this scope
   18 |     int N = strlen(S+1);
      |             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | 
a.cc:29:7: error: continue statement not within a loop
   29 |       continue;
      |       ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,ln[100005],st[100005],ed[100005],cnt,sum[2][100005];
vector < int > dp[100005][2];
char s[100005];
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    int i,j,k;
	scanf("%s",s);
	n=strlen(s);
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
    cnt=1;
    ln[0]=1;
    st[0]=ed[0]=(s[0]-'a');
	for(i=1;i<n;++i){
    	if(s[i]==s[i-1]){
    		ln[cnt]=1;
    		st[cnt]=ed[cnt]=(s[i]-'a');
    		++cnt;
    	}
    	else{
    		++ln[cnt-1];
    		ed[cnt-1]=(s[i]-'a');
    	}
    }
    // initialize for the first block
    dp[0][0].resize(ln[0]+1,0);
	dp[0][1].resize(ln[0]+1,0);
	for(i=1;i<=ln[0];++i){
		dp[0][(i&1)^(int)(s[0]-'a')][i]=1;
	}
	for(i=0;i<2;++i){
		for(j=1+(int)(s[0]==('a'+i));j<=ln[0]+1;j+=2){
			sum[i][j]=(j>=2?sum[i][j-2]:0)+dp[0][i][j];
		}
	}
    for(i=1;i<cnt;++i){
    	// DP transfer
		dp[i][0].resize(ln[i]+1);
		dp[i][1].resize(ln[i]+1);
		// transfer from larger part
		for(j=1;j<=ln[i];++j){
			// j: t
			// ln-j: length in current block
			// 
			int cur=(LL)dp[i-1][s[st[i]]-'a'][]
		}
    }
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:59: error: expected primary-expression before ']' token
   69 |                         int cur=(LL)dp[i-1][s[st[i]]-'a'][]
      |                                                           ^
Language: C++

#include<bits/stdc++.h>
typedef int LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn=51,mod=998244353,inf=0x3f3f3f3f;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
void Chkmin(LL &x,LL y){
	if(y<x) x=y;
}
void Chkmax(LL &x,LL y){
	if(y>x) x=y;
}
LL add(LL x,LL y){
	return x+=y,x>=mod?x-mod:x;
}
LL dec(LL x,LL y){
	return x-=y,x<0?x+mod:x;
}
LL mul(LL x,LL y){
	return 1ll*x*y%mod;
}
LL Pow(LL base,LL b){
	LL ret(1); while(b){
		if(b&1) ret=mul(ret,base); base=mul(base,base); b>>=1;
	}return ret;
}
LL n,T,num,ans;
LL head[maxn],deg[maxn],fa1[maxn],fa2[maxn],vis[maxn],leaf[maxn];
std::vector<LL> V1[maxn],V2[maxn];
void Dfs(LL u,LL f){
	vis[u]=1;
	LL j(0);
	for(LL i=0;i<V1[u].size();++i){
		LL v(V1[u][i]); if(v==f) continue;
		while(j<V2[u].size() && V2[u][j]<v) ++j;
		if(j<V2[u].size() && V2[u][j]==v){
			Dfs(v,u);
		}
	}
}
void Dfs1(LL u,LL f){
	fa1[u]=f;
	for(LL i=0;i<V1[u].size();++i){
		LL v(V1[u][i]); if(v==f) continue;
		Dfs1(v,u);
	}
}
void Dfs2(LL u,LL f){
	fa2[u]=f;
	for(LL i=0;i<V2[u].size();++i){
		LL v(V2[u][i]); if(v==f) continue;
		Dfs2(v,u);
	}
}
void Solve(LL x){
	for(LL i=1;i<=n;++i) vis[i]=0,leaf[i]=0;
	Dfs(x,0);
	Dfs1(x,0);
	Dfs2(x,0);
	LL ret(0);
	for(LL i=1;i<=n;++i) ret+=(!vis[i]);
	static LL deg[maxn];
	for(LL i=1;i<=n;++i) deg[i]=V2[i].size();
	for(LL k=1;k<=ret;++k){
		LL flag(0);
		for(LL i=1;i<=n;++i) if(!vis[i]){
			if(deg[i]==1 && vis[fa1[i]]){
				deg[fa2[i]]--;
				flag=1;
				vis[i]=1;
				break;
			}
		}
		if(!flag) return;
	}
	Chkmin(ans,ret);
}
int main(){
	T=Read();
	while(T--){
		n=Read();
		ans=inf;
		for(LL i=1;i<n;++i){
			LL x(Read()),y(Read());
			V2[x].pb(y); V2[y].pb(x);
		}
		for(LL i=1;i<n;++i){
			LL x(Read()),y(Read());
			V1[x].pb(y); V1[y].pb(x);
		}
		for(LL i=1;i<=n;++i) std::sort(V1[i].begin(),V1[i].end());
		for(LL i=1;i<=n;++i) std::sort(V2[i].begin(),V2[i].end());
		for(LL i=1;i<=n;++i){
			Solve(i);
		}
		if(ans==inf) puts("%d\n",n);
		else printf("%d\n",ans);
		for(LL i=1;i<=n;++i){
		    std::vector<LL>().swap(V1[i]);
			std::vector<LL>().swap(V2[i]);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:105:34: error: too many arguments to function 'int puts(const char*)'
  105 |                 if(ans==inf) puts("%d\n",n);
      |                              ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:714:12: note: declared here
  714 | extern int puts (const char *__s);
      |            ^~~~
Language: C++

#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

vector <int> e1[55],e2[55],e3[55];
int d1[55],d2[55];

int p1[55],p2[55];

void dfs1(int x) {
  for(int i=0;i<e2[x].size();i++)
    if (e2[x][i]!=p1[x]) {
    	int u=e2[x][i];
    	p1[u]=x;
    	dfs1(u);
	}
}

void dfs2(int x) {
  for(int i=0;i<e3[x].size();i++)
    if (e3[x][i]!=p2[x]) {
    	int u=e3[x][i];
    	p2[u]=x;
    	dfs2(u);
	}
}

vector <int> ee[55];
int deg[55];
queue <int> q;

int solve(int n,int rt) {
  p1[rt]=p2[rt]=0;
  dfs1(rt);
  dfs2(rt);
  int s=0;
  for(int i=1;i<=n;i++) ee[i].clear();
  memset(deg,0,sizeof(deg));
  for(int i=1;i<=n;i++)
    if (p1[i]!=p2[i]) {
    	s++;
    	for(int j=0;j<e2[i].size();j++)
    	  if (e2[i][j]!=p1[i]) {
		    ee[e2[i][j]].push_back(i);
		    deg[i]++;
		  }
		for(int j=0;j<e3[i].size();j++)
		  if (e3[i][j]!=p2[i]) {
		    ee[i].push_back(e3[i][j]); 
		    deg[e3[i][j]]++;
		  }
	}
  for(int i=1;i<=n;i++)
    if (!deg[i]) q.push(i);
  while (!q.empty()) {
  	int x=q.front();q.pop();
  	for(int i=0;i<ee[x].size();i++) {
  		int u=ee[x][i];
  		deg[u]--;
  		if (!deg[u]) q.push(u);
	  }
  }
  for(int i=1;i<=n;i++)
    if (deg[i]) return inf;
  return s;
}

int main() {
  int cases;
  scanf("%d",&cases);
  for(;cases;cases--) {
  	memset(d1,0,sizeof(d1));
  	memset(d2,0,sizeof(d2));
  	int n;
  	scanf("%d",&n);
  	for(int i=1;i<=n;i++) {
  		e1[i].clear();
  		e2[i].clear();
	  }
	for(int i=1;i<n;i++) {
		int x,y;
		scanf("%d%d",&x,&y);
		e2[x].push_back(y);
		e2[y].push_back(x);
		d1[x]++;d1[y]++;
	}
	for(int i=1;i<n;i++) {
		int x,y;
		scanf("%d%d",&x,&y);
		e1[x].push_back(y);
		e1[y].push_back(x);
		d2[x]++;d2[y]++;
	}
	for(int i=1;i<=n;i++) e3[i]=e1[i];
	int ans=inf;
	for(int i=1;i<=n;i++)
	  ans=min(ans,solve(n,i));
	/*if (ans==inf) {
		for(int i=1;i<=n;i++)
		  if (d1[i]==1&&d2[i]==1) {
		  	for(int j=1;j<=n;j++)
		  	  if (j!=i) {
		  	  	  for(int k=1;k<=n;k++) 
					if (k!=i) {
		  	  	  	    e3[k].clear();
		  	  	  	    for(int l=0;l<e1[k].size();l++)
		  	  	  	      if (e1[k][l]!=i) e3[k].push_back(e1[k][l]);
					  }
				  e3[j].push_back(i);
				  e3[i].clear();
				  e3[i].push_back(j);
				  ans=min(ans,solve(n,i)+1);
				}
		  }*/
	}
	printf("%d\n",(ans<inf)?ans:-1);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:117:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
  117 |         printf("%d\n",(ans<inf)?ans:-1);
      |                        ^~~
      |                        abs
a.cc: At global scope:
a.cc:119:3: error: expected unqualified-id before 'return'
  119 |   return 0;
      |   ^~~~~~
a.cc:120:1: error: expected declaration before '}' token
  120 | }
      | ^
Language: C++

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define maxv 58
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<int> gr[maxv],rgr[maxv];
vector<int> vs;
bool sumi[maxv];
int cmp[maxv];
void dfs(int v){
	sumi[v]=true;
	rep(i,gr[v].size()){
		if(!sumi[gr[v][i]]) dfs(gr[v][i]);
	}
	vs.pb(v);
}
void rdfs(int v,int k){
	sumi[v]=true;cmp[v]=k;
	rep(i,rgr[v].size()){
		if(!sumi[rgr[v][i]]) rdfs(rgr[v][i],k);
	}
}
int scc(int v)
{
	memset(sumi,false,sizeof(sumi));
	vs.clear();
	rep(i,v){
		if(!sumi[i]) dfs(i);
	}
	memset(sumi,false,sizeof(sumi));
	int k=0;
	for(int i=vs.size()-1;i>=0;i--){
		if(!sumi[vs[i]]) rdfs(vs[i],k++);
	}
	return k;
}
void aedge(int v,int w){
	gr[v].pb(w);rgr[w].pb(v);
}

int st=-1,ko;
vector<int> ed[58][2];
void rec(int v,int u,int d){
	if(d<0){
		ko++;
		int it=0,i2=0,n=ed[v][0].size()-1,m=ed[v][1].size()-1;
		while(it<n || i2<m){
			if(ed[v][0][it]==u){
				it++;
			}
			else if(ed[v][1][i2]==u){
				i2++;
			}
			else if(ed[v][0][it]==st){
				rec(st,v,0);it++;
			}
			else if(ed[v][0][it]<ed[v][1][i2]){
				rec(ed[v][0][it],v,0);it++;
			}
			else if(ed[v][0][it]>ed[v][1][i2]){
				rec(ed[v][1][i2],v,1);i2++;
			}
			else{
				rec(ed[v][0][it],v,-1);it++;i2++;
			}
		}
	}
	else{
		rep(i,ed[v][d].size()-1){
			int w=ed[v][d][i];
			if(u==w) continue;
			rec(w,v,d);
			if(d==0) aedge(v,w);else aedge(w,v);
		}
	}
}
int cal2(int i,int n){
	rep(j,58) gr[j].clear(),rgr[j].clear();
	ko=0;
	rec(i,-1,-1);
	if(scc(n)==n) return n-ko;return 58;
}
int cal(){
	int n,a,b;
	rep(i,55) rep(j,2) ed[i][j].clear();
	cin>>n;
	rep(j,2) rep(i,n-1){
		cin>>a>>b;a--;b--;
		ed[a][j].pb(b);ed[b][j].pb(a);
	}
	int ret=58;
	rep(i,n){
		sort(All(ed[i][0]));sort(All(ed[i][1]));
		ed[i][0].pb(58);
		ed[i][1].pb(58);
	}
	rep(i,n){
		ret=min(ret,cal2(i,n));
	}
	//cout<<"a"<<endl;
	rep(i,n){
		if(ed[i][0].size()>1) continue;
		int ori=ed[i][0][0];
		st=i;
		rep(j,n){
			if(j==i || j==ori) continue;
			ed[i][0][0]=j;
			ret=min(ret,cal2(i,n)+1);
		}
		ed[i][0][0]=ori
	}
	if(ret>50) return -1;
	return ret;
}
int main()
{
	int t;
	cin>>t;
	rep(i,t) cout<<cal()<<endl;
}


Compiler output:
a.cc: In function 'int cal()':
a.cc:142:32: error: expected ';' before '}' token
  142 |                 ed[i][0][0]=ori
      |                                ^
      |                                ;
  143 |         }
      |         ~
Language: Java

import java.util.Scanner;

public class A109 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);

		int A = stdIn.nextInt();
		int B = stdIn.nextInt();

		if(A%2 == 1 && B%2 == 1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}



	}

}


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

#include <stdio.h>

int main(){

  //整数A,Bを受け取る準備
  int A,B;

　//整数A,Bを受け取る
  scanf("%d %d",&A,&B);

  //(A×B)÷２の余りが１かを確認する
  if( (A*B)%2==1 ){

  //もし答えが１ならYesを出力する
    printf("Yes\n");

  //そうでなければNoを出力する
  }else{
    printf("No\n");


  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:1: error: stray '\343' in program
    8 | <U+3000>//<U+6574><U+6570>A,B<U+3092><U+53D7><U+3051><U+53D6><U+308B>
      | ^~~~~~~~
Language: C++

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll a, b;
    cin >> a >> b;
    if (a*b %2){cout << "Yes";}
    else{cout << "No";}

// Driver Function
int main()
{
    ll compte = 1;
   // test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Compiler output:
a.cc: In function 'void solution(long long int)':
a.cc:48:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   48 | int main()
      |         ^~
a.cc:48:9: note: remove parentheses to default-initialize a variable
   48 | int main()
      |         ^~
      |         --
a.cc:48:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:49:1: error: a function-definition is not allowed here before '{' token
   49 | {
      | ^
a.cc:57:2: error: expected '}' at end of input
   57 | }
      |  ^
a.cc:40:1: note: to match this '{'
   40 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;
    if (a*b %2){cout << "Yes";}
    else{cout << "No"}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: expected ';' before '}' token
    7 |     else{cout << "No"}
      |                      ^
      |                      ;
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)//rep(i,回数){処理}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    int a,b,c;
    cin >> a >> >> b;
    if (a*b % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected primary-expression before '>>' token
    9 |     cin >> a >> >> b;
      |                 ^~
Language: C

#include<stdio.h>
int sum(char c,char d){
  char c="Yes";
  char d="No";
  if(a*b%2==0)
  return c;
  else 
  return d;
}
int main(){
  int a,b;
  scanf("%d %d", &a,&b);
  printf("%s",sum(a,b));
  return 0;
  
}


Compiler output:
main.c: In function 'sum':
main.c:3:8: error: 'c' redeclared as different kind of symbol
    3 |   char c="Yes";
      |        ^
main.c:2:14: note: previous definition of 'c' with type 'char'
    2 | int sum(char c,char d){
      |         ~~~~~^
main.c:3:10: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    3 |   char c="Yes";
      |          ^~~~~
main.c:4:8: error: 'd' redeclared as different kind of symbol
    4 |   char d="No";
      |        ^
main.c:2:21: note: previous definition of 'd' with type 'char'
    2 | int sum(char c,char d){
      |                ~~~~~^
main.c:4:10: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    4 |   char d="No";
      |          ^~~~
main.c:5:6: error: 'a' undeclared (first use in this function)
    5 |   if(a*b%2==0)
      |      ^
main.c:5:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:8: error: 'b' undeclared (first use in this function)
    5 |   if(a*b%2==0)
      |        ^
Language: C

#include<stdio.h>
int sum(char c[256],char d[256]){
  char c[256]="Yes";
  char d[256]="No";
  if(a*b%2==0)
  return c;
  else 
  return d;
}
int main(){
  int a,b;
  scanf("%d %d", &a,&b);
  printf("%s",sum(a,b));
  return 0;
  
}


Compiler output:
main.c: In function 'sum':
main.c:3:8: error: 'c' redeclared as different kind of symbol
    3 |   char c[256]="Yes";
      |        ^
main.c:2:14: note: previous definition of 'c' with type 'char *'
    2 | int sum(char c[256],char d[256]){
      |         ~~~~~^~~~~~
main.c:4:8: error: 'd' redeclared as different kind of symbol
    4 |   char d[256]="No";
      |        ^
main.c:2:26: note: previous definition of 'd' with type 'char *'
    2 | int sum(char c[256],char d[256]){
      |                     ~~~~~^~~~~~
main.c:5:6: error: 'a' undeclared (first use in this function)
    5 |   if(a*b%2==0)
      |      ^
main.c:5:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:8: error: 'b' undeclared (first use in this function)
    5 |   if(a*b%2==0)
      |        ^
main.c: In function 'main':
main.c:13:19: error: passing argument 1 of 'sum' makes pointer from integer without a cast [-Wint-conversion]
   13 |   printf("%s",sum(a,b));
      |                   ^
      |                   |
      |                   int
main.c:2:14: note: expected 'char *' but argument is of type 'int'
    2 | int sum(char c[256],char d[256]){
      |         ~~~~~^~~~~~
main.c:13:21: error: passing argument 2 of 'sum' makes pointer from integer without a cast [-Wint-conversion]
   13 |   printf("%s",sum(a,b));
      |                     ^
      |                     |
      |                     int
main.c:2:26: note: expected 'char *' but argument is of type 'int'
    2 | int sum(char c[256],char d[256]){
      |                     ~~~~~^~~~~~