Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
m = []
for i in range(n):
  m = m.append(int(input())) 
  
print(n + x//min(m))


Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n + (x-sum(m))//min(m))

Buggy python submission (verdict: Runtime Error):
n,x = int(input())
m = []
for i in range(n):
  m = m.append(int(input())) 
print(n + x//min(m))

Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n + (x-sum(m))//min(m))

Buggy python submission (verdict: Runtime Error):
n,x = int(input())
gr = [0 for i in range(1,n)]
for i in range(1,n):
  gr[i] = int(input())
print(n-1 + x//min(gr))


Fixed submission:
n,x = map(int,input().split())
m = [int(input()) for i in range(n)]
print(n + (x-sum(m))//min(m))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
ma = lambda : map(int,input().split())
ni = lambda : int(input())
a,b,x = ma

if a<=x and a+b>=x:print("Yes")
else:print("No")


Fixed submission:
import sys
input = sys.stdin.readline
ma = lambda : map(int,input().split())
ni = lambda : int(input())
a,b,x = ma()

if a<=x and a+b>=x:print("YES")
else:print("NO")
Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
A = int(input())
if N % 500 <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int,input().split()))
A = 0
B = 0
lsn = sorted(ls,reverse = True)
if n%2 == 1:
  lsn = lsn.append(0)
for i in range(0,len(lsn),2):
  A += lsn[i]
  B += lsn[i+1]
print(A-B)

Fixed submission:
n = int(input())
ls = list(map(int,input().split()))
A = []
B = []
lsn = sorted(ls,reverse = True)

A = lsn[0::2]
B = lsn[1::2]
print(sum(A)-sum(B))
Buggy python submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
    count += 1
    break
  else:
    x -= i*500
    for j in range(B):
      if j*100 == x:
        count += 1
        break
      else:
        x -= j*100
        for k in range(C):
          if k*50 == x:
            count += 1
            break
print(count)

Fixed submission:
nums = [input() for i in range(3)]
A,B,C = map(int,nums)
x = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == x:
        count +=1
print(count)

Buggy python submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
  	count += 1
  	break
  else:
    x -= i*500
    for j in range(B):
		if j*100 == x:
		  count += 1    		
		  break
        else:
          x -= j*100
          for k in range(C):
            if k*50 == x:
    		  count += 1
      		  break
print(count)

Fixed submission:
nums = [input() for i in range(3)]
A,B,C = map(int,nums)
x = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == x:
        count +=1
print(count)

Buggy python submission (verdict: Runtime Error):
nums = [input() for i in range(2)]
A,B,C = map(int,nums)
x = int(input())
  
count = 0
for i in range(A):
  if i*500 == x:
    count += 1
    break
  else:
    x -= i*500
    for j in range(B):
  		if j*100 == x:
    	  count += 1    		
  		  break
        else:
          x -= j*100
          for k in range(C):
            if k*50 == x:
    		  count += 1
      		  break
print(count)
  			
    
    
     


Fixed submission:
nums = [input() for i in range(3)]
A,B,C = map(int,nums)
x = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == x:
        count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b % 2 == 0:
  print("Even")
 else:
  print("Odd")


Fixed submission:
a,b = map(int,input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = [int(input()) for i in range(n)]
mso = sorted(m)
count = 0
for s in range(1,n):
  if mso[s] == mso[s-1]
    count += 1
print(n-count)

Fixed submission:
n = int(input())
m = [int(input()) for i in range(n)]
mso = sorted(m)
count = 0
for s in range(1,n):
  if mso[s] == mso[s-1]:
    count += 1
print(n-count)
Buggy python submission (verdict: Runtime Error):
def sumC(x):
  s = x//10
  s1 = (x-s)//100
  s2 = (x-s-s1*10)//1000
  s3 = (x-s-s1*10-s2*100)//10000
  s4 = (x-s-s1*10-s2*100-s3*1000)//100000
  return(s+s1+s2+s+3+s4)
  
n,a,b = map(int,input().split)
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans) 

Fixed submission:
def sumC(x):
  s = x%10
  s1 = (x-s)/10 %10
  s2 = (x-s-s1*10)/100 %10
  s3 = (x-s-s1*10-s2*100)/1000 %10
  s4 = (x-s-s1*10-s2*100-s3*1000)/10000 %10
  return(int(s+s1+s2+s3+s4))
  
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
  if a<= sumC(i) <= b:
    ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
def counter(a):
  count = 0 
  while a%2 ==0:
    a /= 2
    count += 1
  return count
s = list(map(int,input().split()))
print(min(list(map(counter,s)))

     


Fixed submission:
def counter(a):
  count = 0 
  while a%2 ==0:
    a /= 2
    count += 1
  return count
N = int(input())
s = [int(n) for n in input().split()]
print(min([counter(a) for a in s]))

Buggy python submission (verdict: Runtime Error):
lis = map(int,input().split())
 
def counter(x):
  count = 0 
  while x%2 ==0:
    x = x/2
    count += 1
  return count
 
min(counter,lis)

Fixed submission:
def counter(a):
  count = 0 
  while a%2 ==0:
    a /= 2
    count += 1
  return count
N = int(input())
s = [int(n) for n in input().split()]
print(min([counter(a) for a in s]))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools


N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(i):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)


Fixed submission:
import itertools
#TLE

N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(i):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)

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


N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
tree = [[] for i in range(N)]
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)


