Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

#bit探索
def bit():
    for i in range(2 **N):
        op = []
        tmp=0
        for j in range(N):
            if ((i >> j) & 1):
                op.append(j+1)
                tmp += (j+1)
        if tmp == N:
            return op

li=bit()

for k in li:
    print(k)

Fixed submission:
N=int(input())


start=int((2*N+1)**0.5)

for i in range(3):
    i += start
    if i*(i+1) >= 2*N:
        ret = i
        delete=i*(i+1)/2 - N
        break

for k in range(1,ret+1):
    if k != delete:
        print(k)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

#bit探索
def bit():
    for i in range(2 **N):
        op = []
        tmp=0
        for j in range(N):
            if ((i >> j) & 1):
                op.append(j+1)
                tmp += (j+1)
        if tmp == N:
            return op

li=bit()

for k in li:
    print(k)

Fixed submission:
N=int(input())


start=int((2*N+1)**0.5)

for i in range(3):
    i += start
    if i*(i+1) >= 2*N:
        ret = i
        delete=i*(i+1)/2 - N
        break

for k in range(1,ret+1):
    if k != delete:
        print(k)
Buggy python submission (verdict: Runtime Error):
if k * 500 >= x:
  print('Yes')
else:
  print('No')

Fixed submission:
k,x = map(int, input().split())
if k * 500 >= x:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = input()
s = input()
x = 0
for i in range(n - 2)
	if s[i:3] == "ABC"
  		x += 1

Fixed submission:
n = int(input())
s = input()
x = 0

for i in range(n-2):
    if s[i:i+3] == "ABC":
        x += 1

print(x)
Buggy python submission (verdict: Runtime Error):
s,t = map(str, input(),split())
print(t + s)

Fixed submission:
s,t = map(str, input().split())
print(t+s)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())
for i in range(k):
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1
print(str(a) + " " + str(b))

Fixed submission:
a,b,k = map(int, input().split())
if k <= a:
    a -= k
elif k <= a + b:
    b = a + b - k
    a = 0
else:
    a = 0
    b = 0
print(str(a) + " " + str(b))
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
ss = []
ans = []
for i in range(n):
    s = input()
    if s in ss:
        ans[ss.index(s)] += 1
    else:
        ss.append(s)
        ans.append(1)
    
m = max(ans)
for i in range(len(ans)):
    if ans[i] != m:
        ss[i] = ""
ss = sorted([i for i in ss if i != ""])
for i in ss:
    print(i)


Fixed submission:
import collections
n =int(input())
ss = []
ans = []
for i in range(n):
    ss.append(input())
a = collections.Counter(ss)

m = max(a.values())

for i,s in a.items():

    if s == m:
        ans.append(i)
ans = sorted(ans)

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())

a = [0] + list(map(int, input().split())) + [0]

s = 0



for i in range(n+1):
    s += abs(a[i+1] - a[i])

for i in range(1,n+1):
    if (a[i] - a[i-1])*(a[i+1] - a[i]) < 0:
        if abs(a[i] - a[i-1]) < abs(a[i+1] - a[i]):
            print(s - 2*abs(a[i] - a[i-1]))
        else:
            print(s - 2*abs(a[i+1] - a[i]))
    else :
        print(s)







Fixed submission:
print(min(int(input()), int(input())) + min(int(input()), int(input())))

Buggy python submission (verdict: Runtime Error):
n = int(input())

a = [0] + list(map(int, input().split())) + [0]

s = 0



for i in range(n+1):
    s += abs(a[i+1] - a[i])

for i in range(1,n+1):
    if (a[i] - a[i-1])*(a[i+1] - a[i]) < 0:
        if abs(a[i] - a[i-1]) < abs(a[i+1] - a[i]):
            print(s - 2*abs(a[i] - a[i-1]))
        else:
            print(s - 2*abs(a[i+1] - a[i]))
    else :
        print(s)







Fixed submission:
print(min(int(input()), int(input())) + min(int(input()), int(input())))

Buggy python submission (verdict: Runtime Error):
n = int(input())

a = [0] + list(map(int, input().split())) + [0]

s = 0



for i in range(n+1):
    s += abs(a[i+1] - a[i])

