Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = input()
n = N[len(N)]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')

Fixed submission:
N = input()
n = N[len(N)-1]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')

Buggy python submission (verdict: Runtime Error):
N = input()
n = N[len(n)]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')

Fixed submission:
N = input()
n = N[len(N)-1]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')

Buggy python submission (verdict: Runtime Error):
N = input()
l = len(N)
n = N[l]
if n == "2" or '4' or '5' or '7' or '9':
  print("hon")
elif n == '0' or '1' or '6' or '8':
  print('pon')
else:
  print('bon')

Fixed submission:
N = input()
n = N[len(N)-1]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')

Buggy python submission (verdict: Runtime Error):
n = input()
l = len(n)
if n[l] == "2" or '4' or '5' or '7' or '9':
  print("hon")
elif n[l] == '0' or '1' or '6' or '8':
  print('pon')
else:
  print('bon')

Fixed submission:
N = input()
n = N[len(N)-1]
if n == "2" or n== '4' or n=='5' or n=='7' or n=='9':
  print("hon")
elif n == '0' or n=='1' or n=='6' or n=='8':
  print('pon')
else:
  print('bon')
Buggy python submission (verdict: Runtime Error):
mport collections
S=[]
N=int(input())
for i in range(N):
    S.append(input())
print(len(collections.Counter(S)))
    

    



Fixed submission:
import collections
S=[]
N=int(input())
for i in range(N):
    S.append(input())
print(len(collections.Counter(S)))
Buggy python submission (verdict: Runtime Error):
N,R=input(int(x) for x in input().split())
if N>=10:
    print(R)
else:
    print(R+100*(10-N))

Fixed submission:
N,R=(int(x) for x in input().split())
if N>=10:
    print(R)
else:
    print(R+100*(10-N))
Buggy python submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
b=1
a=1
If N=1:
    print(1)
else:
     while a<=N:
          b=b+1
          a=K**b
     else:
          print(b)



Fixed submission:
N,K=(int(x) for x in input().split())
b=1
a=1
if N==1:
    print(1)
else:
     while a<=N:
          b=b+1
          a=K**b
     else:
          print(b)

Buggy python submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
b=1
a=1
while a=<N:
    b=b+1
    a=K**b
else:
     print(b)

Fixed submission:
N,K=(int(x) for x in input().split())
b=1
a=1
if N==1:
    print(1)
else:
     while a<=N:
          b=b+1
          a=K**b
     else:
          print(b)
Buggy python submission (verdict: Runtime Error):
N,A,B,C,D =list(map(int,input().split()))
s = input()
flag = 0
if C<D:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if s[B-1:C].count('...')>=1 and s[A:C].count('##')==0:
        print('Yes')
    else:
        print('No')


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

N = int(input())
a =list(map(int,input().split()))

if sum(a) == 0:
    print('Yes')
    exit()

if N%3 != 0:
    print('No')
    exit()    

ac = collections.Counter(a)

if len(ac) == 2 and ac[0] ==N/3:
    print('Yes')
    exit()


if len(ac) != 3 :
    print('No')
    exit()
else:
    lk1,lk2,lk3 = ac.keys()
    lv1,lv2,lv3 = ac.values()
if lv1 == lv2 ==lv3:
    if lk1^lk2 == lk3:
        print('Yes')
    else:
        print('No')
else:
    print('No')
    exit()

Buggy python submission (verdict: Runtime Error):
N,A,B,C,D =list(map(int,input().split()))
s = input()
flag = 0
if C<D:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if s[B-1:C].count('...')>=1 and s[A:C].count('##')==0:
        print('Yes')
    else:
        print('No')


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

N = int(input())
a =list(map(int,input().split()))

if sum(a) == 0:
    print('Yes')
    exit()

if N%3 != 0:
    print('No')
    exit()    

ac = collections.Counter(a)

if len(ac) == 2 and ac[0] ==N/3:
    print('Yes')
    exit()


