Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**5)

n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
frl=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    fr[a-1]=fr[a-1]+1
    fr[b-1]=fr[b-1]+1
    frl[a-1].append(b)
    frl[b-1].append(a)

treelist=[]
hitobito=set()

def saiki(c):
    global treelist
    global hitobito
    global frl
    global bll
    global tmpset

    if frl[c-1] == []:
        hitobito.add(c)
        tmpset.add(c)
    
    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            saiki(tsugi)

for i in range(n):
    tmpset=set()
    saiki(i+1)
    if not tmpset == set():
        treelist.append(tmpset)


bll=[[] for i in range(n)]

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


output=[]
for i in range(n):
    for tree in treelist:
        if i+1 in tree:
            tmpsum=0
            for aaa in frl[i]:
                if aaa in tree:
                    tmpsum+=1
            for bbb in bll[i]:
                if bbb in tree:
                    tmpsum+=1 
            output.extend([str(len(tree)-tmpsum-1)," "])

print("".join(output))    




Fixed submission:
import sys
sys.setrecursionlimit(10**5)

n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
frl=[[] for i in range(n)]
frlist=[]
for i in range(m):
    a,b=map(int,input().split())
    frl[a-1].append(b)
    frl[b-1].append(a)
    frlist.append([a,b])

treelist=[]
hitobito=set()

def saiki(c,tmpi):
    global hitobito
    global tmpset
    global trbl
    
    if frl[c-1] == []:
        hitobito.add(c)
        tmpset.add(c)
        trbl[c-1]=tmpi
    
    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            trbl[tsugi-1]=tmpi
            saiki(tsugi,tmpi)

index=0
trbl=[None for _ in range(n)]
for i in range(n):
    tmpset=set()
    saiki(i+1,index)
    if not tmpset == set():
        treelist.append(tmpset)
        index+=1

bl=[0 for _ in range(n)]
bll=[[] for i in range(n)]
bllist=[]
for i in range(k):
    a,b=map(int,input().split())
    bll[a-1].append(b)
    bll[b-1].append(a)
    bllist.append([a,b])

for fre in frlist:
    if trbl[fre[0]-1] == trbl[fre[1]-1]:
        fr[fre[0]-1]=fr[fre[0]-1]+1
        fr[fre[1]-1]=fr[fre[1]-1]+1

for blo in bllist:
    if trbl[blo[0]-1] == trbl[blo[1]-1]:
        bl[blo[0]-1]=bl[blo[0]-1]+1
        bl[blo[1]-1]=bl[blo[1]-1]+1

output=[]
for i in range(n):
    tmpsum=fr[i]+bl[i]
    output.extend([str(len(treelist[trbl[i]])-tmpsum-1)," "])

print("".join(output))

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
bl=[0 for _ in range(n)]
frl=[[] for i in range(n)]
bll=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    fr[a-1]=fr[a-1]+1
    fr[b-1]=fr[b-1]+1
    frl[a-1].append(b)
    frl[b-1].append(a)

treelist=[]
hitobito=set()

def saiki(c):
    global treelist
    global hitobito
    global frl
    global bll
    global tmpset

    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            saiki(tsugi)

for i in range(n):
    tmpset=set()
    saiki(i+1)
    if not tmpset == set():
        treelist.append(tmpset)



for i in range(k):
    a,b=map(int,input().split())
    bl[a-1]=bl[a-1]+1
    bl[b-1]=bl[b-1]+1
    bll[a-1].append(b)
    bll[b-1].append(a)


output=[]
for i in range(n):
    for tree in treelist:
        if i+1 in tree:
            tmpsum=0
            for aaa in frl[i]:
                if aaa in tree:
                    tmpsum+=1
            for bbb in bll[i]:
                if bbb in tree:
                    tmpsum+=1 
            output.extend([str(len(tree)-tmpsum-1)," "])

print("".join(output))    




Fixed submission:
import sys
sys.setrecursionlimit(10**5)

n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
frl=[[] for i in range(n)]
frlist=[]
for i in range(m):
    a,b=map(int,input().split())
    frl[a-1].append(b)
    frl[b-1].append(a)
    frlist.append([a,b])

treelist=[]
hitobito=set()

