Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter
n, m, k = map(int, input().split())

fgraph = [list() for _ in range(n)]  # 隣接行列のリスト版
bgraph = [list() for _ in range(n)]  # brock関係のグラフ
cgraph = [list() for _ in range(n)]  # 友達候補のグラフ
sys.setrecursionlimit(10**9)
rks = [None]*n


def dfs(graph, s, r):  # 深さ優先探索
    if rks[s] is None:
        rks[s] = r
    for j in range(len(graph[s])):
        if rks[graph[s][j] - 1] is not None:
            continue
        dfs(graph, graph[s][j]-1, r)


for i in range(m):
    a, b = map(int, input().split())
    fgraph[a-1].append(b)
    fgraph[b-1].append(a)

 # fgraphの連結成分を調べる
c = -1
for i in range(n):
    if rks[i] is None:
        c += 1
        dfs(fgraph, i, c)  # iから始めるDFS。ｃが同じなら同じ連結成分にいる

for i in range(k):
    c, d = map(int, input().split())
    if rks[c-1] == rks[d-1]:  # 同一連結成分の中でのブロック関係のみ注目
        bgraph[c-1].append(d)
        bgraph[d-1].append(c)

counter = Counter(rks)
for i in range(n):
    print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)


Fixed submission:
import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()
n, m, k = map(int, input().split())

fgraph = [list() for _ in range(n)]  # 隣接行列のリスト版
bgraph = [list() for _ in range(n)]  # brock関係のグラフ
cgraph = [list() for _ in range(n)]  # 友達候補のグラフ
sys.setrecursionlimit(10**9)
rks = [None]*n


def dfs(graph, s, r):  # 深さ優先探索
    if rks[s] is None:
        rks[s] = r
    for j in range(len(graph[s])):
        if rks[graph[s][j] - 1] is not None:
            continue
        dfs(graph, graph[s][j]-1, r)


for i in range(m):
    a, b = map(int, input().split())
    fgraph[a-1].append(b)
    fgraph[b-1].append(a)

 # fgraphの連結成分を調べる
c = -1
for i in range(n):
    if rks[i] is None:
        c += 1
        dfs(fgraph, i, c)  # iから始めるDFS。ｃが同じなら同じ連結成分にいる

for i in range(k):
    c, d = map(int, input().split())
    if rks[c-1] == rks[d-1]:  # 同一連結成分の中でのブロック関係のみ注目
        bgraph[c-1].append(d)
        bgraph[d-1].append(c)

counter = Counter(rks)
for i in range(n):
    print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n, m, k = map(int, input().split())

fgraph = [list() for _ in range(n)]  # 隣接行列のリスト版
bgraph = [list() for _ in range(n)]  # brock関係のグラフ
cgraph = [list() for _ in range(n)]  # 友達候補のグラフ
rks = [None]*n


def dfs(graph, s, r):  # 深さ優先探索
    if rks[s] is None:
        rks[s] = r
    for j in range(len(graph[s])):
        if rks[graph[s][j] - 1] is not None:
            continue
        dfs(graph, graph[s][j]-1, r)


for i in range(m):
    a, b = map(int, input().split())
    fgraph[a-1].append(b)
    fgraph[b-1].append(a)

 # fgraphの連結成分を調べる
c = -1
for i in range(n):
    if rks[i] is None:
        c += 1
        dfs(fgraph, i, c)  # iから始めるDFS。ｃが同じなら同じ連結成分にいる

for i in range(k):
    c, d = map(int, input().split())
    if rks[c-1] == rks[d-1]:  # 同一連結成分の中でのブロック関係のみ注目
        bgraph[c-1].append(d)
        bgraph[d-1].append(c)

counter = Counter(rks)
for i in range(n):
    print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

Fixed submission:
import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()
n, m, k = map(int, input().split())

fgraph = [list() for _ in range(n)]  # 隣接行列のリスト版
bgraph = [list() for _ in range(n)]  # brock関係のグラフ
cgraph = [list() for _ in range(n)]  # 友達候補のグラフ
sys.setrecursionlimit(10**9)
rks = [None]*n


def dfs(graph, s, r):  # 深さ優先探索
    if rks[s] is None:
        rks[s] = r
    for j in range(len(graph[s])):
        if rks[graph[s][j] - 1] is not None:
            continue
        dfs(graph, graph[s][j]-1, r)


for i in range(m):
    a, b = map(int, input().split())
    fgraph[a-1].append(b)
    fgraph[b-1].append(a)

 # fgraphの連結成分を調べる
c = -1
for i in range(n):
    if rks[i] is None:
        c += 1
        dfs(fgraph, i, c)  # iから始めるDFS。ｃが同じなら同じ連結成分にいる

for i in range(k):
    c, d = map(int, input().split())
    if rks[c-1] == rks[d-1]:  # 同一連結成分の中でのブロック関係のみ注目
        bgraph[c-1].append(d)
        bgraph[d-1].append(c)

counter = Counter(rks)
for i in range(n):
    print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)