if len(ac) != 3 :
    print('No')
    exit()
else:
    lk1,lk2,lk3 = ac.keys()
    lv1,lv2,lv3 = ac.values()
if lv1 == lv2 ==lv3:
    if lk1^lk2 == lk3:
        print('Yes')
    else:
        print('No')
else:
    print('No')
    exit()
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if kyori == int(kyori):
            counter += 1
        
print(counter)


Fixed submission:
import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if kyori == int(kyori):
            counter += 1
        
print(counter)

Buggy python submission (verdict: Runtime Error):
def isinteger(x):
    if isinstance(x, float):
        return x == int(x)


import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if isinteger(kyori):
            counter += 1
print(counter)

Fixed submission:
import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if kyori == int(kyori):
            counter += 1
        
print(counter)

Buggy python submission (verdict: Runtime Error):
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if is_integer(kyori):
            counter += 1
print(counter)


Fixed submission:
import numpy as np
N,D = list(map(int,input().split()))
 
lis =[list(map(int,input().split())) for i in range(N)]
lis_np = np.array(lis)
counter = 0
for i in range(N-1):
    for j in range(i+1,N):
        kyori = (sum((lis_np[:][i] - lis_np[:][j])**2))**0.5
        if kyori == int(kyori):
            counter += 1
        
print(counter)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = list(map(int,input().split()))
C_bai = list(range(A-(A%C)+C,B,C+1))
D_bai = list(range(A-(A%D)+D,B,D+1))
E = lcm(C,D)
CD_bai = list(range(A-(A%E)+E,B,E+1))
print(B-A+1-len(C_bai)-len(D_bai)+CD_bai)
    

Fixed submission:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = list(map(int,input().split()))
if A%C == 0:
    num_C_bai = (B-(B%C) - A)//C + 1
else:
    num_C_bai = ((B-(B%C) - (A-(A%C)+C)))//C + 1
    
if A%D == 0:
    num_D_bai = (B-(B%D) - A)//D + 1
else:
    num_D_bai = ((B-(B%D) - (A-(A%D)+D)))//D + 1

E = lcm(C,D)

if A%E == 0:
    num_E_bai = (B-(B%E) - A)//E + 1
else:
    num_E_bai = ((B-(B%E) - (A-(A%E)+E)))//E + 1

print(B + 1 - A - num_C_bai - num_D_bai + num_E_bai)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

X,A =list(map(int,input().split()))
print(X//A*10)


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

X,A =list(map(int,input().split()))
print(10 if A <= X else 0)
Buggy python submission (verdict: Runtime Error):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
xy = []
for _ in range(N):
    xy.append(list(map(int,input().split())))

rxy = []
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        rxy.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))
cr = collections.Counter(rxy)
print(N-max(cr.values()))



Fixed submission:
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
xy = []

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

for _ in range(N):
    xy.append(list(map(int,input().split())))

rxy = []
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        rxy.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))
cr = collections.Counter(rxy)
print(N-max(cr.values()))
Buggy python submission (verdict: Runtime Error):
import sys,math,collections,itertools,bisect
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
process = []
#--最大最小を見つける--#
maxA = A.pop(A.index(max(A)))
minA = A.pop(A.index(min(A)))
A.append(minA-maxA)
process.append(A)

for i in range(len(A)-2):
    maxA = A.pop(A.index(max(A)))
    A[-1]-=maxA
    process.append(list(q))
print(A[0]-A[-1])
for pro in process:
    print(*pro)


Fixed submission:
import sys,math,collections,itertools,bisect
input = sys.stdin.readline

N=int(input())
A=sorted(list(map(int,input().split())))
process = []
for i in range(N-2):
    tmp = A.pop()
    y=A.pop()
    A.append(tmp)
    if y>=0:
        process.append([A[0],y])
        A[0]-=y
    else:
        process.append([A[-1],y])
        A[-1]-=y
process.append([A[-1],A[0]])
print(A[-1]-A[0])
for pro in process:
    print(*pro)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [ int(input()) for _ in range(m)]
