Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif np.logical_and(mask[0][2], mask[1][1], mask[2][0]):
    print('Yes')
else:
    print('No')


Fixed submission:
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif mask[0][2]&mask[1][1]&mask[2][0]:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif np.logical_and(mask[0][2], mask[1][1], mask[2][0]):
    print('Yes')
else:
    print('No')


Fixed submission:
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
# elif np.all(np.diag(mask.T)):
elif mask[0][2]&mask[1][1]&mask[2][0]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

import numpy as np

for _ in range(M):
  argmax = np.argmax(A)
  A[argmax] =  A[argmax]//2

print(sum(A))


Fixed submission:
import heapq
N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
heapq.heapify(A)
ans = 0
for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, a / 2)
print(-sum(int(a) for a in A))
Buggy python submission (verdict: Runtime Error):
#初期データ、構造
N,Q = (int(x) for x in input().split())
# 隣接リスト表現
connection ={i:set() for i in range(1,N+1)}
for i in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)
point ={i:0 for i in range(1,N+1)}
for i in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] +=x

def DFS(now,prev = -1):
    for next in connection[now]:
        # 親へのエッジはスキップ
        if next == prev:
            continue
        point[next] += point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
#初期データ、構造
N,Q = (int(x) for x in input().split())
# 隣接リスト表現
connection ={i:set() for i in range(1,N+1)}
for _ in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)

point ={i:0 for i in range(1,N+1)}
for _ in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] += x

def DFS(now,prev = -1):
    for next in connection[now]:
        # 親へのエッジはスキップ
        if next == prev:
            continue
        point[next] += point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
# RLを基本的には行き来することになる
# RRLの時 
# 0   1   2   3   4
# 100 010 001 010 001
cnts = [0]*len(S)
for idx in range(len(S)):
    c = 0
    if S[idx] == 'R':
        while True:
            c += 1
            idx += 1
            if S[idx] == 'L':
                break
        if c % 2 == 0:
            cnts[idx] += 1
        else:
            cnts[idx-1] += 1
    else:
        while True:
            c += 1
            idx -= 1
            if S[idx] == 'R':
                break
        if c % 2 == 0:
            cnts[idx] += 1
        else:
            cnts[idx+1] += 1

print(' '.join([str(x) for x in cnts]))
        

Fixed submission:
import numpy as np
S = list(input())
cnts = [0]*len(S)

c = 0
for idx in range(len(S)):
    if S[idx] == 'R':
        c += 1
    else:
        cnts[idx] += np.floor(c / 2)
        cnts[idx-1] += np.ceil(c / 2)
        c = 0

c = 0
for i in range(len(S)):
    idx = len(S)-i-1
    if S[idx] == 'L':
        c += 1
    else:
        cnts[idx] += np.floor(c / 2)
        cnts[idx+1] += np.ceil(c / 2)
        c = 0
        
print(' '.join([str(int(x)) for x in cnts]))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

for _ in range(M):
  b, c = map(int, input().split())
  A += [-c]*b

import heapq
heapq.heapify(A)
ans = [-heapq.heappop(A) for _ in range(N)]
print(sum(ans))


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
from operator import itemgetter
BC.sort(key=itemgetter(1), reverse=True)

for b, c in BC:
  A += [c]*b
  if len(A) > 2*N:
    break

A.sort(reverse=True)
print(sum(A[:N]))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

for _ in range(M):
  b, c = map(int, input().split())
  A += [c]*b

A.sort(reverse=True)
print(sum(A[:N]))


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
from operator import itemgetter
BC.sort(key=itemgetter(1), reverse=True)

for b, c in BC:
  A += [c]*b
  if len(A) > 2*N:
    break

A.sort(reverse=True)
print(sum(A[:N]))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

import heapq
heapq.heapify(A)
for _ in range(M):
  b, c = map(int, input().split())
  for _ in range(b):
    a = heapq.heappop(A)
    if a < c:
      heapq.heappush(A, c)
    else:
      heapq.heappush(A, a)
      break

