Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
S = list(str(input()))
S.sort()
Q = "abcdefghijklmnopqrstuvwxyz"
#print (S)

index = 0
if S[0] == Q[0] :
  index += 1
else :
  print ("a")
  exit()

for i in range(1, len(S)) :
  if S[i] == Q[index] :
    index += 1
  else :
    if S[i] == S[i-1] :
      continue
    print (Q[index])
    exit()

if index != 26 :
  print (Q[index])
else :
  print ("None")
    
    
    




Fixed submission:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
S = list(str(input()))
S.sort()
Q = "abcdefghijklmnopqrstuvwxyz"
#print (S)

index = 0
if S[0] == Q[0] :
  index += 1
else :
  print ("a")
  exit()

for i in range(1, len(S)) :
  if index == 26 :
    print ("None")
    exit()
  
  if S[i] == Q[index] :
    index += 1
  else :
    if S[i] == S[i-1] :
      continue
    print (Q[index])
    exit()


if index != 26 :
  print (Q[index])
else :
  print ("None")
Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()

print(list[int(val)])

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()
vala = int(val) - 1
print(list[vala])

Buggy python submission (verdict: Runtime Error):
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()

print(list[int(val)])

Fixed submission:
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

val = input()
vala = int(val) - 1
print(list[vala])

Buggy python submission (verdict: Runtime Error):
import sys
args = sys.argv

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[int(args[1]) - 1])

Fixed submission:
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[int(input()) - 1])
Buggy python submission (verdict: Runtime Error):
src = int(input())
if src % 2 == 0:
    print('Odd')
else:
    print('Even')


Fixed submission:
src = input()
vals = src.split(' ')
if int(vals[0]) * int(vals[1]) % 2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]

cnt = 0

for i, item in enumerate(s):
    s[i] = ''.join(sorted(s[i]))

visited = []
for i in range(0, n):
    for j in range(i+1, n):
        if s[i] == s[j] and (i, j) not in visited:
            visited.append((i, j))
            visited.append((j, i))
            cnt += 1
print(cnt)

Fixed submission:
import math
n = int(input())
s = [input() for _ in range(n)]

cnt = 0

for i, item in enumerate(s):
    s[i] = ''.join(sorted(s[i]))
s = sorted(s)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


cnt2 = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        if cnt2 == 0:
            cnt2 += 2
        else:
            cnt2 += 1
    else:
        if cnt2 != 0:
            f = combinations_count(cnt2, 2)
            cnt += f
            cnt2 = 0

if cnt2 != 0:
    f = combinations_count(cnt2, 2)
    cnt += f
    cnt2 = 0
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
d = sorted(d)

banken = 1
for item in d:
    if len(d[:banken]) == len(d[banken:]):
        break
    if banken >= len(d):
        break
    banken += 1

print(d[banken] - d[banken-1])


Fixed submission:
n = int(input())
d = list(map(int, input().split()))
d = sorted(d)