M=10**9+7
lis = [1] + [0]*n

for i in a:
  lis[i]=-1
lis[1] += 1
for i in range(n-1):
  if lis[i+2]<0:
    lis[i+2]= 0
  else:
    lis[i+2] = (lis[i+1] + lis[i])%M
print(lis[n])

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

P=list(map(int,input().split()))
print(sum(P)-max(P))
Buggy python submission (verdict: Time Limit Exceeded):
import sys,math,collections,itertools
input = sys.stdin.readline

H,W = list(map(int,input().split()))
s = [input().rstrip() for _ in range(H)]
maperW = [[0]*W for _ in range(H)]
maperH = [[0]*W for _ in range(H)]


#--W方向を調べる--#
for ih in range(H):
    for iw in range(W):
        if s[ih][iw]=='#':
            maperW[ih][iw]=0
        elif s[ih][iw]=='.' and iw == 0:
            maperW[ih][iw]=1
        else:
            maperW[ih][iw]=1+maperW[ih][iw-1]
    for iw in range(W-2,-1,-1):
        if maperW[ih][iw+1] == 0 or maperW[ih][iw]==0:
            continue
        else:
            maperW[ih][iw] = maperW[ih][iw+1]
#--H方向を調べる--#
for iw in range(W):
    for ih in range(H):
        if s[ih][iw]=='#':
            maperH[ih][iw]=0
        elif s[ih][iw]=='.' and ih == 0:
            maperH[ih][iw]=1
        else:
            maperH[ih][iw]=1+maperH[ih-1][iw]
    for ih in range(H-2,-1,-1):
        if maperH[ih+1][iw] == 0 or maperH[ih][iw]==0:
            continue
        else:
            maperH[ih][iw] = maperH[ih+1][iw]
ans = 0
for iw in range(W):
    for ih in range(H):
        ans = max(ans,maperW[ih][iw]+maperH[ih][iw]-1)
print(ans)


Fixed submission:
import sys,math,collections,itertools
input = sys.stdin.readline

H,W = list(map(int,input().split()))
s = [input().rstrip() for _ in range(H)]
maperW = [[0]*W for _ in range(H)]
maperH = [[0]*W for _ in range(H)]


#--W方向を調べる--#
for ih in range(H):
    for iw in range(W):
        if s[ih][iw]=='#':
            maperW[ih][iw]=0
        elif s[ih][iw]=='.' and iw == 0:
            maperW[ih][iw]=1
        else:
            maperW[ih][iw]=1+maperW[ih][iw-1]
    for iw in range(W-2,-1,-1):
        if maperW[ih][iw+1] == 0 or maperW[ih][iw]==0:
            continue
        else:
            maperW[ih][iw] = maperW[ih][iw+1]
#--H方向を調べる--#
for iw in range(W):
    for ih in range(H):
        if s[ih][iw]=='#':
            maperH[ih][iw]=0
        elif s[ih][iw]=='.' and ih == 0:
            maperH[ih][iw]=1
        else:
            maperH[ih][iw]=1+maperH[ih-1][iw]
    for ih in range(H-2,-1,-1):
        if maperH[ih+1][iw] == 0 or maperH[ih][iw]==0:
            continue
        else:
            maperH[ih][iw] = maperH[ih+1][iw]
ans = 0
for iw in range(W):
    for ih in range(H):
        ans = max(ans,maperW[ih][iw]+maperH[ih][iw]-1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))
for i in range(m):
    l,r=list(map(int,input().split()))
    if i == 0:
        ans = set(range(l,r+1))
    else:
        ans = ans & set(range(l,r+1))
print(len(ans))


Fixed submission:
n,m = list(map(int,input().split()))
la = 0
ra = n
for i in range(m):
    l,r=list(map(int,input().split()))
    la = max(la,l)
    ra = min(ra,r)
print(max(0,ra-la+1))
Buggy python submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))

