criyle/codenet-compile-errors huggingface dataset:
Language: Java

import sun.font.TrueTypeFont;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    static List<HashSet<Integer>> group ;
    static List<HashSet<Integer>> group2 ;
    static int[] roads ;
    static int[] rialways ;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        int k = in.nextInt();
        int l = in.nextInt();
        roads = new int[n+1];
        rialways = new int[n+1];
        group = new ArrayList<>(n+1);
        group2 = new ArrayList<>(n+1);
        HashMap<String,Integer> mem = new HashMap<>();
        for(int i=1;i<=n;i++){
            roads[i]=i;
            rialways[i]=i;
        }
        for(int i =0;i<=n;i++){
            group.add(new HashSet<>());
            group2.add(new HashSet<>());
        }
        for(int i=0;i<k;i++){
            int a = in.nextInt();
            int b = in.nextInt();
            int boss1 = find_parent(roads,roads[a],a);
            int boss2 = find_parent(roads,roads[b],b);
            int mn = Math.min(boss1,boss2);
            roads[boss1]=mn;
            roads[boss2]=mn;
        }
        for(int i=0;i<l;i++){
            int a = in.nextInt();
            int b = in.nextInt();
            int boss1 = find_parent(rialways,rialways[a],a);
            int boss2 = find_parent(rialways,rialways[b],b);

        for(int i=1;i<=n;i++){
            int boss = find_parent(roads,roads[i],i);
            group.get(boss).add(i);
            roads[i]=boss;
            boss = find_parent(rialways,rialways[i],i);
            group2.get(boss).add(i);
            rialways[i]=boss;
        }

        for(int i=1;i<=n;i++){
            int j = roads[i];
            int jj = rialways[i];
            HashSet<Integer> intersect = new HashSet<>(group.get(j));
            intersect.retainAll(group2.get(jj));
            System.out.print(intersect.size()+" ");
        }
    }
    static int find_parent(int[] arr,int p,int i){
        if(p==i){
            return i;
        }
        else {
            return find_parent(arr,arr[p],p);
        }
    }

}


Compiler output:
Main.java:65: error: illegal start of expression
    static int find_parent(int[] arr,int p,int i){
    ^
1 error
Language: Java

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Connectivity {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        int k = in.nextInt();
        int l = in.nextInt();
        int[] roads = new int[n+1];
        int[] rialways = new int[n+1];
        List<HashSet<Integer>> group = new ArrayList<>(n+1);
        List<HashSet<Integer>> group2 = new ArrayList<>(n+1);
        HashMap<String,Integer> mem = new HashMap<>();
        for(int i =0;i<=n;i++){
            group.add(new HashSet<>());
            group2.add(new HashSet<>());
        }
        for(int i=0;i<k;i++){
            int a = in.nextInt();
            int b = in.nextInt();
            if (a<b){
                if (roads[a]==0)
                    roads[b]=a;
                else
                    roads[b]=roads[a];
            }
            else{
                if (roads[b]==0)
                    roads[a]=b;
                else
                    roads[b]=roads[a];
            }

        }
        for(int i=0;i<l;i++){
            int a = in.nextInt();
            int b = in.nextInt();
            if (a<b){
                if (rialways[a]==0)
                    rialways[b]=a;
                else
                    rialways[b]=roads[a];
            }
            else{
                if (rialways[b]==0)
                    rialways[a]=b;
                else
                    rialways[b]=roads[a];
            }

        }

        for(int i=1;i<=n;i++){
            if (roads[i]==0)
                group.get(i).add(i);
            else{
                int boss = roads[i];
                if (roads[boss] ==0)
                    group.get(boss).add(i);
                else{
                    group.get(roads[boss]).add(i);
                    roads[i] = roads[boss];
                }
            }


        }
        for(int i=1;i<=n;i++){
            if (rialways[i]==0)
                group2.get(i).add(i);
            else{
                int boss = rialways[i];
                if (rialways[boss] ==0)
                    group2.get(boss).add(i);
                else{
                    group2.get(rialways[boss]).add(i);
                    rialways[i] = rialways[boss];
                }
            }


        }
        for(int i=1;i<=n;i++){
            int j,jj;
            if (roads[i]==0)
                j = i;
            else
                j= roads[i];
            if (rialways[i]==0)
                jj = i;
            else
                jj= rialways[i];
            HashSet<Integer> intersect = new HashSet<>(group.get(j));
            intersect.retainAll(group2.get(jj));
            System.out.print(intersect.size()+" ");
        }
    }

}


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

#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;



struct UnionFind
{
    int n;
    vector<int> parent;
    vector<int> rank;
    UnionFind(int _n) :n(_n)
    {
        parent.assign(n, -1);
        rank.assign(n, 1);
    }

    int find(int i)
    {
        if (parent[i] == -1)
            return i;
        else
            return parent[i] = find(parent[i]);
    }

    void unite(int i, int j)
    {
        i = find(i);
        j = find(j);

        if (i == j) return;

        if (rank[i] == rank[j])
        {
            parent[j] = i;
            ++rank[i];
        }
        else
        {
            if (rank[i] < rank[j]) swap(i, j);
            parent[j] = i;
        }
    }

    bool is_same(int i, int j)
    {
        return find(i) == find(j);
    }
};

