Language: C++

/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
//#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
const int maxn=100000;
int arr[maxn+5];
int size[maxn+5];
int root(int a){
    while(arr[a]!=a){
        a=arr[arr[a]];
    }
    return a;
}
void w_u(int a,int b){
    int roota=root(a);
    int rootb=root(b);
    //cout << roota << " root "<< rootb<<endl;
   // cout << size[roota] << " size "<< size[rootb] << endl;
    if(roota==rootb)return;
    if(size[roota]>size[rootb]){
        arr[rootb]=arr[roota];
        size[roota]+=size[rootb];
    }
    else{
        arr[roota]=arr[rootb];
        size[rootb]+=size[roota];
    }
}
vector<int>fr[maxn+5],bl[maxn+5];
signed main()
{
    IOS
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++){
        arr[i]=i;
        size[i]=1;
    }
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        fr[u].pb(v);
        fr[v].pb(u);
        w_u(u,v);
    }
    for(int i=0;i<k;i++){
        int u,v;
        cin>>u>>v;
        bl[u].pb(v);
        bl[v].pb(u);
    }
    for(int i=1;i<=n;i++){
        int rooti=root(i);
        int szi=size[rooti]-1;
        szi-=fr[i].size();
        for(int j=0;j<(int)bl[i].size();j++){
            int rootj=root(bl[i][j]);
            if(rooti==rootj)szi--;
        }
        cout << szi<< " ";
    }
    cout << endl;
    return 0;
}
///Alhamdulillah


Compiler output:
a.cc: In function 'void w_u(long long int, long long int)':
a.cc:76:8: error: reference to 'size' is ambiguous
   76 |     if(size[roota]>size[rootb]){
      |        ^~~~
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:5:
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:76:20: error: reference to 'size' is ambiguous
   76 |     if(size[roota]>size[rootb]){
      |                    ^~~~
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:78:9: error: reference to 'size' is ambiguous
   78 |         size[roota]+=size[rootb];
      |         ^~~~
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:78:22: error: reference to 'size' is ambiguous
   78 |         size[roota]+=size[rootb];
      |                      ^~~~
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:82:9: error: reference to 'size' is ambiguous
   82 |         size[rootb]+=size[roota];
      |         ^~~~
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:82:22: error: reference to 'size' is ambiguous
   82 |         size[rootb]+=size[roota];
      |                      ^~~~
/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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:93:9: error: reference to 'size' is ambiguous
   93 |         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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~
a.cc:110:17: error: reference to 'size' is ambiguous
  110 |         int szi=size[rooti]-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:63:5: note:                 'long long int size [100005]'
   63 | int size[maxn+5];
      |     ^~~~