Buggy python submission (verdict: Runtime Error):
import queue
 
N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    c,d=map(int,input().split())
    block[c-1].append(d-1)
    block[d-1].append(c-1)
 
q=queue.Queue()
count=[0]*N
 
for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        count[c]+=1
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    count[c]+=1
                    q.put(t)
        c+=1
 
for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)

Fixed submission:
import queue

N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    a,b=map(int,input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)

q=queue.Queue()
count=[0]*N

for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        count[c]+=1
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    count[c]+=1
                    q.put(t)
        c+=1

for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)

Buggy python submission (verdict: Time Limit Exceeded):
import queue

N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    c,d=map(int,input().split())
    block[c-1].append(d-1)
    block[d-1].append(c-1)

q=queue.Queue()

for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    q.put(t)
        c+=1

count=[0]*c

for i in range(c):
    count[i]=color.count(i)

for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)

Fixed submission:
import queue

N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    a,b=map(int,input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)

q=queue.Queue()
count=[0]*N

for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        count[c]+=1
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    count[c]+=1
                    q.put(t)
        c+=1

for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)