banken = len(d) // 2
print(d[banken] - d[banken-1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a >== 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)

Fixed submission:
a, b = map(int, input().split())
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(int(b/2))
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

import numpy as np

rets = np.array([0] * n)
ls = []
rs = []
for _ in range(m):
  l, r = map(int, input().split())
  ret = np.array([0] * n)
  ret[l-1:r] = 1
  rets += ret
cnt = 0
for i in range(n):
  if rets[i] == m:
    cnt += 1
print(cnt)




Fixed submission:
n, m = map(int, input().split())

import numpy as np

rets = np.array([0] * n)
lmax = 1
rmin = n
for _ in range(m):
  l, r = map(int, input().split())
  lmax = max(l, lmax)
  rmin = min(r, rmin)
print(rmin - lmax + 1 if rmin - lmax + 1 > 0 else 0)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

rets = [1] * n
ls = []
rs = []
for _ in range(m):
  l, r = map(int, input().split())
  for i in range(n):
    if i < l-1 or i > r-1:
      rets[i] = 0
print(sum(rets))




Fixed submission:
n, m = map(int, input().split())

import numpy as np

rets = np.array([0] * n)
lmax = 1
rmin = n
for _ in range(m):
  l, r = map(int, input().split())
  lmax = max(l, lmax)
  rmin = min(r, rmin)
print(rmin - lmax + 1 if rmin - lmax + 1 > 0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

items = [a, b, c, d, e]
pps = [0] * 5
pps[0] = n
time = 0
flg = True
while flg:
    carry = 0
    for i, (item, pp) in enumerate(zip(items, pps)):
        pp_bef = pp
        num = pp - item
        if num < 0:
            num = 0
        pps[i] = num + carry
        pp_aft = num
        carry = pp_bef - pp_aft
    time += 1
    if pps == [0] * 5:
        flg = False
print(time)


Fixed submission:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

import math
items = [a, b, c, d, e]
min_item = min(items)
min_idx = items.index(min_item)
n_times = math.ceil(n / min_item)
print(len(items) + n_times - 1)
Buggy python submission (verdict: Runtime Error):

a, b, k = map(int, input().split())
for i in range(1, max(a, b)):
    if a % i == 0 and b % i == 0:
        counter += 1
        ret = i
        if counter == k:
            break

# 出力
print("{}".format(int(ret)))

Fixed submission:
a, b, k = map(int, input().split())
counter = 0
for i in range(100, 0, -1):
    if a % i == 0 and b % i == 0:
        counter += 1
        if counter == k:
            print("{}".format(int(i)))
            break
Buggy python submission (verdict: Time Limit Exceeded):

# -*- coding: utf-8 -*-
# 整数の入力
# a = int(input())
s = input()
# s = '11011010001011'
# スペース区切りの整数の入力
# a, b, k = map(int, input().split())

counter = 0
while s.find('01') != -1 or s.find('10') != -1:
    if s.find('01') != -1:
        s = s.replace('01', '', 1)
        counter += 2
    if s.find('10') != -1:
        s = s.replace('10', '', 1)
        counter += 2

# 出力
print("{}".format(int(counter)))

Fixed submission:
s = input()
counter = 0
length = len(s)
count0 = s.count('0')
count1 = s.count('1')

print("{}".format(int(length - abs(count0 - count1))))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

a = []
b = []
for _ in range(n):
    ta, tb = map(int, input().split())
    a.append(ta)
    b.append(tb)

ret = []
tb = 0
i = 0
for i in range(n):
    ret.extend([a[i]] * b[i])

ret = sorted(ret)
print(ret[k-1])

Fixed submission:
n, k = map(int, input().split())

items = dict()
for _ in range(n):
    ta, tb = map(int, input().split())
    if ta in items.keys():
        items[ta] += tb
    else:
        items[ta] = tb

items = sorted(items.items())

tb = 0
key = 0
for key, val in items:
    tb += val
    if tb >= k:
        break
print(key)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")


Fixed submission:
# coding: utf-8
import numpy as np

a,b,c = map(int,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if a*a+b*b+c*c-2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")


Fixed submission:
# coding: utf-8
import numpy as np

a,b,c = map(int,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
if -2*a*b-2*b*c-2*a*c>0:
    print("Yes")
else:
    print("No")


Fixed submission:
# coding: utf-8
import numpy as np

a,b,c = map(int,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np

a,b,c = map(long,input().split())

# print(a,b,c)



if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
    print("Yes")
else:
    print("No")


Fixed submission:
# coding: utf-8
import numpy as np

a,b,c = map(int,input().split())

# print(a,b,c)
# if np.sqrt(a)+np.sqrt(b)<np.sqrt(c):
#     print("Yes")
# else:
#     print("No")
d = c-a-b
if d>0 and 4*a*b<d*d :
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc098/tasks/arc098_a

n = int(input())
def process(x):
    if x=='E':
        return 0
    else:
        return 1
data = list(map(process, list(input())))

cumul = [0 for _ in range(n)]
for i in range(n):
    cumul[i] = data[:i+1].count(0)
cumul.insert(0, 0)

costs = [0 for _ in range(n)]
for i in range(n):
    cost = 0
    cost += i-cumul[i]
    cost += cumul[n]-cumul[i+1]
    costs[i] = cost

print(min(costs))


Fixed submission:
#https://atcoder.jp/contests/abc098/tasks/arc098_a

n = int(input())
d = input()

pre = d[1:].count('E')
minimum = pre
for i in range(1,n):
    if d[i-1]=='W':
        pre = pre+1
    if d[i]=='E':
        pre = pre-1
    minimum = min(pre, minimum)

print(minimum)

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc098/tasks/arc098_a

n = int(input())
def process(x):
    if x=='E':
        return 0
    else:
        return 1
data = list(map(process, list(input())))

l = [0 for _ in range(n-1)]
for i in range(n-1):
    t = 0
    if data[i]==1:
        t += 1
    if data[i+1]==0:
        t -= 1
    l[i] = t

def default():
    cost = 0
    for value in data[1:]:
        if value == 0:
            cost += 1
    return cost
d = default()

if min([sum(l[:j+1]) for j in range(n-1)]) < 0:
    print(d + min([sum(l[:j+1]) for j in range(n-1)]))
else:
    print(d)


Fixed submission:
#https://atcoder.jp/contests/abc098/tasks/arc098_a

n = int(input())
d = input()

pre = d[1:].count('E')
minimum = pre
for i in range(1,n):
    if d[i-1]=='W':
        pre = pre+1
    if d[i]=='E':
        pre = pre-1
    minimum = min(pre, minimum)

print(minimum)
Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc093/tasks/arc094_a

a, b, c = map(int, input().split())

diff = 3*max(a, b, c) - (a + b + c)

if diff%2 == 1:
    print(diff//2+2)
else:
    pritn(diff//2)


Fixed submission:
#https://atcoder.jp/contests/abc093/tasks/arc094_a

import numpy
data = list(map(int, input().split()))
cost = 0

max_index = numpy.argmax(data)
m = data.pop(max_index)
if abs(data[0]-data[1])%2 == 1:
    cost += 2
cost += (abs(data[0]-data[1])//2 + m - max(data))
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc072/tasks/arc082_a

from functools import reduce
n = int(input())
l = list(map(int, input().split()))

def get_process(arg):
    def process(accumulator, currentValue):
        if currentValue == arg or currentValue+1 == arg or currentValue-1 == arg:
            return accumulator + 1
        else:
            return accumulator
    return process

rl = [0 for _ in range(n)]
for i in range(n):
    for option in range(-1, 2):
        rl[i] = (reduce(get_process(l[i]+option), l, 0))

print(max(rl))


Fixed submission:
#https://atcoder.jp/contests/abc072/tasks/arc082_a

n = int(input())
l = list(map(int, input().split()))
allx = [0 for _ in range(-1, 10**5+1)]

for value in l:
    allx[value+2] += 1
    allx[value+1] += 1
    allx[value] += 1

print(max(allx))

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc072/tasks/arc082_a

from functools import reduce
n = int(input())
l = list(map(int, input().split()))

def get_process(arg):
    def process(accumulator, currentValue):
        if currentValue == arg or currentValue+1 == arg or currentValue-1 == arg:
            return accumulator + 1
        else:
            return accumulator
    return process

def eachX(accumulator, currentValue):
    a = reduce(get_process(currentValue+1), l, 0)
    b = reduce(get_process(currentValue), l, 0)
    c = reduce(get_process(currentValue-1), l, 0)
    if accumulator < max(a, b, c):
        return max(a, b, c)
    else:
        return accumulator

print(reduce(eachX, l, 0))


Fixed submission:
#https://atcoder.jp/contests/abc072/tasks/arc082_a

n = int(input())
l = list(map(int, input().split()))
allx = [0 for _ in range(-1, 10**5+1)]

for value in l:
    allx[value+2] += 1
    allx[value+1] += 1
    allx[value] += 1

print(max(allx))
Buggy python submission (verdict: Runtime Error):
k = input()
z = int(k)
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print (s[z])

Fixed submission:
k = input()
z = int(k)
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print (s[z-1])
Buggy python submission (verdict: Runtime Error):
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizouko) + min(densirenzi)
while zyouken[2] > 0:
    zyouken[2] = zyouken[2] - 1
    waribiki = [int(w) for w in input().split()]
    mink = reizouko[waribiki[0]] + densirenzi[waribiki[1]] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)

Fixed submission:
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizouko) + min(densirenzi)
while zyouken[2] > 0:
    zyouken[2] -= 1 
    waribiki = [int(w) for w in input().split()]
    mink = reizouko[waribiki[0] - 1] + densirenzi[waribiki[1] - 1] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)

Buggy python submission (verdict: Runtime Error):
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizyouko) + min(densirenzi)
while zyouken[2] > 0:
    waribiki = [int(w) for w in input().split()]
    mink = reizyouko[waribiki[0]] + densirenzi[waribiki[1]] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)

Fixed submission:
zyouken = [int(i) for i in input().split()]
reizouko = [int(a) for a in input().split()]
densirenzi = [int(b) for b in input().split()]
minkouho = min(reizouko) + min(densirenzi)
while zyouken[2] > 0:
    zyouken[2] -= 1 
    waribiki = [int(w) for w in input().split()]
    mink = reizouko[waribiki[0] - 1] + densirenzi[waribiki[1] - 1] - waribiki[2]
    if mink < minkouho:
        minkouho = mink
print(minkouho)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
 
if (a*b % 2 == 1):
    print('Odd')
else:
    print(Even)

Fixed submission:
a, b = map(int, input().split())
 
if (a*b % 2 == 1):
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k])