int main()
{
    int n, k, l;
    cin >> n >> k >> l;

    UnionFind uf_road(n);
    rep(i, 0, k)
    {
        int p, q;
        cin >> p >> q;
        --p, --q;
        uf_road.unite(p, q);
    }

    UnionFind uf_express(n);
    rep(i, 0, l)
    {
        int p, q;
        cin >> p >> q;
        --p, --q;
        uf_express.unite(p, q);
    }

    map<pii, int> type_cnt;
    rep(i, 0, n)
    {
        int p1, p2;
        p1 = uf_road.find(i);
        p2 = uf_express.find(i);
        ++type_cnt[make_pair(p1, p2)];
    }
    rep(i, 0, n)
    {
        int p1, p2;
        p1 = uf_road.find(i);
        p2 = uf_express.fsind(i);
        printf("%d ", type_cnt[make_pair(p1, p2)]);
    }
    cout << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:25: error: 'struct UnionFind' has no member named 'fsind'; did you mean 'find'?
   89 |         p2 = uf_express.fsind(i);
      |                         ^~~~~
      |                         find
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

class UnionFind {
public:

  vector<int> Parent;

  UnionFind(int N) {
    Parent = vector<int>(N, -1);
  }

  int root(int A) {
    if (Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }

  int size(int A) {
    return -Parent[root(A)];
  }

  bool connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) return false;

    if (size(A) < size(B)) swap(A, B);

    Parent[A] += Parent[B];
    Parent[B] = A;

    return true;
  }

};

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

  UnionFind road(N);
  UnionFind rail(N);

  rep(i, K) {
    int p, q; cin >> p >> q;
    road.connect(p-1, q-1);
  }

  rep(i, L) {
    int p, q; cin >> p >> q;
    rail.connect(p-1, q-1);
  }

  map<pair<int, int>, int> cnt;
  rep(i, N) {
    pair<int, int> p = make_pair(road.root(i), rail.root(i));

    auto itr = cnt.find(p);
    if (itr != cnt.end()) {
      cnt[p]++;
    } else {
      cnt[p] = 1;
    }
  }

  rep(i, N) {
    pair<int, int> p = make_pair(road.root(i), rail.root(i));
    cout << cnt[p] << " ";
  }


  return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:75:12: error: expected '}' at end of input
   75 |   return 0;
      |            ^
a.cc:41:12: note: to match this '{'
   41 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;

class UnionFind {
public:
	vector<int>par, rank
    //vector<int>node;
	UnionFind(int n) :par(n), rank(n, 0)/*,node(n,1)*/ {
		for (int i = 0;i < n;i++)par[i] = i;
	}
	/*void init(int n) {
		for (int i = 0;i < n;i++) {
			par[i] = i;
			rank[i] = 0;
			node[i] = 1;
		}
	}*/

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

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	void unite_tree(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	int root_size(int x){
		return rank[find(x)];
	}

	/*int size(int x) {
		return node[find(x)];
	}

	void unite_node(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (size(x) < size(y))swap(x, y);
		node[x] += node[y];
		par[y] = par[x];
	}*/
};


int main(void){
    int n,k,l;
    int p,q;
    map<P,int>num;
    cin>>n>>k>>l;
    UnionFind uf(n),uf1(n);
    for(int i=0;i<k;i++){
        cin>>p>>q;
        uf.unite_tree(p,q);
    }
    for(int i=0;i<l;i++){
        cin>>p>>q;
        uf1.unite_tree(p,q);
    }
    for(int i=1;i<=n;i++){
        p=uf.find(i);
        q=uf1.find(i);
        num[P(p,q)]++;
    }
    for(int i=1;i<=n;i++){
        if(i==n){
            p=uf.find(i);
            q=uf1.find(i);
            cout<<num[P(p,q)]<<endl;
        }
        else{
            p=uf.find(i);
            q=uf1.find(i);
            cout<<num[P(p,q)]<<" ";
        }
    }
    return 0;
}

Compiler output:
a.cc:18:25: error: expected ';' at end of member declaration
   18 |         vector<int>par, rank
      |                         ^~~~
      |                             ;
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;

class UnionFind {
public:
	vector<int>par, rank
    //vector<int>node;
	UnionFind(int n) :par(n), rank(n, 0)/*,node(n,1)*/ {
		for (int i = 0;i < n;i++)par[i] = i;
	}
	void init(int n) {
		for (int i = 0;i < n;i++) {
			par[i] = i;
			rank[i] = 0;
			node[i] = 1;
		}
	}

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

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	void unite_tree(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	int root_size(int x){
		return rank[find(x)];
	}

	int size(int x) {
		return node[find(x)];
	}

	/*void unite_node(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (size(x) < size(y))swap(x, y);
		node[x] += node[y];
		par[y] = par[x];
	}*/
};


int main(void){
    int n,k,l;
    int p,q;
    map<P,int>num;
    cin>>n>>k>>l;
    UnionFind uf(n),uf1(n);
    for(int i=0;i<k;i++){
        cin>>p>>q;
        uf.unite_tree(p,q);
    }
    for(int i=0;i<l;i++){
        cin>>p>>q;
        uf1.unite_tree(p,q);
    }
    for(int i=1;i<=n;i++){
        p=uf.find(i);
        q=uf1.find(i);
        num[P(p,q)]++;
    }
    for(int i=1;i<=n;i++){
        if(i==n){
            p=uf.find(i);
            q=uf1.find(i);
            cout<<num[P(p,q)]<<endl;
        }
        else{
            p=uf.find(i);
            q=uf1.find(i);
            cout<<num[P(p,q)]<<" ";
        }
    }
    return 0;
}

Compiler output:
a.cc:18:25: error: expected ';' at end of member declaration
   18 |         vector<int>par, rank
      |                         ^~~~
      |                             ;
a.cc: In member function 'void UnionFind::init(int)':
a.cc:27:25: error: 'node' was not declared in this scope
   27 |                         node[i] = 1;
      |                         ^~~~
a.cc: In member function 'int UnionFind::size(int)':
a.cc:56:24: error: 'node' was not declared in this scope
   56 |                 return node[find(x)];
      |                        ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007

template<class T>
inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T>
inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;


struct UnionFind {
    vector<int> rank, parent;

    UnionFind() {}

    UnionFind(int size) {
        rank.resize(size, 0);
        parent.resize(size, 0);
        for (int i = 0; i < size; ++i) {
            makeSet(i);
        }
    }

