Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [{} for i in range(N + 1)]
def cal(i, w):
  if w in M[i]:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**11)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [{} for i in range(N + 1)]
def cal(i, w):
  if w in M[i]:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Buggy python submission (verdict: Runtime Error):
N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [[-1] * (WW + 1) for i in range(N + 1)]
def cal(i, w):
  if M[i][w] >= 0:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N, WW = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(N)]
W, V = zip(*l)
M = [{} for i in range(N + 1)]
def cal(i, w):
  if w in M[i]:
    return M[i][w]
  if i == N:
    v = 0
  elif w < W[i]:
    v = cal(i + 1, w)
  else:
    v = max(cal(i + 1, w), cal(i + 1, w - W[i]) + V[i])
  M[i][w] = v
  return v

print(cal(0, WW))
Buggy python submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	min1 = min(a,b)
	min2 = min(c,d)
	print(min1+min2)

if __name__ == '__main__':
	main()

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

print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	min1 = min(a,b)
	min2 = min(c,d)
	print(min1+min2)

if __name__ == '__main__':
	main()

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

print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
def main():
	data = list(map(int,input().split()))
	a = data[0]
	b = data[1]
	c = data[2]
	d = data[3]
	print(min(a,b)+min(c,d))

if __name__ == '__main__':
	main()

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

print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
data = list(map(int(),input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]
 
print(min(a,b)+min(c,d))

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

print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]

print(min(a,b)+min(c,d))

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

print(min(a,b)+min(c,d))

Buggy python submission (verdict: Runtime Error):
data = list(map(int,input().split()))
a = data[0]
b = data[1]
c = data[2]
d = data[3]

print(min(a,b)+min(c,d))

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

print(min(a,b)+min(c,d))
Buggy python submission (verdict: Runtime Error):
n,m=input().split("  ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)


Fixed submission:
n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()

Buggy python submission (verdict: Runtime Error):
m=int(input())
n=int(input())
multi=(m*n)-(m+n)+1
print(multi)
print()

Fixed submission:
n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()

Buggy python submission (verdict: Runtime Error):
m=int(input("縦の長さ:"))
n=int(input("横の長さ:"))
multi=(m-1)*(n-1)
print(multi)
print()

Fixed submission:
n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()

Buggy python submission (verdict: Runtime Error):
m=int(input("縦の長さ:"))
n=int(input("横の長さ:"))
multi=(m-1)*(n-1)
print(multi)


Fixed submission:
n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

cnt = 0


for i in range(N):
    now = 0
    for j in A[i:]:
        now += j
        if now == 0:
            cnt += 1

print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

cnt = 0

DP = [0] * (N + 1)

for i in range(N):
    DP[i + 1] = DP [i] + A[i]

dic = {}

for i in DP:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for i in dic.values():
    cnt += (i * (i - 1)) // 2

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

count = 0
saw = []
now = 1

while now not in saw:
    count += 1
    saw.append(now)
    now = a[now - 1]
    if now == 2:
        print(count)
        sys.exit()

print(-1)


Fixed submission:
import sys

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

count = 0
now = 1

while count < N:
    count += 1
    now = a[now - 1]
    if now == 2:
        print(count)
        sys.exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import math

N, M = map(int, input().split())

if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 1:
    print(math.factorial(N) * math.factorial(M))
else:
    print((math.factorial(N) ** 2 * 2) % (10 ** 9 + 7))


Fixed submission:
import math

N, M = map(int, input().split())

if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 1:
    print((math.factorial(N) * math.factorial(M)) % (10 ** 9 + 7))
else:
    print((math.factorial(N) ** 2 * 2) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

output = ''

start = 0
end = 0
for i in S:
    if i == '(':
        if end > 0:
            output = '(' * end + output
            output += ')' * end
            end = 0
            start += 1
            output += i
        else:
            start += 1
            output += i
    else:
        if start > 0:
            start -= 1
            output += i
        else:
            end += 1

for i in range(start):
    output += ')'

for i in range(end):
    output += ')'

output = '(' * end + output

print(output)


Fixed submission:
r, g, b = map(int, input().split())

if (g * 10 + b) % 4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
x = 0

max = 0
for i in range(N):
    if S[i] == ‘I’:
        x += 1
    else:
        x -= 1
    if x > max:
        max = x

print(max)


Fixed submission:
N = int(input())
S = input()
x = 0
 
max = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    if x > max:
        max = x
 
print(max)
Buggy python submission (verdict: Time Limit Exceeded):
N, x = map(int, input().split())
a = list(map(int, input().split()))

diff = [a[i] + a[i+1] for i in range(N-1)]

counter = 0

for i in range(N-2):
    while diff[i] > x:
        counter += 1
        diff[i] -= 1
        diff[i+1] -= 1
if diff[N-2] > x:
    counter += diff[N-2] - x

print(counter)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))

