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


Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

Buggy python submission (verdict: Runtime Error):
xy = [] # (x, y) の配列
for _ in range(n):
    xy.append(tuple(map(float, input().split())))

# g[i][j] := the distance between i and j
g = [[math.sqrt((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) for j in range(n)] for i in range(n)]
t = 0
change = 0

def score(a): # aのスコアを計算する。aは目的地を辿る順に並べた長さnの配列
    s = 0.0
    for i in range(n):
        s += g[a[i]][a[(i + 1) % n]]
    return s

def gen_neighbor(a):#　ランダムに i,j を選んでスワップ
    i = random.randrange(n)
    j = random.randrange(n)
    b = a.copy()
    b[i], b[(i + j) % n] = a[(i + j) % n], a[i]
    return b

start_time = time.time()
a = list(range(n)) # 初期解 a=[0,1,...,n-1]
maxscore = 100000
for i in range(10):
    while time.time() - start_time < (i + 1) * 0.5:
        # 5秒まで0.5秒ずつ山登りした中で最も良い解を採用
        b = gen_neighbor(a)
        if score(a) > score(b): # aより良い解なら採用
            a = b
    if maxscore > score(a):
        a1 = a.copy()
    random.shuffle(a)
while time.time() - start_time < 10: # 10秒まで山登り
    b = gen_neighbor(a1)
    if score(a1) > score(b): # aより良い解なら採用
        a1 = b
print(score(a1))
print(" ".join(map(str, a1)))


Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

Buggy python submission (verdict: Runtime Error):
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(n)]
minw = min(wv)[0]
l = [0] * (n + 1)
for i in range(n + 1):
    l[i] = [0] * (w - minw + 1)


Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

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

Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

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

Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

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


Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

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


Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

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

Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)

Fixed submission:
n, w = map(int, input().split())
l1 = [list(map(int, input().split())) for i in range(n)]
v = 0
for i in range(n):
  v += l1[i][1]
d = [10 ** 9 + 1] * (v + 1)
d[0] = 0
for i in range(n):
    for j in range(v, -1, -1):
        d[j] = min(d[j], d[j - l1[i][1]] + l1[i][0])
answer = 0
for j in range(v + 1):
    if  w >= d[j]:
        answer = max(answer, j)
print(answer)