Language: C++

#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }

class union_find
{
private:
    std::vector<int> parent;
    std::vector<int> rank;
    vint size;
    int node_num;
public:
    union_find(int node_num);
    void unite(int x, int y);
    int find(int x);
    int get_size(int x);
};

union_find::union_find(int node_num) :
    parent(node_num + 1, 0),
    rank(node_num + 1, 0),
    size(node_num + 1, 1)
{
    for (int i = 0; i <= node_num; i++) {
        parent[i] = i;
    }
}

void union_find::unite(int x, int y) {
    int x_root = find(x);
    int y_root = find(y);
    //既に同じ根なら、同じ所属なので何もしない
    if (x_root == y_root) return;
    //ランクが大きい方に小さい方をくっつける
    //結合後のランクは大きい方になる。
    if (rank[x_root] > rank[y_root]) {
        parent[y_root] = x_root;
        size[x_root] += size[y_root];
    }
    else {
        parent[x_root] = y_root;
        if (rank[x_root] == rank[y_root]) {
            //ランクが等しい場合は、必ずランクが1上がる。
            rank[y_root]++;
        }
        size[y_root] += size[x_root];
    }
}
int union_find::get_size(int x) {
    return size[find(x)];
}
int union_find::find(int x) {
    if (x != parent[x]) {
        // findの結果を各parentに入れることで経路を圧縮。
        //ただし、変更コストが大きいのでランクは変えてない。
        parent[x] = find(parent[x]);
    }
    return parent[x];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M, K;
    cin >> N >> M >> K;

    unordered_map<int, unordered_set<int>> graph;
    union_find uf(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        graph[a].insert(b);
        graph[b].insert(a);
        uf.unite(a, b);
    }
    //unordered_map<int, unordered_set<int>> block;
    //rep(i, K) {
    //    int c, d;
    //    cin >> c >> d;
    //    graph[c].insert(d);
    //    graph[d].insert(c);
    //}

    vint ans(N + 1, 0);
    REP(i, 1, N + 1) {
        ans[i] = max(0U, uf.get_size(i) - 1 - graph[i].size());
    }

    rep(i, K) {
        int c, d;
        cin >> c >> d;
        if (uf.find(c) == uf.find(d)) {
            ans[c] = max(0, ans[c] - 1);
            ans[d] = max(0, ans[d] - 1);
        }
    }
    REP(i, 1, N + 1) {
        printf("%d ", ans[i]);
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:128:21: error: no matching function for call to 'max(unsigned int, std::unordered_set<int>::size_type)'
  128 |         ans[i] = max(0U, uf.get_size(i) - 1 - graph[i].size());
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/set:62,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:128:21: note:   deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::unordered_set<int>::size_type' {aka 'long unsigned int'})
  128 |         ans[i] = max(0U, uf.get_size(i) - 1 - graph[i].size());
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:27:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:128:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
  128 |         ans[i] = max(0U, uf.get_size(i) - 1 - graph[i].size());
      |                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~