Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
w = []
v = []
Vmax = 100 * N

for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

inf = float('inf')
dp = [[inf] * (Vmax+1) for _ in range(N)]
dp[0][0] = 0
dp[0][v[0]] = w[0]

for i in range(1,N):
    for j in range(Vmax):

        if dp[i-1][j] != inf:
            dp[i][j] = dp[i-1][j]

            if dp[i-1][j] + w[i] <= W:
                dp[i][j+v[i]] = min(dp[i][j+v[i]], dp[i-1][j] + w[i])
        
ans = 0
for j in range(Vmax):
    if dp[N-1][j] <= W:
        ans = j

print(ans)

Fixed submission:
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    for j in range(N*(10**3)+1):
        if j>=v[i-1]:
            dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
def chmin(a,b):
    if a > b:
        return b
    else:
        return a

N, W = map(int, input().split())
w = []
v = []
Vmax = 100 * N

for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

inf = float('inf')
dp = [[inf] * (Vmax+1) for _ in range(N)]
dp[0][0] = 0
dp[0][v[0]] = w[0]

for i in range(1,N):
    for j in range(Vmax):

        if dp[i-1][j] != inf:
            dp[i][j] = dp[i-1][j]

            if dp[i-1][j] + w[i] <= W:
                dp[i][j+v[i]] = chmin(dp[i][j+v[i]], dp[i-1][j] + w[i])
        
for j in range(Vmax):
    if dp[N-1][j] != inf:
        ans = j

print(ans)

Fixed submission:
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    for j in range(N*(10**3)+1):
        if j>=v[i-1]:
            dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
def chmin(a,b):
    if a > b:
        return b
    else:
        return a

N, W = map(int, input().split())
w = []
v = []
Vmax = 100 * N

for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

inf = float('inf')
dp = [[inf] * (Vmax+1) for _ in range(N)]
dp[0][0] = 0
dp[0][v[0]] = w[0]

for i in range(1,N):
    for j in range(Vmax):

        if dp[i-1][j] != inf:
            dp[i][j] = dp[i-1][j]

            if dp[i-1][j] + w[i] <= W:
                dp[i][j+v[i]] = chmin(dp[i][j+v[i]], dp[i-1][j] + w[i])
        
for j in range(Vmax):
    if dp[N-1][j] != inf:
        ans = j

print(ans)

Fixed submission:
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[10**22]*(N*(10**3)+1) for i in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
    for j in range(N*(10**3)+1):
        if j>=v[i-1]:
            dp[i][j]=min(dp[i-1][j-v[i-1]]+w[i-1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
for i in range(N*(10**3),-1,-1):
    if dp[N][i]<=W:
        print(i)
        break