Fixed submission:
import itertools
#TLE

N,M,R = map(int,input().split())
rs = list(map(lambda x:int(x)-1,input().split()))
cost=[[10**9]*N for i in range(N)]
for i in range(M):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(i):  # j<i
            cost[i][j] =  min(cost[i][j],cost[i][k] + cost[k][j])
            cost[j][i] = cost[i][j]

ans = 10**9
for roads in itertools.permutations(rs):
    co = 0
    p = roads[0]
    for r in roads[1:]:
        co += cost[p][r]
        p = r
    ans = min(ans,co)
print(ans)
Buggy python submission (verdict: Runtime Error):
ma = lambda:map(int,input().split())
n,k = ma()
ab = []
for i in range(n):
    ab.append((list(ma)))
ab.sort()
c  = 0
for a,b in ab:
    c+=b
    if c>=k:print(a) 


Fixed submission:
ma = lambda:map(int,input().split())
n,k = ma()
ab = []
for i in range(n):
    ab.append((list(ma())))
ab.sort()
c  = 0
for a,b in ab:
    c+=b
    if c>=k:
        print(a)
        break
Buggy python submission (verdict: Runtime Error):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        if tmp<abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)


Fixed submission:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
ips = lambda:input().split()
import collections
import math
import itertools
import heapq as hq
import sys
n,m = ma()
ckp = []
st = []

for i in range(n):
    st.append(lma())
for i in range(m):
    ckp.append(lma())
for a,b in st:
    tmp=10**15
    ans=0
    for i  in range(m):
        c,d=ckp[i]
        if tmp>abs(a-c)+abs(b-d):
            tmp=abs(a-c)+abs(b-d)
            ans=i+1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    for m in range(Zm+1):
      if i+j+m == s:
        count += 1
print(count)

Fixed submission:
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k #使わない
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    if 0<= s - (i+j) <= k:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    for m in range(Zm+1):
      if i+j+m = s:
        count += 1
print(count)

Fixed submission:
k,s = map(int,input().split())
Xm = k
Ym = k
Zm = k #使わない
count = 0
for i in range(Xm+1):
  for j in range(Ym+1):
    if 0<= s - (i+j) <= k:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N=input()
S=input()
abc=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
out=[]
for i in S:
  ind=abc.index(i)
  ind+=2
  if index>26:
    index-=26
  out.append(abc(ind))
print(out)
  

Fixed submission:
N=input()
S=input()
abc=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
out=[]
for i in S:
  idx=abc.index(i)
  idx=idx+int(N)%26
  if idx>25:
      idx-=26
  out.append(abc[idx])