S = list(input())

S[K] = chr(ord(S[K])+32)

print(''.join(S))

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

for i in range(len(S)):
    if i != K-1:
        print(S[i],end='')
    else:
        print(chr(ord(S[i])+32),end="")

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

S = list(input())

S[K] = S[K].lower()

print(''.join(S))


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

for i in range(len(S)):
    if i != K-1:
        print(S[i],end='')
    else:
        print(chr(ord(S[i])+32),end="")

Buggy python submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
S = list(input())
S[K]=S[K].lower()
print("".join(S))


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

for i in range(len(S)):
    if i != K-1:
        print(S[i],end='')
    else:
        print(chr(ord(S[i])+32),end="")

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,K=list(map(int,input().split()))
S = list(input().rstrip())
S[K]=S[K].lower()
print("".join(S))


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

for i in range(len(S)):
    if i != K-1:
        print(S[i],end='')
    else:
        print(chr(ord(S[i])+32),end="")

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,K=list(map(int,input().split()))
S = list(input().rstrip())
S[K]=S[K].lower()
print("".join(S))


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

for i in range(len(S)):
    if i != K-1:
        print(S[i],end='')
    else:
        print(chr(ord(S[i])+32),end="")
Buggy python submission (verdict: Runtime Error):
a = {'A':'T','T':'A','G':'C','T':'C'}
print(a[input()])


Fixed submission:
a = {'A':'T','T':'A','G':'C','C':'G'}
print(a[input()])
Buggy python submission (verdict: Time Limit Exceeded):
import re
S = input()
counter = 0
ans_bf = len(S)
while True:
    len_bf = len(S)
    S = re.sub(r"01","",S)
    S = re.sub(r"10","",S)
    if len_bf == len(S):
        break
print(ans_bf - len(S))


