Language: C++

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

const int size=234567;
int N,K,L;
int p[size],q[size],r[size],s[size],g1[size],g2[size];
int par[size],rank[size],G[size],H[size];
vector<int> cnt[size];

void init(int n){
    for(int i=1; i<=n; i++){
        par[i]=i;
        rank[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(rank[x]<rank[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(rank[x]==rank[y]) rank[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}

int main(){

cin>>N>>K>>L; 

init(N);
for(int i=0; i<K; i++){
    scanf("%d %d",&p[i],&q[i]);
    unite(p[i],q[i]);
}
for(int i=1; i<=N; i++) G[i]=find(i);

init(N);
for(int i=0; i<L; i++){
    scanf("%d %d",&r[i],&s[i]);
    if(G[r[i]]==G[s[i]]) unite(r[i],s[i]);
}
for(int i=1; i<=N; i++) H[i]=find(i);
for(int i=1; i<=N; i++) cnt[H[i]].push_back(i);
for(int i=1; i<=N; i++) printf("%d ",cnt[H[i]].size());

return 0;
 
}

Compiler output:
a.cc:8:7: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |       ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:8:15: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |               ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:8:23: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |                       ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:8:31: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |                               ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:8:40: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |                                        ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:8:49: error: reference to 'size' is ambiguous
    8 | int p[size],q[size],r[size],s[size],g1[size],g2[size];
      |                                                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:9:9: error: reference to 'size' is ambiguous
    9 | int par[size],rank[size],G[size],H[size];
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:9:20: error: reference to 'size' is ambiguous
    9 | int par[size],rank[size],G[size],H[size];
      |                    ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:9:28: error: reference to 'size' is ambiguous
    9 | int par[size],rank[size],G[size],H[size];
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:9:36: error: reference to 'size' is ambiguous
    9 | int par[size],rank[size],G[size],H[size];
      |                                    ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc:10:17: error: reference to 'size' is ambiguous
   10 | vector<int> cnt[size];
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:6:11: note:                 'const int size'
    6 | const int size=234567;
      |           ^~~~
a.cc: In function 'void init(int)':
a.cc:14:9: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   14 |         par[i]=i;
      |         ^~~
      |         __pstl::execution::v1::par
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/execution_defs.h:43:45: note: '__pstl::execution::v1::par' declared here
   43 | _GLIBCXX17_INLINE constexpr parallel_policy par{};
      |                                             ^~~
a.cc:15:14: error: redeclaration of 'auto i'
   15 |         rank[i]=0;
      |              ^
a.cc:13:13: note: 'int i' previously declared here
   13 |     for(int i=1; i<=n; i++){
      |             ^
a.cc:15:17: error: class template argument deduction failed:
   15 |         rank[i]=0;
      |                 ^
a.cc:15:17: error: no matching function for call to 'rank(int)'
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:
/usr/include/c++/14/type_traits:1437:12: note: candidate: 'template<class> rank()-> std::rank< <template-parameter-1-1> >'
 1437 |     struct rank
      |            ^~~~
/usr/include/c++/14/type_traits:1437:12: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/type_traits:1437:12: note: candidate: 'template<class> rank(std::rank< <template-parameter-1-1> >)-> std::rank< <template-parameter-1-1> >'
/usr/include/c++/14/type_traits:1437:12: note:   template argument deduction/substitution failed:
a.cc:15:17: note:   mismatched types 'std::rank< <template-parameter-1-1> >' and 'int'
   15 |         rank[i]=0;
      |                 ^
a.cc: In function 'int find(int)':
a.cc:19:8: error: 'par' was not declared in this scope; did you mean