out1=''.join(out)
print(out1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
s = input()
n = len(s)
cnt = 0
lista = []
for i in range(n):
    inta = int(s[-i - 1:n])
    lista.append(inta)
listb = []
for i in range(n):
    intb = lista[i] % 2019
    listb.append(intb)
c = collections.Counter(listb)
for i in listb:
    if i == 0:
        cnt += 1
for i in c.most_common():
    match = i[1]
    if match >= 2:
        cnt += match * (match - 1) // 2
    else:
       break
print(cnt)

Fixed submission:
mod = [0]
pw = 1
for c in input()[::-1]:
    # 大きい数字での計算方法
    # a と z が互いに素のとき
    # x == y (mod z)なら
    # ax == ay (mod z)
    # 10000 == 1924 (mod 2019)
    # 100000 == 19240 (mod 2019)
    # 100000 == 1060 (mod 2019) 前のpwを10で掛けた分に2019を割る
    mod.append((int(c) * pw + mod[-1]) % 2019)
    pw = pw * 10 % 2019
from collections import *
# 8646 % 2019 = 余り570
# 282668646 % 2019 = 余り570
# 282668646 - 8646 = 282660000
# 282660000 % 2019 = 140000 余り0
# 余りが同じものをn(n - 1) / 2する
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
s = input()
n = len(s)
cnt = 0
lista = []
for i in range(n):
    inta = int(s[-i - 1:n])
    lista.append(inta)
listb = []
for i in range(n):
    intb = lista[i] % 2019
    listb.append(intb)
c = collections.Counter(listb)
for i in listb:
    if i == 0:
        cnt += 1
for i in c.most_common():
    match = i[1]
    if match >= 2:
        cnt += match * (match - 1) // 2
print(cnt)

Fixed submission:
mod = [0]
pw = 1
for c in input()[::-1]:
    # 大きい数字での計算方法
    # a と z が互いに素のとき
    # x == y (mod z)なら
    # ax == ay (mod z)
    # 10000 == 1924 (mod 2019)
    # 100000 == 19240 (mod 2019)
    # 100000 == 1060 (mod 2019) 前のpwを10で掛けた分に2019を割る
    mod.append((int(c) * pw + mod[-1]) % 2019)
    pw = pw * 10 % 2019
from collections import *
# 8646 % 2019 = 余り570
# 282668646 % 2019 = 余り570
# 282668646 - 8646 = 282660000
# 282660000 % 2019 = 140000 余り0
# 余りが同じものをn(n - 1) / 2する
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
cnt = 0
lista = []
for i in range(n):
    inta = int(s[-i - 1:n])
    lista.append(inta)
listb = []
for i in range(n):
    intb = lista[i] % 2019
    listb.append(intb)
for i in listb:
    if i == 0:
        cnt += 1
for i in range(len(listb)):
    for j in range(i + 1, len(listb)):
        if listb[i] == listb[j]:
            cnt += 1
print(cnt)

Fixed submission:
mod = [0]
pw = 1
for c in input()[::-1]:
    # 大きい数字での計算方法
    # a と z が互いに素のとき
    # x == y (mod z)なら
    # ax == ay (mod z)
    # 10000 == 1924 (mod 2019)
    # 100000 == 19240 (mod 2019)
    # 100000 == 1060 (mod 2019) 前のpwを10で掛けた分に2019を割る
    mod.append((int(c) * pw + mod[-1]) % 2019)
    pw = pw * 10 % 2019
from collections import *
# 8646 % 2019 = 余り570
# 282668646 % 2019 = 余り570
# 282668646 - 8646 = 282660000
# 282660000 % 2019 = 140000 余り0
# 余りが同じものをn(n - 1) / 2する
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n + 1):
    print(a.count(i))

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
# collections.Counter(A)で速くなる！！
cnt = collections.Counter(A)
for i in range(1, N+1):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import bisect
n = int(input())
s = input()
listR = []
listG = []
listB = []
counter = 0
for i in range(len(s)):
    if s[i] == "R":
        listR.append(i)
    elif s[i] == "G":
        listG.append(i)
    elif s[i] == "B":
        listB.append(i)

for bits in itertools.product(listR, listG):
    diff = max(bits) - min(bits)
    remover = 0
    if sum(bits) % 2 == 0:
        mid = int(sum(bits) / 2)
    else:
        mid = 1000000
    if (max(bits) + diff) in listB:
        remover += 1
    if (min(bits) - diff) in listB:
        remover += 1
    if mid in listB:
        remover += 1
    counter += (len(listB) - remover)
print(counter)

Fixed submission:
import itertools
import bisect
n = int(input())
s = input()
listR = []
listG = []
listB = []
counter = 0
for i in range(len(s)):
    if s[i] == "R":
        listR.append(i)
    elif s[i] == "G":
        listG.append(i)
    elif s[i] == "B":
        listB.append(i)

listB = sorted(listB)
def binary_search_loop(data, target):
    imin = 0
    imax = len(data)-1
    while imin <= imax:
        imid = imin + (imax - imin) // 2
        if target == data[imid]:
            return True
        elif target < data[imid]:
            imax = imid -1
        else:
            imin = imid + 1
    return False
for bits in itertools.product(listR, listG):
    diff = max(bits) - min(bits)
    remover = 0
    if sum(bits) % 2 == 0:
        mid = int(sum(bits) / 2)
    else:
        mid = 1000000
    if binary_search_loop(listB, max(bits) + diff):
        remover += 1
    if binary_search_loop(listB, min(bits) - diff):
        remover += 1
    if binary_search_loop(listB, mid):
        remover += 1
    counter += (len(listB) - remover)
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
anslist = [0] * n
list = []
for m in range(1, n + 1):
    for n in range(m, n + 1):
        if m != n:
            list.append([m, n])
while len(list) != 0:
    dis = list[0][1] - list[0][0]
    warpdis = (abs(x - list[0][0])) + (abs(list[0][1] - y)) + 1
    anslist[min(dis, warpdis)] += 1
    list.pop(0)
for i in range(1, n):
    print(anslist[i])

