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

#include <cstdio>
#include <cstring>
const int maxn=100005;
char s[maxn],S[5][10];
int len;
bool flag=true;
inline bool check(int l,int r,int k){
	int lim=r-l;
	for(int i=0,j=l;i<=lim;i++,j++)
		if(S[k][i]!=s[j])
			return false;
	return true;
}
int main()
{
	scanf("%s",s);
	len=strlen(s);
	S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
	for(int i=len-1;i>0;){
		if(s[i]=='m'){
			if(i<4||check(i-4,i,1))
			{flag=false;break;}
			i-=4;
		}
		else if(s[i]=='e'){
			if(i<4||check(i-4,i,2))
			{flag=false;break;}
			i-=4;
		}
		else if(s[i]=='r'){
			if(i>=5&&check(i-5,i,3))
				i-=5;
			else if(i>=6&&check(i-6,i,4))
				i-=6;
			else {flag=false;break;}
		}
		else {flag=false;break;}
		i--;
	}
	if(flag)printf("YES");
	else printf("NO");
	return 0;
}


Compiler output:
a.cc:18:14: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |              ^~~~~~~
a.cc:18:27: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                           ^~~~~~~
a.cc:18:40: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                                        ^~~~~~~~
a.cc:18:54: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                                                      ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:18:13: error: incompatible types in assignment of 'int' to 'char [10]'
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |         ~~~~^~~~~~~~
a.cc:18:26: error: incompatible types in assignment of 'int' to 'char [10]'
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                      ~~~~^~~~~~~~
a.cc:18:39: error: incompatible types in assignment of 'int' to 'char [10]'
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                                   ~~~~^~~~~~~~~
a.cc:18:53: error: incompatible types in assignment of 'int' to 'char [10]'
   18 |         S[1]='dream';S[2]='erase';S[3]='eraser';S[4]='dreamer';
      |                                                 ~~~~^~~~~~~~~~
Language: C++


#include <string>
#include <vector>
#include <cmath>
#include <list>
#include <set>
#include <algorithm>
#include <map>
#include <iostream>
#include <sstream>
#include <queue>
#include <iomanip>

using namespace std;

bool dfs(const char* str)
{
	
	if(strlen(str) == 0)
	{
		return true;
	}

	else if(str[0] != 'd' && str[0] != 'e')
	{
		return false;
	}

	else if(strncmp(str, "dreamer", sizeof("dreamer")-1) == 0)
	{
		return dfs(str+5) || dfs(str+7);
	}
	else if(strncmp(str, "dream", sizeof("dream")-1) == 0)
	{
		return dfs(str+5);
	}

	else if(strncmp(str, "eraser", sizeof("eraser")-1) == 0)
	{
		return dfs(str+5) || dfs(str+6);
	}

	else if(strncmp(str, "erase", sizeof("erase")-1) == 0)
	{
		return dfs(str+5);
	}

	return false;
}

