Buggy python submission (verdict: Time Limit Exceeded):
n, weightMax = map(int, input().split())
itemList = [[0 for _ in range(weightMax+1)] for _ in range(n+1)]

for i in range(n):
    w,v = list(map(int, input().split()))
    for j in reversed(range(weightMax+1)):
        if j-w >= 0:
            itemList[i+1][j] = max([itemList[i][j],itemList[i][j-w] + v])
        else:
            itemList[i+1][j] = itemList[i][j]
print(max(itemList[n]))


Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)
for _ in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        tmp = dp[w - weight] + value
        if dp[w] < tmp:
            dp[w] = tmp

print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for _ in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        tmp = dp[w - weight] + value
        if dp[w] < tmp:
          dp[w] = tmp
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for _ in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for _ in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Runtime Error):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[num][capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Runtime Error):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,w-1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[num][capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,-1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0 for i in range(capacity + 1)]

for _ in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,-1,-1):
        if w - weight >= 0:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = map(int, input().split())
dp = [0 for i in range(capacity + 1)]

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,-1,-1):
        if w - weight >= 0:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = list(map(int, input().split()))
dp = [0 for i in range(capacity + 1)]

for i in range(1, num + 1):
    weight, value = list(map(int, input().split()))
    for w in range(capacity,-1,-1):
        if w - weight >= 0:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = list(map(int, input().split()))
dp = [[0 for i in range(capacity + 1)] for j in range(num + 1)]

for i in range(1, num + 1):
    weight, value = list(map(int, input().split()))
    for w in range(capacity + 1):
        if w - weight >= 0:
            dp[i][w] = max( dp[i-1][w - weight] + value,  dp[i-1][w] )
        else:
            dp[i][w] = dp[i-1][w]
print(dp[num][capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Runtime Error):
num, capacity = list(map(int, input().split()))
dp = [[0 for i in range(capacity + 1)] for j in range(num + 1)]

for i in range(1, num + 1):
    weight, value = list(map(int, input().split())
    for w in range(capacity + 1):
        if w - weight >= 0:
            dp[i][w] = max( dp[i-1][w - weight] + value,  dp[i-1][w] )
        else:
            dp[i][w] = dp[i-1][w]
print(max( dp[num] ))

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = list(map(int, input().split()))
actions = [[0 for i in range(capacity + 1)]]
for i in range(num):
    actions.append(list(map(int, input().split())))

dp = [[0 for i in range(capacity + 1)] for j in range(num + 1)]
for i in range(1, num + 1):
    for w in range(capacity + 1):
        if w - actions[i][0] >= 0:
            dp[i][w] = max( dp[i-1][w - actions[i][0]] + actions[i][1],  dp[i-1][w] )
        else:
            dp[i][w] = dp[i-1][w]
print(dp[num][capacity])

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))

Buggy python submission (verdict: Time Limit Exceeded):
num, capacity = list(map(int, input().split()))
actions = [[0 for i in range(capacity + 1)]]
for i in range(num):
    actions.append(list(map(int, input().split())))

dp = [[0 for i in range(capacity + 1)] for j in range(num + 1)]
for i in range(1, num + 1):
    for w in range(capacity + 1):
        if w - actions[i][0] >= 0:
            dp[i][w] = max( dp[i-1][w - actions[i][0]] + actions[i][1],  dp[i-1][w] )
        else:
            dp[i][w] = dp[i-1][w]
print(max( dp[num] ))

Fixed submission:
def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))