Language: C++

#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
const ld pi = 3.14159265358979;
 
vector<int> size, p;

void init(int n){
      p.resize(n);
      size.resize(n);
      for(int i=0; i < n; i++){
            p[i] = i;
            size[i] = 1;
      }
      return;
}

int find(int u){
      if(p[u] == u){
            return u;
      }
      return p[u] = find(p[u]);
}

void unite(int u, int v){
      int pu = find(u); int pv = find(v);
      if(pu == pv) return;
      if(size[pv] > size[pu]) swap(pv, pu);
      size[pu] += size[pv];
      p[pv] = pu;
      return;
}

int same(int u, int v){
      return find(u) == find(v);
}

int find_size(int u){
      return size[find(u)];
}

int run_test(){
      int n, m, k;
      cin >> n >> m >> k;
      int deg[n];
      fill(deg, 0);
      init(n);
      for(int i=0;i <m; i++){
            int a, b;
            cin >> a >> b;
            a--; b--;
            unite(a, b);
            deg[a]++; deg[b]++;
      }
      vector<int> v[n];
      for(int i=0; i<k; i++){
            int a, b;
            cin >> a >> b;
            a--; b--;
            v[a].pb(b);
            v[b].pb(a);
      }
      for(int i=0; i < n; i++){
             int t = find_size(i) - deg[i] - 1;
             for(auto x: v[i]){
                  if(same(x, i)) t--;
             }
             cout <<t << " ";
      }
      return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:22:7: error: reference to 'size' is ambiguous
   22 |       size.resize(n);
      |       ^~~~
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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc:25:13: error: reference to 'size' is ambiguous
   25 |             size[i] = 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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc: In function 'void unite(int, int)':
a.cc:40:10: error: reference to 'size' is ambiguous
   40 |       if(size[pv] > size[pu]) swap(pv, pu);
      |          ^~~~
/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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc:40:21: error: reference to 'size' is ambiguous
   40 |       if(size[pv] > size[pu]) swap(pv, pu);
      |                     ^~~~
/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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc:41:7: error: reference to 'size' is ambiguous
   41 |       size[pu] += size[pv];
      |       ^~~~
/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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc:41:19: error: reference to 'size' is ambiguous
   41 |       size[pu] += size[pv];
      |                   ^~~~
/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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~
a.cc: In function 'int find_size(int)':
a.cc:51:14: error: reference to 'size' is ambiguous
   51 |       return size[find(u)];
      |              ^~~~
/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:18:13: note:                 'std::vector<int> size'
   18 | vector<int> size, p;
      |             ^~~~