Fixed submission:
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
S = input()
S = S.replace('.', '0').replace('#', '1')
b = np.array(list(S)).astype(np.int)
w = np.ones(N, dtype=np.int) - b

moves = 200000

for i in range(N + 1):
    left = np.sum(b[:i])
    right = np.sum(w[i:])
    moves = np.min([moves, left + right])

print(moves)


Fixed submission:
N = int(input())
S = input()

w = S.count('.')
b = 0

k = w

for i in range(N):
    if S[i] == '.':
        w -= 1
    else:
        b += 1

    k = min(k, w + b)

print(k)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = input()
S = S.replace('.', '0').replace('#', '1')
b = np.array(list(S)).astype(np.int)
w = np.ones(N, dtype=np.int) - b

moves = 200000

for i in range(N + 1):
    left = np.sum(b[:i])
    right = np.sum(w[i:])
    moves = np.min([moves, left + right])

print(moves)


Fixed submission:
N = int(input())
S = input()

w = S.count('.')
b = 0

k = w

for i in range(N):
    if S[i] == '.':
        w -= 1
    else:
        b += 1

    k = min(k, w + b)

print(k)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

moves = 2 * 10 ** 5

for i in range(len(S) + 1):
    left = S[:i]
    right = S[i:]
    moves = min(moves, left.count('#') + right.count('.'))