Fixed submission:
import collections
S = input()
col_S = collections.Counter(S) 
print(min(col_S['0'],col_S['1'])*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
counter = 0
ans_bf = len(S)
while True:
    len_bf = len(S)
    for i in range(0,(len_bf-1)):
        if (S[i] == '0' and S[i+1] == '1') or(S[i] == '1' and S[i+1] == '0') :
            S = S[:i]+S[i+2:]
            break
    if len_bf == len(S):
        break
print(ans_bf - len(S))


Fixed submission:
import collections
S = input()
col_S = collections.Counter(S) 
print(min(col_S['0'],col_S['1'])*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
counter = 0
ans_bf = len(S)
while True:
    S = list(S)
    len_bf = len(S)
    for i in range(0,(len_bf-1)):
        if (S[i] == '0' and S[i+1] == '1') or(S[i] == '1' and S[i+1] == '0') :
            S[i] = ""
            S[i+1] = ""
    S = "".join(S)
    if len_bf == len(S):
        break
print(ans_bf - len(S))


Fixed submission:
import collections
S = input()
col_S = collections.Counter(S) 
print(min(col_S['0'],col_S['1'])*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
counter = 0
ans_bf = len(S)
while True:
    S = list(S)
    len_bf = len(S)
    for i in range(0,(len_bf-1)):
        if (S[i] == '0' and S[i+1] == '1') or(S[i] == '1' and S[i+1] == '0') :
            S[i] = ""
            S[i+1] = ""
    S = "".join(S)
    if len_bf == len(S):
        break
print(ans_bf - len(S))


Fixed submission:
import collections
S = input()
col_S = collections.Counter(S) 
print(min(col_S['0'],col_S['1'])*2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
ABC= []
for _ in range(N):
    a,b = map(int,input().split())
    ABC.append([a,b])

taka = 0
aoki = 0
while ABC:
    ABC.sort(key=lambda x:[x[0],x[1]])
    taka += ABC.pop()[0]
    if len(ABC)==0:
        break
    ABC.sort(key=lambda x:[x[1],x[0]])
    aoki += ABC.pop()[1]
print(taka-aoki)


Fixed submission:
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
ABC= []
for _ in range(N):
    a,b = map(int,input().split())
    ABC.append([a,b,a+b])

taka = 0
aoki = 0
ABC.sort(key=lambda x:x[2])
while ABC:
    
    taka += ABC.pop()[0]
    if len(ABC)==0:
        break
    aoki += ABC.pop()[1]
print(taka-aoki)

Buggy python submission (verdict: Time Limit Exceeded):
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
ABC= []
for _ in range(N):
    a,b = map(int,input().split())
    ABC.append([a,b])

taka = 0
aoki = 0
while ABC:
    ABC.sort(key=lambda x:[x[0],x[1]])
    taka += ABC.pop()[0]
    if len(ABC)==0:
        break
    ABC.sort(key=lambda x:[x[1],x[0]])
    aoki += ABC.pop()[1]
print(taka-aoki)


Fixed submission:
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
ABC= []
for _ in range(N):
    a,b = map(int,input().split())
    ABC.append([a,b,a+b])

taka = 0
aoki = 0
ABC.sort(key=lambda x:x[2])
while ABC:
    
    taka += ABC.pop()[0]
    if len(ABC)==0:
        break
    aoki += ABC.pop()[1]
print(taka-aoki)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

dq = collections.deque([0])

for i in range(1,N):
    l = []
    if i<K+1:
        for k in range(1,i+1):
            l.append(dq[i-k]+abs(h[i]-h[i-k]))

        dq.append(min(l))
    else:
        for k in range(1,K+1):
            l.append(dq[k]+abs(h[i]-h[i-K+k-1]))
        dq.append(min(l))
        dq.popleft()
print(dq.pop())

Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**7)

N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

dq = collections.deque([0])

for i in range(1,N):
    l = []
    if i<K+1:
        for k in range(1,i+1):
            l.append(dq[i-k]+abs(h[i]-h[i-k]))

        dq.append(min(l))
    else:
        for k in range(1,K+1):
            l.append(dq[k]+abs(h[i]-h[i-K+k-1]))
        dq.append(min(l))
        dq.popleft()
print(dq.pop())
Buggy python submission (verdict: Time Limit Exceeded):
N,W = map(int,input().split())
wv = []
for i in range(N):
    wv.append(list(map(int,input().split())))
    
#- dp[i][j] i番目より後ろの品物から、重さjまで許して荷物を入れた時の価値の最大
dp = [[0]*(W+1) for i in range(N+1)]

for i in range(N-1,-1,-1):#N番目以降は品物がもうないので0。→N-1からやる
    for j in range(W,-1,-1): #重いほうから見ていく
        if j<wv[i][0]:#i番目の荷物の重さがそもそも許容値よりも大きい→いれられない
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-wv[i][0]]+wv[i][1])#いれない or いれる　の大きいほう
#最後の出力は、0番目以降の品物(つまり、全部)から、重さWまで許したときの価値の最大
print(dp[0][W])


Fixed submission:
N,W = map(int,input().split())
wv = []
for i in range(N):
    wv.append(list(map(int,input().split())))
    
#- dp[i][j] i番目より後ろの品物から、重さjまで許して荷物を入れた時の価値の最大
dp = [[0]*(W+1) for i in range(N+1)]

for i in range(N-1,-1,-1):#N番目以降は品物がもうないので0。→N-1からやる
    for j in range(W,-1,-1): #重いほうから見ていく
        if j<wv[i][0]:#i番目の荷物の重さがそもそも許容値よりも大きい→いれられない
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-wv[i][0]]+wv[i][1])#いれない or いれる　の大きいほう
#最後の出力は、0番目以降の品物(つまり、全部)から、重さWまで許したときの価値の最大
print(dp[0][W])
Buggy python submission (verdict: Runtime Error):
N,W = map(int,input().split())
wv = []
for i in range(N):
    wv.append(list(map(int,input().split())))
    