a += [0]
counter = 0

for i in range(N-1):
    flow = a[i] + a[i+1] - x
    if flow > 0:
        counter += flow
        a[i+1] = max(a[i+1]-flow, 0)

print(counter)
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i range(10):
    num = n % i
    if num != 0:
        print('No')
else:
    print('Yes')


Fixed submission:
n = int(input())
for i in range(1, 10):
    if n % i ==0 and n/i <10:
        print('Yes')
        break
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n):
    for j in range(n):
        if(a[j] == i + 1):
            ans.append(j+1)
for i in ans:
    print(i, end=' ')


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
    ans[a[i] - 1] = i + 1
for i in ans:
    print(i, end=' ')
Buggy python submission (verdict: Runtime Error):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):

    p[a - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')

Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):
    p[a[i] - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
'''
p = []
for i in range(n):
    p.append(k)
for i in range(q):
    for j in range(n):
        if(j + 1 == a[i]):
            pass
        else:
            p[j] = p[j] - 1
#print(p)
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')
'''
for i in range(q):
    for j in range(n):
        if(j + 1 == a[i]):
            p[j] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):
    p[a[i] - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = []
for i in range(n):
    p.append(k)
for i in range(q):
    for j in range(n):
        if(j + 1 == a[i]):
            pass
        else:
            p[j] = p[j] - 1
#print(p)
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')


Fixed submission:
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k - q] * n
for i in range(q):
    p[a[i] - 1] += 1
for i in range(n):
    if(p[i] > 0):
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)


Fixed submission:
s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().sprit()))
t = list(map(int, input().sprit()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)


Fixed submission:
s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)


Fixed submission:
s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 0
print(ans)


Fixed submission:
s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
ans = 1
cnt = a;
while True:
  	if ans == 21:
        break
    if cnt >= b:
        break
    cnt += a-1
    ans += 1
print(ans)


Fixed submission:
a, b = list(map(int, input().split()))
ans = 0
cnt = 1;
while cnt < b:
    cnt += a-1
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
for i in range(n-1):
    if i==0:
        print(max(a[1:]))
    else:
        max1 = max(a[:i])
        max2 = max(a[i+1:])
        print(max(max1, max2))
print(max(a[:n]))


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for i in range(n)]
for i in range(n-1):
    if i==0:
        print(max(a[1:]))
    else:
        max1 = max(a[:i])
        max2 = max(a[i+1:])
        print(max(max1, max2))
print(max(a[:n]))


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for i in range(n)]
'''
for i in range(n):
    tmp = a[i]
    a.pop(i)
    print(max(a))
    a.insert(i, tmp)
'''
for i in range(n-1):
    if i==0:
        print(max(a[1:]))
    else:
        max1 = max(a[:i])
        max2 = max(a[i+1:])
        print(max(max1, max2))
print(max(a[:n]))


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [input() for i in range(n)]
for i in range(n):
    tmp = a[i]
    a.pop(i)
    print(max(a))
    a.insert(i, tmp)


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-1])
Buggy python submission (verdict: Runtime Error):
a,b=list(map(int,raw_input().split(' ')))
if(a>=1 and a<=9 and b>=1 and b<=9):
  print(a*b)
else:
  print(-1)

Fixed submission:
a,b=list(map(int,input().split(' ')))
if(a>=1 and a<=9 and b>=1 and b<=9):
  print(a*b)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