print(moves)


Fixed submission:
N = int(input())
S = input()

w = S.count('.')
b = 0

k = w

for i in range(N):
    if S[i] == '.':
        w -= 1
    else:
        b += 1

    k = min(k, w + b)

print(k)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
ABC = np.zeros([N, 3])
for i in range(N):
    ABC[i] = list(map(int, input().split()))

dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i+1, 0]
    dp[i+1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i+1, 1]
    dp[i+1, 2] = max(dp[i, 0], dp[i, 1]) + ABC[i+1, 2]

print(int(max(dp[N-1])))

Fixed submission:
import numpy as np
N = int(input())
ABC = np.zeros([N, 3])
for i in range(N):
    ABC[i] = list(map(int, input().split()))

dp = np.zeros([N, 3])
dp[0] = ABC[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i, 1], dp[i, 2]) + ABC[i+1, 0]
    dp[i+1, 1] = max(dp[i, 0], dp[i, 2]) + ABC[i+1, 1]
    dp[i+1, 2] = max(dp[i, 0], dp[i, 1]) + ABC[i+1, 2]

print(int(max(dp[N-1])))
Buggy python submission (verdict: Time Limit Exceeded):
N, WW = map(int, input().split())
W, V = [], []
for _ in range(N):
    _w, _v = list(map(int, input().split()))
    if _w > WW:
        continue
    W.append(_w)
    V.append(_v)