def saiki(c,tmpi):
    global hitobito
    global tmpset
    global trbl
    
    if frl[c-1] == []:
        hitobito.add(c)
        tmpset.add(c)
        trbl[c-1]=tmpi
    
    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            trbl[tsugi-1]=tmpi
            saiki(tsugi,tmpi)

index=0
trbl=[None for _ in range(n)]
for i in range(n):
    tmpset=set()
    saiki(i+1,index)
    if not tmpset == set():
        treelist.append(tmpset)
        index+=1

bl=[0 for _ in range(n)]
bll=[[] for i in range(n)]
bllist=[]
for i in range(k):
    a,b=map(int,input().split())
    bll[a-1].append(b)
    bll[b-1].append(a)
    bllist.append([a,b])

for fre in frlist:
    if trbl[fre[0]-1] == trbl[fre[1]-1]:
        fr[fre[0]-1]=fr[fre[0]-1]+1
        fr[fre[1]-1]=fr[fre[1]-1]+1

for blo in bllist:
    if trbl[blo[0]-1] == trbl[blo[1]-1]:
        bl[blo[0]-1]=bl[blo[0]-1]+1
        bl[blo[1]-1]=bl[blo[1]-1]+1

output=[]
for i in range(n):
    tmpsum=fr[i]+bl[i]
    output.extend([str(len(treelist[trbl[i]])-tmpsum-1)," "])

print("".join(output))

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
bl=[0 for _ in range(n)]
frl=[[] for i in range(n)]
bll=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    fr[a-1]=fr[a-1]+1
    fr[b-1]=fr[b-1]+1
    frl[a-1].append(b)
    frl[b-1].append(a)

treelist=[]
hitobito=set()

def saiki(c):
    global treelist
    global hitobito
    global frl
    global bll
    global tmpset

    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            saiki(tsugi)

for i in range(n):
    tmpset=set()
    saiki(i+1)
    if not tmpset == set():
        treelist.append(tmpset)

print(treelist)

for i in range(k):
    a,b=map(int,input().split())
    bl[a-1]=bl[a-1]+1
    bl[b-1]=bl[b-1]+1
    bll[a-1].append(b)
    bll[b-1].append(a)



for i in range(n):
    for tree in treelist:
        if i+1 in tree:
            tmpsum=0
            for aaa in frl[i]:
                if aaa in tree:
                    tmpsum+=1
            for bbb in bll[i]:
                if bbb in tree:
                    tmpsum+=1 
            print(len(tree)-tmpsum-1)
    




Fixed submission:
import sys
sys.setrecursionlimit(10**5)

n,m,k=map(int,input().split())
fr=[0 for _ in range(n)]
frl=[[] for i in range(n)]
frlist=[]
for i in range(m):
    a,b=map(int,input().split())
    frl[a-1].append(b)
    frl[b-1].append(a)
    frlist.append([a,b])

treelist=[]
hitobito=set()

def saiki(c,tmpi):
    global hitobito
    global tmpset
    global trbl
    
    if frl[c-1] == []:
        hitobito.add(c)
        tmpset.add(c)
        trbl[c-1]=tmpi
    
    for tsugi in frl[c-1]:
        if not tsugi in hitobito:
            hitobito.add(tsugi)
            tmpset.add(tsugi)
            trbl[tsugi-1]=tmpi
            saiki(tsugi,tmpi)

index=0
trbl=[None for _ in range(n)]
for i in range(n):
    tmpset=set()
    saiki(i+1,index)
    if not tmpset == set():
        treelist.append(tmpset)
        index+=1

bl=[0 for _ in range(n)]
bll=[[] for i in range(n)]
bllist=[]
for i in range(k):
    a,b=map(int,input().split())
    bll[a-1].append(b)
    bll[b-1].append(a)
    bllist.append([a,b])

for fre in frlist:
    if trbl[fre[0]-1] == trbl[fre[1]-1]:
        fr[fre[0]-1]=fr[fre[0]-1]+1
        fr[fre[1]-1]=fr[fre[1]-1]+1

for blo in bllist:
    if trbl[blo[0]-1] == trbl[blo[1]-1]:
        bl[blo[0]-1]=bl[blo[0]-1]+1
        bl[blo[1]-1]=bl[blo[1]-1]+1

output=[]
for i in range(n):
    tmpsum=fr[i]+bl[i]
    output.extend([str(len(treelist[trbl[i]])-tmpsum-1)," "])

print("".join(output))