Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
def main():
    input=sys.stdin.readline
    h,w=map(int,input().split())
    a=[list(map(int,input().split())) for _ in range(h)]
    b=[list(map(int,input().split())) for _ in range(h)]
    
    ofset = 80*164
    #mask = (1 << (ofset*2)) - 1
    dp=[[0 for i in range(w)] for j in range(h)]
    dp[0][0] |= 1 << (a[0][0] - b[0][0] + ofset)
    dp[0][0] |= 1 << (b[0][0] - a[0][0] + ofset)
    """
    for i in range(h):
        for j in range(w):
            if i < h - 1:
                A = abs(a[i+1][j] - b[i+1][j])
                dp[i+1][j] |= (dp[i][j] << A)
                dp[i+1][j] |= (dp[i][j] >> A)
            if j < w - 1:
                A = abs(a[i][j+1] - b[i][j+1])
                dp[i][j+1] |= (dp[i][j] << A)
                dp[i][j+1] |= (dp[i][j] >> A)
    ans = 10000000000
    """
    for i in range(ofset, 80*330):
        if (dp[h-1][w-1]>>i)&1:
            ans = i - ofset
            break
    for i in reversed(range(ofset)):
        if (dp[h-1][w-1]>>i)&1:
            ans = min(ans, ofset - i)
            break
    print(ans)
    
if __name__=='__main__':
  main()


Fixed submission:
import sys
def main():
    input=sys.stdin.readline
    h,w=map(int,input().split())
    a=[list(map(int,input().split())) for _ in range(h)]
    b=[list(map(int,input().split())) for _ in range(h)]
    ofset = 80*164
    mask = (1 << (ofset*2)) - 1
    dp=[[0 for i in range(w)] for j in range(h)]
    dp[0][0] |= 1 << (a[0][0] - b[0][0] + ofset)
    dp[0][0] |= 1 << (b[0][0] - a[0][0] + ofset)
    for i in range(h):
        for j in range(w):
            if i < h - 1:
                A = abs(a[i+1][j] - b[i+1][j])
                dp[i+1][j] |= (dp[i][j] << A) & mask
                dp[i+1][j] |= (dp[i][j] >> A) & mask
            if j < w - 1:
                A = abs(a[i][j+1] - b[i][j+1])
                dp[i][j+1] |= (dp[i][j] << A) & mask
                dp[i][j+1] |= (dp[i][j] >> A) & mask
    ans = 10000000000
    for i in range(ofset, 80*330):
        if (dp[h-1][w-1]>>i)&1: ans = min(ans, i - ofset)
    for i in range(ofset):
        if (dp[h-1][w-1]>>i)&1: ans = min(ans, ofset - i)
    print(ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
for i in range(len(s)):
  c = (ord(s[i]) + n - ord('A')) % 26
  c += ord('A')
  s[i] = chr(c)
 print(s)

Fixed submission:
n = int(input())
s = list(input())
for i in range(len(s)):
  c = (ord(s[i]) + n - ord('A')) % 26
  c += ord('A')
  s[i] = chr(c)
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n, t = map(int, input().split())
a = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
  x, y = map(int, input().split())
  a[i][0], a[i][1] = x, y
a = sorted(a, key=lambda x: x[0], reverse=True)
dp = [[0 for i in range(t+1)] for j in range(n+1)]

for i in range(1, n+1):
  for j in range(1, t+1):
    dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    if j == 1:
      dp[i][j] = max(dp[i][j], a[i-1][1])
    if j >= a[i-1][0]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
print(dp[n][t])  

Fixed submission:
n, t = map(int, input().split())
a = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
  x, y = map(int, input().split())
  a[i][0], a[i][1] = x, y
a = sorted(a, key=lambda x: x[0], reverse=True)
dp = [[0 for i in range(t+1)] for j in range(n+1)]

for i in range(1, n+1):
  for j in range(1, t+1):
    dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    if j == 1:
      dp[i][j] = max(dp[i][j], a[i-1][1])
    if j >= a[i-1][0]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
print(dp[n][t])

Buggy python submission (verdict: Time Limit Exceeded):
n, t = map(int, input().split())
a = []
for i in range(n):
  x, y = map(int, input().split())
  a.append([x, y])
a = sorted(a, key=lambda x: x[0], reverse=True)
dp = [[0 for i in range(t+1)] for j in range(n+1)]
for i in range(1, n+1):
  for j in range(1, t+1):
    dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    if j == 1:
      dp[i][j] = max(dp[i][j], a[i-1][1])
    if j >= a[i-1][0]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
print(dp[n][t])  

Fixed submission:
n, t = map(int, input().split())
a = [[0 for i in range(2)] for j in range(n)]
for i in range(n):
  x, y = map(int, input().split())
  a[i][0], a[i][1] = x, y
a = sorted(a, key=lambda x: x[0], reverse=True)
dp = [[0 for i in range(t+1)] for j in range(n+1)]

for i in range(1, n+1):
  for j in range(1, t+1):
    dp[i][j] = max(dp[i-1][j], dp[i][j-1])
    if j == 1:
      dp[i][j] = max(dp[i][j], a[i-1][1])
    if j >= a[i-1][0]:
      dp[i][j] = max(dp[i][j], dp[i-1][j-a[i-1][0]] + a[i-1][1])
print(dp[n][t])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in range(s):
    if i==now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)


