Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
[k,s]=[int(i) for i in input().split()]
a=[]
for i in range(k+1):
    x=i
    for j in range(s-x+1):
        y=s-x-j
        z=s-x-y
        if y<=k and z<=k:
            a.append([x,y,z])
#print(a)
print(len(a))

Fixed submission:
[k,s] = [int(i) for i in input().split()]
count = 0
for x in range(k+1):
  for y in range(min(s-x+1,k+1)):
      if s - x - y <= k:
          count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
[k,s]=[int(i) for i in input().split()]
a=[]
for i in range(k+1):
    x=i
    for j in range(s-x+1):
        y=s-x-j
        z=s-x-y
        if x<=k and y<=k and z<=k:
            a.append([x,y,z])
#print(a)
print(len(a))

Fixed submission:
[k,s] = [int(i) for i in input().split()]
count = 0
for x in range(k+1):
  for y in range(min(s-x+1,k+1)):
      if s - x - y <= k:
          count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
[h,w] = [int(i) for i in input().split()]
s=[]
for i in range(h):
  s=input()

for i in range(h):
  print(s[i])
  print(s[i])


Fixed submission:
[h,w] = [int(i) for i in input().split()]
s=[]
for i in range(h):
  s.append(input())

for i in range(h):
  print(s[i])
  print(s[i])
Buggy python submission (verdict: Runtime Error):
[n,k]=[int(i) for i in input().split()]
a=k
if n==1:
    print(k)
else:
    for i in range(n-1):
        a=a*(k-1)
    print(a)


Fixed submission:
t=[int(i) for i in input().split()]
t.sort()
#print(t)
a=1
for j in range(1,len(t)):
    if t[j-1]<t[j]:
        a=a+1
print(a)
Buggy python submission (verdict: Runtime Error):
[a,b,c] == [int(i) for i in input().split()]

if (a * b * c) % 2 == 0:
    print(0)
else:
    print(min(a * b,b * c,c * a))


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

if (a * b * c) % 2 == 0:
    print(0)
else:
    print(min(a * b,b * c,c * a))
Buggy python submission (verdict: Runtime Error):
s=[int(i) for i in input.split()]
if len(s)==3 and s.count("5")==2 and s.count("7")==1:
    print("YES")
else:
    print("NO")


Fixed submission:
s=[int(i) for i in input().split()]
#print(s,len(s))
if len(s)==3 and s.count(5)==2 and s.count(7)==1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(i) for i in input().split()]
a = 0
for i in len(l):
    if i % 2 == 0:
        a = a + l[i]
print(a)


Fixed submission:
n = int(input())
l = [int(i) for i in input().split()]
a = 0
l.sort()
for i in range(len(l)):
    if i % 2 == 0:
        a = a + l[i]
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
"""
def f(char, start, end):
    global rgb
    return rgb[char][end] - rgb[char][start]

rgb = {'R':[0]*(n+1), 'G':[0]*(n+1), 'B':[0]*(n+1)}
for i in range(1, n+1):
    j = s[i-1]
    rgb['R'][i] = rgb['R'][i-1] + (j=='R')
    rgb['G'][i] = rgb['G'][i-1] + (j=='G')
    rgb['B'][i] = rgb['B'][i-1] + (j=='B')

print(rgb['R'])
print(rgb['G'])
print(rgb['B'])

print(f('R', 0,0) )
print(f('R', 0,1) )
print(f('R', 0,2) )
print(f('R', 0,3) )
print(rgb['R'][-1] * rgb['G'][-1] * rgb['B'][-1])
ans = rgb['R'][-1] * rgb['G'][-1] * rgb['B'][-1]
"""
rgb = {'R':0, 'G':0,'B':0}
for i in range(1, n+1):
    j = s[i-1]
    rgb[j] += 1
ans = rgb['R'] * rgb['G'] * rgb['B']
for j in range(1, n):
    for i in range(j):
        if j-i>(n-1)-j: continue
        if s[j]!=s[i] and s[j+(j-i)]!=s[j] and s[j+(j-i)]!=s[i] :
            ans -= 1

print(ans)


