Buggy python submission (verdict: Time Limit Exceeded):
    #d
    
def main():        
    import sys
    input = sys.stdin.readline
    
    n,m,k = map(int,input().split())
    
    # friends_pair=[]
    # for i in range(m):
    #     a,b = map(int,input().split())
    #     friends_pair.append((a-1,b-1))
    
    # friend=[[] for _ in range(n)]
    # for ab in friends_pair:
    #     a,b = ab
    #     friend[a].append(b)
    #     friend[b].append(a) 
        
    friends_pair=[]
    friend=[[] for _ in range(n)]
    for i in range(m):
        a,b = map(int,input().split())
        a-=1
        b-=1
        friends_pair.append((a,b))
        friend[a].append(b)
        friend[b].append(a) 
            
        
    block=[]
    for i in range(k):
        a,b = map(int,input().split())
        block.append((a-1,b-1))
    
    from collections import deque
    clusters=[]
    visited=[0]*n
    list_cluster=[0]*n
    i_c=0
    while sum(visited)<n:
        for i in range(n):
            if visited[i]==0:
                start=i
                break
        
        cluster =[start]
        q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
        visited[start]=1
        list_cluster[start]=i_c
        for togo in friend[start]:
            visited[togo]=1
            cluster.append(togo)
            list_cluster[togo]=i_c
        while q:
            parent,x = q.popleft()
            for y in friend[x]:
                if y == parent:#親ノードを飛ばし
                    continue
                if visited[y]==0:
                    q.append((x,y))#子ノードを追加
                    visited[y]=1
                    cluster.append(y)
                    list_cluster[y]=i_c
    #        print(parent,x,q)
        clusters.append(cluster)
        i_c+=1
    
    ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
    for f0,f1 in friends_pair:
        if list_cluster[f0] ==  list_cluster[f1]:
            ans[f0]-=1
            ans[f1]-=1
    for b0,b1 in block:
        if list_cluster[b0] ==  list_cluster[b1]:
            ans[b0]-=1
            ans[b1]-=1
    print(*ans)

main()

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#d
def main():
        
    import sys
    input = sys.stdin.readline
    
    n,m,k = map(int,input().split())
    
    friends_pair=[]
    for i in range(m):
        a,b = map(int,input().split())
        friends_pair.append((a-1,b-1))
    
    friend=[[] for _ in range(n)]
    for ab in friends_pair:
        a,b = ab
        friend[a].append(b)
        friend[b].append(a) 
        
    block=[]
    for i in range(k):
        a,b = map(int,input().split())
        block.append((a-1,b-1))
    
    from collections import deque
    clusters=[]
    visited=[0]*n
    list_cluster=[0]*n
    i_c=0
    while sum(visited)<n:
        for i in range(n):
            if visited[i]==0:
                start=i
                break
        
        cluster =[start]
        q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
        visited[start]=1
        list_cluster[start]=i_c
        for togo in friend[start]:
            visited[togo]=1
            cluster.append(togo)
            list_cluster[togo]=i_c
        while q:
            parent,x = q.popleft()
            for y in friend[x]:
                if y == parent:#親ノードを飛ばし
                    continue
                if visited[y]==0:
                    q.append((x,y))#子ノードを追加
                    visited[y]=1
                    cluster.append(y)
                    list_cluster[y]=i_c
    #        print(parent,x,q)
        clusters.append(cluster)
        i_c+=1
    
    ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
    for f in friends_pair:
        if list_cluster[f[0]] ==  list_cluster[f[1]]:
            ans[f[0]]-=1
            ans[f[1]]-=1
    for b in block:
        if list_cluster[b[0]] ==  list_cluster[b[1]]:
            ans[b[0]]-=1
            ans[b[1]]-=1
    print(*ans)
    
main()

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#d
def main():
        
    import sys
    input = sys.stdin.readline
    
    n,m,k = map(int,input().split())
    
    friends_pair=[]
    for i in range(m):
        a,b = map(int,input().split())
        friends_pair.append((a-1,b-1))
    
    friend=[[] for _ in range(n)]
    for ab in friends_pair:
        a,b = ab
        friend[a].append(b)
        friend[b].append(a) 
        
    block=[]
    for i in range(k):
        a,b = map(int,input().split())
        block.append((a-1,b-1))
    
    from collections import deque
    clusters=[]
    visited=[0]*n
    list_cluster=[0]*n
    i_c=0
    while sum(visited)<n:
        for i in range(n):
            if visited[i]==0:
                start=i
                break
        
        cluster =[start]
        q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
        visited[start]=1
        list_cluster[start]=i_c
        for togo in friend[start]:
            visited[togo]=1
            cluster.append(togo)
            list_cluster[togo]=i_c
        while q:
            parent,x = q.popleft()
            for y in friend[x]:
                if y == parent:#親ノードを飛ばし
                    continue
                if visited[y]==0:
                    q.append((x,y))#子ノードを追加
                    visited[y]=1
                    cluster.append(y)
                    list_cluster[y]=i_c
    #        print(parent,x,q)
        clusters.append(cluster)
        i_c+=1
    #ans=[]
    # for i in range(n):
    #     friend_cand = [j for j in range(n) if j in clusters[list_cluster[i]] ]
    #     #print(friend_cand)
    #     ans.append( len([ff for ff in friend_cand if ff not in block[i] and ff not in friend[i] ] ) -1)
    
    # same_cluster = [clusters[list_cluster[i]] for i in range(n) ]
    # for i in range(n):
    #     same = same_cluster[i]
    #     ans.append(  len([s for s in same_cluster[i] if s!=i and s not in friend[i] and s not in block[i]]) )
    
    #print(*ans)
    
    ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
    for f in friends_pair:
        if list_cluster[f[0]] ==  list_cluster[f[1]]:
            ans[f[0]]-=1
            ans[f[1]]-=1
    for b in block:
        if list_cluster[b[0]] ==  list_cluster[b[1]]:
            ans[b[0]]-=1
            ans[b[1]]-=1
    print(*ans)
    