#- dp[i][j] i番目より後ろの品物から、重さjまで許して荷物を入れた時の価値の最大
dp = [[0]*(W+1) for i in range(N+1)]

for i in range(N-1,-1,-1):#N番目以降は品物がもうないので0。→N-1からやる
    for j in range(W,-1,-1): #重いほうから見ていく
        if j<wv[i][0]:#i番目の荷物の重さがそもそも許容値よりも大きい→いれられない
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-wv[i][0]]+wv[i][1])#いれない or いれる　の大きいほう
#最後の出力は、0番目以降の品物(つまり、全部)から、重さWまで許したときの価値の最大
print(dp[0][W])


Fixed submission:
N,W = map(int,input().split())
wv = [0]
for i in range(N):
    wv.append(list(map(int,input().split())))
    
#- dp[i][j] i番目までの品物から、価値がjとなるように選んだ時の、重さの最小値
Vmax = 10**3*100
dp = [[float('inf')]*(Vmax+1) for i in range(N+1)]
dp[0][0]=0#なにも品物を選ばないなら価値0で重さ0

for i in range(1,N+1):#N番目以降は品物がもうないので0。→N-1からやる
    for j in range(0,Vmax+1): #価値でループ
        if j<wv[i][1]:#i番目の荷物の価値がそもそも入れたい価値よりも大きい→いれられない
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = min(dp[i-1][j],dp[i-1][j-wv[i][1]]+wv[i][0])#いれない or いれる　の大きいほう
#最後の出力は、最終番目以降の品物(つまり、全部)から、価値の大きいほうから見ていき、許容W以下のもの
for i in range(Vmax,-1,-1):
    if dp[N][i] <= W:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
import sys,math
input = sys.stdin.readline

N,M = list(map(int,input().split()))
S = input().rstrip()
T = input().rstrip()

lcm = N*M//math.gcd(N,M)
X_S=list("#"*lcm)
for i in range(N):
    X_S[i*lcm//N] = S[i]

for i in range(M):
    if X_S[i*lcm//M] == T[i] or X_S[i*lcm//M] == '#':
        continue
    else:
        print(-1)
print(lcm)


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

N,M = list(map(int,input().split()))
S = input().rstrip()
T = input().rstrip()

L = N*M//math.gcd(N,M)

sn = L//M
tm = L//N

for i in range(N//sn):
    if S[i*sn] == T[i*tm]:
        continue
    else:
        print(-1)
        exit()
print(L)

Buggy python submission (verdict: Runtime Error):
import sys,math
input = sys.stdin.readline

N,M = list(map(int,input().split()))
S = input().rstrip()
T = input().rstrip()

lcm = N*M//math.gcd(N,M)
X_S=list("#"*lcm)
X_T=list("#"*lcm)
for i in range(N):
    X_S[i*lcm//N] = S[i]
for j in range(M):
    X_T[j*lcm//M] =T[j]

for i in range(lcm):
    if X_S[i] == X_T[i] or X_S[i] =='#' or X_T[i] =='#':
        continue
    else:
        print(-1)
        exit()
print(lcm)


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

N,M = list(map(int,input().split()))
S = input().rstrip()
T = input().rstrip()

L = N*M//math.gcd(N,M)

sn = L//M
tm = L//N

for i in range(N//sn):
    if S[i*sn] == T[i*tm]:
        continue
    else:
        print(-1)
        exit()
print(L)
Buggy python submission (verdict: Runtime Error):
if input() == '1':
  print(Hello World)
else:
  print(eval(input()+'+'+input()))

Fixed submission:
if input() == '1':
  print('Hello World')
else:
  print(eval(input()+'+'+input()))

Buggy python submission (verdict: Runtime Error):
N,T = map(int,(list(input().split())))
cost = []
for _ in range(N):
    c,t = map(int,(list(input().split())))
    if t<=T:
        cost.append(c)
print(min(cost))

Fixed submission:
if input() == '1':
  print('Hello World')
else:
  print(eval(input()+'+'+input()))