Fixed submission:
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in s:
    if i!=now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in range(s):
    if i=now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)


Fixed submission:
n, k = map(int, input().split())
s = input()
segment = 0
now = '#'
ans = 0
for i in s:
    if i!=now:
        segment+=1
        now = i
    else:
        ans+=1
for i in range(k):
    t = 0
    if segment > 2:
        t = 2
    elif segment == 2:
        t = 1
    segment, ans = segment-t, ans+t
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,m=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
l=list()
v=0
heapq.heapify(l)
for i in range(1,m+1):
  for j in range(n):
    if c[j][0]==i:
      heapq.heappush(l,(-1)*c[j][1])
  if l:
    v+=heapq.heappop(l)*(-1)
print(v)


Fixed submission:
import heapq
n,m=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
ans, available = 0, []
heapq.heapify(available)
heapq.heapify(c)
for i in range(1, m+1):
    while len(c)!=0 and c[0][0]<=i:
        now = heapq.heappop(c)
        heapq.heappush(available,-now[1])
    if len(available) != 0:
        ans -= heapq.heappop(available)
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

R, G, B, N = map(int, input().split())
r = np.arange(0, int(N/R)+1)
g = np.arange(0, int(N/G)+1)
rg = r[:, np.newaxis]*R+g[np.newaxis, :]*G
mask = (rg<=N) & ((N-rg)%B==0)
print(np.sum(mask))

Fixed submission:
import numpy as np
R, G, B, N = map(int, input().split())
r = np.arange(0, int(N/R)+1)
g = np.arange(0, int(N/G)+1)
rg = r[:, np.newaxis]*R+g[np.newaxis, :]*G
mask = (rg<=N) & ((N-rg)%B==0)
print(np.sum(mask))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int, input().split()))
newA = np.array(A)
num = np.gcd.reduce(newA)
print(num)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


N = int(input())
A = list(map(int, input().split()))
num = A[0]
for i in range(N):
    num = gcd(num, A[i])
print(num)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
num = reduce(math.gcd, A)
print(num)


Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


N = int(input())
A = list(map(int, input().split()))
num = A[0]
for i in range(N):
    num = gcd(num, A[i])
print(num)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")

Fixed submission:
N = input()
count = 0
for i in range(len(N)):
    if N[i] == '2':
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        ffag = 0
        for i in range(N):
            if a[i] == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")

Fixed submission:
N = int(input())
a = [0 for i in range(N)]
for i in range(N):
    a[i] = int(input())
