Buggy python submission (verdict: Runtime Error):
N,W = map(int, input().split())
dp = [0]*(W+1)

for i in range(1,N+1):
    v,w = map(int,input().split())
    for j in range(w-1,, W, -1):
    	print(j)
        x = v+dp[j-w]
        if x > dp[j]: dp[j] = x

print(dp[W])



Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N,W = map(int, input().split())
dp = [0]*(W+1)

for i in range(1,N+1):
    v,w = map(int,input().split())
    for j in range(w-1, W, -1):
    	print(j)
        x = v+dp[j-w]
        if x > dp[j]: dp[j] = x

print(dp[W])



Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N , W = map(int,input())
dp[W+1] = [0]

for i in range(N):
    n , m = map(input())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x > dp[j]:
            dp[j] = x:
            
print(dp[W])


Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N , W = map(int,input().split())
dp[W+1] = [0]

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x > dp[j]:
            dp[j] = x:
            
print(dp[W])


Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N , W = map(int,input().split())
dp[W+1] = [0]

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x:
            
print(dp[W])


Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N , W = map(int,input().split())
dp[W+1] = [0]

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])


Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])

Buggy python submission (verdict: Runtime Error):
N , W = map(int,input().split())
dp[] = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])


Fixed submission:
N , W = map(int,input().split())
dp = [0]*(W+1)

for i in range(N):
    n , m = map(int,input().split())
    for j in range(W,m-1,-1):
        x = n + dp[j-m]
        if x >= dp[j]:
            dp[j] = x
            
print(dp[W])