for i in range(1,n+1):
    if (a[i] - a[i-1])*(a[i+1] - a[i]) < 0:
        if abs(a[i] - a[i-1]) < abs(a[i+1] - a[i]):
            print(s - 2*abs(a[i] - a[i-1]))
        else:
            print(s - 2*(a[i+1] - a[i]))
    else :
        print(s)







Fixed submission:
print(min(int(input()), int(input())) + min(int(input()), int(input())))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    ans = 0
    a_i = a.copy()
    a_i.pop(i)
    for j in range(n-2):
        ans += abs(a_i[j+1] - a_i[j])
    ans += abs(a_i[0])
    ans += abs(a_i[-1])
    

    print(ans)





Fixed submission:
n = int(input())

a = [0] + list(map(int, input().split())) + [0]

s = 0



for i in range(n+1):
    s += abs(a[i+1] - a[i])

for i in range(1,n+1):
    if (a[i] - a[i-1])*(a[i+1] - a[i]) < 0:
        if abs(a[i] - a[i-1]) < abs(a[i+1] - a[i]):
            print(s - 2*abs(a[i] - a[i-1]))
        else:
            print(s - 2*abs(a[i+1] - a[i]))
    else :
        print(s)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = [[0]*m for i in range(n)]
ans = 0
if n == 1:
    if m == 1:
        ans = 1
    elif m == 2:
        ans = 0
    else:
        ans = m - 2

if n == 2:
    ans = 0

if n > 2:
    if m == 1:
        ans = n-2
    elif m == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)
    



print(ans)


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

ans = 0
if n == 1:
    if m == 1:
        ans = 1
    elif m == 2:
        ans = 0
    else:
        ans = m - 2

if n == 2:
    ans = 0

if n > 2:
    if m == 1:
        ans = n-2
    elif m == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)
    



print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = [[0]*m for i in range(n)]
ans = 0
if n == 1:
    if m == 1:
        ans = 1
    elif m == 2:
        ans = 0
    else:
        ans = m - 2

if n == 2:
    ans = 0

if n > 2:
    if m == 1:
        ans = n-2
    elif m == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)
    



print(ans)


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

ans = 0
if n == 1:
    if m == 1:
        ans = 1
    elif m == 2:
        ans = 0
    else:
        ans = m - 2

if n == 2:
    ans = 0

if n > 2:
    if m == 1:
        ans = n-2
    elif m == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)
    



print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = [[0]*m for i in range(n)]
def rev(k):
    if k==1:
        return 0
    else:
        return 1
for i in range(n):
    for j in range(m):
        a[i][j] = rev(a[i][j])
        if j > 0:
            a[i][j-1] = rev(a[i][j-1])
        if j < m-1:
            a[i][j+1] = rev(a[i][j+1])
        if i > 0:
            a[i-1][j] = rev(a[i-1][j])
            if j > 0:
                a[i-1][j-1] = rev(a[i-1][j-1])
            if j < m-1:
                a[i-1][j+1] = rev(a[i-1][j+1])
        if i < n-1:
            a[i+1][j] = rev(a[i+1][j])
            if j > 0:
                a[i+1][j-1] = rev(a[i+1][j-1])
            if j < m-1:
                a[i+1][j+1] = rev(a[i+1][j+1])

ans = 0
for i in range(n):
    for j in range(m):
        ans += a[i][j]
print(ans)


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

ans = 0
if n == 1:
    if m == 1:
        ans = 1
    elif m == 2:
        ans = 0
    else:
        ans = m - 2

if n == 2:
    ans = 0

if n > 2:
    if m == 1:
        ans = n-2
    elif m == 2:
        ans = 0
    else:
        ans = (n-2)*(m-2)
    



print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
print(f"{s[0]}{len(s) - 2}{s[-1]}")

Fixed submission:
s = input()
print(s[0] + str(len(s) - 2) + s[-1])

Buggy python submission (verdict: Runtime Error):
str = input()
print(f"{str[0]}{len(str) - 2}{str[-1]}")

Fixed submission:
s = input()
print(s[0] + str(len(s) - 2) + s[-1])
Buggy python submission (verdict: Runtime Error):
s = input()
a = 0
ans = 0
b = 0
d = []
e = []
now = 0

for i in range(len(s)):
    if s[i] == '<':
        
        if a != 0:
            if a > now:
                ans = ans - d[-1] + a
                
            for j in range(a):
                ans = ans + j
                d.append(a - j)
                e.append(">")
            now = 0
            a = 0
        
        ans = ans + now + 1
        now = now + 1
        d.append(now)
        
    else:
        a = a + 1
        b = 0
    
