Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
#define int long long
using namespace std;
ll par[114514];
ll rank[114514];
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		rank[i]=0;
	}
}
ll find(ll x){
	if(par[x] == 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;
	}else{
		par[y]=x;
		if(rank[x]==rank[y])rank[x]++;
	}
}
signed main(){
	int n,k,l;
	cin>>n>>k>>l;
	vector< pair<int,int> > p,q,gr;
	multiset< pair<int,int> > sgr;
	vector<int> cp,cq;
	for(int i=0;i<k;i++){
		int x,y;
		cin>>x>>y;
		p.pb(mp(x-1,y-1));
	}
	for(int i=0;i<l;i++){
		int x,y;
		cin>>x>>y;
		q.pb(mp(x-1,y-1));
	}
	init(n);
	for(int i=0;i<p.size();i++){
		unite(p[i].first,p[i].second);
	}
	for(int i=0;i<n;i++){
		cp.pb(find(i));
	}
	init(n);
	for(int i=0;i<q.size();i++){
		unite(q[i].first,q[i].second);
	}
	for(int i=0;i<n;i++){
		cq.pb(find(i));
	}
	for(int i=0;i<n;i++){
		gr.pb(mp(cp[i],cq[i]));
		sgr.insert(mp(cp[i],cq[i]));
	}
	for(int i=0;i<n;i++){
		cout<<sgr.count(gr[i])<<" ";
	}
	cout<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void init(long long int)':
a.cc:13:17: error: reference to 'rank' is ambiguous
   13 |                 rank[i]=0;
      |                 ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~
a.cc: In function 'void unite(long long int, long long int)':
a.cc:27:12: error: reference to 'rank' is ambiguous
   27 |         if(rank[x]<rank[y]){
      |            ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~
a.cc:27:20: error: reference to 'rank' is ambiguous
   27 |         if(rank[x]<rank[y]){
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~
a.cc:31:20: error: reference to 'rank' is ambiguous
   31 |                 if(rank[x]==rank[y])rank[x]++;
      |                    ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~
a.cc:31:29: error: reference to 'rank' is ambiguous
   31 |                 if(rank[x]==rank[y])rank[x]++;
      |                             ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~
a.cc:31:37: error: reference to 'rank' is ambiguous
   31 |                 if(rank[x]==rank[y])rank[x]++;
      |                                     ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:9:4: note:                 'long long int rank [114514]'
    9 | ll rank[114514];
      |    ^~~~