Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in B[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
n, m, k = list(map(int, sys.stdin.readaline().split()))
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[c].append(d)
    F[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in F[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

n, m, k = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
n, m, k = map(int, sys.stdin.readline().split())
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]

for i in range(m):
    a,b = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)

for i in range(k):
    c,d = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

ans = []
for i in range(n):
    que = deque([i])
    V = [False]*n
    V[i] = True
    _B = set(B[i])
    _F = set(F[i])
    _ans = 0
    while que:
        nw = que.popleft()
        for nx in F[nw]:
            if V[nx]: continue
            V[nx] = True
            if nx not in _B and not nx in _F:
                _ans += 1
            que.append(nx)
    ans.append(_ans)
print(" ".join([str(_ans) for _ans in ans]))

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in F[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

n, m, k = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
n, m, k = map(int, sys.stdin.readline().split())
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]

for i in range(m):
    a,b = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)

for i in range(k):
    c,d = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

ans = []
for i in range(n):
    que = deque([i])
    V = [False]*n
    V[i] = True
    _B = set(B[i])
    _F = set(F[i])
    _ans = 0
    while que:
        nw = que.popleft()
        for nx in F[nw]:
            if V[nx]: continue
            V[nx] = True
            if nx not in _B and not nx in _F:
                _ans += 1
            que.append(nx)
    ans.append(_ans)
print(" ".join([str(_ans) for _ans in ans]))

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in F[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

n, m, k = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

print(*ans)