if a != 0:
    if a > now:
        ans = ans - d[-1] + a
                
    for j in range(a):
        ans = ans + j
        d.append(a - j)
        e.append(">")
    
print(ans)

Fixed submission:
s = input()
a = 0
ans = 0
b = 0
d = [0]
e = []
now = 0

for i in range(len(s)):
    if s[i] == '<':
        
        if a != 0:
            if a > now:
                ans = ans - d[-1] + a
                
            for j in range(a):
                ans = ans + j
                d.append(a - j)
                e.append(">")
            now = 0
            a = 0
        
        ans = ans + now + 1
        now = now + 1
        d.append(now)
        
    else:
        a = a + 1
        b = 0
    
if a != 0:
    if a > now:
        ans = ans - d[-1] + a
                
    for j in range(a):
        ans = ans + j
        d.append(a - j)
        e.append(">")
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = str(N)
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")

Fixed submission:
N = (input())
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")

Buggy python submission (verdict: Runtime Error):
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")

Fixed submission:
N = (input())
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")
Buggy python submission (verdict: Runtime Error):
K = input()
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[:K] + '...')

Fixed submission:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[:K] + '...')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

X=int(input())
ans=[]
for i in range(2*X):
  A=i-X
  for j in range(2*X):
    B=j-X
    x=A**5-B**5
    if x == X:
      ans.append(A)
      ans.append(B)
print("{} {}".format(ans[0],ans[1]))
      

Fixed submission:
import numpy as np

X=int(input())
ans=[0,0]

for i in range(-120,120):
  a=i
  for j in range(-120 , 120):
    b=j
    if (a**5 - b**5) ==X:
      ans[0]=a
      ans[1]=b

print("{} {}".format(ans[0],ans[1]))
Buggy python submission (verdict: Runtime Error):
temp = input()
if temp[-1] in {'2','4','5','7','9'}:
  return 'hon'
elif temp[-1] in {'3'}:
  return 'bon'
else:
  return 'pon'

Fixed submission:
temp = input()
if temp[-1] in {'2','4','5','7','9'}:
  print('hon')
elif temp[-1] in {'3'}:
  print('bon')
else:
  print('pon')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')


Fixed submission:
a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a%2 == 0 or b%2 == 0:
    print('no')
else:
    print('yes')

Fixed submission:
a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())

#"ありうる値"の最大値なので、K枚選択時はa,b,cの順に選択する

card_num = 0 #カード枚数
card_sum = 0 #値の合計

while card_num < k:
    if a > 0:
        card_sum += 1
        a -= 1
    elif b > 0:
        b -= 1
    elif c > 0:
        card_sum -= 1
        c -= 1
    
    card_num += 1

print(card_sum)

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

#"ありうる値"の最大値なので、K枚選択時はa,b,cの順に選択する

card_num = 0 #カード枚数
card_sum = 0 #値の合計

#1card*k
if k <= a:
    card_sum = k
#1card*a + 0card*(k-a)
elif k <= a + b:
    card_sum = a
#1card*a + 0card*b + -1card*(k-a-b)
else:
    card_sum = a - (k-a-b)

print(card_sum)
Buggy python submission (verdict: Runtime Error):
ar=map(int,input().split())
print(ar[0]<10 and ar[1]<10)

Fixed submission:
ar=list(map(int,input().split()))
if ar[1]<10 and ar[0]<10:
  print(ar[0]*ar[1])
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
def squared(x):
    return x**2

def theta(h, m):
    mr = 6 * m
    hr = 30 * h + m / 2
    r = abs(float(hr) - float(mr))
    return r

def length(a, b, h, m):
    return math.sqrt(squared(a) + squared(b) - 2 * a * b * math.cos(math.radians(theta(h, m))))


a, b, h, m = [x for x in map(int, input().split())]

print(length(a, b, h, m))

Fixed submission:
import math
def squared(x):
    return x**2

def theta(h, m):
    mr = 6 * m
    hr = 30 * h + m / 2
    r = abs(float(hr) - float(mr))
    return r

def length(a, b, h, m):
    return math.sqrt(squared(a) + squared(b) - 2 * a * b * math.cos(math.radians(theta(h, m))))


