Buggy python submission (verdict: Runtime Error):
import numpy as np
def main():
    N,W=map(int,input().split())
    dp=np.zeros((N+1,W+1),dtype=int)
    for i in range(1,N+1):
        w,v=map(int,input().split())
        dp[i][w:]=np.maximum(dp[i-1][w:],dp[i-1][:-w]+v)
        dp[i][:w]=dp[i-1][:w]
    print(max(dp))
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    N,W=map(int,input().split())
    dp=np.zeros((N+1,W+1),dtype=int)
    for i in range(1,N+1):
        w,v=map(int,input().split())
        for j in range(W+1):
            if w<=j:
                can1=max(dp[i-1][k] for k in range(j-w+1))
                can2=max(dp[i-1][k] for k in range(j-w+1,j+1))
                dp[i][j]=max(can1+v,can2)
            else:
                dp[i][j]=dp[i-1][j]
    print(dp[N][W])
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,W=map(int,input().split())
    dp=[0]*(W+1)
    for _ in range(1,N+1):
        w,v=map(int,input().split())
        for i in range(w,W+1)[::-1]:
            can1=dp[i-w]+v
            can2=dp[i]
            dp[i]=max(can1,can2)
    print(max(dp))
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,W=map(int,input().split())
    dp=[0]*(W+1)
    for _ in range(1,N+1):
        w,v=map(int,input().split())
        for i in range(W+1)[::-1]:
            if w<=i:
                can1=dp[i-w]+v
                can2=dp[i]
                dp[i]=max(can1,can2)
            else:
                break
    print(max(dp))
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,W=map(int,input().split())
    dp=[0]*(W+1)
    for _ in range(1,N+1):
        w,v=map(int,input().split())
        for i in range(W+1)[::-1]:
            if w<=i:
                can1=dp[i-w]+v
                can2=max(dp[j] for j in range(i-w+1,i+1))
                dp[i]=max(can1,can2)
            else:
                break
    print(max(dp))
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,W=map(int,input().split())
    dp=[0]*(W+1)
    for _ in range(1,N+1):
        w,v=map(int,input().split())
        for i in range(W+1)[::-1]:
            if w<=i:
                can1=max(dp[j] for j in range(i-w+1))
                can2=max(dp[j] for j in range(i-w+1,i+1))
                dp[i]=max(can1+v,can2)
            else:
                break
    print(dp[-1])
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,W=map(int,input().split())
    dp=[[0]*(W+1) for _ in range(N+1)]
    for i in range(1,N+1):
        w,v=map(int,input().split())
        for j in range(W+1):
            if w<=j:
                can1=max(dp[i-1][k] for k in range(j-w+1))
                can2=max(dp[i-1][k] for k in range(j-w+1,j+1))
                dp[i][j]=max(can1+v,can2)
            else:
                dp[i][j]=dp[i-1][j]
    print(dp[N][W])
main()

Fixed submission:
import numpy as np
N,W=map(int,input().split())
dp=np.zeros(W+1,dtype=int)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=np.maximum(dp[w:],dp[:-w]+v)
print(dp[-1])