Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5+100):
        if j+v < 10**7+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])

Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5):
        if j+v < 10**9+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5):
        if j+v < 10**9+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])

Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**5+100) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5):
        if j+v < 10**9+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])