Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind:
    # この時点でそれぞれのノードは自分を親としている
    # 初期化時に問題が0の頂点を認めるかに注意すること
    def __init__(self, n):
        self.N = n
        self.parent = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    # xの根を返す関数
    def root(self, x):
        visited_nodes = []
        while True:
            p = self.parent[x]
            if p == x:
                # 縮約
                for node in visited_nodes:
                    self.parent[node] = x
                return x
            else:
                visited_nodes.append(x)
                x = p

    # 木の結合を行う。親の配下に入る
    def unite(self, x, y):
        if not self.root(x) == self.root(y):
            if self.rank[x] > self.rank[y]:
                self.parent[self.root(y)] = self.root(x)
            else:
                self.parent[self.root(x)] = self.root(y)
                if self.rank[x] == self.rank[y]:
                    self.rank[self.root(y)] += 1

    def ifSame(self, x, y):
        return self.root(x) == self.root(y)

    # 木の根に到達すまでにたどるノードの配列を返す
    def printDebugInfo(self):
        print([self.root(i) for i in range(self.N)])


N, M, K = map(int, input().split())
friend_tree = UnionFind(N)
like_array = [[] for _ in range(N)]
for _ in range(M):
    # 友人木を構築する
    A, B = map(int, input().split())
    like_array[B-1].append(A-1)
    like_array[A-1].append(B-1)
    if not friend_tree.ifSame(A-1, B-1):
        friend_tree.unite(A-1, B-1)

# friend_tree.printDebugInfo()

friend_groups = {}
for i in range(N):
    root = friend_tree.root(i)
    if root in friend_groups.keys():
        friend_groups[root] += 1
    else:
        friend_groups[root] = 1

# print(friend_groups)

dislike_array = [[] for _ in range(N)]
for _ in range(K):
    C, D = map(int, input().split())
    dislike_array[C-1].append(D-1)
    dislike_array[D-1].append(C-1)

# print(dislike_array)

answer = []
for i in range(N):
    root = friend_tree.root(i)
    friends_count = friend_groups[root] - 1

    blockd_friend = 0
    for dislike_person in dislike_array[i]:
        if friend_tree.ifSame(i, dislike_person):
            blockd_friend += 1

    kai = friends_count - blockd_friend - len(like_array[i])
    answer.append(str(kai))

print(" ".join(answer))


Fixed submission:
from sys import stdin
input = stdin.readline


class UnionFind:
    # この時点でそれぞれのノードは自分を親としている
    # 初期化時に問題が0の頂点を認めるかに注意すること
    def __init__(self, n):
        self.N = n
        self.parent = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    # xの根を返す関数
    def root(self, x):
        visited_nodes = []
        while True:
            p = self.parent[x]
            if p == x:
                # 縮約
                for node in visited_nodes:
                    self.parent[node] = x
                return x
            else:
                visited_nodes.append(x)
                x = p

    # 木の結合を行う。親の配下に入る
    def unite(self, x, y):
        if not self.root(x) == self.root(y):
            if self.rank[x] > self.rank[y]:
                self.parent[self.root(y)] = self.root(x)
            else:
                self.parent[self.root(x)] = self.root(y)
                if self.rank[x] == self.rank[y]:
                    self.rank[self.root(y)] += 1

    def ifSame(self, x, y):
        return self.root(x) == self.root(y)

    # 木の根に到達すまでにたどるノードの配列を返す
    def printDebugInfo(self):
        print([self.root(i) for i in range(self.N)])


N, M, K = map(int, input().split())
friend_tree = UnionFind(N)
like_array = [[] for _ in range(N)]
for _ in range(M):
    # 友人木を構築する
    A, B = map(int, input().split())
    like_array[B-1].append(A-1)
    like_array[A-1].append(B-1)
    if not friend_tree.ifSame(A-1, B-1):
        friend_tree.unite(A-1, B-1)

# friend_tree.printDebugInfo()

friend_groups = {}
for i in range(N):
    root = friend_tree.root(i)
    if root in friend_groups.keys():
        friend_groups[root] += 1
    else:
        friend_groups[root] = 1

# print(friend_groups)

dislike_array = [[] for _ in range(N)]
for _ in range(K):
    C, D = map(int, input().split())
    dislike_array[C-1].append(D-1)
    dislike_array[D-1].append(C-1)

# print(dislike_array)

answer = []
for i in range(N):
    root = friend_tree.root(i)
    friends_count = friend_groups[root] - 1

    blockd_friend = 0
    for dislike_person in dislike_array[i]:
        if friend_tree.ifSame(i, dislike_person):
            blockd_friend += 1

    kai = friends_count - blockd_friend - len(like_array[i])
    answer.append(str(kai))

print(" ".join(answer))