Fixed submission:
from collections import deque

n, x, y = map(int, input().split())
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n

def line(num):
    pos = deque([[num, 0]])
    dp = [-1] * n

    while len(pos) > 0:
        now, depth = pos.popleft()
        dp[num] = 0
        for i in dist[now]:
            if dp[i] > 0:
                continue
            dp[i] = depth + 1
            pos.append([i, depth + 1])
    for i in dp:
        list[i] += 1
for i in range(n):
    line(i)
for i in range(1, n):
    print(int(list[i] / 2))

Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
anslist = [0] * n
list = []
for m in range(1, n + 1):
    for n in range(m, n + 1):
        if m != n:
            list.append([m, n])
while len(list) != 0:
    dis = list[0][1] - list[0][0]
    warpdis = (abs(x - list[0][0])) + (abs(list[0][1] - y)) + 1
    anslist[min(dis, warpdis)] += 1
    list.pop(0)
for i in range(1, n):
    print(anslist[i])

Fixed submission:
from collections import deque

n, x, y = map(int, input().split())
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n

def line(num):
    pos = deque([[num, 0]])
    dp = [-1] * n

    while len(pos) > 0:
        now, depth = pos.popleft()
        dp[num] = 0
        for i in dist[now]:
            if dp[i] > 0:
                continue
            dp[i] = depth + 1
            pos.append([i, depth + 1])
    for i in dp:
        list[i] += 1
for i in range(n):
    line(i)
for i in range(1, n):
    print(int(list[i] / 2))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
counter = 1
lista = [list(input().split()) for i in range(q)]

def rever(i):
    if i == '1':
        return 1
    else:
        return -1
for i in lista:
    if i[0] == '1':
        counter = -1 * counter
    else:
        if counter * rever(i[1]) > 0:
            s = i[2] + s
        else:
            s = s + i[2]
if counter > 0:
    print(s)
else:
    print(s[::-1])

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
counter = 1
lista = [list(input().split()) for i in range(q)]

def rever(i):
    if i == '1':
        return 1
    else:
        return -1
for i in lista:
    if i[0] == '1':
        counter = -1 * counter
    else:
        if counter * rever(i[1]) > 0:
            s.appendleft(i[2])
        else:
            s.append(i[2])
s = "".join(list(s))
if counter > 0:
    print(s)
else:
    print(s[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left

import sys
# sys.setrecursionlimit(1000000)
# list(map(int, input().split()))
mod = 10 ** 9 + 7
# https://atcoder.jp/contests/abc141/tasks/abc141_d

# Nは人、Mは関係の数
N, M, K = getNM()
friend = [[] for i in range(N)]
for i in range(M):
    a, b = getNM()
    friend[a - 1].append(b - 1)
    friend[b - 1].append(a - 1)
blocked = [[] for i in range(N)]
for i in range(K):
    a, b = getNM()
    blocked[a - 1].append(b - 1)
    blocked[b - 1].append(a - 1)
def matcher(n):
    ignore = [0] * (N + 1)
    ignore[n] = 1
    pos = deque([n])
    setfriend = set(friend[n])
    setblocked = set(blocked[n])
    res = set()
    while len(pos) > 0:
        u = pos.popleft()
        for i in friend[u]:
            if ignore[i] > 0:
                continue
            ignore[i] = 1
            if not i in (setfriend | setblocked):
                res.add(i)
            pos.append(i)
    return len(res)
ans = []
for i in range(N):
    ans.append(matcher(i))
print(*ans)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left

import sys
# sys.setrecursionlimit(1000000)
# list(map(int, input().split()))
mod = 10 ** 9 + 7

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.parents[self.find(x)]

N, M, K = getNM()

# グループ分けをして解いていく
U = UnionFind(N)

friendlist = [getList() for i in range(M)]
blockedlist = [getList() for i in range(K)]
# friendlist内のa, bを繋いでいく
for a, b in friendlist:
    U.union(a - 1, b - 1)

friends = [0] * (N + 1)
blocks = [0] * (N + 1)

# 「同じグループ内に」友達、ブロックが何人いるか
for a, b in friendlist:
    if U.same(a - 1, b - 1):
        friends[a - 1] += 1
        friends[b - 1] += 1
for a, b in blockedlist:
    if U.same(a - 1, b - 1):
        blocks[a - 1] += 1
        blocks[b - 1] += 1

ans = []
for i in range(N):
    # U.size: グループの大きさ
    cnt = U.size(i) - friends[i] - blocks[i] - 1
    ans.append(cnt)
print(*ans)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(int(a * b / math.gcd(a, b)))

Fixed submission:
import fractions
a, b = map(int, input().split())
print(int(a * b / fractions.gcd(a, b)))