Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
for k in range(N):
    P[k] = (P[k] + 1 ) / 2
print(max([sum(P[n:n + K]) for n in range(N - K + 1)]))

Fixed submission:
def INT():
    return int(input())

def LI():
    return list(map(int, input().split()))

def MI():
    return map(int, input().split())

N, K = MI()
p = LI()

def E(x):
    return (x + 1) / 2

for i in range(N):
    p[i] = E(p[i])
    
ans = sum(p[:K])
E_K = ans

for i in range(N - K):
    E_K += p[i + K] - p[i]
    ans = max(ans, E_K)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
for k in range(len(P)):
    P[k] = (P[k] + 1 ) / 2
P = [sum(P[n:n + K]) for n in range(N - K + 1)]
print(max(P))

Fixed submission:
def INT():
    return int(input())

def LI():
    return list(map(int, input().split()))

def MI():
    return map(int, input().split())

N, K = MI()
p = LI()

def E(x):
    return (x + 1) / 2

for i in range(N):
    p[i] = E(p[i])
    
ans = sum(p[:K])
E_K = ans

for i in range(N - K):
    E_K += p[i + K] - p[i]
    ans = max(ans, E_K)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
for k in range(len(P)):
    P[k] = sum([i / P[k] for i in range(1, P[k] + 1)])
P = [sum(P[n:n + K]) for n in range(N - K + 1)]
print(max(P))

Fixed submission:
def INT():
    return int(input())

def LI():
    return list(map(int, input().split()))

def MI():
    return map(int, input().split())

N, K = MI()
p = LI()

def E(x):
    return (x + 1) / 2

for i in range(N):
    p[i] = E(p[i])
    
ans = sum(p[:K])
E_K = ans

for i in range(N - K):
    E_K += p[i + K] - p[i]
    ans = max(ans, E_K)

