Buggy python submission (verdict: Runtime Error):
#問題D
#これだとタイムアウト
import numpy as np
import warnings
warnings.filterwarnings('ignore')

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

dp = np.array([[0] * (W+1)] * (N+1))
for i in range(1, N+1):
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr[w[i]:] = dp[i-1][:-w[i]] + v[i]
    dp[i] = np.maximum(dp[i-1], tmp_arr)

print(dp[N, W])



Fixed submission:
import numpy as np
import warnings
warnings.filterwarnings('ignore')

Mv = 10 ** 5
Mw = 10 ** 11

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

V = np.max(v)

# dp[i,j]:iまでのアイテムで価値がj以下の時の重さの最小値
dp = np.array([[Mw] * (Mv + 1)] * (N+1))
dp[0][0] = 0
for i in range(1, N+1):
    tmp_arr = np.full(Mv+1, Mw, dtype=int)
    tmp_arr[v[i]:] = dp[i-1][:-v[i]] + w[i]
    dp[i] = np.minimum(dp[i-1], tmp_arr)

print(np.max(np.where(dp[N] <= W, dp[N], 0).nonzero()))

Buggy python submission (verdict: Runtime Error):
#問題D
#これだとタイムアウト
import numpy as np
import warnings
warnings.filterwarnings('ignore')

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

dp = np.array([[0] * (W+1)] * (N+1))
for i in range(1, N+1):
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr[w[i]:] = dp[i-1][:-w[i]] + v[i]
    dp[i] = np.maximum(dp[i-1], tmp_arr)

Fixed submission:
import numpy as np
import warnings
warnings.filterwarnings('ignore')

Mv = 10 ** 5
Mw = 10 ** 11

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

V = np.max(v)

# dp[i,j]:iまでのアイテムで価値がj以下の時の重さの最小値
dp = np.array([[Mw] * (Mv + 1)] * (N+1))
dp[0][0] = 0
for i in range(1, N+1):
    tmp_arr = np.full(Mv+1, Mw, dtype=int)
    tmp_arr[v[i]:] = dp[i-1][:-v[i]] + w[i]
    dp[i] = np.minimum(dp[i-1], tmp_arr)

print(np.max(np.where(dp[N] <= W, dp[N], 0).nonzero()))

Buggy python submission (verdict: Runtime Error):
import warnings
warnings.filterwarnings('ignore')
import numpy as np

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

dp = np.array([[0] * (W+1)] * (N+1))
for i in range(1, N+1):
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr = np.zeros(W + 1, dtype=int)
    tmp_arr[w[i]:] = dp[i-1][:-w[i]] + v[i]
    dp[i] = np.maximum(dp[i-1], tmp_arr)

print(dp[N, W])



Fixed submission:
import numpy as np
import warnings
warnings.filterwarnings('ignore')

Mv = 10 ** 5
Mw = 10 ** 11

N, W = list(map(int, input().split()))
w = np.array([0] * (N+1))
v = np.array([0] * (N+1))
for i in range(N):
    w[i+1], v[i+1] = map(int, input().split())

V = np.max(v)

# dp[i,j]:iまでのアイテムで価値がj以下の時の重さの最小値
dp = np.array([[Mw] * (Mv + 1)] * (N+1))
dp[0][0] = 0
for i in range(1, N+1):
    tmp_arr = np.full(Mv+1, Mw, dtype=int)
    tmp_arr[v[i]:] = dp[i-1][:-v[i]] + w[i]
    dp[i] = np.minimum(dp[i-1], tmp_arr)

print(np.max(np.where(dp[N] <= W, dp[N], 0).nonzero()))