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 k1[x]==x?k1[x]:k1[x]=find(k1[x]);
}
int find2(int x)
{
    return k2[x]==x?k2[x]:k2[x]=find(k2[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:37: error: no matching function for call to 'find(int&)'
   10 |     return k1[x]==x?k1[x]:k1[x]=find(k1[x]);
      |                                 ~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 1 provided
In file included from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   candidate expects 3 arguments, 1 provided
a.cc: In function 'int find2(int)':
a.cc:14:37: error: no matching function for call to 'find(int&)'
   14 |     return k2[x]==x?k2[x]:k2[x]=find(k2[x]);
      |                                 ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   candidate expects 3 arguments, 1 provided