main()

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#d
n,m,k = map(int,input().split())

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

friend=[[] for _ in range(n)]
for ab in friends_pair:
    a,b = ab
    friend[a].append(b)
    friend[b].append(a) 
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
while sum(visited)<n:
    for i in range(n):
        if visited[i]==0:
            start=i
            break
    
    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1
#ans=[]
# for i in range(n):
#     friend_cand = [j for j in range(n) if j in clusters[list_cluster[i]] ]
#     #print(friend_cand)
#     ans.append( len([ff for ff in friend_cand if ff not in block[i] and ff not in friend[i] ] ) -1)

# same_cluster = [clusters[list_cluster[i]] for i in range(n) ]
# for i in range(n):
#     same = same_cluster[i]
#     ans.append(  len([s for s in same_cluster[i] if s!=i and s not in friend[i] and s not in block[i]]) )

#print(*ans)

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f in friends_pair:
    if list_cluster[f[0]] ==  list_cluster[f[1]]:
        ans[f[0]]-=1
        ans[f[1]]-=1
for b in block:
    if list_cluster[b[0]] ==  list_cluster[b[1]]:
        ans[b[0]]-=1
        ans[b[1]]-=1
print(*ans)

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#d

n,m,k = map(int,input().split())

friend=[[] for _ in range(n)]
block=[[] for _ in range(n)]

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)

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
while sum(visited)<n:
    
    for i in range(n):
        if visited[i]==0:
            start=i
            break
    
    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
    
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans=[]
# for i in range(n):
#     friend_cand = [j for j in range(n) if j in clusters[list_cluster[i]] ]
#     #print(friend_cand)
#     ans.append( len([ff for ff in friend_cand if ff not in block[i] and ff not in friend[i] ] ) -1)

same_cluster = [clusters[list_cluster[i]] for i in range(n) ]
for i in range(n):
    same = same_cluster[i]
    ans.append(  len([s for s in same_cluster[i] if s!=i and s not in friend[i] and s not in block[i]]) )

print(*ans)

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#d

n,m,k = map(int,input().split())

friend=[[] for _ in range(n)]
block=[[] for _ in range(n)]

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)

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
while sum(visited)<n:
    
    for i in range(n):
        if visited[i]==0:
            start=i
            break
    
    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
    
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans=[]
for i in range(n):
    friend_cand = [j for j in range(n) if j in clusters[list_cluster[i]] ]
    #print(friend_cand)
    ans.append( len([ff for ff in friend_cand if ff not in block[i] and ff not in friend[i] ] ) -1)

print(*ans)

Fixed submission:
#d

        
#     import sys
#     input = sys.stdin.readline

n,m,k = map(int,input().split())

friends_pair=[]
friend=[[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    friends_pair.append((a,b))
    friend[a].append(b)
    friend[b].append(a) 
        
    
block=[]
for i in range(k):
    a,b = map(int,input().split())
    block.append((a-1,b-1))

from collections import deque
clusters=[]
visited=[0]*n
list_cluster=[0]*n
i_c=0
# while sum(visited)<n:
#     for i in range(n):
#         if visited[i]==0:
#             start=i
#             break
for i in range(n):
    if visited[i]==0:
        start=i
    else:
        continue

    cluster =[start]
    q=deque([(start,togo) for togo in friend[start]]) #スタート地点から行ける場所を列挙
    visited[start]=1
    list_cluster[start]=i_c
    for togo in friend[start]:
        visited[togo]=1
        cluster.append(togo)
        list_cluster[togo]=i_c
    while q:
        parent,x = q.popleft()
        for y in friend[x]:
            if y == parent:#親ノードを飛ばし
                continue
            if visited[y]==0:
                q.append((x,y))#子ノードを追加
                visited[y]=1
                cluster.append(y)
                list_cluster[y]=i_c
#        print(parent,x,q)
    clusters.append(cluster)
    i_c+=1

ans = [len(clusters[list_cluster[i]])-1 for i in range(n)  ]
for f0,f1 in friends_pair:
    if list_cluster[f0] ==  list_cluster[f1]:
        ans[f0]-=1
        ans[f1]-=1
for b0,b1 in block:
    if list_cluster[b0] ==  list_cluster[b1]:
        ans[b0]-=1
        ans[b1]-=1
print(*ans)