Buggy python submission (verdict: Runtime Error):
import copy
import itertools
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0] * 2 for i in range(m)]
blist = [[0] * 2 for i in range(k)]
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)

Fixed submission:

import copy
import itertools
import sys
sys.setrecursionlimit(10**5)
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0] * 2 for i in range(m)]
blist = [[0] * 2 for i in range(k)]
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)

Buggy python submission (verdict: Runtime Error):
import copy
import itertools
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0]*2]*m
blist = [[0]*2]*k
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)



Fixed submission:

import copy
import itertools
import sys
sys.setrecursionlimit(10**5)
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0] * 2 for i in range(m)]
blist = [[0] * 2 for i in range(k)]
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)

Buggy python submission (verdict: Runtime Error):
import copy
import itertools
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0]*2]*m
blist = [[0]*2]*k
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)



Fixed submission:

import copy
import itertools
import sys
sys.setrecursionlimit(10**5)
def addp(a, i, j):
    tmp1 = searchp(a, i)
    tmp2 = searchp(a, j)
    if(tmp1 != tmp2):
        a[tmp2][0] = tmp1
        a[tmp1][1] += a[tmp2][1]

def searchp(a, i):
    if(a[i][0]==i):
        return i
    else:
        tmp = searchp(a, a[i][0])
        a[i][0] = tmp
        return tmp
n, m, k = map(int, input().split())

clist = [[1] * 2 for i in range(n)]

for i in range(n):
    clist[i][0] = i
flist = [[0] * 2 for i in range(m)]
blist = [[0] * 2 for i in range(k)]
for i in range(m):
    flist[i] = list(map(int, input().split()))
for i in range(k):
    blist[i] = list(map(int, input().split()))
for i in range(m):
    addp(clist, flist[i][0]-1, flist[i][1]-1)
for i in range(n):
    if(clist[i][0] != i):
        tmp = searchp(clist, i)
        clist[i][0] = tmp
        clist[i][1] = clist[tmp][1]
for i in range(m):
    if(searchp(clist, flist[i][0]-1) == searchp(clist, flist[i][1]-1)):
        clist[flist[i][0]-1][1] -= 1
        clist[flist[i][1]-1][1] -= 1
for i in range(k):
    if(searchp(clist, blist[i][0]-1) == searchp(clist, blist[i][1]-1)):
        clist[blist[i][0]-1][1] -= 1
        clist[blist[i][1]-1][1] -= 1
for i in range(n):
    print(clist[i][1]-1)