Buggy python submission (verdict: Runtime Error):
## coding: UTF-8
import sys
#import time

#start = time.time()
N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]


dp = [ [sys.maxsize] * (N * 1000) for _ in range(N) ]
for i in range(N):
    for j in range(N * 1000):
        w = l[i][0]
        v = l[i][1]
        if(j == 0):
            dp[i][j] = 0
        elif(j <= v):
            dp[i][j] = min(dp[i-1][j], w)
        else:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + w)
#for k in range(N):
    #print(dp[k][:20])


cnt = 0
i = 0
while cnt <= W:
    cnt = dp[-1][i]
    i += 1
print(i-2)#0-index , while分の構造上、iが2多くなる



Fixed submission:
## coding: UTF-8
import sys
#import time

#start = time.time()
N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]


dp = [ [sys.maxsize] * (N * 1000) for _ in range(N) ]
for i in range(N):
    for j in range(N * 1000):
        w = l[i][0]
        v = l[i][1]
        if(j == 0):
            dp[i][j] = 0
        elif(j <= v):
            dp[i][j] = min(dp[i-1][j], w)
        else:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + w)
#for k in range(N):
    #print(dp[k][:20])

#print(dp[-1][2999])
#print(dp[-1][3000])
cnt = 0
i = 0
while cnt <= W:
    cnt = dp[-1][i]
    i += 1
    if(i == N*1000):
        i += 2
        break
print(i-2)#0-index , while分の構造上、iが2多くなる

Buggy python submission (verdict: Runtime Error):
## coding: UTF-8


N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]

dp = [[0] * (W+1) for _ in range(N)]

for i in range(N):
    for j in range(W+1):
        if(j >= l[i][0]):
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-l[i][0]] + l[i][1])
        else:
            dp[i][j] = dp[i-1][j]
#for k in range(N):
    #print(dp[k])
print(dp[-1][-1])

Fixed submission:
## coding: UTF-8
import sys
#import time

#start = time.time()
N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]


dp = [ [sys.maxsize] * (N * 1000) for _ in range(N) ]
for i in range(N):
    for j in range(N * 1000):
        w = l[i][0]
        v = l[i][1]
        if(j == 0):
            dp[i][j] = 0
        elif(j <= v):
            dp[i][j] = min(dp[i-1][j], w)
        else:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + w)
#for k in range(N):
    #print(dp[k][:20])

#print(dp[-1][2999])
#print(dp[-1][3000])
cnt = 0
i = 0
while cnt <= W:
    cnt = dp[-1][i]
    i += 1
    if(i == N*1000):
        i += 2
        break
print(i-2)#0-index , while分の構造上、iが2多くなる

Buggy python submission (verdict: Runtime Error):
## coding: UTF-8


N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]

dp = [[0] * (W+1) for _ in range(N)]

for i in range(N):
    for j in range(W+1):
        if(j >= l[i][0]):
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-l[i][0]] + l[i][1])
        else:
            dp[i][j] = dp[i-1][j]
#for k in range(N):
    #print(dp[k])
print(dp[-1][-1])

Fixed submission:
## coding: UTF-8
import sys
#import time

#start = time.time()
N, W = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(N)]


dp = [ [sys.maxsize] * (N * 1000) for _ in range(N) ]
for i in range(N):
    for j in range(N * 1000):
        w = l[i][0]
        v = l[i][1]
        if(j == 0):
            dp[i][j] = 0
        elif(j <= v):
            dp[i][j] = min(dp[i-1][j], w)
        else:
            dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + w)
#for k in range(N):
    #print(dp[k][:20])

#print(dp[-1][2999])
#print(dp[-1][3000])
cnt = 0
i = 0
while cnt <= W:
    cnt = dp[-1][i]
    i += 1
    if(i == N*1000):
        i += 2
        break
print(i-2)#0-index , while分の構造上、iが2多くなる