# dp = [[0] * (WW+1) for _ in range(N+1)]
dp = [[0] * (N+1) for _ in range(WW+1)]
for j in range(WW+1):
    # アイテムの数だけ探索する
    for i in range(1, N+1):
        w = W[i-1]
        v = V[i-1]
        if j+w > WW:
            continue
        dp[j+w][i] = max(dp[j+w][i-1], max(dp[j][:i]) + v)

# import numpy as np
# print(np.array(dp))
print(max(dp[WW]))


Fixed submission:
N, WW = map(int, input().split())
W, V = [], []
for _ in range(N):
    _w, _v = list(map(int, input().split()))
    if _w > WW:
        continue
    W.append(_w)
    V.append(_v)

dp = [[0] * (WW+1) for _ in range(N+1)]
for i in range(1, N+1):
    # i := 1...N
    for j in range(1, WW+1):
        # j := 0...WW
        
        wi = W[i-1]
        vi = V[i-1]
        if j-wi < 0:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-wi] + vi)

print(dp[N][WW])
Buggy python submission (verdict: Runtime Error):
https://shirahonoyu.com/#character

Fixed submission:
n, y = map(int, input().split())

found = False
for a in range(n+1):
    for b in range(n-a+1):
        c = n - a - b
        total = 10000 * a + 5000 * b + 1000 * c
        if total == y:
            found = True
            print(a, b, c)
            break
    if found:
        break

if not found:
    print('-1 -1 -1')
Buggy python submission (verdict: Runtime Error):
def d():
    N  = int(input())
    S1 = input()
    S2 = input()
    from collections import deque
    s = deque(S1)
    S = ''
    for _ in range(N):
        try:
            if s[0] == s[1]:
                S += 'Z'
                s.popleft()
                s.popleft()
            else:
                S += 'I'
                s.popleft()
        except:
            break
    res = 6 if S[0] == 'Z' else 3
    for i in range(1, len(S)):
        if S[i-1:i+1] == 'II':
            res *= 2
        if S[i-1:i+1] == 'IZ':
            res *= 2
        if S[i-1:i+1] == 'ZI':
            res *= 1
        if S[i-1:i+1] == 'ZZ':
            res *= 3
    print(res % 1000000007)
    
d()

Fixed submission:
def d():
    N  = int(input())
    S1 = input()
    S2 = input()
    from collections import deque
    s = deque(S1)
    S = ''
    for _ in range(N):
        if len(s) >= 2:
            if s[0] == s[1]:
                S += 'Z'
                s.popleft()
                s.popleft()
            else:
                S += 'I'
                s.popleft()
        elif len(s) == 1:
            S += 'I'
            s.popleft()
        else:
            break
    res = 6 if S[0] == 'Z' else 3
    for i in range(len(S)-1):
        if S[i:i+2] == 'II':
            res *= 2
        if S[i:i+2] == 'IZ':
            res *= 2
        if S[i:i+2] == 'ZI':
            res *= 1
        if S[i:i+2] == 'ZZ':
            res *= 3
    print(res % 1000000007)

d()
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
U = []
for i in range(n):
    U.append(tuple(map(int, input().split())))
sorted(U, key=lambda i: i[0])
# print(U)
for i in U:
    k -= i[1]
    print(i, k)
    if k <= 0:
        print(i[0])
        return

Fixed submission:
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    U = sorted(U, key=lambda i: i[0])
    # print(U)
    for i in U:
        if k <= i[1]:
            print(i[0])
            break
        k -= i[1]
    else:
        print(U[-1][0])
        # if k <= 0:
        #     print(i[0])
        #     break
        # print(i, k)

c()
Buggy python submission (verdict: Runtime Error):
n, t = map(int, input().split())
ti = map(int, input().split())
ttl = t
for i in range(n-1):
    ttl += min(ti[i+1]-ti[i], t)
print(ttl)

Fixed submission:
n, t = map(int, input().split())
ti = list(map(int, input().split()))
ttl = t
for i in range(n-1):
    ttl += min(ti[i+1]-ti[i], t)
print(ttl)