a, b, h, m = [x for x in map(int, input().split())]

print(length(a, b, h, m))
Buggy python submission (verdict: Runtime Error):
import math as ma

a,b,h,m = map(int,input().split())

al = h*30
bl = m*6
dec = al-bl
dec = dec % 180
if dec < 0:
  dec *= -1
rad = dec * ma.pi / 180
r = ma.sqrt(a**2 + b**2 -2*a*b*ma.cos(rad))
print(r)

Fixed submission:
a = int(input())
s = a % 10
print("hon" if s ==2 or s == 4 or s == 5 or 
      s == 7 or s == 9 else "pon" if 
      s == 0 or s == 1 or s == 6 or s == 8
      else "bon")

Buggy python submission (verdict: Runtime Error):
a = input()
s = a % 10
print("hon" if s ==2 or s == 4 or s == 5 or 
      s == 7 or s == 9 else "pon" if 
      s == 0 or s == 1 or s == 6 or s == 8
      else "bon")

Fixed submission:
a = int(input())
s = a % 10
print("hon" if s ==2 or s == 4 or s == 5 or 
      s == 7 or s == 9 else "pon" if 
      s == 0 or s == 1 or s == 6 or s == 8
      else "bon")
Buggy python submission (verdict: Runtime Error):
k = int(input())
a = int(input())
b = int(input())

for i in range(a,b+1):
  if i % k == 0:
    print("OK")
    break
else :
  print("NG")


Fixed submission:
k = int(input())
abs = [int(e) for e in input().split()]

for i in range(abs[0],abs[1]+1):
  if i % k == 0:
    print("OK")
    break
else :
  print("NG")
Buggy python submission (verdict: Runtime Error):
s,w = map(int,input())
print("unsafe" if s <= w else "safe")

Fixed submission:
s,w = map(int,input().split())
print("unsafe" if s <= w else "safe")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
# print(L)

for i in range(N-2):
    for j in range(i+1,N-1):
        start = j+1
        end = N
        while(start + 1 < end):
            if L[i] + L[j] > L[(start + end)//2]:
                start = (start + end)//2
            else:
                end = (start + end)//2
            # print(L[i],L[j],L[start],L[end-1])
        # print(i,j,start)
        if L[i] + L[j] > L[start]:
            ans += start - j
print(ans)


Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(L,L[i]+L[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] + L[j] > L[k]:
                ans += 1
            else:
                break
print(ans)

Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(L,L[i]+L[j]) - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] + L[j] > L[k]:
                ans += 1
print(ans)

Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        ans += bisect.bisect_left(L,L[i]+L[j]) - j - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N+1)/2N
print(ans)

Fixed submission:
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N+1)/(2*N)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if N % 2 ==0:
  print(0.5)
else:
  print((N+1)/2N)

Fixed submission:
N = int(input())
if N % 2 ==0:
  ans = 0.5
else:
  ans = (N+1)/(2*N)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

A,B=map(int,input().split())
gcd=math.gcd(A,B)
ans=1

if gcd > 1:
  for i in range(2,math.sqrt(gcd)//1 + 1):
    if gcd % i == 0:
      ans += 1
      while(gcd % i == 0):
        gcd /= i
print(ans)

Fixed submission:
import fractions

A,B=map(int,input().split())
gcd=fractions.gcd(A,B)
ans=1

if gcd > 1:
  fact = 2
  tmp = gcd
  while(fact * fact <= gcd):
    if tmp % fact == 0:
      ans += 1
      while(tmp % fact == 0):
        tmp //= fact
    fact += 1
  if tmp > 1:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())
seikaisha = [0 for _ in range(N)]
for _ in range(Q):
  seikaisha[int(input())-1] += 1
for _ in seikaisha:
  shitten = sum(seikaisha) - _
  if K - shitten > 0:
    print('Yes')
  else:
    print('No')


Fixed submission:
N,K,Q = map(int, input().split())
seikaisha = [0 for _ in range(N)]
for _ in range(Q):
  seikaisha[int(input())-1] += 1
sum_seikai = sum(seikaisha)
for seikai in seikaisha:
  shitten = sum_seikai - seikai
  if K - shitten > 0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
ans=0

while i < N-1:
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
  i = i + tmp +1
print(ans)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
ans=0
i = 0

while i < N-1:
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
  i = i + tmp +1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
ans=0

while i < N-1:
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
  i = i + tmp