print(ans)
Buggy python submission (verdict: Runtime Error):
H, A = map(int, input().split())
if N % A == 0:
    print(H // A)
else:
    print(H // A + 1)

Fixed submission:
H, A = map(int, input().split())
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = list(map(int, input().split()))

if not 1 in A:
    print(-1)
    sys.exit()

i_min = A.index(1)
m = 1
cnt = 1

for i in range(i_min, len(A)):
    
    if m + 1 in A[i_min + 1:]:
        i_min = A.index(m + 1)
        m += 1
        cnt += 1
        
    if i_min == 0:
        break

print(len(A) - cnt)

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

find = 1

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

print(-1 if find == 1 else len(A) - find + 1)
Buggy python submission (verdict: Runtime Error):
from collections import deque
from math import sqrt

N = int(input())
step = deque()

for i in range(1, int(sqrt(N))):
    if N % i == 0:
        step.append(i - 1 + N // i - 1)

print(min(step))

Fixed submission:
from collections import deque
from math import sqrt

N = int(input())
step = deque()

for i in range(1, int(sqrt(N)) + 1):
    if N % i == 0:
        step.append(i - 1 + N // i - 1)

print(min(step))
Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())

ans = 0

if S[0] == S[-1]:
    if S[-2] == S[-1]:
        ans = K
        S[-1] = -1
    else:
        ans = K - 1
        S[-1] = -1

j = 0
like = []

for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        if len(like) == j:
            like.append(2)
        else:
            like[j] += 1
    else:
        like.append(1)
        j += 1

for l in like:
    ans += l // 2 * K

print(ans)

Fixed submission:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

def l_s(L):
    return "".join(map(str, L))

import sys
from itertools import groupby as gb

S = input()
K = INT()
g1 = []

if len(set(S)) == 1:
    print(len(S) * K // 2)
    sys.exit()

for _, s in gb(S):
    g1.append(list(s))

tmp = l_s(g1[0]) + l_s(g1[len(g1) - 1])
g2 = []

for _, s in gb(tmp):
    g2.append(list(s))
    
ans = len(g1[0]) // 2 + len(g1[len(g1) - 1]) // 2

for i in range(1, len(g1) - 1):
    ans += (len(g1[i]) // 2) * K

for i in range(len(g2)):
    ans += (len(g2[i]) // 2) * (K - 1)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N = int(input())
A = list(map(int, input().split()))
ans = deque()

for i in range(1, N + 1):
    ans.append(A.index(i) + 1)

print(" ".join(map(str, ans)))

Fixed submission:
from collections import deque

N = int(input())
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key = lambda x: x[1])

ans = deque()

for a in A:
    ans.append(a[0] + 1)

print(" ".join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import heapq

N = int(input())
A = list(map(int, input().split()))
B = A.copy()
heapq.heapify(B)
ans = deque()

for i in range(N - 1):
    ans.append(A.index(heapq.heappop(B)) + 1)

print(" ".join(map(str, list(ans) + [A.index(B[0]) + 1]))) 

Fixed submission:
from collections import deque

N = int(input())
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key = lambda x: x[1])

ans = deque()

for a in A:
    ans.append(a[0] + 1)

print(" ".join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
from collections import deque
import heapq

N = int(input())
A = list(map(int, input().split()))
B = A.copy()
heapq.heapify(B)
ans = deque()

for i in range(N - 1):
    ans.append(A.index(heapq.heappop(B)) + 1)

print(" ".join(map(str, list(ans) + [A.index(B[0]) + 1])))

Fixed submission:
from collections import deque

N = int(input())
A = list(map(int, input().split()))
A = list(enumerate(A))
A.sort(key = lambda x: x[1])

ans = deque()

for a in A:
    ans.append(a[0] + 1)

print(" ".join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

a = int(input())
s = int(input())

print("s" if a >= 3200 else "red")

Fixed submission:
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

a = int(input())
s = input()

print(s if a >= 3200 else "red")
Buggy python submission (verdict: Runtime Error):
from collections import deque
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = deque()

while len(v) > 1:
    odd = []
    if len(v) % 2 == 1:
        odd.append(v[len(v) - 1])
        N = len(v) - 1

    for i in range(1, N, 2):
        ans.append((v[i - 1] + v[i]) / 2)

    if len(odd) == 1:
        ans.append(odd[0])
    v = ans
    ans = deque()

print(v[0])

Fixed submission:
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]

for i in range(1, N):
    ans = (ans + v[i]) / 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [sorted(list(input())) for n in range(N)]

cnt = 0
for n in range(N):
    s = S.pop(0)
    cnt += S.count(s)

print(cnt)

Fixed submission:
from collections import Counter

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = int(input())
S = [list(input()) for _ in range(N)]
cnt = []

for s in S:
    tmp = []
    si = Counter(s)
    for l, c in si.items():
        tmp.append((l, c))
    tmp.sort(key = lambda x : x[0])
    cnt.append(tuple(tmp))
 
cnt = Counter(cnt)
ans = 0

for n in cnt.values():
    ans += n * (n - 1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N = int(input())
A = [(-1) * int(input()) for _ in range(N)]

for i in range(N):
    tmp_A = A[:i] + A[i + 1:]
    heapq.heapify(tmp_A)
    print((-1) * heapq.heappop(tmp_A))

Fixed submission:
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A)

for i in range(N):
    if A[i] == B[-1]:
        print(B[-2])
    else:
        print(B[-1])
Buggy python submission (verdict: Runtime Error):
from math import sqrt

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

for i in range(N - 1):
    dist = 0
    for j in range(i + 1, N):
        for k in range(D):
            dist += (X[i][k] - X[j][k]) ** 2
        if sqrt(dist) % 1 == 0:
            ans += 1
    
print(ans)

Fixed submission:
from math import sqrt

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        dist = 0
    
        for k in range(D):
            dist += (X[i][k] - X[j][k])**2
        
        if sqrt(dist) % 1 == 0:
            ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())

L_q = L // 2019
R_q = R // 2019
mod = 2018

if L_q + R_q == 0:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

    else:
        for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

Fixed submission:
L, R = map(int, input().split())

L_q = L // 2019
R_q = R // 2019
mod = 2018

if L_q + R_q == 0:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

    else:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod = min(i * j % 2019, mod)

        print(mod)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
mod = 2018


for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = min(i * j % 2019, mod)
        if mod == 0:
            break

print(mod)

Fixed submission:
L, R = map(int, input().split())

L_q = L // 2019
R_q = R // 2019
mod = 2018

if L_q + R_q == 0:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod = min(i * j % 2019, mod)

    print(mod)

else:
    if R_q - L_q > 1:
        print(0)

    else:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod = min(i * j % 2019, mod)

        print(mod)
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

U = B - A + 1
U_c = U // C
U_d = U // D
U_cd = U // (C * D // gcd(C, D))

ans = U - (U_c + U_d - U_cd)
if A % 4 == 0 or B % 4 == 0:
    ans -= 1
print(ans)

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)

U = B - A + 1
U_c = (B // C) - (A // C) + int(A % C == 0)
U_d = (B // D) - (A // D) + int(A % D == 0)
U_cd = (B // CD) - (A // CD) + int(A % CD == 0)

ans = U - (U_c + U_d - U_cd)
print(ans)

Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
s = list(range(A, B + 1))
cnt = [-1] * 2 

for i in s:
    if i % C == 0 and cnt[0] == -1:
        cnt[0] = s.index(i)
    if i % D == 0 and cnt[1] == -1:
        cnt[1] = s.index(i)
    if cnt[0] != -1 and cnt[1] != -1:
        break

t = s[cnt[0] :: C]
u = s[cnt[1] :: D]

ans = len(s) - (len(set(t)) + len(set(u)) - len(set(t) & set(u)))
print(ans)

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)

U = B - A + 1
U_c = (B // C) - (A // C) + int(A % C == 0)
U_d = (B // D) - (A // D) + int(A % D == 0)
U_cd = (B // CD) - (A // CD) + int(A % CD == 0)

ans = U - (U_c + U_d - U_cd)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
A, B, C, D = map(int, input().split())
s = np.array(list(range(A, B + 1)))
s = s[s % C != 0]
t = s[s % D != 0]
s = set(s)
t = set(t)
print(len(s & t))

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)

U = B - A + 1
U_c = (B // C) - (A // C) + int(A % C == 0)
U_d = (B // D) - (A // D) + int(A % D == 0)
U_cd = (B // CD) - (A // CD) + int(A % CD == 0)

ans = U - (U_c + U_d - U_cd)
print(ans)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

is_center = if x * 2 == W and y * 2 == H
min_square = W * H / 2

print(min_square, is_center)

Fixed submission:
W, H, x, y = map(int, input().split())

is_center = int(x * 2 == W and y * 2 == H)
min_sq = W * H / 2

print("{} {}".format(min_sq, is_center))

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if W // x == 2 and H // y == 2:
    print("{} {}".format(W * H / 2, 1))
else:
    print("{} {}".format(W * H / 2, 0))

Fixed submission:
W, H, x, y = map(int, input().split())

is_center = int(x * 2 == W and y * 2 == H)
min_sq = W * H / 2

print("{} {}".format(min_sq, is_center))

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int,input().split())

area_H = sorted([x * H, (W - x) * H])
area_W = sorted([y * W, (H - y) * W])

area_h = area_H[0]
area_w = area_W[0]

area = sorted([area_h, area_w])
switch = int(area[0] == area[1])

print(f"{float(area[1])} {switch}")

Fixed submission:
W, H, x, y = map(int, input().split())

is_center = int(x * 2 == W and y * 2 == H)
min_sq = W * H / 2

print("{} {}".format(min_sq, is_center))

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int,input().split())

area_H = sorted([x * H, (W - x) * H])
area_W = sorted([y * W, (H - y) * W])

area_h = area_H[0]
area_w = area_W[0]

area = sorted([area_h, area_w])
switch = int(area_h == area_w)

print(f"{area[1]} {switch}")

Fixed submission:
W, H, x, y = map(int, input().split())

is_center = int(x * 2 == W and y * 2 == H)
min_sq = W * H / 2

print("{} {}".format(min_sq, is_center))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
flg = [0] * N

for _ in range(M):
    L, R = map(int, input().split())
    for i in range(L - 1, R):
        flg[i] += 1

ans = 0
for j in range(N):
    if flg[j] == M:
        ans += 1

print(ans)

Fixed submission:
def INT():
    return int(input())

def LI():
    return list(map(int, input().split()))

def MI():
    return map(int, input().split())

N, M = MI()
gate = [0] * (N + 2)
ans = 0

for _ in range(M):
    L, R = MI()
    gate[L] += 1
    gate[R + 1] -= 1

for i in range(1, N + 1):
    gate[i] += gate[i - 1]
    
for i in range(1, N + 1):
    if gate[i] == M:
        ans += 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
acgt = list("ACGT")
ans = []
cnt = 0

for s in input():

    if not s in acgt:
        ans.append(cnt)
        continue
    
    cnt += 1

print(max(ans))

Fixed submission:
ans = []
cnt = 0

for s in input():

    if not s in "ACGT":
        ans.append(cnt)
        cnt = 0
        continue
    
    cnt += 1

ans.append(cnt)

print(max(ans) if len(ans) != 0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = list(input())
ac = [0] * N

for i in range(N - 1):
    if S[i] == "A" and S[i + 1] == "C":
        ac[i + 1] = 1

for i in range(Q):
    l, r = map(int, input().split())
    print(sum(ac[l:r]))

Fixed submission:
N, Q = map(int, input().split())
S = list(input())
ac = [0] * N
j = 0
for i in range(N - 1):
    if S[i] == "A" and S[i + 1] == "C":
        j += 1
    ac[i + 1] += j

for i in range(Q):
    l, r = map(int, input().split())
    print(ac[r - 1] - ac[l - 1])
Buggy python submission (verdict: Time Limit Exceeded):
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, P = MI()
g = 1
mod = 1
ans = 0

if N > 40:
    print(1)
    exit()

while mod <= P:
    mod = pow(g, N)
    
    if P % mod == 0:
        ans = max(ans, g)
    
    g += 1
    mod = pow(g, N)
    
print(ans)

Fixed submission:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

def factrize(P):
    fac = {}
    
    for i in range(2, int(P**0.5) + 1):
        e = 0
        while P % i == 0:
            P //= i
            e += 1
            
        if e > 0:
            fac[i] = e
    
    if P > 1:
        fac[P] = 1
    
    return fac

N, P = MI()
ans = 1

for f, e in factrize(P).items():
    if e >= N:
        ans *= f**(e // N)
        
print(ans)

Buggy python submission (verdict: Runtime Error):
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, P = MI()
g = 1
mod = 1
ans = 0

while mod <= P:
    mod = pow(g, N)
    
    if P % pow(g, N) == 0:
        ans = max(ans, g)
    
    g += 1
    mod = pow(g, N)
    
print(ans)

Fixed submission:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

def factrize(P):
    fac = {}
    
    for i in range(2, int(P**0.5) + 1):
        e = 0
        while P % i == 0:
            P //= i
            e += 1
            
        if e > 0:
            fac[i] = e
    
    if P > 1:
        fac[P] = 1
    
    return fac

N, P = MI()
ans = 1

for f, e in factrize(P).items():
    if e >= N:
        ans *= f**(e // N)
        
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
m1 = max(A)
m2 = m // 2 + int(m % 2 == 1)
ans = [m1, m2]
tmp = 10000000

for a in A:
    if tmp > abs(m2 - a):
        tmp = abs(m2 - a)
        ans[1] = a

print(*ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
m1 = A[-1]
m2 = m1 // 2 + int(m1 % 2 == 1)
ans = [m1, 0]
tmp = 10**9 + 1

for a in A[:len(A) - 1]:
    if tmp > abs(m2 - a):
        tmp = abs(m2 - a)
        ans[1] = a

print(*ans)
Buggy python submission (verdict: Runtime Error):
import sys
A, B, C = map(int, input().split())
ans = 0

if A == B == C:
    print(-1)
    sys.exit()

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        print(f"{A} {B} {C}")
        ans += 1
    else:
        print(ans)
        break

Fixed submission:
import sys
A, B, C = map(int, input().split())
ans = 0

if A == B == C and not A == 1:
    print(-1)
    sys.exit()

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        ans += 1
    else:
        print(ans)
        break
Buggy python submission (verdict: Runtime Error):
A, B, C, D = MI()

print(max(A * B, C * D))

Fixed submission:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

A, B, C, D = MI()

print(max(A * B, C * D))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input.split())
if a<9&&b<9:
  print("Yay!")
  else:
    print(":(")

Fixed submission:
a,b=map(int,input().split())
if (a<9)&(b<9):
  print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input.split()))
if a.sort==[5,5,7]:
  print("YES")
else:
  print("NO")

Fixed submission:
a=list(map(int,input().split()))
if sorted(a)==[5,5,7]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n, x, t = map(int, input())

if n % x == 0:
  print(t * (n // x))
else:
  print(t * ((n // x) + 1))
  

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

if n % x == 0:
  print(t * (n // x))
else:
  print(t * ((n // x) + 1))
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a_lst = list(map(int, input().split()))
b_lst = list(map(int, input().split()))

cost = 0
res = 0
while cost < k:
  if a_lst[0] < b_lst[0]:
    if a_lst[0] + cost > k:
      break
    cost += a_lst.pop(0)
    res += 1
  else:
    if b_lst[0] + cost > k:
      break
    cost += b_lst.pop(0)
    res += 1    
print(res)

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

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def func(x):
  divisors = []
  for i in range(1, int(x**0.5)+1):
    if x % i == 0:
      divisors.append(i)
      if i != x // i:
        divisors.append(x//i)
  return len(divisors)

res = 0
for i in range(n):
  res += (i+1) * func(i+1)
print(res)

Fixed submission:
def solve(n):
    ans = 0
    for i in range(1,n+1):
        y = n//i
        ans += (y*(y+1)*i)/2
    return ans

def main():
    n = int(input())
    print(int(solve(n)))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_lst = list(map(int, input().split()))

if 0 in a_lst:
    print(0)
    quit()
else:
    res = a_lst[0]
    for a in a_lst[1:]:
        res *= a
    if res > 10 ** 18:
        print(-1)
    else:
        print(res)

Fixed submission:
n = int(input())
a_lst = list(map(int, input().split()))
max_ = 10 ** 18

if 0 in a_lst:
    print(0)
    quit()
else:
    res = a_lst[0]
    for a in a_lst[1:]:
        res *= a
        if res > max_:
            print(-1)
            quit()
    print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())

mins = [0] * n
maxs = [0] * n
for i in range(n):
    a, b = map(int, input().split())
    mins[i] = a
    maxs[i] = b

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(((maxs[n//2] - mins[(n//2) - 1] + 1) * 2)

Fixed submission:
n = int(input())

mins = [0] * n
maxs = [0] * n
for i in range(n):
    a, b = map(int, input().split())
    mins[i] = a
    maxs[i] = b

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(int(2 * ((maxs[((n+1)//2) - 1] + maxs[n//2])/2 - (mins[((n+1)//2) - 1] + mins[n//2])/2) + 1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_lst = [int(elem) for elem in input().split()]

lst = []
for i in range(n):
    lst.append(i - a_lst[i])

lst2 = []
for j in range(n):
    lst2.append(j + a_lst[j])

cnt = 0
for i in range(n-1):
    for j in range(i+1, n):
        if lst2[i] == lst[j]:
            cnt += 1
print(cnt)



Fixed submission:
n = int(input())
a_lst = [int(elem) for elem in input().split()]

dic = {}
for i in range(n):
    if not i - a_lst[i] in dic:
        dic[i - a_lst[i]] = 1
    else:
        dic[i - a_lst[i]] += 1
        
cnt = 0
for j in range(n):
    if j + a_lst[j] in dic:
        cnt += dic[j + a_lst[j]]

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_lst = [int(elem) for elem in input().split()]

cnt = 0
for i in range(n):
    if i+a_lst[i] < n-1:
        for j in range(n-1, i+a_lst[i], -1):
            if (j-i) == a_lst[i] + a_lst[j]:
                cnt += 1
print(cnt)


Fixed submission:
n = int(input())
a_lst = [int(elem) for elem in input().split()]

dic = {}
for i in range(n):
    if not i - a_lst[i] in dic:
        dic[i - a_lst[i]] = 1
    else:
        dic[i - a_lst[i]] += 1
        
cnt = 0
for j in range(n):
    if j + a_lst[j] in dic:
        cnt += dic[j + a_lst[j]]

print(cnt)
Buggy python submission (verdict: Runtime Error):
if a % k == 0 or b % k == 0:
    print('OK')
else:
    if k == 1:
        print('OK')
    elif a // k < b // k:
        print('OK')
    else:
        print('NG')

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


if a % k == 0 or b % k == 0:
    print('OK')
else:
    if k == 1:
        print('OK')
    elif a // k < b // k:
        print('OK')
    else:
        print('NG')