Fixed submission:
n = int(input())
s = input()
"""
def f(char, start, end):
    global rgb
    return rgb[char][end] - rgb[char][start]

rgb = {'R':[0]*(n+1), 'G':[0]*(n+1), 'B':[0]*(n+1)}
for i in range(1, n+1):
    j = s[i-1]
    rgb['R'][i] = rgb['R'][i-1] + (j=='R')
    rgb['G'][i] = rgb['G'][i-1] + (j=='G')
    rgb['B'][i] = rgb['B'][i-1] + (j=='B')

print(rgb['R'])
print(rgb['G'])
print(rgb['B'])

print(f('R', 0,0) )
print(f('R', 0,1) )
print(f('R', 0,2) )
print(f('R', 0,3) )
print(rgb['R'][-1] * rgb['G'][-1] * rgb['B'][-1])
ans = rgb['R'][-1] * rgb['G'][-1] * rgb['B'][-1]
"""
rgb = {'R':0, 'G':0,'B':0}
for i in range(1, n+1):
    j = s[i-1]
    rgb[j] += 1
ans = rgb['R'] * rgb['G'] * rgb['B']
for j in range(1, n):
    for i in range(j):
        if j-i>(n-1)-j: continue
        if s[j]!=s[i] and s[j+(j-i)]!=s[j] and s[j+(j-i)]!=s[i] :
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
quer = [input().split() for _ in range(Q)]

hanten = 0
t = 0
for i in quer:
    quary = i
    if quary[0]=='1':
        #S = S[::-1]
        hanten = hanten ^ 1
    else:
        t = (int(quary[1])-1) ^ hanten
        if t:
            S = S + quary[2]
        else:
            S = quary[2] + S
    #print(S)
if hanten:
    S = S[::-1]
print(S)

Fixed submission:
from collections import deque
S = input()
Q = int(input())
quer = [input().split() for _ in range(Q)]

hanten = 0
t = 0
d = deque(S)
for i in quer:
    quary = i
    if quary[0]=='1':
        #S = S[::-1]
        hanten = hanten ^ 1
    else:
        t = (int(quary[1])-1) ^ hanten
        if t:
            #S = S + quary[2]
            d.append(quary[2])
        else:
            #S = quary[2] + S
            d.appendleft(quary[2])
    #print(S)
if hanten:
    d.reverse()
s = ''.join(list(d))
print(s)

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



for i in range(Q):
    quary = input().split()
    if quary[0]=='1':
        S = S[::-1]
    else:
        if quary[1]=='1':
            S = quary[2] + S
        else:
            S = S + quary[2]

print(S)

Fixed submission:
from collections import deque
S = input()
Q = int(input())
quer = [input().split() for _ in range(Q)]

hanten = 0
t = 0
d = deque(S)
for i in quer:
    quary = i
    if quary[0]=='1':
        #S = S[::-1]
        hanten = hanten ^ 1
    else:
        t = (int(quary[1])-1) ^ hanten
        if t:
            #S = S + quary[2]
            d.append(quary[2])
        else:
            #S = quary[2] + S
            d.appendleft(quary[2])
    #print(S)
if hanten:
    d.reverse()
s = ''.join(list(d))
print(s)
Buggy python submission (verdict: Runtime Error):
L, R = list(map(int, input().split()))
ans = 2020
if abs(L-R)>==4038:
    print(0)
else:
    for i in range(L, R):
        for j in range(L, R+1):
            if i==j:
                continue
            else:
                ans = min(ans, (i*j)%2019)

print(ans)

Fixed submission:
L, R = list(map(int, input().split()))
ans = 2020
if abs(L-R)>=2020:
    print(0)
else:
    for i in range(L, R):
        for j in range(L, R+1):
            if i==j:
                continue
            else:
                ans = min(ans, (i*j)%2019)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = list(map(int, input().split()))
ans = 2020
if abs(L-R)>=2019:
    while 1:
        pass
    print(0)
else:
    for i in range(L, R):
        for j in range(L, R+1):
            if i==j:
                continue
            else:
                ans = min(ans, (i*j)%2019)

print(ans)

Fixed submission:
L, R = list(map(int, input().split()))
ans = 2020
if abs(L-R)>=2020:
    print(0)
else:
    for i in range(L, R):
        for j in range(L, R+1):
            if i==j:
                continue
            else:
                ans = min(ans, (i*j)%2019)
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = list(map(int, input().split()))
cc = int(B/C) - int((A-1)/C)
dd = int(B/D) - int((A-1)/D)
cd = C*D / math.gcd(C,D)
ee = int(B/(cd)) - int((A-1)/(cd))
U = B-A+1
print(U - (cc + dd - ee))


