Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int n,m,k;
int par[100001],rank[100001],ans[100001];

void init()
{
	for(int i=1;i<=n;i++)
	{
		par[i]=i;
		rank[i]=1;
	}
}

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(rank[x]<rank[y])
	{
		par[x]=y;
		rank[y]=rank[x]+rank[y];
	}
	else
	{
		par[y]=x;
		rank[x]=rank[x]+rank[y];
	}
}

int main()
{
	int x,y;
	cin>>n>>m>>k;
	init();
    while(m--)
    {
    	scanf("%d%d",&x,&y);
    	if(find(x)!=find(y))unite(x,y);
    	ans[x]++;ans[y]++;
    }
    while(k--)
    {
    	scanf("%d%d",&x,&y);
    	if(find(x)==find(y))
    	{
	    	ans[x]++;ans[y]++;
	    }
    }
    for(int i=1;i<=n;i++)printf("%d ",rank[find(i)]-1-ans[i]);
	printf("\n");
	return 0;   
} 

Compiler output:
a.cc: In function 'void init()':
a.cc:12:17: error: reference to 'rank' is ambiguous
   12 |                 rank[i]=1;
      |                 ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc: In function 'void unite(int, 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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:30:17: error: reference to 'rank' is ambiguous
   30 |                 rank[y]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:30:25: error: reference to 'rank' is ambiguous
   30 |                 rank[y]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:30:33: error: reference to 'rank' is ambiguous
   30 |                 rank[y]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:35:17: error: reference to 'rank' is ambiguous
   35 |                 rank[x]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:35:25: error: reference to 'rank' is ambiguous
   35 |                 rank[x]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc:35:33: error: reference to 'rank' is ambiguous
   35 |                 rank[x]=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:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:58:39: error: reference to 'rank' is ambiguous
   58 |     for(int i=1;i<=n;i++)printf("%d ",rank[find(i)]-1-ans[i]);
      |                                       ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:5:17: note:                 'int rank [100001]'
    5 | int par[100001],rank[100001],ans[100001];
      |                 ^~~~