dp = [0 for i in range(N + 1)]
dp[0] = 0
for i in range(N):
    dp[i + 1] = (dp[i] + a[i]) % 2
if dp[i] == 1:
    print("first")
elif dp[i] == 0:
    if a[i] % 2 == 0:
        flag = 0
        for i in range(N):
            if a[i] % 2 == 1:
                flag = 1
        if flag == 1:
            print("first")
        else:
            print("second")
    else:
        print("first")
Buggy python submission (verdict: Runtime Error):
a = input().split()
print(a[0] + a[1]/2)

Fixed submission:
a = list(map(int, input().split()))
print(int(a[0] + a[1]/2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
k = N%500<=a
print('Yes' if k else 'No')


Fixed submission:
n = int(input())
a = int(input())
k = n%500<=a
print('Yes' if k else 'No')
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')


Fixed submission:
a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4, 'F':5}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
a=[0]*k
ans=0
for i in range(k):
    a[i]=p[i]
ans=sum(a)
for i in range(n):
    a.remove(a[0])
    a.append(p[i])
    if ans<sum(a):
        ans=sum(a)
print((ans+k)*0.5)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
for i in range(k):
    ans+=p[i]
pre=ans
for i in range(k,n,1):
    pre=(pre+p[i]-p[i-k])
    if ans<pre:
        ans=pre
print((ans+k)*0.5)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
b=[0]*n
for i in range(n):
    b[i]=a.index(i+1)+1
maped_b=map(str,b)
ans=' '.join(maped_b)
print(ans)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[a[i]-1]=str(i+1)
ans=' '.join(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
import heapq
N,M=map(int, input().split())
A=list(map(int, input().split()))
for i in range(N):
    A[i]=-1*A[i]
heapq.heapify(A)
for i in range(M):
    q=heapq.heappop(A)
    q=q/2
    heapq.heappush(A,q)
ans=0
for i in range(N):
    ans+=-1*int(A[i])
print(ans)

Fixed submission:
S=input()
if S=="Sunny":
    print("Cloudy")
elif S=="Cloudy":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())
M=K-Q
A=[]
for i in range(0,Q):
    A.append(int(input()))
for i in range(0,N):
    if M+A.count(i+1)>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q=map(int, input().split())
M=K-Q
A=[M]*N
for i in range(Q):
    B=int(input())
    A[B-1]+=1
for i in range(N):
    if A[i]<1:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())
A=[]
for i in range(0,Q):
    A.append(int(input()))
B=[0]*N
for i in range(N):
    B[i]=A.count(i+1)
for i in range(0,N):
    if K+B[i]-Q>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q=map(int, input().split())
M=K-Q
A=[M]*N
for i in range(Q):
    B=int(input())
    A[B-1]+=1
for i in range(N):
    if A[i]<1:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())
A=[]
for i in range(0,Q):
    A.append(int(input()))
for i in range(0,N):
    if K+A.count(i+1)-Q>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q=map(int, input().split())
M=K-Q
A=[M]*N
for i in range(Q):
    B=int(input())
    A[B-1]+=1
for i in range(N):
    if A[i]<1:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import math
N,M=map(int, input().split())
A=list(map(int, input().split()))
for i in range(M):
    A.sort()
    A[N-1]=math.trunc(A[N-1]/2)
print(sum(A))

Fixed submission:
import heapq
N,M=map(int, input().split())
A=list(map(int, input().split()))
for i in range(N):
    A[i]=-1*A[i]
heapq.heapify(A)
for i in range(M):
    q=heapq.heappop(A)
    q=q/2
    heapq.heappush(A,q)
for i in range(N):
    A[i]=-1*int(A[i])
print(sum(A))
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(B-1)//(A-1)
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-3)//(A-1)
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A-1+B-1-1)//(A-1)
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-1)//B
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy python submission (verdict: Runtime Error):

A=int(input())
B=int(input())

if B<=A:
    ans=1
else:
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

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