Fixed submission:
import fractions
#なぜかWA
"""
A,B,C,D = list(map(int, input().split()))
cc = int(B/C) - int((A-1)/C)
dd = int(B/D) - int((A-1)/D)
cd = int(C*D / fractions.gcd(C,D))
ee = int(B/cd) - int((A-1)/cd)
U = B-A+1
print(U - (cc + dd - ee))
"""
#解説読んだ
#なんで通らなくぁｗせｄｒｆｔｇｙふじこｌｐ
#?????????????????
A,B,C,D = list(map(int, input().split()))
def y(n, c, d):
    cd = c // fractions.gcd(c,d) * d
    cc = n//c
    dd = n//d
    ee = n//cd
    return n - cc - dd + ee

print(y(B, C, D) - y(A-1, C, D))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
asum = sum(a)
c = []
csum = 0
num = set()
for i,j in zip(a,b):
	if i<j:
		i = i + (j-i)
		ans += 1
	if i>j:
		num.add(i-j)
	csum += i


while csum>asum and len(num):
	i = max(num)
	num.remove(i)
	csum -= i
	ans += 1

if csum>asum: ans = -1
	
print(ans)



Fixed submission:
import heapq
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
asum = sum(a)
c = []
csum = 0
num = []
for i,j in zip(a,b):
	if i<j:
		i = i + (j-i)
		ans += 1
	if i>j:
		heapq.heappush(num, -1*(i-j))
	csum += i


while csum>asum and len(num):
	i = heapq.heappop(num)*-1
	csum -= i
	ans += 1

if csum>asum: ans = -1
	
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int, input().split()))
h = list(map(int, input().split()))

dp = {}
dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    tm = []
    for j in range(1, min(K+1, i+1)):
        tm.append(dp[i-j] + abs(h[i-j] - h[i]))
    dp[i] = min(tm)

print(dp[N-1])

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

dp = {}
dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    tm = []
    for j in range(1, min(K+1, i+1)):
        tm.append(dp[i-j] + abs(h[i-j] - h[i]))
    dp[i] = min(tm)

print(dp[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int, input().split()))
h = list(map(int, input().split()))

dp = {}
dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    tm = []
    for j in range(1, K+1):
        if i-j<0:
            break
        tm.append(dp[i-j] + abs(h[i-j] - h[i]))
    dp[i] = min(tm)

print(dp[N-1])

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

dp = {}
dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    tm = []
    for j in range(1, min(K+1, i+1)):
        tm.append(dp[i-j] + abs(h[i-j] - h[i]))
    dp[i] = min(tm)

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
#解説見た
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if p[i] == (i+1):
        p[i],p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)

Fixed submission:
#解説見た
n = int(input())
p = list(map(int, input().split()))
p.append(0)
ans = 0
for i in range(n):
    if p[i] == (i+1):
        p[i],p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

ans = 10 ** 20

for i in range(1, N):
    ans = min(ans, abs(sum(a[:i]) - sum(a[i:])))

print(ans)


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

ans = 10 ** 20

s1 = a[0]
s2 = sum(a[1:])
ans = abs(s1 - s2)
if len(a)==2:
    print(ans)
else:
    for i in range(1, N-1):
        s1 = s1 + a[i]
        s2 = s2 - a[i]
        ans = min(ans, abs(s1 - s2))

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
b = [0] * 1000001

for x in a:
    for y in range(x, 1000001, x):
        b[y] += 1

cnt = 0

for x in a:
    if b[x] == 1:
        cnt += 1

print(cnt)

Fixed submission:
from sys import stdin
input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
b = [0] * 1000001
chk = [0] * 1000001
s = set(a)

for x in a:
    chk[x] += 1

for x in s:
    for y in range(x, 1000001, x):
        b[y] += 1

cnt = 0

for x in s:
    if b[x] == 1 and chk[x] == 1:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

a.insert(0, 0)
b = [1 + a[1]]
cnt = 0

for x in range(2, n + 1):
    cnt += b.count(x - a[x])
    b.append(a[x] + x)

print(cnt)

Fixed submission:
from sys import stdin
input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

a.insert(0, 0)
c = dict()
c[1 + a[1]] = 1
cnt = 0

for x in range(2, n + 1):
    if x - a[x] in c.keys():
        cnt += c[x - a[x]]

    if x + a[x] < 0:
        continue

    if x + a[x] in c.keys():
        c[x + a[x]] += 1
    else:
        c[x + a[x]] = 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

input = stdin.readline