int main()
{
	string s;
	cin >> s;

	const char *str = s.c_str();

	if(strlen(str) > 0 && dfs(str))
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'bool dfs(const char*)':
a.cc:19:12: error: 'strlen' was not declared in this scope
   19 |         if(strlen(str) == 0)
      |            ^~~~~~
a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <iomanip>
  +++ |+#include <cstring>
   13 | 
a.cc:29:17: error: 'strncmp' was not declared in this scope
   29 |         else if(strncmp(str, "dreamer", sizeof("dreamer")-1) == 0)
      |                 ^~~~~~~
a.cc:29:17: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc: In function 'int main()':
a.cc:58:12: error: 'strlen' was not declared in this scope
   58 |         if(strlen(str) > 0 && dfs(str))
      |            ^~~~~~
a.cc:58:12: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <cstdio>
#include <cstring>

char c[120000];
int f[120000];
int i,l;

int main()
{
	gets(c+1);
	l=strlen(c+1);
	f[0]=1;
	for (i=1;i<=l;i++)
		if (((f[i-5]) && (c[i-4]=='d') && (c[i-3]=='r') && (c[i-2]=='e') && (c[i-1]=='a') && (c[i]=='m')) ||
			((f[i-7]) && (c[i-6]=='d') && (c[i-5]=='r') && (c[i-4]=='e') && (c[i-3]=='a') && (c[i-2]=='m') && (c[i-1]=='e') && (c[i]=='r')) ||
			((f[i-5]) && (c[i-4]=='e') && (c[i-3]=='r') && (c[i-2]=='a') && (c[i-1]=='s') && (c[i]=='e')) ||
			((f[i-6]) && (c[i-5]=='e') && (c[i-4]=='r') && (c[i-3]=='a') && (c[i-2]=='s') && (c[i-1]=='e') && (c[i]=='r')))
			f[i]=1;
	if (f[l])
		puts("YES");
	else
		puts("NO");
	return 0;
}

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

#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	char *p=(char*)S.c_str();
	while (*p!='\0'){
		if (!memcmp(p,"dreamer",6)){
			p+=6;
			continue;
		}else if (!memcmp(p,"eraser",6)){
			p+=6;
			continue;
		}else if (!memcmp(p,"dream",5)){
			p+=5;
			continue;
		}else if (!memcmp(p,"erase",5)){
			p+=5;
			continue;
		}
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:10:22: error: 'memcmp' was not declared in this scope
   10 |                 if (!memcmp(p,"dreamer",6)){
      |                      ^~~~~~
a.cc:2:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<assert.h>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define mp make_pair
#define pb push_back

////////////////////

int const N = 1e5 +41;
char s[N];
vector<int> q;
int can[N], n;

string str[4] = {"dream", "dreamer", "erase", "eraser"};

void read(){
	scanf("%s",&s);
}

bool canPos(string a, int p){
	if(sz(a) + p > n){
		return false;
	}
	fi(0, sz(a)){
		if(a[i] != s[i+p]){
			return false;
		}
	}
	return true;
}

void solve(){
	n = strlen(s);
	q.pb(0);
	can[0] = 1;
	while(sz(q)){
		int pos = q.back();
		if(pos == n){
				printf("YES\n");
				exit(0);
		}
		q.pop_back();
		fi(0, 4){
			if(canPos(str[i], pos) && !can[pos+sz(str[i])]){
				q.pb(pos + sz(str[i]));
				can[pos + sz(str[i])] = 1;
			}
		}
	}
	
	if(can[n]){
		assert(false);
	}else{
		printf("NO\n");
	}
}

void prepare(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

int main(){
	prepare();
	read();
	solve();





	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:42:13: error: 'strlen' was not declared in this scope
   42 |         n = strlen(s);
      |             ^~~~~~
a.cc:8:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include<assert.h>
  +++ |+#include <cstring>
    8 | using namespace std;
Language: C++

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

const string ss[] = {"dream", "dreamer", "erase", "eraser"};
bool dp[100005];

int main()
{
	string S;
	cin >> S;
	memset(dp, 0, sizeof(dp));
	dp[0] = true;
	for (int pos = 0; pos < S.size(); pos++) {
		if (!dp[pos]) continue;
		for (int i = 0; i < 4; i++) {
			if (S.compare(pos, ss[i].size(), ss[i]) == 0) {
				dp[pos + ss[i].size()] = true;
			}
		}
	}
	if (dp[S.size()]) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(dp, 0, sizeof(dp));
      |         ^~~~~~
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 | #include <string>
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

char str[123456];
int length;

bool f(int i)
{
	if (length == i)return true;
	if (length - i < 5)return false;
	if (length - i >= 7 && str[i] == 'd' && str[i + 1] == 'r' &&str[i + 2] == 'e' &&str[i + 3] == 'a' &&str[i + 4] == 'm' &&str[i + 5] == 'e' &&str[i + 6] == 'r')
	{
		if (f(i + 7))return true;
	}
	if (length - i >= 6 && str[i] == 'e' && str[i + 1] == 'r' &&str[i + 2] == 'a' &&str[i + 3] == 's' &&str[i + 4] == 'e' &&str[i + 5] == 'r')
	{
		return f(i + 6);
	}
	if (str[i] == 'd' && str[i + 1] == 'r' &&str[i + 2] == 'e' &&str[i + 3] == 'a' &&str[i + 4] == 'm')
	{
		return f(i + 5);
	}
	if (length - i >= 6 && str[i] == 'e' && str[i + 1] == 'r' &&str[i + 2] == 'a' &&str[i + 3] == 's' &&str[i + 4] == 'e')
	{
		return f(i + 5);
	}
	return false;
}

int main(void)
{
	scanf("%s", str);
	length = strlen(str);
	if (f(0))
	{
		printf("YES");
	}
	else
	{
		printf("NO");
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:18: error: 'strlen' was not declared in this scope
   51 |         length = strlen(str);
      |                  ^~~~~~
a.cc:20:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   19 | #include <queue>
  +++ |+#include <cstring>
   20 | using namespace std;
Language: C++

#include<bits/stdc++.h>

using namespace std;

string X[] = { "dream","dreamer","erase","eraser" };

bool check( string &S ) {
	if( S == "" ) {
		return true;
	}
	for( size_t i = 0; i < 4; i++ ) {
		if( S.substr( 0, X[i].size() ) == X[i] && check( S.substr( X[i].size() ) ) ) {
			return true;
		}
	}
	return false;
}

int main() {
	string S;
	cin >> S;
	cout << (check( S ) ? "YES" : "NO") << endl;
}

Compiler output:
a.cc: In function 'bool check(std::string&)':
a.cc:12:74: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   12 |                 if( S.substr( 0, X[i].size() ) == X[i] && check( S.substr( X[i].size() ) ) ) {
      |                                                                  ~~~~~~~~^~~~~~~~~~~~~~~
a.cc:7:21: note:   initializing argument 1 of 'bool check(std::string&)'
    7 | bool check( string &S ) {
      |             ~~~~~~~~^
Language: C++

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include "testlib.h"
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	string s; cin >> s;
	int N = s.length();
	vector<bool> dp(N + 1);
	dp[0] = true;
	for (int i = 0; i <= N; i++) {
		if (!dp[i]) continue;
		if (i + 5 <= N && s.substr(i, 5) == "dream")
			dp[i + 5] = true;
		if (i + 7 <= N && s.substr(i, 7) == "dreamer")
			dp[i + 7] = true;
		if (i + 5 <= N && s.substr(i, 5) == "erase")
			dp[i + 5] = true;
		if (i + 6 <= N && s.substr(i, 6) == "eraser")
			dp[i + 6] = true;
	}
	cout << (dp[N] ? "YES" : "NO") << endl;
}


Compiler output:
a.cc:20:10: fatal error: testlib.h: No such file or directory
   20 | #include "testlib.h"
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
int main() {
  int N,K,L;cin>>N>>K>>L;
  UnionFind A(N);
  UnionFind B(N);
  for(int I=0;I<K;I++){
    int X,Y;cin>>X>>Y;X--;Y--;
    A.merge(X,Y);
  }
  for(int I=0;I<L;I++){
    int X,Y;cin>>X>>Y;X--;Y--;
    B.marge(X,Y);
  }
  for(int X=0;X<N;X++){
    int M=0;
    for(int Y=0;Y<N;Y++){
      if(X==Y)continue;
      if(A.issame(X,Y)&&B.issame(X,Y))M++;
    }
    cout<<M<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:7: error: 'struct UnionFind' has no member named 'marge'; did you mean 'merge'?
   41 |     B.marge(X,Y);
      |       ^~~~~
      |       merge
Language: C++

#include <iostream>
#include<map>
using namespace std;
const int maxn = 2e6 + 10;
typedef pair<int, int> P;
int fa[maxn], ma[maxn],ans[maxn];
void init(int n)
{
	for (int i = 0; i <= n; ++i)
	{
		fa[i] = i;
		ma[i] = i;
	}
}
int find(int* fa, int x)//找到根节点
{
	if (fa[x] == x)
	{	
		return fa[x];
	}
	return fa[x] = find(fa, fa[x]);
}
void unin(int a, int b, int* fa)
{
	a = find(fa, a);//找到a根节点
	b = find(fa, b);//找到b跟节点
	fa[a] = b;//a为b的父节点
}
int main()
{
	int n, k, l;
	while (scanf_s("%d%d%d", &n, &k, &l) != EOF)
	{
		init(n);
		for (int i = 0; i < k; ++i)
		{
			int a, b;
			scanf_s("%d%d", &a, &b);
			unin(a, b, ma);
		}
		for (int i = 0; i < l; ++i)
		{
			int a, b;
			scanf_s("%d%d", &a, &b);
			{
				unin(a, b, fa);
			}
		}
		for (int i = 1; i <= n; ++i)
		{
			if (fa[i] == ma[i])
				ans[i]++;
		}
		for (int i = 1; i <= n; ++i)
		{
			if (i != n)
				cout << ans[i] + 1 << " ";
			else
				cout << ans[i] + 1<<endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   32 |         while (scanf_s("%d%d%d", &n, &k, &l) != EOF)
      |                ^~~~~~~
      |                scanf
Language: C++

#include<bits./stdc++.h>
using namespace std;
struct hi{
	int a,b;
} cnt[200005];
int id[200005],id2[2000005],p[200005]
,n,k,l,i,j,m;

int find(int x){
	while (x!=id[x]){
		id[x]=id[id[x]];
		x=id[x];
	}
	return x;
}

int find2(int x){
	while (x!=id2[x]){
		id2[x]=id2[id2[x]];
		x=id2[x];
	}
	return x;
}

void connect(int x,int y){
	x=find(x);y=find(y);
	if (x!=y) id[x]=y;
}

void connect2(int x,int y){
	x=find2(x);y=find2(y);
	if (x!=y) id2[x]=y;
}

bool cmp(hi a,hi b){
	return a.a<b.a;
}

int main(){
	scanf("%d%d%d",&n,&k,&l);
	for (i=1;i<=n;i++){
		id[i]=i;id2[i]=i;
	}
	for (i=1;i<=k;i++){
		scanf("%d%d",&j,&m);
		connect(j,m);
	}
	for (i=1;i<=l;i++){
		scanf("%d%d",&j,&m);
		connect2(j,m);
	}
	for (i=1;i<=n;i++){
		id[i]=find(id[i]);id2[i]=find2(id2[i]);
		cnt[i].a=id[i]*200001+id2[i];cnt[i].b=i;
	}
	sort(cnt+1,cnt+n+1,cmp);
	j=0;k=0;
	for (i=1;i<=n;i++){
		if (cnt[i].a!=cnt[i-1].a) j++;
		p[j]++;
		id[cnt[i].b]=j;
	}
	for (i=1;i<n;i++) printf("%d ",p[id[i]]);
	printf("%d\n",p[id[n]]);
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
import java.util.StringTokenizer;
 
public class Main {
 
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		DreamTask solver = new DreamTask();
		solver.solve(1, in, out);
		out.close();
 
	}
	static class DreamTask{
		
		public void solve(int testcaseNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt(), k= in.nextInt(), l = in.nextInt();
			UF road = new UF(n);
			UF rail = new UF(n);
			int x,y;
			for(int i = -1; ++i < k;) {
				x = in.nextInt(); y = in.nextInt();
				road.union(x,y);
			}
			for(int i = -1; ++i < l;) {
				x = in.nextInt(); y = in.nextInt();
				rail.union(x,y);
			}
			
			HashMap<pair, Integer> map = new HashMap<Dreamer.pair, Integer>();
			pair[] vp = new pair[n+1];
			for(int i = 0; ++i <= n;) {
				pair p = new pair(road.root(i), rail.root(i));
				vp[i] = p;
				if(map.containsKey(p)) map.put(p, map.get(p)+1);
				else map.put(p, 1);
			}
			
			for(int i = 0; ++i <= n;) {
				out.print(map.get(vp[i])+" ");
				
			}
			
			
		}
		
	}
	
/*
4
3
6
9
10
 */
	static class pair{
		int f,s;
 
		public pair(int f, int s) {
			this.f = f;
			this.s = s;
		}
		
		@Override
		public boolean equals(Object o) {
			if(o==null||getClass()!=o.getClass()) return false;
			if(this == o) return true;
			pair p = (pair) o;
			return f == p.f && s == p.s;
			
		}
		
		@Override
		public int hashCode() {
			return Objects.hash(f,s);
		}
	}
	static class UF{
		int[] u;
 
		public UF(int n) {
			u = new int[n+5];
			Arrays.fill(u,-1);
		}
		
		public int root(int x) {return u[x] <0?x:(u[x] = root(u[x]));}
		public void union(int x, int y) {
			x = root(x); y=root(y);
			if(x!=y) {u[x]+=u[y];u[y] = x;}
		}
		
	}
	static class InputReader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next() {
			while(tokenizer==null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
 
}

Compiler output:
Main.java:40: error: package Dreamer does not exist
			HashMap<pair, Integer> map = new HashMap<Dreamer.pair, Integer>();
			                                                ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
import java.util.StringTokenizer;

public class Dreamer {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		DreamTask solver = new DreamTask();
		solver.solve(1, in, out);
		out.close();

	}
	static class DreamTask{
		
		public void solve(int testcaseNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt(), k= in.nextInt(), l = in.nextInt();
			UF road = new UF(n);
			UF rail = new UF(n);
			int x,y;
			for(int i = -1; ++i < k;) {
				x = in.nextInt(); y = in.nextInt();
				road.union(x,y);
			}
			for(int i = -1; ++i < l;) {
				x = in.nextInt(); y = in.nextInt();
				rail.union(x,y);
			}
			
			HashMap<pair, Integer> map = new HashMap<Dreamer.pair, Integer>();
			pair[] vp = new pair[n+1];
			for(int i = 0; ++i <= n;) {
				pair p = new pair(road.root(i), rail.root(i));
				vp[i] = p;
				if(map.containsKey(p)) map.put(p, map.get(p)+1);
				else map.put(p, 1);
			}
			
			for(int i = 0; ++i <= n;) {
				out.print(map.get(vp[i])+" ");
				
			}
			
			
		}
		
	}
	
/*
4
3
6
9
10
 */
	static class pair{
		int f,s;

		public pair(int f, int s) {
			this.f = f;
			this.s = s;
		}
		
		@Override
		public boolean equals(Object o) {
			if(o==null||getClass()!=o.getClass()) return false;
			if(this == o) return true;
			pair p = (pair) o;
			return f == p.f && s == p.s;
			
		}
		
		@Override
		public int hashCode() {
			return Objects.hash(f,s);
		}
	}
	static class UF{
		int[] u;

		public UF(int n) {
			u = new int[n+5];
			Arrays.fill(u,-1);
		}
		
		public int root(int x) {return u[x] <0?x:(u[x] = root(u[x]));}
		public void union(int x, int y) {
			x = root(x); y=root(y);
			if(x!=y) {u[x]+=u[y];u[y] = x;}
		}
		
	}
	static class InputReader{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next() {
			while(tokenizer==null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}

}

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

#include<bits/stdc++.h>
using namespace std;
int par1[200001],par2[200001];
vector<pair<int,int>> idx;
map<pair<int,int>,int> cnt;
int rep1(int n)
{
    if(par1[n]==n)
        return n;
    return par1[n]=rep1(par1[n]);
}
int rep2(int n)
{
    if(par2[n]==n)
        return n;
    return par2[n]=rep2(par2[n]);
}
int main()
{
    int i,j;
    int n,k,l;
    int a,b,res=0;
    scanf("%d %d %d",&n,&k,&l);
    for(i=1;i<=n;i++){
        par1[i]=i;
        par2[i]=i;
    }
    for(i=0;i<k;i++){
        scanf("%d %d",&a,&b);
        swap(a,b);
        int r1=rep1(a);
        int r2=rep1(b);
        par1[r1]=r2;
    }
    for(i=0;i<l;i++){
        scanf("%d %d",&a,&b);
        int r1=rep2(a);
        int r2=rep2(b);
        par2[r1]=r2;
    }
    for(i=1;i<=n;i++){
            
        idx.push_back(make_pair(rep1(i),rep2(i)));
    }

    for(i=0;i<idx.size();i++){
            assert(idx[i].fi == idx[i].se);
        cnt[idx[i]]++;
        //printf("%d %d\n",idx[i].first,idx[i].second);
    }
    for(i=0;i<idx.size();i++)
        printf("%d ",cnt[idx[i]]);
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:47:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'fi'
   47 |             assert(idx[i].fi == idx[i].se);
      |                           ^~
a.cc:47:40: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'se'
   47 |             assert(idx[i].fi == idx[i].se);
      |                                        ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

/* Union-Find-Tree */
/* 必ず要素数をコンストラクタに入れること */
template <class T = long long>
class Union_Find {
  using size_type = std::size_t;
  using _Tp = T;
public:

  vector<_Tp> par;
  vector<_Tp> rnk;

  // 親の根を返す。値の変更は認めない。
  const _Tp & operator[] (size_type child) const {
    return find(child);
  }

  Union_Find (_Tp n) {
    par.resize(n), rnk.resize(n);
    for (int i = 0; i < n; ++i) {
      par[i] = i;
      rnk[i] = 0;
    }
  }

  // 木の根を求める
  _Tp find(_Tp x) const {
    if (par[x] == x)
      return x;
    else
      return par[x] = find(par[x]);
  }

  // xとyの属する集合を併合
  void merge(_Tp x, _Tp y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rnk[x] < rnk[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rnk[x] == rnk[y]) rnk[x]++;
    }
  }

  // xとyが同じ集合に属するか否か
  bool same(_Tp x, _Tp y) {
    return find(x) == find(y);
  }
};


int main() {
  int n,k,l;
  cin >> n >> k >> l;
  Union_Find uf_road(n+1), uf_train(n+1);

  int r,s;
  rep(i,k) {
    cin >> r >> s;
    uf_road.merge(r, s);
  }

  rep(i,l) {
    cin >> r >> s;
    uf_train.merge(r, s);
  }

  /*for (int i = 1; i <= n; ++i) {
    cout << uf_train.find(i) << " ";
  }
  END;*/

  vector<pair<int,int> > com;
  map<pair<int,int>, int> mp;

  for (int i = 1; i <= n; ++i) {
    int a, b;
    a = uf_road.find(i);
    b = uf_train.find(i);
    com.push_back(make_pair(a,b));
    mp[make_pair(a,b)] += 1;
  }

  for (int i = 0; i < n; ++i) {
    cout << mp[com[i]] << " ";
  }

  END;
}


Compiler output:
a.cc: In instantiation of 'Union_Find<T>::_Tp Union_Find<T>::find(_Tp) const [with T = int; _Tp = int]':
a.cc:110:21:   required from here
  110 |     a = uf_road.find(i);
      |         ~~~~~~~~~~~~^~~
a.cc:60:21: error: assignment of read-only location '((const Union_Find<int>*)this)->Union_Find<int>::par.std::vector<int, std::allocator<int> >::operator[](((std::vector<int, std::allocator<int> >::size_type)x))'
   60 |       return par[x] = find(par[x]);
      |              ~~~~~~~^~~~~~~~~~~~~~
Language: C++

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

//#define int ll
int N, K, L;
set<int> adj1[202020];
set<int> adj2[202020];
int cnt[202020];
vector<set<int>> S1;
vector<set<int>> SS;
bool visited1[202020],visited2[202020];
class DConnectivity {
public:
   
    void dfs1(int s,set<int> &v){
        if(visited1[s])return ;
        v.insert(s);
        visited1[s] = 1;
        for(int node : adj1[s])dfs1(node,v);
    }

    void dfs2(int s, set<int> connected,set<int>& ac){
        if(visited2[s] || !connected.count(s))return ;
        ac.insert(s);
        visited2[s] = 1;
        for(int node: adj2[s])dfs2(node, connected,ac);
    }
    void solve(std::istream& cin, std::ostream& cout) {
        cin >> N >> K >> L;
        memset(cnt,0,sizeof(cnt));
        _for(i,K){
            int a,b;
            cin >> a >> b;
            adj1[a].insert(b);
            adj1[b].insert(a);
        }
        _for(i,L){
            int a,b;
            cin >> a >> b;
            adj2[a].insert(b);
            adj2[b].insert(a);
        }
        _for(i,N){
            set<int> v = {};
            dfs1(i+1,v);
            if(!v.empty())S1.push_back(v);
        }
        for(auto connected1 : S1){
            for(auto node : connected1){
                set<int> s = {};
                dfs2(node, connected1, s);
                SS.emplace_back(s);
            }
        }
        for(auto ac : SS)for(auto node : ac)cnt[node] = ac.size();
        _for(i,N)cout << cnt[i+1] << " \n"[i==N-1];
    }
};


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;
#define ll long long
#define MAXN 200010
vector<ll> c(MAXN,1);
ll par[MAXN]; // 親
ll deep[MAXN]; // 深さ

// in要素で初期化
ll init(ll in){
  for(int i=0;i<=in;i++){
    par[i]=i;
    deep[i]=0;
  }
}

// 木の根を求める
ll find(ll x){
  if(par[x]==x){
    return x;
  }else{
    return par[x]=find(par[x]);
  }
}

// xとyの集合を併合
void unite(ll x,ll y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(deep[x]<deep[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(deep[x]==deep[y]) deep[x]++;
  }
}

// xとyが同じ集合に属するか否か
bool same(ll x,ll y){
  return find(x)==find(y);
}

ll pard[MAXN]; // 親
ll deepd[MAXN]; // 深さ

// in要素で初期化
ll initd(ll in){
  for(int i=0;i<=in;i++){
    pard[i]=i;
    deepd[i]=0;
  }
}

// 木の根を求める
ll findd(ll x){
  if(pard[x]==x){
    return x;
  }else{
    return pard[x]=findd(pard[x]);
  }
}

// xとyの集合を併合
void united(ll x,ll y){
  x=findd(x);
  y=findd(y);
  if(x==y) return;
  if(deepd[x]<deepd[y]){
    c[y]+=c[x];
    pard[x]=y;
  }else{
    c[x]+=c[y];
    pard[y]=x;
    if(deepd[x]==deepd[y]) deepd[x]++;
  }
}

// xとyが同じ集合に属するか否か
bool samed(ll x,ll y){
  return findd(x)==findd(y);
}

int main(){
  ll n,k,l,p,q;
  cin>>n>>k>>l;
  init(n); initd(n);
  for(int i=0;i<k;i++){
    cin>>p>>q;
    unite(p,q);
  }
  for(int i=0;i<l;i++){
    cin>>p>>q;
    if(same(p,q)){
      unitd(p,q);
    }
  }
  for(int i=1;i<=n;i++){
    cout<<c[findd(i)]<<" ";
  }
}

Compiler output:
a.cc: In function 'long long int init(long long int)':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'long long int initd(long long int)':
a.cc:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^
a.cc: In function 'int main()':
a.cc:95:7: error: 'unitd' was not declared in this scope; did you mean 'united'?
   95 |       unitd(p,q);
      |       ^~~~~
      |       united
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXN 200010
vector<ll> c(MAXN,1);
ll par[MAXN]; // 親
ll deep[MAXN]; // 深さ

// in要素で初期化
ll init(ll in){
  for(int i=0;i<=in;i++){
    par[i]=i;
    deep[i]=0;
  }
}

// 木の根を求める
ll find(ll x){
  if(par[x]==x){
    return x;
  }else{
    return par[x]=find(par[x]);
  }
}

// xとyの集合を併合
void unite(ll x,ll y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(deep[x]<deep[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(deep[x]==deep[y]) deep[x]++;
  }
}

// xとyが同じ集合に属するか否か
bool same(ll x,ll y){
  return find(x)==find(y);
}

ll pard[MAXN]; // 親
ll deepd[MAXN]; // 深さ

// in要素で初期化
ll initd(ll in){
  for(int i=0;i<=in;i++){
    pard[i]=i;
    deepd[i]=0;
  }
}

// 木の根を求める
ll findd(ll x){
  if(pard[x]==x){
    return x;
  }else{
    return pard[x]=findd(pard[x]);
  }
}

// xとyの集合を併合
void united(ll x,ll y){
  x=findd(x);
  y=findd(y);
  if(x==y) return;
  if(deepd[x]<deepd[y]){
    c[y]+=c[x];
    pard[x]=y;
  }else{
    c[x]+=c[y];
    pard[y]=x;
    if(deepd[x]==deepd[y]) deepd[x]++;
  }
}

// xとyが同じ集合に属するか否か
bool samed(ll x,ll y){
  return findd(x)==findd(y);
}

int main(){
  ll n,k,l,p,q;
  cin>>n>>k>>l;
  init(n); initd(n)
  for(int i=0;i<k;i++){
    cin>>p>>q;
    unite(p,q);
  }
  for(int i=0;i<l;i++){
    cin>>p>>q;
    if(same(p,q)){
      unitd(p,q);
    }
  }
  for(int i=1;i<=n;i++){
    cout<<c[findd(i)]<<" ";
  }
}

Compiler output:
a.cc: In function 'long long int init(long long int)':
a.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]
   15 | }
      | ^
a.cc: In function 'long long int initd(long long int)':
a.cc:53:1: warning: no return statement in function returning non-void [-Wreturn-type]
   53 | }
      | ^
a.cc: In function 'int main()':
a.cc:87:20: error: expected ';' before 'for'
   87 |   init(n); initd(n)
      |                    ^
      |                    ;
   88 |   for(int i=0;i<k;i++){
      |   ~~~               
a.cc:88:15: error: 'i' was not declared in this scope
   88 |   for(int i=0;i<k;i++){
      |               ^
a.cc:95:7: error: 'unitd' was not declared in this scope; did you mean 'united'?
   95 |       unitd(p,q);
      |       ^~~~~
      |       united
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int N=1000000;
int road[N];
int raw[N];
int ans[N];
map<pair<int,int>,int> s;
int xz(int x,char c)
{
	if(c=='a')
		while(road[x]!=x) x=road[x];
	if(c=='b')
		while(raw[x]!=x)	x=raw[x];
	return x;
}
bool judge(int x,int y,char c)
{
	x=xz(x,c);
	y=xz(y,c);
	if(x==y)	return 1;
	else return 0;
}
void hb(int x,int y,char c)
{
	x=xz(x,c);
	y=xz(y,c);
	if(c=='a')	road[y]=x;
	if(c=='b')	raw[y]=x;
	
}
int main()
{
	int n,a0,b0;
	int from,to;
	for(int i=1;i<=n;i++)
		road[i]=i,raw[i]=i;
	for(int i=1;i<=a0;i++)
	{
		cin>>from>>to;
		hb(from,to,a);
	}
	for(int i=1;i<=b0;i++)
	{
		cin>>from>>to;
		hb(from,to,b);
	}
	for(int i=1;i<=n;i++)
	{
		s[{road[i],raw[i]}]++;
	}
	for(int i=1;i<=n;i++)
		cout<<s[{road[i],raw[i]}]<<" ";
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:28: error: 'a' was not declared in this scope
   44 |                 hb(from,to,a);
      |                            ^
a.cc:49:28: error: 'b' was not declared in this scope
   49 |                 hb(from,to,b);
      |                            ^
Language: C++


N,K,L=map(int,input().split())
len = [[[] for s in range(N)] for t in range (2)]
i=1
j=1
while i <= K:
    a,b=map(int,input().split())
    len[0][a-1].append(b-1)
    len[0][b-1].append(a-1)
    i+=1

while j <= L:
    a,b=map(int,input().split())
    len[1][a-1].append(b-1)
    len[1][b-1].append(a-1)
    j+=1

def add(z,n):
    for num1 in len[z][n]:
        for num2 in len[z][num1]:
            if num2 != n and num2 not in len[z][n]:
                len[z][n].append(num2)
                add(z,num2)
n=0
while n < N:
	add(0,n)
	add(1,n)
    n+=1

n=0
answer=[1]*N
while n < N:
    for point in len[0][n]:
        if point in len[1][n]:
            answer[n]+=1
    n+=1

n=0
while n<N-1:
    print(answer[n],end=' ')
    n+=1
print(answer[N-1])

Compiler output:
a.cc:2:1: error: 'N' does not name a type
    2 | N,K,L=map(int,input().split())
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<numeric>
#include <unordered_map>
 
using namespace std;
 
long long find(long long x, std::vector<long long>& par) {
	if (par[x] == x) return x;
	return par[x] = find(par[x],par);
}
 
 
long long main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long n, k, l;
	cin >> n >> k >> l;
	vector<long long> rpar(n);
	iota(rpar.begin(), rpar.end(), 0);
	vector<long long>rnk(n, 0);
	long long p, q;
	// 道路
	for (long long i = 0; i < k; i++) {
		cin >> p >> q;
		--p; --q;
		p = find(p,rpar);
		q = find(q,rpar);
		if (p == q) continue;
		if (rnk[p] < rnk[q]) {
			rpar[p] = q;
		}
		else {
			rpar[q] = p;
			if (rnk[p] == rnk[q]) rnk[p]++;
		}
	}
	// 線路
	vector<long long> lpar(n);
	vector<long long> ans(n, 1);
	iota(lpar.begin(), lpar.end(), 0);
	fill(rnk.begin(), rnk.end(), 0);
	for (long long i = 0; i < l; i++) {
		cin >> p >> q;
		--p; --q;
		if (find(p, rpar) != find(q, rpar))continue;
		p = find(p, lpar);
		q = find(q, lpar);
		if (p == q) continue;
		if (rnk[p] < rnk[q]) {
			lpar[p] = q;
			ans[q] += ans[p];
		}
		else {
			lpar[q] = p;
			ans[p] += ans[q];
			if (rnk[p] == rnk[q]) rnk[p]++;
		}
	}
	for (long long i = 0; i < n-1; i++) {
		cout << to_string(ans[lpar[i]]) << " ";
	}
	cout << to_string(ans[lpar[n - 1]]) << endl;
 
 
	return 0;
}

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

#include<iostream>

using namespace std;

const static int MAX_N = 2 * 100000;
int N, K, L;
bool roads[MAX_N + 1][MAX_N + 1];

int c_roads[MAX_N + 1];
int c_rails[MAX_N + 1];

void rec_roads(int p, int c) {
  for (int q = p; q <= N; q++) {
    if (roads[p][q] == 1) {
      c_roads[q] = c;
      roads[p][q] = 0;
      roads[q][p] = 0;
      rec_roads(q, c);
    }
  }
}

void rec_rails(int r, int c) {
  for (int s = r; s <= N; s++) {
    if (roads[r][s] == 1) {
      c_rails[s] = c;
      roads[r][s] = 0;
      roads[s][r] = 0;
      rec_rails(s, c);
    }
  }
}

int main() {
  cin >> N >> K >> L;

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int p, q;
  for (int i = 1; i <= K; i++) {
    cin >> p >> q;
    roads[p][q] = 1;
    roads[q][p] = 1;
  }
  
  for (p = 1; p <= N; p++) {
    rec_roads(p, p);
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      roads[i][j] = 0;
    }
  }

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int r, s;
  for (int i = 1; i <= L; i++) {
    cin >> r >> s;
    roads[r][s] = 1;
    roads[s][r] = 1;
  }


  for (r = 1; r <= N; r++) {
    rec_rails(r, r);
  }

  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int j = 1; j <= N; j++) {
      if (c_roads[i] == c_roads[j] && c_rails[i] == c_rails[j])
        cnt += 1;
    }
    cout << cnt;
    if (i != N)
      cout << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/ccmJYFZ5.o: in function `rec_roads(int, int)':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccmJYFZ5.o
/tmp/ccmJYFZ5.o: in function `rec_rails(int, int)':
a.cc:(.text+0x11a): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccmJYFZ5.o
/tmp/ccmJYFZ5.o: in function `main':
a.cc:(.text+0x419): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccmJYFZ5.o
a.cc:(.text+0x430): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccmJYFZ5.o
a.cc:(.text+0x44b): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccmJYFZ5.o
a.cc:(.text+0x462): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccmJYFZ5.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>

using namespace std;

const static int MAX_N = 2 * 100000;
int N, K, L;
short roads[MAX_N + 1][MAX_N + 1];

int c_roads[MAX_N + 1];
int c_rails[MAX_N + 1];

void rec_roads(int p, int c) {
  for (int q = p; q <= N; q++) {
    if (roads[p][q] == 1) {
      c_roads[q] = c;
      roads[p][q] = 0;
      roads[q][p] = 0;
      rec_roads(q, c);
    }
  }
}

void rec_rails(int r, int c) {
  for (int s = r; s <= N; s++) {
    if (roads[r][s] == 1) {
      c_rails[s] = c;
      roads[r][s] = 0;
      roads[s][r] = 0;
      rec_rails(s, c);
    }
  }
}

int main() {
  cin >> N >> K >> L;

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int p, q;
  for (int i = 1; i <= K; i++) {
    cin >> p >> q;
    roads[p][q] = 1;
    roads[q][p] = 1;
  }
  
  for (p = 1; p <= N; p++) {
    rec_roads(p, p);
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      roads[i][j] = 0;
    }
  }

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int r, s;
  for (int i = 1; i <= L; i++) {
    cin >> r >> s;
    roads[r][s] = 1;
    roads[s][r] = 1;
  }


  for (r = 1; r <= N; r++) {
    rec_rails(r, r);
  }

  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int j = 1; j <= N; j++) {
      if (c_roads[i] == c_roads[j] && c_rails[i] == c_rails[j])
        cnt += 1;
    }
    cout << cnt;
    if (i != N)
      cout << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/ccECphvz.o: in function `rec_roads(int, int)':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccECphvz.o
/tmp/ccECphvz.o: in function `rec_rails(int, int)':
a.cc:(.text+0x122): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccECphvz.o
/tmp/ccECphvz.o: in function `main':
a.cc:(.text+0x449): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccECphvz.o
a.cc:(.text+0x460): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccECphvz.o
a.cc:(.text+0x47b): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccECphvz.o
a.cc:(.text+0x492): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccECphvz.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>

using namespace std;

const static int MAX_N = 2 * 100000;
int N, K, L;
short roads[MAX_N + 1][MAX_N + 1];

int c_roads[MAX_N + 1];
int c_rails[MAX_N + 1];

void rec_roads(int p, int c) {
  for (int q = p; q <= N; q++) {
    if (roads[p][q] == 1) {
      c_roads[q] = c;
      roads[p][q] = 0;
      roads[q][p] = 0;
      rec_roads(q, c);
    }
  }
}

void rec_rails(int r, int c) {
  for (int s = r; s <= N; s++) {
    if (roads[r][s] == 1) {
      c_rails[s] = c;
      roads[r][s] = 0;
      roads[s][r] = 0;
      rec_rails(s, c);
    }
  }
}

int main() {
  cin >> N >> K >> L;

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int p, q;
  for (int i = 1; i <= K; i++) {
    cin >> p >> q;
    roads[p][q] = 1;
    roads[q][p] = 1;
  }
  
  for (p = 1; p <= N; p++) {
    rec_roads(p, p);
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      roads[i][j] = 0;
    }
  }

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int r, s;
  for (int i = 1; i <= L; i++) {
    cin >> r >> s;
    roads[r][s] = 1;
    roads[s][r] = 1;
  }


  for (r = 1; r <= N; r++) {
    rec_rails(r, r);
  }

  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int j = 1; j <= N; j++) {
      if (c_roads[i] == c_roads[j] && c_rails[i] == c_rails[j])
        cnt += 1;
    }
    cout << cnt;
    if (i != N)
      cout << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/cc2K85s9.o: in function `rec_roads(int, int)':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/cc2K85s9.o
/tmp/cc2K85s9.o: in function `rec_rails(int, int)':
a.cc:(.text+0x122): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/cc2K85s9.o
/tmp/cc2K85s9.o: in function `main':
a.cc:(.text+0x449): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/cc2K85s9.o
a.cc:(.text+0x460): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/cc2K85s9.o
a.cc:(.text+0x47b): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/cc2K85s9.o
a.cc:(.text+0x492): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/cc2K85s9.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>

using namespace std;

const static int MAX_N = 2 * 100000;
int N, K, L;
int roads[MAX_N + 1][MAX_N + 1];

int c_roads[MAX_N + 1];
int c_rails[MAX_N + 1];

void rec_roads(int p, int c) {
  for (int q = p; q <= N; q++) {
    if (roads[p][q] == 1) {
      c_roads[q] = c;
      roads[p][q] = 0;
      roads[q][p] = 0;
      rec_roads(q, c);
    }
  }
}

void rec_rails(int r, int c) {
  for (int s = r; s <= N; s++) {
    if (roads[r][s] == 1) {
      c_rails[s] = c;
      roads[r][s] = 0;
      roads[s][r] = 0;
      rec_rails(s, c);
    }
  }
}

int main() {
  cin >> N >> K >> L;

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int p, q;
  for (int i = 1; i <= K; i++) {
    cin >> p >> q;
    roads[p][q] = 1;
    roads[q][p] = 1;
  }
  
  for (p = 1; p <= N; p++) {
    rec_roads(p, p);
  }
  
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      roads[i][j] = 0;
    }
  }

  for (int i = 1; i <= N; i++) {
    roads[i][i] = 1;
  }

  int r, s;
  for (int i = 1; i <= L; i++) {
    cin >> r >> s;
    roads[r][s] = 1;
    roads[s][r] = 1;
  }


  for (r = 1; r <= N; r++) {
    rec_rails(r, r);
  }

  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int j = 1; j <= N; j++) {
      if (c_roads[i] == c_roads[j] && c_rails[i] == c_rails[j])
        cnt += 1;
    }
    cout << cnt;
    if (i != N)
      cout << " ";
  }
  cout << endl;

  return 0;
}


Compiler output:
/tmp/ccm2UEBA.o: in function `rec_roads(int, int)':
a.cc:(.text+0x55): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccm2UEBA.o
/tmp/ccm2UEBA.o: in function `rec_rails(int, int)':
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccm2UEBA.o
/tmp/ccm2UEBA.o: in function `main':
a.cc:(.text+0x482): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccm2UEBA.o
a.cc:(.text+0x499): relocation truncated to fit: R_X86_64_PC32 against symbol `c_roads' defined in .bss section in /tmp/ccm2UEBA.o
a.cc:(.text+0x4b4): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccm2UEBA.o
a.cc:(.text+0x4cb): relocation truncated to fit: R_X86_64_PC32 against symbol `c_rails' defined in .bss section in /tmp/ccm2UEBA.o
collect2: error: ld returned 1 exit status