import math.sqrt as sqrt
n=int(input())
ans=1+n
if(n%2==0):
  ans=2+int(n/2)
  
for i in range(3,int(sqrt(n))+1,2):
  if(n%i==0):
    ans=min(ans,(i+int(n/i)))
print(ans)


Fixed submission:
n=int(input())
ans=n-1
e=int(n**(1/2))+1
for i in range(2,e):
  if(n%i==0):
    ans=min(ans,i+int(n/i)-2)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=1+n
if(n%2==0):
  ans=2+int(n/2)
  
for i in range(3,int(sqrt(n))+1,2):
  if(n%i==0):
    ans=min(ans,(i+int(n/i)))
print(ans)

Fixed submission:
n=int(input())
ans=n-1
e=int(n**(1/2))+1
for i in range(2,e):
  if(n%i==0):
    ans=min(ans,i+int(n/i)-2)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input(),split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
else:
  print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input(),split())
if 1<=A<=9:
        if 1<=B<=9:
        print(A*B)
else print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
a=A
b=B
if 1<=a<=9:
  if 1<=b<=9:
    print(a*b)
else:
  print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
if 1<=A<=9:
  if 1<=B<=9:
    print(A*B)
else:
  print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
if 1<=A<=9:
  if 1<=B<=9:
    print(A*B)
  elif 10<=B<=20:
    print(-1)
elif 10<=A<=20:
  print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
if 1<=A<=9:
  if 1<=B<=9:
    C=A*B
    print(C)
  else print(-1)
else print(-1)

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)

Buggy python submission (verdict: Runtime Error):
ygfgfuh

Fixed submission:
A,B=map(int,input().split())
if 1<=A<=9:
        if 1<=B<=9:
            print(A*B)
        else:
            print(-1)
else: print(-1)
Buggy python submission (verdict: Runtime Error):
N=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)

Fixed submission:
N=int(input())
d=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)
Buggy python submission (verdict: Runtime Error):
input(S)
if S=Sunny:
  print('Cloudy')
elif S=Cloudy:
  print('Rainy')
elif S=Rainy:
  print('Sunny')

Fixed submission:
S=input()
if S=='Sunny':
    print('Cloudy')
elif S=='Cloudy':
    print('Rainy')
elif S=='Rainy':
    print('Sunny')
Buggy python submission (verdict: Runtime Error):
N=input()
print(N*N*N)

Fixed submission:
N=int(input())
print(N*N*N)
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a=>3200:
  print(s)
else:
  print('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')

Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a=>3200:
  print('s')
else:
  print('red')

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
n = int(input())
r = int(n**0.5)
revList = [i for i in range(r)]
revList = revList[1:]
revList.reverse()

for i in revList:
  if n % i == 0:
    res = int(n/i) + i - 2
    break
print(res)


Fixed submission:
n = int(input())
r = int(n**0.5)
revList = [i for i in range(r+1)]
revList = revList[1:]
revList.reverse()

for i in revList:
  if n % i == 0:
    res = int(n/i) + i - 2
    break
print(res)
Buggy python submission (verdict: Runtime Error):
def func():
    a = int(input())
    for i in range(1, 10):
        for n in range(1, 10):
            if a == i * n:
                print("Yes")
                return
    print("No")
 
 
func()

Fixed submission:
a, b = [int(i) for i in input().split(" ")]

if (a < 10 and a > 0) and (b < 10 and b > 0):
    print(a * b)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split())) # 消化コスト
F = list(map(int, input().split())) # 食べにくさ
 
import math
import numpy as np
 
A.sort(reverse = True)
F.sort()
 
arrA = np.array(A)
arrF = np.array(F)
 
range_max = max(arrA * arrF) + 1
range_min = max(min((A-K) * B), 0)
 
my_lambda = lambda x: sum([max(math.ceil(A[i] - x/F[i]), 0) for i in range(0, N)]) <= K
 
my_range = range(range_min, range_max)
 