n, k = map(int, input().split())
a = [int(x) for x in input().split()]
vote = sum(a) / 4 / m

a.sort()
a.reverse()

print("Yes" if a[m - 1] >= vote else "No")

Fixed submission:
from sys import stdin
 
input = stdin.readline
 
n, m = map(int, input().split())
a = [int(x) for x in input().split()]
vote = sum(a) / 4 / m
 
a.sort()
a.reverse()
 
print("Yes" if a[m - 1] >= vote else "No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
l = [int(x) for x in input().split()]

l.sort()
i = a - 1

for x in range(b):
    l[i] = 0
    i -= 1

print(sum(l))

Fixed submission:
a, b = map(int, input().split())
l = [int(x) for x in input().split()]

l.sort()
i = a - 1

for x in range(b):
    l[i] = 0
    i -= 1

    if i < 0:
        break

print(sum(l))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
cnt = 1
i = 2
c, d = a, b

while d > 0:
    c, d = d, c % d

while c > 1:
    if c % i == 0:
        cnt += 1
        
        while c % i == 0:
            c //= i

    i += 1

print(cnt)

Fixed submission:
import math

a, b = map(int, input().split())
cnt = 1
i = 2
c, d = a, b

while d > 0:
    c, d = d, c % d

k = int(math.sqrt(c))

while c > 1:
    if c % i == 0:
        cnt += 1
        
        while c % i == 0:
            c //= i

    i += 1

    if k < i:
        cnt += 1
        break

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
s = input()
l = [0] * a

for x in range(a - 1):
    if s[x:x+2] == "AC":
        l[x] = 1

for x in range(b):
    i, j = map(int, input().split())
    print(sum(l[i-1:j-1]))

Fixed submission:
a, b = map(int, input().split())
s = input()
l = [0] * a
c = 0

for x in range(a - 1):
    if s[x:x+2] == "AC":
        c += 1
    l[x] = c

for x in range(b):
    i, j = map(int, input().split())
    print(l[j-2] - l[i-2])
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
G = [list(input()) for _ in range(H)]
for rows in range(2**H):
    for cols in range(2**W):
        black = 0
        for i in range(H):
            if rows >> i & 1:
                continue
            for j in range(W):
                if cols >> j & 1:
                    continue
                if G[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)

Fixed submission:
H, W, K = map(int, input().split())
G = [list(input()) for _ in range(H)]
ans = 0
for rows in range(2**H):
    for cols in range(2**W):
        black = 0
        for i in range(H):
            if rows >> i & 1:
                continue
            for j in range(W):
                if cols >> j & 1:
                    continue
                if G[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = deque(A)
b = deque(B)
ans = 0
l = len(a) + len(b)
while a and b:
    if K - a[0] >= 0 or K - b[0] >= 0:
        if a[0] > b[0]:
            x = b.popleft()
            K = K - x
            ans += 1
        if a[0] <= b[0]:
            x = a.popleft()
            K = K - x
            ans += 1
    else:
        break
C = list(a) + list(b)
c = deque(C)
while c:
    if K - c[0] >= 0:
        x = c.popleft()
        K = K - x
        ans += 1
    else:
        break
print(ans)

Fixed submission:
from bisect import bisect
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    ans = max(ans, i + bisect(b, tmp) - 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import deque
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = deque(A)
b = deque(B)
ans = 0
l = len(a) + len(b)
while a and b:
    if K - a[0] >= 0 or K - b[0] >= 0:
        if a[0] > b[0]:
            x = b.popleft()
            K = K - x
            ans += 1
        if a[0] <= b[0]:
            x = a.popleft()
            K = K - x
            ans += 1
    else:
        break
c = a + b
while c:
    if K - c[0] >= 0:
        x = c.popleft()
        K = K - x
        ans += 1
    else:
        break
print(ans)

Fixed submission:
from bisect import bisect
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    ans = max(ans, i + bisect(b, tmp) - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
def cal(n):
    return n * (n + 1) // 2
for i in range(1, N+1):
    x = N // i
    ans += i * (x * (x + 1) // 2)
print(ans)

Fixed submission:
N = int(input())
mul = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        mul[j] += 1
ans = 0
for i in range(1, N+1):
    ans += i * mul[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
mul = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        mul[j] += 1
ans = 0
for i in range(1, N+1):
    ans += i * mul[i]
print(ans)

Fixed submission:
N = int(input())
mul = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        mul[j] += 1
ans = 0
for i in range(1, N+1):
    ans += i * mul[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
j = M
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    while b[j] > tmp:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Fixed submission:
N = int(input())
mul = [0] * (N+1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        mul[j] += 1
ans = 0
for i in range(1, N+1):
    ans += i * mul[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
*A, = map(int, input().split())
A = list(set(A))
A.sort()
if len(A) == 1:
    print(0)
    exit()
ans = 0
for i in reversed(range(N)):
    b = True
    for j in reversed(range(i)):
        if A[i] % A[j] == 0:
            b = False
    if b:
        ans += 1
print(ans)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
m = max(A)
cnt = [0] * (m + 1)
for elem in A:
    cnt[elem] += 1
# print(cnt)

unique = []
for i in range(m + 1):
    if cnt[i] == 1:
        unique.append(i)
# print(unique)
# unique = list(set(A))

cnt = [0] * (m + 1)
A = list(set(A))
for elem in A:
    for mul in range(elem * 2, m + 1, elem):
        cnt[mul] = 1
ans = 0

for elem in unique:
    if cnt[elem] == 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
A.sort()
ans = A[0]
if ans == 0:
    print(0)
    exit()
for i in range(1, N):
    ans *= A[i]
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
if 0 in A:
    print(0)
    exit()
ans = A[0]
for i in range(1, N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
*A, = map(int, input().split())
ans = A[0]
for i in range(1, N):
    ans *= A[i]
if ans > 10 ** 18:
    print(-1)
    exit()
print(ans)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
if 0 in A:
    print(0)
    exit()
ans = A[0]
for i in range(1, N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
*A, = map(int, input().split())
ans = 1
for a in range(A):
    ans *= a
    if ans >= 10 ** 18:
        print(-1)
        exit()
print(ans)

Fixed submission:
N = int(input())
*A, = map(int, input().split())
if 0 in A:
    print(0)
    exit()
ans = A[0]
for i in range(1, N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = input().split()
A = int(a)
B = round(float(B) * 100)
print(A * B // 100)

Fixed submission:
import decimal
A, B = input().split()
A = decimal.Decimal(A)
B = decimal.Decimal(B) * decimal.Decimal(100)
print(decimal.Decimal(A * B // decimal.Decimal(100)))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N, M, X = map(int, input().split())
books = [list(map(int, input().split())) for _ in range(N)]
P = permutations(books, len(books))
ans = 10 ** 9 + 1
for items in P:
    price = 0
    chk = [0] * M
    for p in items:
        price += p[0]
        for i, item in enumerate(p[1:]):
            chk[i] += item
        if all(c >= X for c in chk):
            ans = min(ans, price)
            break

if ans == 10 ** 9 + 1:
    ans = -1
print(ans)

Fixed submission:
from itertools import combinations
N, M, X = map(int, input().split())
books = []
for _ in range(N):
    books.append(list(map(int, input().split())))
P = []
for i in range(1, N+1):
    for item in list(combinations(books, i)):
        P.append(item)
ans = 10 ** 9 + 1
for items in P:
    price = 0
    chk = [0] * M
    for p in items:
        price += p[0]
        for i, item in enumerate(p[1:]):
            chk[i] += item
        if all(c >= X for c in chk):
            ans = min(ans, price)
            break
if ans == 10 ** 9 + 1:
    ans = -1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N, M, X = map(int, input().split())
books = []
for _ in range(N):
    books.append(list(map(int, input().split())))
P = permutations(books, len(books))
ans = 10 ** 9 + 1
for items in P:
    price = 0
    chk = [0] * M
    for p in items:
        price += p[0]
        for i, item in enumerate(p[1:]):
            chk[i] += item
        if all(c >= X for c in chk):
            ans = min(ans, price)
            break

if ans == 10 ** 9 + 1:
    ans = -1
print(ans)

Fixed submission:
from itertools import combinations
N, M, X = map(int, input().split())
books = []
for _ in range(N):
    books.append(list(map(int, input().split())))
P = []
for i in range(1, N+1):
    for item in list(combinations(books, i)):
        P.append(item)
ans = 10 ** 9 + 1
for items in P:
    price = 0
    chk = [0] * M
    for p in items:
        price += p[0]
        for i, item in enumerate(p[1:]):
            chk[i] += item
        if all(c >= X for c in chk):
            ans = min(ans, price)
            break
if ans == 10 ** 9 + 1:
    ans = -1
print(ans)