print(ans)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
ans=0
i = 0

while i < N-1:
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
  i = i + tmp +1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))
ans=0
for i in range(N-1):
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
print(ans)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
ans=0
i = 0

while i < N-1:
  tmp=0
  for j in range(i,N-1):
    if H[j] >= H[j+1]:
      tmp += 1
    else:
      break
  ans = max(ans,tmp)
  i = i + tmp +1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(2,N+1):
  ans += (i-1)%i
print(ans)

Fixed submission:
N = int(input())

print((N-1)*N//2)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

N, M, R = map(int, input().split())
r = map(int, input().split())
 
INF = float("inf")
d = [[INF] * (N + 1) for _ in range(N + 1)]
for n in range(1, N + 1):
    d[n][n] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    d[a][b] = c
    d[b][a] = c

for k in range(1, N + 1):
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

ans = INF
for p in permutations(r):
    cnt = 0
    for i in range(len(p) - 1):
        p1, p2 = p[i:i + 2]
        cnt += d[p1][p2]
    ans = min(cnt, ans)

print(ans)


Fixed submission:
N = int(input())
n10 = N//10
n1 = N%10
if n10 == 9 or n1 == 9:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
from itertools import permutations
 
N,M,R = map(int, input().split())
r = list(map(int,input().split()))
 
dis = [[float('inf')]*(N+1) for _ in range(N+1)]
for i in range(1, N+1):
	dis[i][i] = 0
for i in range(M):
    Ai, Bi, Ci = map(int, input().split())
    if dis[Ai][Bi] > Ci:
        dis[Ai][Bi] = Ci
        dis[Bi][Ai] = Ci
for k in range(1, N+1):    # Warshall-Floyd
    for i in range(1, N+1):
        for j in range(i, N+1):
            if dis[i][j] > dis[i][k] + dis[k][j]:
                dis[i][j] = dis[i][k] + dis[k][j]
 
ans = float('inf')
for p in permutations(r):
    cnt = 0
    for i in range(len(p)-1):
        cnt += dis[p[i]][p[i+1]]
    ans = min(ans, cnt)
print(ans)

Fixed submission:
N = int(input())
n10 = N//10
n1 = N%10
if n10 == 9 or n1 == 9:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
from itertools import permutations
 
N,M,R = map(int, input().split())
r = list(map(int,input().split()))
 
dis = [[float('inf')]*(N+1) for _ in range(N+1)]
for i in range(N+1):
	dis[i][i] = 0
for i in range(M):
    Ai, Bi, Ci = map(int, input().split())
    if dis[Ai][Bi] > Ci:
        dis[Ai][Bi] = Ci
        dis[Bi][Ai] = Ci
for k in range(1, N+1):    # Warshall-Floyd
    for i in range(1, N+1):
        for j in range(i, N+1):
            if dis[i][j] > dis[i][k] + dis[k][j]:
                dis[i][j] = dis[i][k] + dis[k][j]
 
ans = float('inf')
for p in permutations(r):
    cnt = 0
    for i in range(len(p)-1):
        cnt += dis[p[i]][p[i+1]]
    ans = min(ans, cnt)
print(ans)

Fixed submission:
N = int(input())
n10 = N//10
n1 = N%10
if n10 == 9 or n1 == 9:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []

for i in range(N):
    Ai = int(input())
    if Ai in A:
        A.remove(Ai)
    else:
        A.append(Ai)

print(len(A))


Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
A.sort()
ans = 0
cnt = 1
for i in range(1, N):
    if A[i] == A[i-1]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
ans += cnt%2
print(ans)
Buggy python submission (verdict: Runtime Error):
K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

largest=B / K * K
if A <= largest
    print('OK')
else:
    print('NG')

Fixed submission:
K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

if A <= B//K*K:
    print('OK')
else:
    print('NG')

Buggy python submission (verdict: Runtime Error):
K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

largest=b / k * k
if A <= largest
    print('OK')
else:
    print('NG')

Fixed submission:
K=int(input())

ARGS=input().split()
A=int(ARGS[0])
B=int(ARGS[1])

if A <= B//K*K:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

B = [0] * (N + 1)
for i in range(1, N + 1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

B = [0] * (N + 1)
for i in range(N - 1):
        B[A[i]] += 1

for i in range(1, N + 1):
    print(str(B[i]))