Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    N, K = list(map(int, input().split()))
    P = list(map(int, input().split()))
    C = list(map(int, input().split()))

    max_score = max(C)
    score = C
    P_now = P
    P_ci = P
    for _ in range(K-1):
        score = [score[i]+C[num-1] for i, num in enumerate(P_now)]
        if max_score < max(score):
            max_score = max(score)
            P_ci = P_now
        P_now = [P[i-1] for i in P_now]
        if P_ci == P_now:
            break
    print(max_score)

if __name__ == "__main__":
    main()

Fixed submission:
S = input()
a = 0
for i in range(3):
  if S[i]=="R":
    a+=1
  if S[i]=="S" and a>0:
      break
print(a)

Buggy python submission (verdict: Runtime Error):
S = input()

c = 0
max = 0

for i in S:
  if i==R:
    c += 1
  else:
    max = max([c, max])
    c = 1
    
print(max)

Fixed submission:
S = input()
a = 0
for i in range(3):
  if S[i]=="R":
    a+=1
  if S[i]=="S" and a>0:
      break
print(a)

Buggy python submission (verdict: Runtime Error):
s = rawinput()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)

Fixed submission:
s = input()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split())

if a >= 13:
  print(b)
  
else if a >= 6:
  b /= 2
  print(b)
  
else print(0)

Fixed submission:
a, b = map(int,input().split())

if a >= 13:
  print(b)
  
elif a >= 6:
  b //= 2
  print(b)
  
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split())

if a >= 13:
  print(b)
  end()
  
if a >= 6:
  b /= 2
  print(b)
  end()
  
print(0)


Fixed submission:
a, b = map(int,input().split())

if a >= 13:
  print(b)
  
elif a >= 6:
  b //= 2
  print(b)
  
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())

if a >= 13:
  print(b)
  end()
  
if a >= 6:
  b /= 2
  print(b)
  end()
  
print(0)

Fixed submission:
a, b = map(int,input().split())

if a >= 13:
  print(b)
  
elif a >= 6:
  b //= 2
  print(b)
  
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

l = []
r = []

for i in range(M):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)

ans = rmin - lmax + 1

print(ans)


Fixed submission:
n, m = map(int, input().split())

l = []
r = []

for i in range(m):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)


ans = rmin - lmax + 1
if (ans < 0):
  ans = 0

print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

l, r = []

for i in range(M):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)

ans = rmin - lmax + 1

print(ans)

Fixed submission:
n, m = map(int, input().split())

l = []
r = []

for i in range(m):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)


ans = rmin - lmax + 1
if (ans < 0):
  ans = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d = map(int,input().split())

def judge():
    if x > 0:
        for r in range(d):
            if (x - r)/d == (x - r)//d:
                i = (x - r)//d
                if (k - i)%2 == 0:
                    print(r)
                else:
                    print(d-r)
                exit()
    else:
        l = -x
        for r in range(d):
            if (l - r)/d == (l - r)//d:
                i = (l - r)//d
                if (k - i)%2 == 0:
                    print(r)
                else:
                    print(d-r)
                exit()


if x == 0:
    if k%2 == 0:
        print(0)
    else:
        print(d)
elif x < 0:
    if k*d + x > 0:
        judge()
    else:
        print(abs(k*d + x))
else:
    if x - k*d < 0:
        judge()
    else:
        print(abs(x - k*d))


Fixed submission:
x,k,d = map(int,input().split())

def judge():
    l = x if x > 0 else -x
    i = l//d
    r = l%d

    if (k - i)%2 == 0:
        print(r)
    else:
        print(d - r)
    '''
    if x > 0:
        for r in range(d):
            if (x - r)/d == (x - r)//d:
                i = (x - r)//d
                if (k - i)%2 == 0:
                    print(r)
                else:
                    print(d-r)
                exit()
    else:
        l = -x
        for r in range(d):
            if (l - r)/d == (l - r)//d:
                i = (l - r)//d
                if (k - i)%2 == 0:
                    print(r)
                else:
                    print(d-r)
                exit()
    '''