print(sum(A))


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
from operator import itemgetter
BC.sort(key=itemgetter(1), reverse=True)

for b, c in BC:
  A += [c]*b
  if len(A) > 2*N:
    break

A.sort(reverse=True)
print(sum(A[:N]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

# 文字列にABが入ってる数 + 組み合わせて入る数
# 文字列にABが入ってる数 + f(Aで終わる数, Bで始まる数, Bで始まりAで終わる数)
include = 0
sb = 0
fa = 0
sbfa = 0
for s in S:
    if 'AB' in s:
        include += 1
    if s[0] == 'B' and s[-1] == 'A':
        sbfa += 1
    elif s[0] == 'B':
        sb += 1
    elif s[-1] == 'A':
        fa += 1

def calc_comb(sb, fa, sbfa):
    ans = 0
    if sbfa > 0:
        ans += sbfa-1
        if sb > 0:
            sb -= 1
            ans += 1
        if fa > 0:
            fa -= 1
            ans += 1
    ans += min(sb, fa)

print(include + calc_comb(sb, fa, sbfa))


Fixed submission:
n = int(input())
s_array = [input() for x in range(n)]
a_count = 0
b_count = 0
ab_count = 0
for s in s_array:
    if s[-1] == "A" and s[0] != "B":
        a_count += 1
    elif s[0] == "B" and s[-1] != "A":
        b_count += 1
    elif s[0] == "B" and s[-1] == "A":
        ab_count += 1
    else:
        pass

res = sum([x.count("AB") for x in s_array])

if n == 1:
    print(res)
elif ab_count == 0:
    print(res + min(a_count, b_count))
elif a_count == 0 and b_count == 0:
    print(res - 1 + ab_count)
else:
    print(res + min(a_count, b_count) + ab_count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
V_list = np.array(list(map(int, input().split())))
C_list = np.array(list(map(int, input().split())))

diff = V_list - C_list

print(diff[diff > 0].sum())

Fixed submission:
import numpy as np
N = int(input())
V_list = np.array(list(map(int, input().split())))
C_list = np.array(list(map(int, input().split())))

diff = V_list - C_list

print(diff[diff > 0].sum())
Buggy python submission (verdict: Runtime Error):
N = int(input())

def cnt(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '357') else 0
    for c in '357':
        ret += cnt(s+c)
    return ret

pritn(cnt('0'))

Fixed submission:
N = int(input())

def cnt(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '357') else 0
    for c in '357':
        ret += cnt(s+c)
    return ret

print(cnt('0'))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))

# nCrにおいてrが一定の時にnが最大の時に場合の数が最大になる
# max_xCrをDPで調べればok

import numpy as np
max_a = a[-1]
max_r = a[-2]+1
dp = np.zeros(max_r)
for i in range(max_r-1):
    if i != 0:
        dp[i+1] = dp[i] * (max_a-i) // (i+1)
    else:
        dp[i+1] = max_a

idx = np.argmax(dp[a[:-1]])
print('{:d} {:d}'.format(max_a, a[idx]))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()

import bisect
import numpy as np
amax = a[-1]
cent = amax // 2

idx = bisect.bisect_left(a, cent)
if idx == len(a)-1:
    print(amax, a[-2])
else:
    max_idx = np.argmin([abs(a[idx]-cent), abs(a[idx-1]-cent)])
    if max_idx:
        print(amax, a[idx-1])
    else:
        print(amax, a[idx])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = ''
for _ in range(M):
  B += input()

ans = 'No'
for i in range(N-M+1):
  for j in range(N-M+1):
    sbstr = ''.join(A[i][j:j+M] + A[i+1][j:j+M])
    if B == sbstr:
      ans = 'Yes'

print(ans)


Fixed submission:
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = ''
for _ in range(M):
  B += input()

ans = 'No'
for i in range(N-M+1):
  for j in range(N-M+1):
    sbstr = ''
    for k in range(M):
      sbstr += ''.join(A[i+k][j:j+M]) 
    if B == sbstr:
      ans = 'Yes'

print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = list(map(int, input().split(' ')))
if N >= 10:
    print(R)
else:
    print(R + (100 - (10 - K)))

Fixed submission:
N, R = list(map(int, input().split(' ')))
if N >= 10:
    print(R)
else:
    print(R + (100 * (10 - N)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(map(int, input().split(' ')))
for i in range(N):
    A = A_list.pop(0)
    if A in A_list:
        print('NO')
        exit()
    else:
        A_list.append(A)
print('YES')

Fixed submission:
N = int(input())
A_set = set(list(map(int, input().split(' '))))
if len(A_set) == N:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
if N % 2 == 1:
    print(0)
else:
    div10 = N // 10
    sum_val = div10
    count_5 = math.floor(math.log(div10, 5))
    for i in range(count_5):
        sum_val += div10 // pow(5, i + 1)
    print(sum_val)


Fixed submission:
import math
N = int(input())
if N % 2 == 1:
    print(0)
else:
    div10 = N // 10
    sum_val = div10
    if sum_val > 0:
        count_5 = math.floor(math.log(div10, 5))
        for i in range(count_5):
            sum_val += div10 // pow(5, i + 1)
    print(sum_val)
Buggy python submission (verdict: Runtime Error):
S = input()

if S = 'SUN':
  print(7)
elif S = 'MON':
  print(6)
elif S = 'TUE':
  print(5)
elif S = 'WED':
  print(4)
elif S = 'THU':
  print(3)
elif S = 'FRI':
  print(2)
elif S = 'SAT':
  print(1)

Fixed submission:
S = input()

if S == 'SUN':
  print(7)
elif S == 'MON':
  print(6)
elif S == 'TUE':
  print(5)
elif S == 'WED':
  print(4)
elif S == 'THU':
  print(3)
elif S == 'FRI':
  print(2)
elif S == 'SAT':
  print(1)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())

import math
if (x/a < 0.5*a*b):
  print(90-math.degrees(math.atan((2*x)/(a*b**2))))
else:
  print(90-math.degrees(math.atan(0.5*a**3/((b*a**2)-x))))

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

import math
if (x/a < 0.5*a*b):
  print(90-math.degrees(math.atan((2*x)/(a*b**2))))
elif (x/a == a*b):
  print(0)
else:
  print(90-math.degrees(math.atan(0.5*a**3/((b*a**2)-x))))
Buggy python submission (verdict: Runtime Error):
A,B = int(input())

if 2*B >= A:
  print(0)
else:
  print(A-2*B)

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

if 2*B >= A:
  print(0)
else:
  print(A-2*B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
la=input().split()
lb=input().split()
lc=input().split()

lc = lc+['0']
#print(lc)

total=0
for i in range(N):
    total = total+int(lb[i])+int(lc[i])
#print(total)

k = int(la[N-1])
#print(k)

print(total-int(lc[k-1]))


Fixed submission:
N = int(input())

print(N**3)

Buggy python submission (verdict: Runtime Error):
N = int(input())
la=input().split()
lb=input().split()
lc=input().split()

lc = lc+['0']
#print(lc)

total=0
for i in range(N):
    total = total+int(lb[i])+int(lc[i])
#print(total)

k = int(la[N-1])
#print(k)

print(total-int(lc[k-1]))


Fixed submission:
N = int(input())

print(N**3)

Buggy python submission (verdict: Runtime Error):
N = int(input())
la=input().split()
lb=input().split()
lc=input().split()

lc = lc+['0']
#print(lc)

total=0
for i in range(N-1):
    total =total+int(lb[i])+int(lc[i])

print(total-int(lc[int(la[N-1])]))


Fixed submission:
N = int(input())

print(N**3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A=[int(_) for _ in input().split()]

Maxcounter = 0
for i in range(1,N):
    counter = 0
    k = i
    while k < N:
      if (A[k-1]>=A[k]):
        counter += 1
        k += 1
        if Maxcounter <= counter:
            Maxcounter = counter
      else:
        break
      
print(Maxcounter)


Fixed submission:
S = list(input())
T = list(input())

counter = 0
for i in range(0,3):
    if S[i] == T[i]:
        counter += 1

print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=[int(_) for _ in input().split()]

Maxcounter = 0
for i in range(1,N):
    counter = 0
    k = i
    while k < N:
      if (A[k-1]>=A[k]):
        counter += 1
        k += 1
        if Maxcounter <= counter:
            Maxcounter = counter
      else:
        break
      
print(Maxcounter)


Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]

cnt = 0
maxcnt = 0
for j in range(0,N):
  if (j!=N-1)and(H[j]>=H[j+1]):
    cnt += 1
  else:
    if cnt>maxcnt:
      maxcnt = cnt
      cnt = 0
    else:
      cnt = 0
print(maxcnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
v = [int(x) for x in input().split()]

v.sort()
#print(v)
for i in range(1,N):
  v[:2] = [(v[0]+v[1])/2]

print(v[0])

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = [int(x) for x in input().split()]
 cnt = 0
for i in range(N-1):
  if H[i]-H[i+1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]

H.reverse()
#print(H)
cnt = 0
for i in range(1,N):
  if H[i]-H[i-1] == 1:
    H[i] = H[i]-1
  elif H[i]-H[i-1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(0,N):
  A.append(int(input()))
#print(A)
print(max(A[1:]))
for j in range(1,N-1):
  print(max(A[:j]+A[j+1:]))
print(max(A[:N-1]))

Fixed submission:
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
max1 = 0
max2 = 0
for i in range(N):
  if max1 < A[i]:
    max2 = max1
    max1 = A[i]
  elif A[i] > max2:
    max2 = A[i]

for j in range(N):
  if A[j] == max1:
    print(max2)
  else:
    print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for i in range(0,N):
  A.append(int(input()))
#print(A)
print(max(A[1:]))
for j in range(1,N-1):
  print(max(max(A[:j]),max(A[j+1:])))
print(max(A[:N-1]))

Fixed submission:
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))
max1 = 0
max2 = 0
for i in range(N):
  if max1 < A[i]:
    max2 = max1
    max1 = A[i]
  elif A[i] > max2:
    max2 = A[i]

for j in range(N):
  if A[j] == max1:
    print(max2)
  else:
    print(max1)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())

print(min(N*A,B)

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

print(min(N*A,B))
Buggy python submission (verdict: Runtime Error):
S=input()
S.sort()
if (S[0]==S[1])and(S[2]==S[3])and(S[0]!=S[1]):
  print('Yes')
else:
  print('No')
    

Fixed submission:
S=list(input())
S.sort()
if (S[0]==S[1])and(S[2]==S[3])and(S[0]!=S[2]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S = list(input())

if (S[0]==S[1])or(S[1]==S[2])or(S[2]==S[3]):
  print('Bad')
else:
  print('Good')


Fixed submission:
N,L = map(int,input().split())
import math
T = []
for i in range(N):
  T.append(L+i)
cnt = 0
mcnt = sum(T)
k = 1000000
for i in range(0,N):
  if abs(T[i])<k:
    mcnt = sum(T)-T[i]
    cnt = i+1
    k=abs(T[i])
print(mcnt)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
def gcd(x,y):
  if x<y:
    l = y
    k = x
    x = y
    y = k
  z = x%y
  while z != 0:
    x = y
    y = z
    z = x%y
  return (k//y)*(l//y)*y

if A%C ==0:
  i = (A//C)-1
else:
  i = A//C

j = B//C

if A%D ==0:
  k = (A//D)-1
else:
  k = A//D

l = B//D

if A%(gcd(C,D)) ==0:
  m = (A//(gcd(C,D)))-1
else:
  m = A//gcd(C,D)
  
n = B//gcd(C,D)

#print(i,j,k,l,m,n)
#print(B-A+1,j-i,l-k,n-m)
print((B-A+1)-(j-i)-(l-k)+(n-m))

Fixed submission:
A,B,C,D = map(int,input().split())
def gcd(x,y):
  if x<y:
    l = y
    k = x
    x = y
    y = k
  else:
    k = y
    l = x
  z = x%y
  while z != 0:
    x = y
    y = z
    z = x%y
  return (k//y)*(l//y)*y

if A%C ==0:
  i = (A//C)-1
else:
  i = A//C

j = B//C

if A%D ==0:
  k = (A//D)-1
else:
  k = A//D

l = B//D

if A%(gcd(C,D)) ==0:
  m = (A//(gcd(C,D)))-1
else:
  m = A//gcd(C,D)
  
n = B//gcd(C,D)

#print(i,j,k,l,m,n)
#print(B-A+1,j-i,l-k,n-m)
print((B-A+1)-(j-i)-(l-k)+(n-m))
Buggy python submission (verdict: Runtime Error):
A,P = int(input())
N = 3*A+P
print(N//2)

Fixed submission:
A,P = map(int,input().split())
N = 3*A+P
print(N//2)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if A<=5:
  print(0)
elif　A>=13:
  print(B)
else:
  print(B//2)
    

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

if A<=5:
  print(0)
elif A>=13:
  print(B)
else:
  print(B//2)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int, input().split())
for i in range(k):
    if a >= 1:
        a -= 1
    elif b >= 1:
        b -= 1
print(str(a) + ' ' +str(b))

Fixed submission:
a,b,k = map(int, input().split())
if a <= k:
    a, k = 0, k-a
    b -= k
else:
    a -= k
if b < 0:
    b = 0
print(str(a)+' '+str(b))
Buggy python submission (verdict: Runtime Error):
a1, a2, a3 = map(int, input())
if a1+a2+a3 >= 22:
    print('bust')
else:
    print('win')

Fixed submission:
a1, a2, a3 = map(int, input().split())
if a1+a2+a3 >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Runtime Error):
if S[2]==S[3] and S[4]==S[5]:
  return "Yes"

return "No"

Fixed submission:
S = input()
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
X = input()
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Fixed submission:
X = int(input())
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Buggy python submission (verdict: Runtime Error):
X = input()
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Fixed submission:
X = int(input())
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)
Buggy python submission (verdict: Runtime Error):
K = int(input())
N = int(input())
A = [int(input()) for i in range(N)]

D = []
for i in range(N):
	D.append((K + A[i] - A[i - 1]) % K)
    
print(K - max(D))

Fixed submission:
# K = int(input())
# N = int(input())
# A = [int(input()) for i in range(N)]
K, N = list(map(int,input().split()))
A = list(map(int,input().split()))
 
D = []
for i in range(N):
	D.append((K + A[i] - A[i - 1]) % K)
    
print(K - max(D))
Buggy python submission (verdict: Runtime Error):

def main():
    N = int(input())
    row = input()
    for (s, t) in zip(row[:N], row[N:]):
        print(s+t, end="")
    print("") # 改行

    if __name__ == "__main__":
    main()

Fixed submission:
def main():
    N = int(input())
    row = input()
    S = row.split()[0]
    T = row.split()[1]
    result = ""
    for (s, t) in zip(S, T):
        result += s
        result += t
    print(result)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
dsum = 0
tmp = N
while tmp > 0:
  dsum += tmp % 10
  tmp /=  10
  tmp  = int(tmp)
if N % dsum != 0:
  print ("No")
else:
  print ("Yes")

Fixed submission:
import math
def main():
    line_input = input().split()
    n = int(line_input[0])
    k = int(line_input[1])
    nums = input().split()
    print(math.ceil((n - 1) / (k - 1)))

main()
Buggy python submission (verdict: Runtime Error):
S = input()
print("Yes" if S[2] == S[3] and S[4] == S[5])

Fixed submission:
S = input()
print("Yes" if S[2] == S[3] and S[4] == S[5] else "No")