Buggy python submission (verdict: Runtime Error):
import numpy as np
N,W = list(map(int,input()).split())
V_sum = 0
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    V_sum+=v
    w_l.append(w)
    v_l.append(v)
dp = np.full((V_sum+1,1),10**6)
for i in range(N):
    dp[v_l[i]:] = np.minimum(dp[v_l[i]:],dp[:-v_l[i]]+w_l[i])
for i in range(V_sum+1,-1,-1):
    if dp[i]<=W:
        print(i)
        break
    
    

Fixed submission:
import numpy as np
N,W = map(int,input().split())
V_sum = 0
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    V_sum+=v
    w_l.append(w)
    v_l.append(v)
dp = np.full(V_sum+1,W+1)
dp[0] = 0
for i in range(N):
    dp[v_l[i]:] = np.minimum(dp[v_l[i]:],dp[:-v_l[i]]+w_l[i])
for i in range(V_sum,-1,-1):
    if dp[i]<=W:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N,W = list(map(int,input().split()))
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    w_l.append(w)
    v_l.append(v)
def knapsack(N,W,w_l,v_l):
    if (N==0 or W==0):
        return 0
    elif(w_l[N-1]>W):
        return knapsack(N-1,W,w_l,v_l)
    
    else:
        return max(knapsack(N-1,W,w_l,v_l), v_l[N-1]+knapsack(N-1,W-w_l[N-1],w_l,v_l))
ans = knapsack(N,W,w_l,v_l)
print(ans)

Fixed submission:
import numpy as np
N,W = map(int,input().split())
V_sum = 0
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    V_sum+=v
    w_l.append(w)
    v_l.append(v)
dp = np.full(V_sum+1,W+1)
dp[0] = 0
for i in range(N):
    dp[v_l[i]:] = np.minimum(dp[v_l[i]:],dp[:-v_l[i]]+w_l[i])
for i in range(V_sum,-1,-1):
    if dp[i]<=W:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
n,w=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort()
b=[]
for i in range(n):
    b.append([0]*(w+1))
for i in range(1,w+1):
    if i>=a[0][0]:
        b[0][i]=a[0][1]
 
for i in range(1,n):
    for j in range(1,w+1):
        if j>=a[i][0]:
            b[i][j]=max(b[i-1][j],b[i-1][j-a[i][0]]+a[i][1])
        else:
            b[i][j]=b[i-1][j]
print(b[n-1][w])

Fixed submission:
import numpy as np
N,W = map(int,input().split())
V_sum = 0
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    V_sum+=v
    w_l.append(w)
    v_l.append(v)
dp = np.full(V_sum+1,W+1)
dp[0] = 0
for i in range(N):
    dp[v_l[i]:] = np.minimum(dp[v_l[i]:],dp[:-v_l[i]]+w_l[i])
for i in range(V_sum,-1,-1):
    if dp[i]<=W:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N,W = list(map(int,input().split()))
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    w_l.append(w)
    v_l.append(v)
def knapsack(N,W,w_l,v_l):
    if (N==0 or W==0):
        return 0
    elif(w_l[N-1]>W):
        return knapsack(N-1,W,w_l,v_l)
    
    else:
        return max(knapsack(N-1,W,w_l,v_l), v_l[N-1]+knapsack(N-1,W-w_l[N-1],w_l,v_l))
ans = knapsack(N,W,w_l,v_l)
print(ans)

Fixed submission:
import numpy as np
N,W = map(int,input().split())
V_sum = 0
w_l = []
v_l = []
for i in range(N):
    w,v = list(map(int,input().split()))
    V_sum+=v
    w_l.append(w)
    v_l.append(v)
dp = np.full(V_sum+1,W+1)
dp[0] = 0
for i in range(N):
    dp[v_l[i]:] = np.minimum(dp[v_l[i]:],dp[:-v_l[i]]+w_l[i])
for i in range(V_sum,-1,-1):
    if dp[i]<=W:
        print(i)
        break