Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
"""
unioufind
集合の中で、直接の友達 と直接のブロックを引く
"""

from collections import defaultdict
class UnionFind:
    def __init__(self, n):
        class KeyDict(dict):
            # 辞書にないときの対応
            def __missing__(self,key):
                self[key] = key
                return key
        self.parent = KeyDict()
        self.rank = defaultdict(int)
        self.weight = defaultdict(int)

    # 根を探す
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            # 経路圧縮
            # 自分自身じゃない場合は、上にさかのぼって検索(再帰的に)
            y = self.find(self.parent[x])           
            self.weight[x] += self.weight[self.parent[x]]   #圧縮時にweightを更新(和)
            self.parent[x] = y      #親の置き換え(圧縮)
            return self.parent[x]

    # 結合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # 低い方を高い方につなげる(親のランクによる)
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
        
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    ### 重み付き
    def weighted_union(self, x, y, w):
        # print("unite",x,y,w,self.weight)
        px = self.find(x)
        py = self.find(y)
        # 低い方を高い方につなげる(親のランクによる)
        # if px == py: return 0
        if self.rank[px] < self.rank[py]:
            self.parent[px] = py
            self.weight[px] = - w - self.weight[x] + self.weight[y]
        else:
            self.parent[py] = px
            self.weight[py] =  w + self.weight[x] - self.weight[y]
        if self.rank[px] == self.rank[py]:
            self.rank[px] += 1
        return 0

    # 判定
    def judge(self, x, y):
        return self.find(x) == self.find(y)





N,M,K = map(int, input().split())
uf = UnionFind(N)

tomodachi = defaultdict(int)
for i in range(M):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    tomodachi[a] += 1
    tomodachi[b] += 1
    if not uf.judge(a,b):
        uf.union(a,b)
tomo_size = defaultdict(int)
for i in range(N):
    tomo_size[uf.find(i)] += 1


block = defaultdict(int)
for i in range(K):
    c,d = map(int, input().split())
    c -= 1
    d -= 1
    # 友達グループじゃないと無意味
    if not uf.judge(c,d):continue
    block[c] += 1
    block[d] += 1

ans = []
for i in range(N):
    a = tomo_size[uf.find(i)] - tomodachi[i] - block[i] -1 
    ans.append(a)

print(*ans)

Fixed submission:
"""
unioufind
集合の中で、直接の友達 と直接のブロックを引く
TLE

bfsで集合をまず見ておく
"""
from collections import deque
from collections import defaultdict
N,M,K = map(int, input().split())

# 木構造を作る
G = defaultdict(list)
for i in range(M):
    # グラフに頂点を追加(距離があるときは,u,vの後に入れる)
    u,v = map(int,input().split())
    G[u-1].append((v-1))
    G[v-1].append((u-1))

tomodachi_group = defaultdict(int)
used = [False] * N
parent = [-1] * N
group_cnt = {}
for i in range(N):
    if used[i]: continue
    used[i] = True
    parent[i] = i
    q = deque([])
    q.append(i)
    cnt = 0
    while len(q) > 0:
        a = q.popleft()
        Vs = G[a]
        for u in Vs:
            if not used[u]:
                q.append(u)
                parent[u] = i
                used[u] = True
                cnt += 1
    group_cnt[i] = cnt

block = defaultdict(int)
for i in range(K):
    c,d = map(int, input().split())
    c -= 1
    d -= 1
    # 友達グループじゃないと無意味
    if parent[c] != parent[d] :continue
    block[c] += 1
    block[d] += 1

ans = []
for i in range(N):
    cnt = group_cnt[parent[i]] - len(G[i]) - block[i]
    ans.append(cnt)
print(*ans)