def node(lst):
    len_lst = len(lst)
    if len_lst % 2 == 0:
        mid_idx = int(len_lst/2)
    else:
        mid_idx = int(math.floor(len_lst/2))
 
    if len_lst == 1:
        print(lst[mid_idx])
        return()
 
    if my_lambda(lst[mid_idx-1]) == True:
        left = lst[0:mid_idx]
        node(left)
    else:
        right = lst[mid_idx:]
        node(right)
node(my_range)

Fixed submission:
A, B = map(int, input().split())

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split())) # 消化コスト
F = list(map(int, input().split())) # 食べにくさ
 
import math
import numpy
 
A.sort(reverse = True)
F.sort()

arrA = np.array(A)
arrF = np.array(F)

range_max = max(arrA * arrF) + 1
range_min = max(min((A-K) * B), 0)
 
my_lambda = lambda x: sum([max(math.ceil(A[i] - x/F[i]), 0) for i in range(0, N)]) <= K
 
my_range = range(range_min, range_max)
 
def node(lst):
    len_lst = len(lst)
    if len_lst % 2 == 0:
        mid_idx = int(len_lst/2)
    else:
        mid_idx = int(math.floor(len_lst/2))
 
    if len_lst == 1:
        print(lst[mid_idx])
        return()
 
    if my_lambda(lst[mid_idx-1]) == True:
        left = lst[0:mid_idx]
        node(left)
    else:
        right = lst[mid_idx:]
        node(right)
node(my_range)

Fixed submission:
A, B = map(int, input().split())

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = input()
N_sqrt = int(np.sqrt(N))+1
N_ = [i for i in range(2, N_sqrt) if N % i == 0]

if len(N_) == 0:
    print(N-1)
else:
    pair = [(i, int(N/i)) for i in N_]
    my_lambda = lambda x : sum(x)
    x = list(map(my_lambda, pair))
    print(min(x)-2)

Fixed submission:
import numpy as np

N = int(input())
N_sqrt = int(np.sqrt(N))+1
N_ = [i for i in range(2, N_sqrt) if N % i == 0]

if len(N_) == 0:
    print(N-1)
else:
    pair = [(i, int(N/i)) for i in N_]
    my_lambda = lambda x : sum(x)
    x = list(map(my_lambda, pair))
    print(min(x)-2)
Buggy python submission (verdict: Runtime Error):
### D - Triangles ###

N = int(input())
L = list(map(int, input().split()))

# N = 7
# L = [218, 786, 704, 233, 645, 728, 389]

L.sort()

from itertools import combinations

cb = combinations(L, 2)
cb = list(map(sorted, cb))

rslt = 0

for el_cb in cb:
    for v in L:
        if el_cb[1] - el_cb[0] <= v and el_cb[0] >= v:
            rslt = rslt + 1

# if のところに2分探索入れる

print(rslt)

Fixed submission:
### A - Curtain ###
A, B = map(int, input().split())
print(A-B*2 if A-B*2 > 0 else 0)

Buggy python submission (verdict: Runtime Error):
from multiprocessing import Pool

### D - Triangles ###
 
N = int(input())
L = list(map(int, input().split()))
 
from itertools import combinations
 
cb = combinations(L, 3)
 
def my_def(x):
    if x[1] + x[2] > x[0]:
        if x[0] + x[2] > x[1]:
            if x[0] + x[1] > x[2]:
                return(1)
    return(0)
 
print(sum(list(map(my_def, cb))))

Fixed submission:
### A - Curtain ###
A, B = map(int, input().split())
print(A-B*2 if A-B*2 > 0 else 0)

Buggy python submission (verdict: Runtime Error):
### D - Triangles ###

N = int(input())
L = list(map(int, input().split()))

# N = 7
# L = [218, 786, 704, 233, 645, 728, 389]

from itertools import combinations

cb = list(combinations(L, 3))

my_lambda = lambda x : x[0] + x[1] > x[2] and x[1] + x[2] > x[0] and x[0] + x[2] > x[1]

print(sum(
        list(
            map(my_lambda, cb)
        )
    )
)

Fixed submission:
### A - Curtain ###
A, B = map(int, input().split())
print(A-B*2 if A-B*2 > 0 else 0)