Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

struct UF{
  vector<int> par, si;
  UF(int n) :par(n){
    rep(i, n) par[i] = i;
  }
  UF(int n) :si(n, 1);
  int root(int x){
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y){
    if (root(x) == root(y)) return;
    else{
      par[root(x)] = root(y);
      int tmp = si[x];
      si[x] += si[y];
      si[y] += tmp;
    }
  }
  bool same(int x, int y){
    return root(x) == root(y);
  }
  int size(int x){
    return si[x];
  }
};

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  UF f(n);
  vector<vector<int>> b(n), g(n);
  rep(i, m){
    int a, c;
    cin >> a >> c;
    f.unite(a-1, c-1);
    g[a-1].push_back(a-1, c-1);
    g[c-1].push_back(c-1, a-1);
  }
  rep(i, k){
    int a, c;
    cin >> a >> c;
    b[a-1].push_back(c-1);
    b[c-1].push_back(a-1);
  }
  rep(i, n){
    int d = 0;
    rep(j, b[i].size()){
      if(f.same(b[i][j])) ++d;
    }
    cout << f.size(i) - g[i].size() - d - 1;
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  return 0;
}

Compiler output:
a.cc:10:3: error: 'UF::UF(int)' cannot be overloaded with 'UF::UF(int)'
   10 |   UF(int n) :si(n, 1);
      |   ^~
a.cc:7:3: note: previous declaration 'UF::UF(int)'
    7 |   UF(int n) :par(n){
      |   ^~
a.cc: In constructor 'UF::UF(int)':
a.cc:10:22: error: expected '{' at end of input
   10 |   UF(int n) :si(n, 1);
      |                      ^
a.cc: In function 'int main()':
a.cc:41:21: error: no matching function for call to 'std::vector<int>::push_back(int, int)'
   41 |     g[a-1].push_back(a-1, c-1);
      |     ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:42:21: error: no matching function for call to 'std::vector<int>::push_back(int, int)'
   42 |     g[c-1].push_back(c-1, a-1);
      |     ~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note:   candidate expects 1 argument, 2 provided
a.cc:53:16: error: no matching function for call to 'UF::same(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   53 |       if(f.same(b[i][j])) ++d;
      |          ~~~~~~^~~~~~~~~
a.cc:24:8: note: candidate: 'bool UF::same(int, int)'
   24 |   bool same(int x, int y){
      |        ^~~~
a.cc:24:8: note:   candidate expects 2 arguments, 1 provided