if x == 0:
    if k%2 == 0:
        print(0)
    else:
        print(d)
elif x < 0:
    if k*d + x > 0:
        judge()
    else:
        print(abs(k*d + x))
else:
    if x - k*d < 0:
        judge()
    else:
        print(abs(x - k*d))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

k = int(input())

if k%2 == 0:
    print(-1)
    exit()

if k == 7:
    print(1)
    exit()

if k == 1:
    print(1)
    exit()

seven = 7
d = 1
while seven != 0:
    seven += pow(7*pow(10,d,k),1,k)
    seven = pow(seven,1,k)
    d += 1

print(d)




Fixed submission:
import sys
input = sys.stdin.readline

k = int(input())

if k%2 == 0:
    print(-1)
    exit()

if k == 7:
    print(1)
    exit()

if k == 1:
    print(1)
    exit()

if k % 5 == 0:
    print(-1)
    exit()

seven = 7
d = 1
while seven != 0:
    seven += pow(7*pow(10,d,k),1,k)
    seven = pow(seven,1,k)
    d += 1

print(d)
Buggy python submission (verdict: Runtime Error):
import sympy
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += i*sympy.divisor_count(i)
print(ans)

Fixed submission:
import sys
input = sys.stdin.buffer.readline
n = int(input())

ans = 0
for i in range(1,n+1):
    ans += i*(n//i)*(n//i+1)//2

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
if a[0] != a[1]:
    ans += 1
for i in range(1,n):
    if a[i] != a[i-1]:
        div = True
        j = 0
        while 2*a[j] <= a[i]:
            if a[i] < 2*a[j]:
                if i < n-1 and a[i] == a[i+1]:
                    div = False
                break
            if a[i]%a[j] == 0:
                div = False
                break
            j += 1
        if div:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
dp = [0]*(a[-1]+1)
k = 2
while k*a[0] <= a[-1]:
    dp[k*a[0]] += 1
    k += 1

for i in range(1,n):
    if a[i] == a[i-1]:
        dp[a[i]] += 1
    else:
        k = 2
        while k*a[i] <= a[-1]:
            dp[k*a[i]] += 1
            k += 1
ans = 0
for elem in a:
    if dp[elem] == 0:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
if a[0] != a[1]:
    ans += 1
for i in range(1,n):
    if a[i] != a[i-1]:
        div = True
        for j in range(i):
            if a[i] < 2*a[j]:
                if i < n-1 and a[i] == a[i+1]:
                    div = False
                break
            if a[i]%a[j] == 0:
                div = False
                break
        if div:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
dp = [0]*(a[-1]+1)
k = 2
while k*a[0] <= a[-1]:
    dp[k*a[0]] += 1
    k += 1

for i in range(1,n):
    if a[i] == a[i-1]:
        dp[a[i]] += 1
    else:
        k = 2
        while k*a[i] <= a[-1]:
            dp[k*a[i]] += 1
            k += 1
ans = 0
for elem in a:
    if dp[elem] == 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,K = map(int,input().split())
a = list(map(int,input().split()))

for k in range(K):
    light = [0]*n
    st = [0]*n

    for i in range(n):
        if i - a[i] >= 0:
            light[i-a[i]] += 1
        else:
            light[0] += 1
        
        if i + a[i] + 1 <= n-1:
            light[i + a[i] + 1] -= 1

    st[0] = light[0]
    for i in range(1,n):
        st[i] = st[i-1] + light[i]    
    
    if st == a:
        for ans in st:
            print(ans, end = " ")
    
    a = st[::]
for ans in a:
    print(ans, end = " ")
        


Fixed submission:
import sys
input = sys.stdin.readline
n,K = map(int,input().split())
a = list(map(int,input().split()))

for k in range(K):
    light = [0]*n
    st = [0]*n
    skip = True
    for i in range(n):
        if i - a[i] >= 0:
            light[i-a[i]] += 1
        else:
            light[0] += 1
        
        if i + a[i] + 1 <= n-1:
            light[i + a[i] + 1] -= 1

    st[0] = light[0]
    if st[0] < n-1:
        skip = False
    for i in range(1,n):
        st[i] = st[i-1] + light[i]
        if st[i] < min(n-1-i,i):
            skip = False
    
    if skip:
        if k < K-1:
            for _ in range(n):
                print(n,end =" ")
            exit()
        else:
            for ans in st:
                print(ans, end = " ")
            exit()
    a = st[::]
for ans in a:
    print(ans, end = " ")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = list(map(int,input().split()))

mx = 10**18

ans = 1
for a in alist:
    ans *= a

print(ans) if ans <= mx else print(-1)

Fixed submission:
n = int(input())
alist = list(map(int,input().split()))
alist.sort()
mx = 10**18

ans = 1
for a in alist:
    ans *= a
    if ans > mx:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

for i in range(int(x**(3/5)+1)):
    for j in range(-int((x)**(1/5))-1,int((x)**(1/5))+1):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break


Fixed submission:
x = int(input())

for i in range(-200,200):
    for j in range(-200,200):
        if i**5 - j**5 == x:
            print(i,j)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
for i in range(x):
    for j in range(-int((x)**(1/5))-1,int((x)**(1/5))+1):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break

Fixed submission:
x = int(input())

for i in range(-200,200):
    for j in range(-200,200):
        if i**5 - j**5 == x:
            print(i,j)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
def floor(x):
    return (a*x)//b - a*(x//b)
ans = 0
if b <= n: 
    for i in range(b-1,n+1):
        ans = max(ans,floor(i))
        #print(floor(i))
    print(ans)
else:
    print(floor(n))

Fixed submission:
a,b,n = map(int,input().split())
def floor(x):
    return (a*x)//b - a*(x//b)
ans = 0
if b <= n: 
    '''
    for i in range(b-1,n+1):
        ans = max(ans,floor(i))
        #print(floor(i))
    print(ans)
    '''
    print(floor(b-1))
else:
    print(floor(n))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
def floor(x):
    return (a*x)//b - a*(x//b)
ans = 0
p = b-1 if b < n else 1 
for i in range(p,n+1):
    ans = max(ans,floor(i))
    #print(floor(i))
print(ans)

Fixed submission:
a,b,n = map(int,input().split())
def floor(x):
    return (a*x)//b - a*(x//b)
ans = 0
if b <= n: 
    '''
    for i in range(b-1,n+1):
        ans = max(ans,floor(i))
        #print(floor(i))
    print(ans)
    '''
    print(floor(b-1))
else:
    print(floor(n))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import fractions
k = int(input())
nums = [i for i in range(1,k+1)]
alist = []
ans = 0
for balls in itertools.product(nums, repeat=3):
  alist.append(balls)
for i in alist:
  ans += fractions.gcd(i[0],fractions.gcd(i[1],i[2]))
print(ans)

Fixed submission:
import math
ans = 0
k = int(input())
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      ans += math.gcd(i,math.gcd(j,l))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
slist = ['R','G','B']
sslist = slist[:]
for i in range(n-3):
  for j in range(i+1,n-1):
    if s[i] != s[j]:
      slist.remove(s[i])
      slist.remove(s[j])
      ans += s[j+1:].count(slist[0])
      if 2*j-i <= n-1:
        if s[2*j-i] == slist[0]:
          ans -= 1
      slist = sslist[:]
print(ans)

Fixed submission:
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
  for j in range(i+1,n):
    k = 2*j-i
    if k < n:
      if  s[i] != s[j] and s[j]!= s[k] and s[i] != s[k]:
        ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
def count(s):
  ans = 0
  for i in range(n-3):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and k-j != j-i:
          ans += 1
  print(ans)
count(s)


Fixed submission:
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
ans = r*g*b
for i in range(n):
  for j in range(i+1,n):
    k = 2*j-i
    if k < n:
      if  s[i] != s[j] and s[j]!= s[k] and s[i] != s[k]:
        ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
k = int(input())
lunlun = [1,2,3,4,5,6,7,8,9]
i = 0
while len(lunlun) < k:
  p = lunlun[i]
  if str(p)[-1] == 0:
    lunlun.append(int(str(p)+'0'))
    lunlun.append(int(str(p)+'1'))
  elif str(p)[-1] == 9:
    lunlun.append(int(str(p)+'8'))
    lunlun.append(int(str(p)+'9'))
  else:
    lunlun.append(int(str(p)+str(int(str(p)[-1])-1)))
    lunlun.append(int(str(p)+str(int(str(p)[-1]))))
    lunlun.append(int(str(p)+str(int(str(p)[-1])+1)))
  i += 1

print(lunlun[k-1])

Fixed submission:
k = int(input())
lunlun = [1,2,3,4,5,6,7,8,9]
i = 0
while len(lunlun) < k:
  p = lunlun[i]
  if str(p)[-1] == '0':
    lunlun.append(p*10)
    lunlun.append(p*10+1)
  elif str(p)[-1] == '9':
    lunlun.append(p*10+8)
    lunlun.append(p*10+9)
  else:
    lunlun.append(p*10+p%10-1)
    lunlun.append(p*10+p%10)
    lunlun.append(p*10+p%10+1)
  i += 1

print(lunlun[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int,input().split())
ans = 0
grid = [['#']*(w+2)]
for i in range(h):
    grid += [ ['#'] + list(input()) + ['#']]

grid += [['#']*(w+2)]
#print(grid)
if grid[1][1] != '.':
    grid[1][1] = '.'
    ans += 1
from collections import deque

q = deque()
q.append([1,1,0])
point = 10**18
while q:
    k = q.popleft()
    x,y,p = k[0],k[1],k[2]
    if x == h and y == w:
        point = min(point,p)
    elif x == h:
        if grid[x][y+1] == '#':
            p += 1
        q.append([x,y+1,p])
    elif y == w:
        if grid[x+1][y] == '#':
            p += 1
        q.append([x+1,y,p])
    else:
        if grid[x+1][y] == '#':
            q.append([x+1,y,p+1])
        else:
            q.append([x+1,y,p])
        if grid[x][y+1] == '#':
            q.append([x,y+1,p+1])
        else:
            q.append([x,y+1,p])
ans += point
print(ans)

Fixed submission:
h,w = map(int,input().split())
grid = []
for _ in range(h):
    grid.append(list(input()))
 
dp = [[0]*(w+1) for i in range(h+1)]
#dp[i][j] = i,jでの最小の操作回数
 
if grid[0][0] == '#':
    dp[0][0] += 1
 
for i in range(1,h):
    p = 0
    if grid[i][0] == '#' and grid[i-1][0] == '.':
        p += 1
    dp[i][0] = dp[i-1][0] + p
 
for i in range(1,w):
    p = 0
    if grid[0][i] == '#' and grid[0][i-1] == '.':
        p += 1
    dp[0][i] = dp[0][i-1] + p
 
for x in range(1,h):
    for y in range(1,w):
        a,b = 0,0
        if grid[x][y] == '#' and grid[x-1][y] == '.':
            a += 1
        if grid[x][y] == '#' and grid[x][y-1] == '.':
            b += 1
        dp[x][y] = min(dp[x-1][y] + a,dp[x][y-1] + b)
print(dp[h-1][w-1])
#print(dp)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if c-a-b<=0:
  print("No")
else:
  if (c-a-b)**2-4a*b>0:
    print("Yes")
  else("No")

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b<=2:
  print("No")
else:
  if (c-a-b)**2-4*a*b>0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if c-a-b<=0:
  print("No")
else:
  if (c-a-b)**2>4ab:
    print("Yes")
  else("No")

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b<=2:
  print("No")
else:
  if (c-a-b)**2-4*a*b>0:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math,sqrt(a) + math,sqrt(b) < math,sqrt(c):
  print("Yes")
else:
  print("No")


Fixed submission:
a,b,c = map(int,input().split())
if c-a-b<=2:
  print("No")
else:
  if (c-a-b)**2-4*a*b>0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input("N>"))
a = int(input("A>"))
b = int(input("B>"))

if a>0:
    if n-n//(a+b)*(a+b)>a:
        print(n//(a+b)*a+a)
    else:
        print(n//(a+b)*a+n-n//(a+b)*(a+b))
else:
    print(0)


Fixed submission:
n,a, b = map(int, input().split()) 
if a>0:
    if n-n//(a+b)*(a+b)>a:
        print(n//(a+b)*a+a)
    else:
        print(n//(a+b)*a+n-n//(a+b)*(a+b))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
a = int(input("A>"))
b = int(input("B>"))
n = int(input("N>"))

if a>0:
    if n-n//(a+b)*(a+b)>a:
        print(n//(a+b)*a+a)
    else:
        print(n//(a+b)*a+n-n//(a+b)*(a+b))
else:
    print(0)


Fixed submission:
n,a, b = map(int, input().split()) 
if a>0:
    if n-n//(a+b)*(a+b)>a:
        print(n//(a+b)*a+a)
    else:
        print(n//(a+b)*a+n-n//(a+b)*(a+b))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
querys = [list(input().split()) for i in range(q)]

rev = 0
moji = []
for query in querys:
    if query[0] == '1':
        rev += 1
    else:
        query[1] = int(query[1])
        p = True if query[1] == 1 else False
        moji.append([query[2], rev, p])

if rev%2 != 0:
    s = s[::-1]

for m in moji:
    if (rev - m[1]) % 2 != 0:
        m[2] = not(m[2])
    
    if m[2]:
        s = m[0] + s
    else:
        s = s + m[0]

print(s)

Fixed submission:
s = input()
q = int(input())
querys = [list(input().split()) for i in range(q)]

rev = 0
moji = []
for query in querys:
    if query[0] == '1':
        rev += 1
    else:
        query[1] = int(query[1])
        p = True if query[1] == 1 else False
        moji.append([query[2], rev, p])

if rev%2 != 0:
    s = s[::-1]
head = ""
end = ""
for m in moji:
    if (rev - m[1]) % 2 != 0:
        m[2] = not(m[2])
    
    if m[2]:
        head = m[0] + head
    else:
        end = end + m[0]

s = head + s + end
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
querys = [list(input().split()) for i in range(q)]

rev = 0
moji = []
for query in querys:
    if query[0] == '1':
        rev += 1
    else:
        query[1] = int(query[1])
        p = True if query[1] == 1 else False
        moji.append([query[2], rev, p])

if rev%2 != 0:
    s = s[::-1]

for m in moji:
    if (rev - m[1]) % 2 != 0:
        m[2] = not(m[2])
    
    if m[2]:
        s = m[0] + s
    else:
        s = s + m[0]

print(s)

Fixed submission:
s = input()
q = int(input())
querys = [list(input().split()) for i in range(q)]

rev = 0
moji = []
for query in querys:
    if query[0] == '1':
        rev += 1
    else:
        query[1] = int(query[1])
        p = True if query[1] == 1 else False
        moji.append([query[2], rev, p])

if rev%2 != 0:
    s = s[::-1]
head = ""
end = ""
for m in moji:
    if (rev - m[1]) % 2 != 0:
        m[2] = not(m[2])
    
    if m[2]:
        head = m[0] + head
    else:
        end = end + m[0]

s = head + s + end
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
    
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]


n,m,k = map(int,input().split())
ab = [list(map(int,input().split()))for i in range(m)]
cd = [list(map(int,input().split()))for i in range(k)]

par = [-1]*(n+1)
for i in range(m):
    unite(ab[i][0],ab[i][1])

ablist = [set()for i in range(1+n)]
cdlist = [set()for i in range(n+1)]
for elem in ab:
    ablist[elem[0]].add(elem[1])
    ablist[elem[1]].add(elem[0])
for elem in cd:
    cdlist[elem[0]].add(elem[1])
    cdlist[elem[1]].add(elem[0])

all = set(range(1,n+1))
anslist = []
for i in range(1,n+1):
    cand = list(all-ablist[i]-cdlist[i]-{i})
    c = 0
    for j in range(len(cand)):
        if same(i,cand[j]):
            c += 1
    anslist.append(c)

for ans in anslist:
    print(ans, end = " ")



Fixed submission:
import sys
input = sys.stdin.readline

def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
    
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]

n,m,k = map(int,input().split())
ab = [list(map(int,input().split()))for i in range(m)]
cd = [list(map(int,input().split()))for i in range(k)]

friend = [0]*(n+1)
for i in range(m):
    friend[ab[i][1]] += 1
    friend[ab[i][0]] += 1

par = [-1]*(n+1)
for i in range(m):
    unite(ab[i][0],ab[i][1])

block = [0]*(n+1)
for i in range(k):
    if same(cd[i][0],cd[i][1]):
        block[cd[i][0]] += 1
        block[cd[i][1]] += 1
    #block[cd[i][0]].append(cd[i][1])
    #block[cd[i][1]].append(cd[i][0])



for i in range(1,n+1):
    print(size(i)-friend[i]-block[i]-1,end = " ")
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
i = 0
while True:
   if n < k**(i+1):
     print(i + 1)
     break
   i += 1

Fixed submission:
n,k = map(int,input().split())

i = 0
while True:
   if n < k**(i+1):
     print(i + 1)
     break
   i += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
slist = tuple(input() for i in range(n))
sset = set(slist)
slist2 = list(sset)
slist2.sort()
c = 0
for i in slist2:
  if slist.count(i) > c:
    c = slist.count(i)
for i in slist2:
  if c == slist.count(i):
    print(i)

Fixed submission:
n = int(input())
cnt = {}
mx = 0
for i in range(n):
  s = input()
  if s not in cnt:
    cnt[s] = 0
  cnt[s] += 1
  mx = max(mx,cnt[s])
ans = []
for s in cnt:
  if cnt[s] == mx:
    ans.append(s)
ans.sort()
for i in ans:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
slist = tuple(input() for i in range(n))
sset = set(slist)
slist2 = list(sset)
slist2.sort()
count_list = []
c = 0
for i in slist2:
  count_list.append(slist.count(i))
  if slist.count(i) > c:
    c = slist.count(i)
for i in range(len(count_list)):
  if c == count_list[i]:
    print(slist2[i])
  

Fixed submission:
n = int(input())
cnt = {}
mx = 0
for i in range(n):
  s = input()
  if s not in cnt:
    cnt[s] = 0
  cnt[s] += 1
  mx = max(mx,cnt[s])
ans = []
for s in cnt:
  if cnt[s] == mx:
    ans.append(s)
ans.sort()
for i in ans:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
slist = list(input() for i in range(n))
sset = set(slist)
slist2 = list(sset)
slist2.sort()
count_list = []
for i in slist2:
  count_list.append(slist.count(i))
for i in range(len(count_list)):
  if max(count_list) == count_list[i]:
    print(slist2[i])

Fixed submission:
n = int(input())
cnt = {}
mx = 0
for i in range(n):
  s = input()
  if s not in cnt:
    cnt[s] = 0
  cnt[s] += 1
  mx = max(mx,cnt[s])
ans = []
for s in cnt:
  if cnt[s] == mx:
    ans.append(s)
ans.sort()
for i in ans:
  print(i)