Language: C++

#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9+7;
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<bool> vb;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
long long int min(long long int a,long long int b){
  if(a<b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
    }
  return res;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}

lli mul(lli a,lli b){
  return (a%mod * b%mod)%mod;
}

lli add(lli a,lli b){
  return (a%mod + b%mod)%mod;
}

lli sub(lli a,lli b){
  return (a%mod-b%mod+mod)%mod;
}
 
//############################ENDOFTEMPLATE############################
vector<vi> adj(100005);
//vector<vi> adjb(100005);

vi link(100005);
vi size(100005);

int find(int x){
  while(x!=link[x]) x = link[x];
  return x;
}

bool same(int a,int b){
  if(find(a)==find(b))
    return true;
  return false;
}

void unite(int a,int b){
  a = find(a);
  b = find(b);

  if(size[a]<size[b]) swap(a,b);
  size[a]+=size[b];
  link[b] = a;
}


void solve(){
  int n,m,k;
  cin>>n>>m>>k;

  for(int i = 1;i<=n;i++) 
    link[i] = i;

  for(int i = 1;i<=n;i++) 
    size[i] = 1;


  vi deg(n+1);
  for(int i = 0;i<m;i++){
    int u,v;
    cin>>u>>v;
    deg[u]++;
    deg[v]++;

    if(!same(u,v))
      unite(u,v);
  }

  vector<int> ans(n+1);

  for(int i = 1;i<=n;i++){
    int h = find(i);
    //cout<<size[h]<<endl;
    ans[i] = size[h]-deg[i]-1;
  }

  for(int i = 0;i<k;i++){
    int u,v;
    cin>>u>>v;
    if(same(u,v)){
      ans[u]--;
      ans[v]--;

    }
  }

  for(int i = 1;i<=n;i++){
    cout<<ans[i]<<" ";
  }







}

 
 
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Compiler output:
a.cc:58:8: error: 'vi link' redeclared as different kind of entity
   58 | vi link(100005);
      |        ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
  819 | extern int link (const char *__from, const char *__to)
      |            ^~~~
a.cc: In function 'int find(int)':
a.cc:62:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |   while(x!=link[x]) x = link[x];
      |                  ^
a.cc:62:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   62 |   while(x!=link[x]) x = link[x];
      |         ~^~~~~~~~~
a.cc:62:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   62 |   while(x!=link[x]) x = link[x];
      |                               ^
a.cc:62:31: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'int' [-fpermissive]
   62 |   while(x!=link[x]) x = link[x];
      |                         ~~~~~~^
      |                               |
      |                               int (*)(const char*, const char*) noexcept
a.cc: In function 'void unite(int, int)':
a.cc:76:6: error: reference to 'size' is ambiguous
   76 |   if(size[a]<size[b]) swap(a,b);
      |      ^~~~
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:
/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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~
a.cc:76:14: error: reference to 'size' is ambiguous
   76 |   if(size[a]<size[b]) swap(a,b);
      |              ^~~~
/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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~
a.cc:77:3: error: reference to 'size' is ambiguous
   77 |   size[a]+=size[b];
      |   ^~~~
/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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~
a.cc:77:12: error: reference to 'size' is ambiguous
   77 |   size[a]+=size[b];
      |            ^~~~
/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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~
a.cc:78:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   78 |   link[b] = a;
      |         ^
a.cc:78:11: error: assignment of read-only location '*(link + ((sizetype)b))'
   78 |   link[b] = a;
      |   ~~~~~~~~^~~
a.cc: In function 'void solve()':
a.cc:87:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   87 |     link[i] = i;
      |           ^
a.cc:87:13: error: assignment of read-only location '*(link + ((sizetype)i))'
   87 |     link[i] = i;
      |     ~~~~~~~~^~~
a.cc:90:5: error: reference to 'size' is ambiguous
   90 |     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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~
a.cc:109:14: error: reference to 'size' is ambiguous
  109 |     ans[i] = size[h]-deg[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:59:4: note:                 'vi size'
   59 | vi size(100005);
      |    ^~~~