if B<=A:
    ans=1
else:
    for k in range(2,31):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
ans=(A+B-1)//A
print(ans)


Fixed submission:
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n,k= map(int,input().split())
m=min(n,k)
a=[0]*n
for i in range(1,m+1):
    a[i-1]=math.ceil(math.log2(k/i))
for i in range(m):
    a[i]=0.5**a[i]
print((sum(a)+max(n-k,0))/n)

Fixed submission:
import math
n,k= map(int,input().split())
m=min(n,k)
a=[0]*n
for i in range(1,m+1):
    a[i-1]=math.ceil(math.log2(k/i))
for i in range(m):
    a[i]=0.5**a[i]
print((sum(a)+max(n-k,0))/n)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input(),split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n,1):
  dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n,1):
    dp[i]=min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[1000000000]*n
dp[0]=0
for i in range (1,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[n-1])

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

dp=[1000000000]*n
dp[0]=0
for i in range (1,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[n-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[100000]*n
dp[0]=0
for i in range (1,n):
    if i<k:
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),abs(h[i]-h[0]))
    else:
        dp[i]=dp[i-k]+abs(h[i]-h[i-k])
        for j in range(1,k):
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])

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

dp=[1000000000]*n
dp[0]=0
for i in range (1,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j<w[i]:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
print(dp[N][W])

Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N,W=map(int,input().split())
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j<w[i]:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
print(dp[N][W])

Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N,W=map(int,input().split())
for i in range(n):
    w[i],v[i]=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j<w[i]:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
print(dp[N][W])


Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1
print(dp[W])

Buggy python submission (verdict: Runtime Error):

#入力,準備
N,W=map(int,input().split())
w=[0]*n
v=[0]*n
for i in range(n):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)

#メイン
#dp[j] : 重さの総和がjを超えないように選んだ時の価値の総和の最大値
for i in range(n):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1

print(dp[W])

Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1
print(dp[W])

Buggy python submission (verdict: Runtime Error):

#入力,準備
n=int(input())
w=[0]*n
v=[0]*n
for i in range(n):
    w[i],v[i]=map(int,input().split())
W=int(input())
dp=[0]*(W+1)

#メイン
#dp[j] : 重さの総和がjを超えないように選んだ時の価値の総和の最大値
for i in range(n):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1

print(dp[W])

Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())
dp=[0]*(W+1)
for i in range(N):
    j=W
    while j>=w[i]:
        dp[j]=max(dp[j],dp[j-w[i]]+v[i])
        j-=1
print(dp[W])
Buggy python submission (verdict: Runtime Error):
a,b=int(input())
print(a+(b//2))

Fixed submission:
a,b=map(int,input().split())
print(a+(b//2))
Buggy python submission (verdict: Runtime Error):
n=input()
for i in range(3):
  if n[i]=="1":
    n[i]="9"
  else:
    n[i]="1"
print(n)

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
for i in range(3):
  if n[i]=="1":
    n[i]=9
  else:
    n[i]=1
print(n)

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=list(input())
for i in range(3):
  if n[i]=="1":
    n[i]=9
  else:
    n[i]=1
s=" "
for i in range(3):
  s+="n[i]"
print(int(s))

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=list(input())
for i in range(3):
  if n[i]=="1":
    n[i]=9
  else:
    n[i]=1
s=""
for i in range(3):
  s+="n[i]"
print(int(s))

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=list(input())
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
s=""
for i in range(3):
  s+="n[i]"
print(int(s))

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=list(input())
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
s=""
for i in range(3):
  s+=n[i]
print(int(s))

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=list(input())
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
s=""
for i in range(3):
  s+=n[i]
print(s)

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
print("n")

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
for i in range(3):
  if n[i]==1:
    n[i]=9
  else:
    n[i]=1
print(n)

Fixed submission:
n=input()
ans=""
for i in range(3):
  if n[i]=="1":
    ans+="9"
  else:
    ans+="1"
print(ans)