    void makeSet(int x) {
        parent[x] = x;
        rank[x] = 0;
    }

    void link(int x, int y) {
        if (rank[x] < rank[y]) {
            parent[x] = y;
        } else {
            parent[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    void unite(int x, int y) {
        link(find(x), find(y));
    }

    int find(int x) {
        if (parent[x] != x) {
            parent[x] = find(parent[x]);
        }
        return parent[x];
    }
};

int main() {
    int n, k, l, p, q;
    cin >> n >> k >> l;
    UnionFind ro(n+1);
    UnionFind ra(n+1);
    rep(i, k){
        cin >> p >> q;
        ro.unite(p, q);
    }
    rep(i, l){
        cin >> p >> q;
        ra.unite(p, q);
    }
    vector<pair<int,int> > com(n);
    map<pair<int,int> ,int> s;1
    reps(i, n){
        com[i].first = ro.find(i);
        com[i].second =  ra.find(i);
        s[com[i]]++;
    }
    for(int i = 0; i < n; i++){
        cout << s[com[i]] << " ";
    }printf("\n");
}



Compiler output:
a.cc: In function 'int main()':
a.cc:97:32: error: expected ';' before 'for'
   97 |     map<pair<int,int> ,int> s;1
      |                                ^
      |                                ;
a.cc:98:10: error: 'i' was not declared in this scope
   98 |     reps(i, n){
      |          ^
a.cc:20:32: note: in definition of macro 'reps'
   20 | #define reps(i, x) for(int i=1;i<=(int)(x);i++)
      |                                ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
// https://tmasaaa.github.io/kaito_procon/procon/201810041749.html
class UnionFind {
  private:
    vector<int> parent;
    vector<int> height;
    vector<int> m_size;

  public:
    UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    void init(int size_) {
        parent.resize(size_);
        height.resize(size_, 0);
        m_size.resize(size_, 0);
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    int find(int x) {
        if(parent[x] == x)
            return x;
        return parent[x] = find(parent[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y)
            return;
        int t = size(x) + size(y);
        m_size[x] = m_size[y] = t;
        if(height[x] < height[y])
            parent[x] = y;
        else
            parent[y] = x;
        if(height[x] == height[y])
            ++height[x];
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) {
        if(parent[x] == x)
            return m_size[x];
        return size(parent[x] = find(parent[x]));
    }
};

int main() {
    long long N, K, L;
    cin >> N >> K >> L;
    vector<long long> p(K), q(K);
    REP(i, K) cin >> p[i] >> q[i];
    vector<long long> s(L), r(L);
    REP(i, L) cin >> r[i] >> s[i];
    UnionFind road(N);
    REP(i, K) { road.unite(p[i] - 1, q[i] - 1); }
    UnionFind rail(N);
    REP(i, L) { rail.unite(r[i] - 1, s[i] - 1); }
    vector<int> a(N);
    vector<int> b(N);
    REP(i, N) {
        a[i] = road.find(i);
        b[i] = rail.find(i);
        mp[make_pair(a[i], b[i])]++;
    }
    REP(i, N){cout << mp[make_pair(a[i], b[i])] << " "} cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:9: error: 'mp' was not declared in this scope; did you mean 'p'?
   88 |         mp[make_pair(a[i], b[i])]++;
      |         ^~
      |         p
a.cc:90:23: error: 'mp' was not declared in this scope; did you mean 'p'?
   90 |     REP(i, N){cout << mp[make_pair(a[i], b[i])] << " "} cout << endl;
      |                       ^~
      |                       p
Language: C++

#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define inf 10000000000000007
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

class Union_Find {
private:
	int par[200010], rankk[200010];
public:
	void init(int n) {
		rep(i, n) {
			par[i] = i;
			rankk[i] = 0;
		}
	}

	int find(int x) {
		if (par[x] == x)return x;
		else {
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;

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

	bool same(int x, int y) {
		return find(x) == find(y);
	}

};

int n, k, l, p[100010], q[100010], a[100010], b[100010];
map<pair<int, int>, int> mp;

signed main() {
	cin >> n >> k >> l;
	Union_Find ta, mu;
	ta.init(n + 1);
	mu.init(n + 1);
	rep(i, k) {
		cin >> p[i] >> q[i];
		ta.unite(p[i], q[i]);
	}
	rep(i, l) {
		cin >> a[i] >> b[i];
		mu.unite(a[i], b[i]);
	}
	for (int i = 1; i <= n; i++) {
		mp[make_pair(ta.find(i), mu.find(i))]++;
	}
	for (int i = 1; i <= n; i++) {
		if (i == n) {
			cout << mp[make_pair(ta.find(i), mu.find(i))] << endl;
			return 0;
		}
		else cout << mp[make_pair(ta.find(i), mu.find(i))] << " ";
	}
}


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

#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

#include<vector>
template<typename T>
class UnionFind
{
	public:
	vector<T> parent;
	vector<T> sz;

	UnionFind(T n):parent(n),sz(n)
	{
		for(int i=0;i<n;i++)
			parent[i]=i;
		for(int i=0;i<n;i++)
			sz[i]=1;
	}
	
	void unite(T a,T b)
	{
		a=root(a);
		b=root(b);
		if(a==b)return;
		if(a>b)swap(a,b);
		sz[a]+=sz[b];
		sz[b]=0;
		parent[b]=a;
		return;
	}
	
	T root(T n)
	{
		if(parent[n]==n)
			return n;
		else
		{
			T ret=root(parent[n]);
			parent[n]=ret;
			return ret;
		}
	}

	T size(T n)
	{
		return sz[root(n)];
	}
};

int main()
{
	int N,K,L;
	
	cin >> N >> K >> L;
	
	UnionFind<int> uf0(N);
	UnionFind<int> uf2(N);
	for(int i=0;i<K;i++)
	{
		int p,q;
		cin >> p >> q;
		uf1.unite(p-1,q-1);
	}
	for(int i=0;i<L;i++)
	{
		int r,s;
		cin >> r >> s;
		if(uf1.root(r-1)==uf1.root(s-1))
			uf2.unite(r-1,s-1);
	}
	
	for(int i=0;i<N;i++)
	{
		cout << uf2.size(uf2.root(i));
		if(i!=N-1)
			cout << " ";
	}
	cout << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:17: error: 'uf1' was not declared in this scope; did you mean 'uf2'?
   64 |                 uf1.unite(p-1,q-1);
      |                 ^~~
      |                 uf2
a.cc:70:20: error: 'uf1' was not declared in this scope; did you mean 'uf2'?
   70 |                 if(uf1.root(r-1)==uf1.root(s-1))
      |                    ^~~
      |                    uf2
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

class UnionFind{
    public:
        vector<ll> par;
        vector<ll> rank;
        vector<ll> size;

        UnionFind(ll n){
            for(int i = 0; i < n; i++){
                par.push_back(i);
                rank.push_back(0);
                size.push_back(1);
            }
        }

        ll find(ll x){
            if(x == par[x])
                return x;
            else
                return par[x] = find(par[x]);
        }

        void unite(ll x, ll y){
            x = find(x);
            y = find(y);
            if(x == y) return;

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

        bool same(llnt x, ll y){
            return find(x) == find(y);
        }

        ll get_size(ll x){
            return size[find(x)];
        }
};


vector<ll> RL[300100];
vector<ll> TL[300100];
bool isvisit[300100];

UnionFind road(300100);
UnionFind train(300100);
UnionFind ans(300100);

void dfs(int v){
    isvisit[v] = true;
    for(int i = 0; i < RL[v].size(); i++){
        int next = RL[v][i];
        if(isvisit[next]) continue;
        road.unite(v, next);
        dfs(next);
    }
}

void dfs3(int v){
    isvisit[v] = true;
    for(int i = 0; i < TL[v].size(); i++){
        int next = TL[v][i];
        if(isvisit[next]) continue;
        train.unite(v, next);
        dfs(next);
    }
}

void dfs2(int v){
    isvisit[v] = true;
    for(int i = 0; i < TL[v].size(); i++){
        int next = TL[v][i];
        if(isvisit[next]) continue;
        if(!road.same(v, next)) continue;
        ans.unite(v, next);
        dfs2(next);
    }
}

int main(){
    ll N, K, L;
    cin >> N >> K >> L;
    REP(i,K){
        ll p, q;
        cin >> p >> q;
        p--, q--;
        RL[p].push_back(q);
        RL[q].push_back(p);
    }
    REP(i,L){
        ll r, s;
        cin >> r >> s;
        r--, s--;
        TL[r].push_back(s);
        TL[s].push_back(r);
    }


    for(int i = 0; i < N; i++){
        if(isvisit[i]) continue;
        dfs(i);
    }

    fill(isvisit, isvisit+N, false);
    for(int i = 0; i < N; i++){
        if(isvisit[i]) continue;
        dfs3(i);
    }

    //fill(isvisit, isvisit+N, false);
    //for(int i = 0; i < N; i++){
    //    if(isvisit[i]) continue;
    //    dfs2(i);
    //}
    map<pair<ll, ll>, ll> ma;
    for(int i = 0; i < N; i++){
        auto p = make_pair(road.find(i), train.find(i));
        ma[p]++;
    }

    for(int i = 0; i < N; i++){
        auto p = make_pair(road.find(i), train.find(i));
        //cout << ma[p] << " ";
        printf("%lld ", ma[p]);
    }
    printf("\n");

    return 0;
}


Compiler output:
a.cc:46:19: error: 'llnt' has not been declared
   46 |         bool same(llnt x, ll y){
      |                   ^~~~
Language: C++

#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

struct UF
{
    long         num;
    vector<long> par;
    vector<long> rank;

    UF(long n): num(n) {
        par.resize(n);
        rank.resize(n);
        long i;
        for(i=0; i<n; i++) {
            par[i]=i;  rank[i]=1;
        }
    }
	
    long find(long x) {
        if(x==par[x]) return x;
        return par[x] = find(par[x]);
    }

    void unite(long x, long y) {
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]) {
            par[x]=y;
        }
        else {
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(long x, long y) {
        return find(x)==find(y);
    }

    long ngroup() {
        long count=0;
        long i;
        for(i=0; i<num; i++) {
            if(par[i]==i) count++;
        }
        return count;
    }
};


int main(int argc, char* argv[])
{
    long n, k, l;
    scanf("%ld%ld%ld", &n, &k, &l);

    UF uf0(n);
    UF uf1(n);

    long i;
    for(i=0; i<k; i++) {
        long x, y;
        scanf("%ld%ld", &x, &y);
        uf0.unite(x-1, y-1);
    }
    for(i=0; i<l; i++) {
        long x, y;
        scanf("%ld%ld", &x, &y);
        uf1.unite(x-1, y-1);
    }

    map<pair<long, long>, long> zz;
    for(i=0; i<n; i++) {
        zz[make_pair(uf0.find(i), uf1.find(i)]++;
    }
    for(i=0; i<n; i++) {
        printf("%ld", zz[make_pair(uf0.find(i), uf1.find(i))]);
        if(i==n-1) printf("\n");
        else       printf(" ");
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:92:46: error: expected ')' before ']' token
   92 |         zz[make_pair(uf0.find(i), uf1.find(i)]++;
      |                     ~                        ^
      |                                              )
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class ABC049D_ {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int L = sc.nextInt();
        DJSet road = new DJSet(N+1);
        DJSet rail = new DJSet(N+1);
        for (int i = 0; i < K; i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            road.union(p, q);
        }
        for (int i = 0; i < L; i++) {
            int r = sc.nextInt();
            int s = sc.nextInt();
            rail.union(r, s);
        }
        StringBuilder sb = new StringBuilder();
        int[] con = new int[N+1];
        for (int i = 1; i <= N; i++) {
            con[i] += 1;
            for (int j = i+1; j <= N ; j++) {
                if(road.same(i, j) && rail.same(i, j)){
                    con[i]++;
                    con[j]++;
                }
            }
            sb.append(con[i]);
            if(i < N) sb.append(" ");
        }

        System.out.println(sb.toString());
        sc.close();
    }

}

class DJSet {
    // 親を保持する。根は負の数を持つ。（負の数の場合、絶対値がその集合のrank）
    public int[] upper;

    public DJSet(int n){
        upper = new int[n];
        Arrays.fill(upper, -1);
    }

    /*
     * 要素xが含まれる集合のrootを求める.
     * rootを求める過程で経路圧縮しrootが親になるようにする.
     */
    public int root(int x){
        return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
    }

    /*
     * 要素xと要素yが同じ集合か判定する.
     */
    public boolean same(int x, int y){
        return root(x) == root(y);
    }

    /*
     * 要素xと要素yを含むそれぞれの集合を合併する.
     * 要素数の多い集合のrootを残し、少ないほうのrootをその下に合併する.
     */
    public boolean union(int x, int y){
        x = root(x);
        y = root(y);
        if(x != y){
            if(upper[y] < upper[x]){
                int t = x;
                x = y;
                y = t;
            }
            upper[x] += upper[y];
            upper[y] = x;
        }
        return x == y;
    }

    /*
     * 集合の数を数える.
     */
    public int count(){
        int c = 0;
        for(int u :upper){
            if(u < 0) c++;
        }
        return c;
    }
}


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

#include <bits/stdc++.h>

using namespace std;
template <>
struct hash<pair<int, int>> {
  size_t operator()(const pair<int, int>& p) const {
    return hash<int>()(p.first) + hash<int>()(p.second);
  }
};

class UnionFind {
 public:
  explicit UnionFind(int n) : vec(n + 1), rank(n + 1) {
    for (int i = 0; i <= n; ++i) {
      vec[i] = i;
      rank[i] = 0;
    }
  }

  int find(int x) const {
    if (x == vec[x]) return x;
    return vec[x] = find(vec[x]);
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank[x] < rank[y]) {
      vec[x] = y;
    } else {
      vec[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
    return;
  }

  bool same(int x, int y) const { return find(x) == find(y); }

  void dump() const {
    for (size_t i = 1; i < vec.size(); ++i) {
      if (1 < i) cout << ", ";
      cout << vec[i];
    }
    cout << "\n";
  }

  mutable vector<int> vec;
  mutable vector<int> rank;
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, k, l;
  cin >> n >> k >> l;
  UnionFind roads(n), rails(n);
  for (int i = 0; i < k; ++i) {
    int p, q;
    cin >> p >> q;
    p--;
    q--;
    roads.unite(p, q);
  }
  for (int i = 0; i < l; ++i) {
    int r, s;
    cin >> r >> s;
    r--;
    s--;
    rails.unite(r, s);
  }

  unordered_map<pair<int, int>, int> connects;
  for (int i = 0; i < n; ++i) {
    auto p = make_pair(roads.vec[i], rails.vec[i]);
    connects[p]++;
  }
  for (int i = 0; i < n; ++i) {
    if (0 < i) cout << " ";
    cout << connects[make_pair(roads.vec[i], rails.vec[i])];
  }
  cout << "\n";
}


Compiler output:
a.cc:5:8: error: explicit specialization of 'template<class _Tp> struct std::hash' outside its namespace must use a nested-name-specifier [-fpermissive]
    5 | struct hash<pair<int, int>> {
      |        ^~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
map<pair<int,int>,int>father;
#define twy(x,y) father[make_pair(x,y)]
#define M 200001
int k1[M],k2[M];
int n,k,l,p,q,r,s;
int find1(int x)
{
    return p1[x]==x?p1[x]:p1[x]=find(p1[x]);
}
int find2(int x)
{
    return p1[x]==x?p1[x]:p1[x]=find(p1[x]);
}
void kkk1(int x,int y)
{
	int kx=find1(x);
	int ky=find1(y);
	if(kx!=ky)k1[kx]=ky;
}void kkk2(int x,int y)
{
	int kx=find2(x);
	int ky=find2(y);
	if(kx!=ky)k2[kx]=ky;
}
int main(){
	scanf("%d%d%d",&n,&k,&l);
	for(int i=1;i<=n;i++)k1[i]=k2[i]=i;
	for(int i=1;i<=k;i++)
	{
		scanf("%d%d",&p,&q);
		kkk1(p,q);
	}
	for(int i=1;i<=l;i++)
	{
		scanf("%d%d",&r,&s);
		kkk2(r,s);
	}
	for(int i=1;i<=n;i++)
    {
        find1(i);
        find1(i);
    }
	for(int i=1;i<=n;i++)
	twy(k1[i],k2[i])++;
	for(int i=1;i<=n;i++)
	printf("%d ",twy(k1[i],k2[i]));
	return 0;
}

Compiler output:
a.cc: In function 'int find1(int)':
a.cc:10:12: error: 'p1' was not declared in this scope; did you mean 'y1'?
   10 |     return p1[x]==x?p1[x]:p1[x]=find(p1[x]);
      |            ^~
      |            y1
a.cc: In function 'int find2(int)':
a.cc:14:12: error: 'p1' was not declared in this scope; did you mean 'y1'?
   14 |     return p1[x]==x?p1[x]:p1[x]=find(p1[x]);
      |            ^~
      |            y1
Language: C++

#include <iostream>
#include <map>
using namespace std;
const int N=200000+10;
const int INF=10000000;
int p1[N],p2[N];
map<pair<int,int>,int>m;
inline int find(int x,int *p){
    return p[x]==x?x:p[x]=find(p[x],p);
}
int main()
{
    int n,k,l;
    int x,y;
    cin>>n>>k>>l;
    for(int i=1;i<=n;i++)
        p1[i]=i,p2[i]=i;
    for(int i=1;i<=k;i++){
        cin>>x>>y;
        if(find(x,p1)!=find(y,p1)){
      		p1[find(x,p1)]=find(y,p1);
    	}
    }
    for(int i=1;i<=l;i++){
        cin>>x>>y;
       	if(find(x,p2)!=find(y,p2)){
        	p2[find(x,p2)]=find(y,p2);
    	}
    }
    for(int i=1;i<=n;i++){
        if(find(x,p1)!=find(y,p1)){
        	p1[find(x,p1)]=find(y,p1);
    	}
		if(find(x,p2)!=find(y,p2)){
    	    p2[find(x,p2)]=find(y,p2);
    	}
    }
    for(int i=1;i<=n;i++)
        m[make_pair(p1[i],p2[i])]++;
    for(int i=1;i<=n;i++)
        cout<<m[make_pair(p1[i],p2[i])])<<' ';
    cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:40: error: expected ';' before ')' token
   41 |         cout<<m[make_pair(p1[i],p2[i])])<<' ';
      |                                        ^
      |                                        ;
Language: C++

#include <iostream>
#include <map>
using namespace std;
const int N=200000+10;
const int INF=10000000;
int p1[N],p2[N];
map<pair<int,int>,int>m;
inline int find(int x,int *p){
    return p[x]==x?x:p[x]=find(p[x],p);
}
int main()
{
    int n,k,l;
    int x,y;
    cin>>n>>k>>l;
    for(int i=1;i<=n;i++)
        p1[i]=i,p2[i]=i;
    for(int i=1;i<=k;i++){
        cin>>x>>y;
        if(find(x,p1)!=find(y,p1)){
      		p1[find(x,p1)]=find(y,p1);
    	}
    }
    for(int i=1;i<=l;i++){
        scanf("%d%d,",&x,&y);
       	if(find(x,p2)!=find(y,p2)){
        	p2[find(x,p2)]=find(y,p2);
    	}
    }
    for(int i=1;i<=n;i++){
        if(find(x,p1)!=find(y,p1)){
        	p1[find(x,p1)]=find(y,p1);
    	}
		if(find(x,p2)!=find(y,p2)){
    	    p2[find(x,p2)]=find(y,p2);
    	}
    }
    for(int i=1;i<=n;i++)
        m[make_pair(p1[i],p2[i])]++;
    for(int i=1;i<=n;i++)
        cout<<m[make_pair(p1[i],p2[i])])<<' ';
    cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:40: error: expected ';' before ')' token
   41 |         cout<<m[make_pair(p1[i],p2[i])])<<' ';
      |                                        ^
      |                                        ;
Language: C++

#include<bits/stdc++.h> using namespace std; const int N=1e6+5; struct node{ int t,next; }e[N]; int head[N],cnt; void init(){ memset(head,-1,sizeof(head)); cnt=0; } void add(int u,int v){ e[cnt]=node{v,head[u]}; head[u]=cnt++; } int fa[N]; int father(int x){return x==fa[x]?x:fa[x]=father(fa[x]);} int join(int x,int y){x=father(x);y=father(y);if(x!=y)fa[x]=y;} void initfa(int n){for(int i=1;i<=n;i++)fa[i]=i;} int vis[N],ans[N]; void dfs1(int u,int tag,map<int,int>&M) //块计数 { if(vis[u]==tag)return; vis[u]=tag; M[father(u)]++; for(int i=head[u];~i;i=e[i].next) { dfs1(e[i].t,tag,M); } } void dfs2(int u,int tag,map<int,int>&M) { if(vis[u]==tag)return; vis[u]=tag; ans[u]+=M[father(u)]; for(int i=head[u];~i;i=e[i].next) { dfs2(e[i].t,tag,M); } } int main() { int n,k,L,u,v; scanf("%d%d%d",&n,&k,&L); init(); initfa(n); while(k--){ scanf("%d%d",&u,&v); join(u,v); } while(L--){ scanf("%d%d",&u,&v); add(u,v); add(v,u); } memset(vis,0,sizeof(vis)); for(int i=1;i<=n;i++) if(!vis[i]) { map<int,int>M; dfs1(i,i,M); dfs2(i,-i,M); } for(int i=1;i<=n;i++) printf("%d%c",ans[i],i<n?' ':'\n'); }

Compiler output:
a.cc:1:25: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h> using namespace std; const int N=1e6+5; struct node{ int t,next; }e[N]; int head[N],cnt; void init(){ memset(head,-1,sizeof(head)); cnt=0; } void add(int u,int v){ e[cnt]=node{v,head[u]}; head[u]=cnt++; } int fa[N]; int father(int x){return x==fa[x]?x:fa[x]=father(fa[x]);} int join(int x,int y){x=father(x);y=father(y);if(x!=y)fa[x]=y;} void initfa(int n){for(int i=1;i<=n;i++)fa[i]=i;} int vis[N],ans[N]; void dfs1(int u,int tag,map<int,int>&M) //块计数 { if(vis[u]==tag)return; vis[u]=tag; M[father(u)]++; for(int i=head[u];~i;i=e[i].next) { dfs1(e[i].t,tag,M); } } void dfs2(int u,int tag,map<int,int>&M) { if(vis[u]==tag)return; vis[u]=tag; ans[u]+=M[father(u)]; for(int i=head[u];~i;i=e[i].next) { dfs2(e[i].t,tag,M); } } int main() { int n,k,L,u,v; scanf("%d%d%d",&n,&k,&L); init(); initfa(n); while(k--){ scanf("%d%d",&u,&v); join(u,v); } while(L--){ scanf("%d%d",&u,&v); add(u,v); add(v,u); } memset(vis,0,sizeof(vis)); for(int i=1;i<=n;i++) if(!vis[i]) { map<int,int>M; dfs1(i,i,M); dfs2(i,-i,M); } for(int i=1;i<=n;i++) printf("%d%c",ans[i],i<n?' ':'\n'); }
      |                         ^~~~~
/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;

class UnionFind {
private:
	vector<int> parent;
	vector<int> height;
	vector<int> m_size;

public:
	UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	void init(int size_) {
		parent.resize(size_);
		height.resize(size_, 0);
		m_size.resize(size_, 0);
		for (int i = 0; i < size_; ++i) parent[i] = i;
	}
	int find(int x) {
		if (parent[x] == x) return x;
		return parent[x] = find(parent[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		int t = size(x) + size(y);
		m_size[x] = m_size[y] = t;
		if (height[x] < height[y]) parent[x] = y;
		else parent[y] = x;
		if (height[x] == height[y]) ++height[x];
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		if (parent[x] == x) return m_size[x];
		return size(parent[x] = find(parent[x]));
	}
};

int N,K,L;
int p[200000],q[200000],r[200000],s[200000];
int a[300000],b[300000];
map<pair<int, int>, int> mp;
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  cin >> N >> K >> L;
  UnionFind ufk(N);
  UnionFind ufl(N);
  for(i = 0;i < K;i++){
   cin >> p[i] >> q[i];
   p[i]--;q[i]--;
   ufk.unite(p[i], q[i]);
  }
  for(i = 0;i < L;i++){
    cin >> r[i] >> s[i];
    r[i]--;s[i]--;
    ufl.unite(r[i], s[i]);
  }
  for(i = 0;i < N;i++){
    a[i]=ufk.find(i);
    b[i]=ufl.find(i);
    mp[make_pair(a[i], b[i])]++;
  }
  for(i = 0;i < N;i++){
    cout<< mp[make_pair(a[i], b[i])] <<" \n"[i==N-1];
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:7: error: 'i' was not declared in this scope
   57 |   for(i = 0;i < K;i++){
      |       ^
a.cc:62:7: error: 'i' was not declared in this scope
   62 |   for(i = 0;i < L;i++){
      |       ^
a.cc:67:7: error: 'i' was not declared in this scope
   67 |   for(i = 0;i < N;i++){
      |       ^
a.cc:72:7: error: 'i' was not declared in this scope
   72 |   for(i = 0;i < N;i++){
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N= 1<<5+7;
const int INF=INT_MAX;
int pre1[MAXN],pre2[MAXN];
int finds(int x,int *pre)
{
    return pre[x] == x? pre[x]:pre[x] = finds(pre[x],pre);
}
void join(int x,int y,int *pre)
{
    int px = finds(x,pre);
    int py = finds(y,pre);
    if( px!=py)
    {
        pre[px] = py;
    }
}
int main()
{
    int n,k,l;
    cin>>n>>k>>l;
    for(int i = 1;i<=n;i++)
        pre1[i] = i,pre2[i] = i;
    for(int i = 1;i<=k;i++)
    {
        int x,y;
        cin>>x>>y;
        join(x,y,pre1);
    }
    for(int i = 1;i<=l;i++)
    {
        int x,y;
        cin>>x>>y;
        join(x,y,pre2);
    }
    for(int i = 1;i<=n;i++)
    {
        finds(i,pre1);
        finds(i,pre2);
    }
    map<pair<int,int>,int> mp;
    for(int i = 1;i<=n;i++)
    {
        mp[make_pair(pre1[i],pre2[i])] ++;
    }
    for(int i = 1;i<=n;i++)
    {
        cout<<mp[make_pair(pre1[i],pre2[i])]<<" ";
    }
    cout<<endl;
}


Compiler output:
a.cc:5:10: error: 'MAXN' was not declared in this scope
    5 | int pre1[MAXN],pre2[MAXN];
      |          ^~~~
a.cc:5:21: error: 'MAXN' was not declared in this scope
    5 | int pre1[MAXN],pre2[MAXN];
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:24:9: error: 'pre1' was not declared in this scope
   24 |         pre1[i] = i,pre2[i] = i;
      |         ^~~~
a.cc:24:21: error: 'pre2' was not declared in this scope
   24 |         pre1[i] = i,pre2[i] = i;
      |                     ^~~~
a.cc:29:18: error: 'pre1' was not declared in this scope
   29 |         join(x,y,pre1);
      |                  ^~~~
a.cc:35:18: error: 'pre2' was not declared in this scope
   35 |         join(x,y,pre2);
      |                  ^~~~
a.cc:39:17: error: 'pre1' was not declared in this scope
   39 |         finds(i,pre1);
      |                 ^~~~
a.cc:40:17: error: 'pre2' was not declared in this scope
   40 |         finds(i,pre2);
      |                 ^~~~
a.cc:45:22: error: 'pre1' was not declared in this scope
   45 |         mp[make_pair(pre1[i],pre2[i])] ++;
      |                      ^~~~
a.cc:45:30: error: 'pre2' was not declared in this scope
   45 |         mp[make_pair(pre1[i],pre2[i])] ++;
      |                              ^~~~
a.cc:49:28: error: 'pre1' was not declared in this scope
   49 |         cout<<mp[make_pair(pre1[i],pre2[i])]<<" ";
      |                            ^~~~
a.cc:49:36: error: 'pre2' was not declared in this scope
   49 |         cout<<mp[make_pair(pre1[i],pre2[i])]<<" ";
      |                                    ^~~~
Language: C++

#include<bits/stdc++.h>
#define MAX 200005
using namespace std;
 
int p[2][MAX];
int getp(int i, int x){return p[i][x] == x ? x : p[i][x] = getp(i, p[i][x]);}

int main(){
  int n, k, l, i, j, a, b;
  map<long long, int> m;
  scanf("%d%d%d", &n, &k, &l);
  for(i = 1; i <= n; i++) p[0][i] = p[1][i] = i;
  for(i = 0; i < 2; i++){
    for(j = 0; j < (i ? l : k); j++){
      scanf("%d%d", &a, &b);
      if(getp(i, a) != getp(i, b)) p[i][p[i][a]] = p[i][b];
    }
  }
  for(i = 1; i <= n; i++) m[(long long)p[0][i]*p[1][i]]++;
  for(i = 1; i <= n; i++){
    printf("%d", m[(long long)p[0][i]*p[1][i]]);
    put(i == n ? "\n" : " ");
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'put' was not declared in this scope; did you mean 'putw'?
   22 |     put(i == n ? "\n" : " ");
      |     ^~~
      |     putw
Language: Java

import java.io.*;
import java.util.*;

/**
 * @author baito
 */
class UnionFindTree
{
    int[] par;
    int[] rank;
    int[] sizes;

    UnionFindTree(int n)
    {
        par = new int[n];
        rank = new int[n];
        sizes = new int[n];
        for (int i = 0; i < n; i++)
        {
            par[i] = i;
            sizes[i] = 1;
        }
    }

    int root(int x)
    {
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);

        if (x == y) return;
        if (rank[x] < rank[y])
        {
            par[x] = y;
            sizes[y] += sizes[x];
        }
        else
        {
            par[y] = x;
            sizes[x] += sizes[y];
            if (rank[x] == rank[y]) rank[x]++;
        }
    }

    boolean isSame(int x, int y)
    {
        return root(x) == root(y);
    }

    int size(int x)
    {
        return sizes[par[x]];
    }
}

public class Main
{
    static StringBuilder sb = new StringBuilder();
    static Scanner sc = new Scanner(System.in);
    static int INF = 12345678;
    static long LINF = 123456789123456789L;
    static long MINF = -123456789123456789L;
    static long MOD = 1000000007;
    static int[] y4 = {0, 1, 0, -1};
    static int[] x4 = {1, 0, -1, 0};
    static int[] y8 = {0, 0, 1, 0, -1, -1, 1, 1, -1};
    static int[] x8 = {0, 1, 0, -1, 0, 1, -1, 1, -1};
    static long[] F;//factorial
    static boolean[] isPrime;
    static int[] primes;
    static char[][] map;

    static int N, K, L;
    static int[] A;


    public static void main(String[] args)
    {
        N = sc.nextInt();
        K = sc.nextInt();
        L = sc.nextInt();
        UnionFindTree u1 = new UnionFindTree(N);
        UnionFindTree u2 = new UnionFindTree(N);
        for (int i = 0; i < K; i++)
            u1.unite(sc.nextInt() - 1, sc.nextInt() - 1);
        for (int i = 0; i < L; i++)
            u2.unite(sc.nextInt() - 1, sc.nextInt() - 1);

        Map<Long, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++)
        {
            int r1 = u1.root(i);
            int r2 = u2.root(i);
            Long key = getHashKey(r1, r2);
            Integer v = map.get(key);
            map.put(key, v == null ? 1 : v + 1);
        }
        int[] cous = new int[N];
        for (int i = 0; i < N; i++)
        {
            int r1 = u1.root(i);
            int r2 = u2.root(i);
            Long key = getHashKey(r1, r2);
            System.out.println(map.get(key));
        }
    }

    public static long getHashKey(int a, int b)
    {
        return (long) a << 32 | b;
    }


Compiler output:
Main.java:117: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include<iostream>
using ll = long long;
#define MAX_N 201010
using namespace std;
	
ll par_way[MAX_N],r_way[MAX_N];
ll par_train[MAX_N],r_train[MAX_N];
	
void init_way(ll n){
	for(ll i=0;i<n;i++){
		par_way[i] = i;
		r_way[i] = 0;
	}
}
	
ll find_way(ll x){
	if(par_way[x] == x){
		return x;
	}else{
		return par_way[x] = find_way(par_way[x]);
	}
}
	
void unite_way(ll x,ll y){
	x = find_way(x);
	y = find_way(y);
	if(x==y)	return;
	if(r_way[x]<r_way[y]){
		par_way[x] = y;
	}
	else{
		par_way[y] = x;
		if(r_way[x] == r_way[y])	r_way[x]++;
	}
}
	
	
void init_train(ll n){
	for(ll i=0;i<n;i++){
		par_train[i] = i;
		r_train[i] = 0;
	}
}
	
ll find_train(ll x){
	if(par_train[x] == x){
		return x;
	}else{
		return par_train[x] = find_train(par_train[x]);
	}
}
	
void unite_train(ll x,ll y){
	x = find_train(x);
	y = find_train(y);
	if(x==y)	return;
	if(r_train[x]<r_train[y]){
		par_train[x] = y;
	}
	else{
		par_train[y] = x;
		if(r_train[x] == r_train[y])	r_train[x]++;
	}
}
	
bool same(ll x,ll y){
	return (find_train(x) == find_train(y))&&(find_way(x) == find_wat(y));
}
	
int main(void){
	ll N,K,L,x,y;
	cin >> N >> K >> L;
	init_train(N);init_way(N);
	while(K--){
		cin >> x >> y;
		unite_way(x,y);
	}
	while(L--){
		cin >> x >> y;
		unite_train(x,y);
	}
	for(ll i=1;i<=N;i++){
		ll ans=0;
		for(ll j=1;j<=N;j++){
			if(same(i,j))	ans++;
		}
		cout << ans;
		if(i!=N)	cout << ' ';
	}
	cout << endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool same(ll, ll)':
a.cc:67:66: error: 'find_wat' was not declared in this scope; did you mean 'find_way'?
   67 |         return (find_train(x) == find_train(y))&&(find_way(x) == find_wat(y));
      |                                                                  ^~~~~~~~
      |                                                                  find_way