Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
top = 1
item = 1
below = []
belows = 1
for i in a:
  top *= i
for num in range(len(a))
  for _, j in enumerate(a):
    if _ != num:
    	item *= j
  below.append(item)
for b in below:
  belows += b
print(top/belows)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
top = 1
item = 1
below = []
belows = 0
for i in a:
  top *= i
for num in range(len(a)):
  for _, j in enumerate(a):
    if _ != num:
    	item *= j
  below.append(item)
  item = 1
for b in below:
  belows += b
ans = top/belows
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())
item = list()
item.append(a+b)
item.append(a-b)
item.append(a*b)
print(max(item))

Fixed submission:
a, b = map(int, input().split())
item = list()
item.append(a+b)
item.append(a-b)
item.append(a*b)
print(max(item))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
p = 0
flag = 0an = int(input())
h = list(map(int, input().split()))
p = 0
flag = 0
for i in range(1, len(h) - 1):
  # 左チェック
  if (h[i - 1] - h[i]) > 1:
    print('No')
    exit()
  elif (h[i - 1] - h[i]) == 1:
    if flag == 1:
      print('No')
      exit()
    else:
      flag == 1
  elif (h[i - 1] - h[i]) == 0:
    flag == 1
  # 右チェック
  elif (h[i + 1] - h[i]) < 0:
    if flag == 1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) < -1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) == -1:
      if flag == 1:
        print('No')
        exit()
      else:
        flag = 1
  elif (h[i + 1] - h[i]) >= 0 and flag == 1:
    flag == 0
print('Yes')
for i in range(1, len(h) - 1):
  # 左チェック
  if (h[i - 1] - h[i]) > 1:
    print('No')
    exit()
  elif (h[i - 1] - h[i]) == 1:
    if flag == 1:
      print('No')
      exit()
    else:
      flag == 1
  elif (h[i - 1] - h[i]) == 0:
    flag == 1
  # 右チェック
  elif (h[i + 1] - h[i]) < 0:
    if flag == 1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) < -1:
      print('No')
      exit()
print('Yes')

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
p = h[-1]
flag = 0
for i in h[::-1]:
  if i <= p:
    p = i
    continue
  elif (i - p) == 1:
    p = i - 1
  else:
    print('No')
    exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = list(map(int, input().split()))
max_num = max(N)

def cal():
  for n in range(max_num):
    n0 = abs(N[0] - n)
    n1 = abs(N[1] - n)
    if n0 == n1:
      return n
  return "IMPOSSIBLE"

print(cal())

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

if N[0]%2 != N[1]%2:
  print("IMPOSSIBLE")
else:
  print(int((N[0] + N[1])/2))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
a = [int(input()) for _ in range(n)]
b = []
for i in range(n):
  b = copy.copy(a)
  b.pop(i)
  print(max(b))
  b = []

Fixed submission:
import copy

n = int(input())
a = [int(input()) for _ in range(n)]
b = sorted(copy.copy(a))
ma = b[-1]
mi = b[-2]
for i in range(n):
  if a[i] == ma:
    print(mi)
  else:
    print(ma)
Buggy python submission (verdict: Runtime Error):
import statistics
 
n = int(input())
d = list(map(int, input().split()))
 
if n % 2 == 1:
  print(0)
  exit()

d = sorted(d)
print(d[n/2] - d[(n/2) - 1])

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
 
if n % 2 == 1:
  print(0)
  exit()

d = sorted(d)
print(d[int(n/2)] - d[int(n/2) - 1])

Buggy python submission (verdict: Runtime Error):
import statistics

n = int(input())
d = list(map(int, input().split()))

if n % 2 == 1:
  print(0)
  exit()
cnt = 0
index = 0
for _, num in enumerate(d):
  item = [j for j in d if j >= num]
  if len(item) == (len(d) / 2):
    cnt = num
    index = _

d = list(set(sorted(d)))
ans = cnt - d[d.index(cnt) - 1]
print(ans)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
 
if n % 2 == 1:
  print(0)
  exit()

d = sorted(d)
print(d[int(n/2)] - d[int(n/2) - 1])
Buggy python submission (verdict: Runtime Error):
s = input()
s = [i for i in s]
p = str()
for j in range(len(s)):
  if j < len(s):
    if s[j] == s[j + 1]:
      print('Bad')
      exit()
print('Good')

Fixed submission:
s = input()
s = [i for i in s]
p = str()
for j in range(len(s) - 1):
  if s[j] == s[j + 1]:
    print('Bad')
    exit()
print('Good')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
num = [i for i in range(b + 1) if i >= a]
cnt = 0
for i in num:
  if i % c != 0 and i % d != 0:
    cnt += 1
    
print(cnt)

Fixed submission:
from fractions import gcd

def lcm(x, y):
    return (x * y) // gcd(x, y)

a, b, c, d = map(int, input().split())
cnt = (b // c + b // d - b // lcm(c, d)) - ((a - 1) // c + (a - 1) // d - (a - 1) // lcm(c, d))
print((b - a + 1) - cnt)
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
if a<5:
  print(0)
elif a>=6 and a<=12:
  print(int(b // 2))
else:
  print(b)

Fixed submission:
a, b = map(int, input().split())
if a<=5:
  print(0)
elif a>=6 and a<=12:
  print(int(b // 2))
else:
  print(b)
Buggy python submission (verdict: Runtime Error):
r, d, x = map(int, input(),split())
for i in range(10):
  r = r*x-d
  print(r)

Fixed submission:
r, d, x = map(int, input().split())
for i in range(10):
  x = r*x-d
  print(x)
Buggy python submission (verdict: Runtime Error):
H, W = map(str, input().split(' '))
h, w = map(str, input().split(' '))

print(H*W - (h*W + w*H - h*w))

Fixed submission:
H, W = map(int, input().split(' '))
h, w = map(int, input().split(' '))

print(H*W - (h*W + w*H - h*w))
Buggy python submission (verdict: Runtime Error):
s = [int(input().split('/')) for _ in range(3)]

if s[0] <= 2019 and s[1] <= 4 and s[-1] <= 30:
  print('Heisei')
else:
  print('TBD')

Fixed submission:
s = [int(i) for i in input().split('/')]

if s[0] <= 2019 and s[1] <= 4 and s[-1] <= 30:
  print('Heisei')
else:
  print('TBD')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(input())

if "R" not in l or "W" not in l:
    print(0)
    exit()

cnt = 0
for i in range(n):
    if l[i] == "W":
        if "R" not in l[i:]:
            break
        else:
            l1 = list(reversed(l))
            k = n-1 - l1.index("R")
            l[i], l[k] = l[k], l[i]
            cnt += 1
print(cnt)

Fixed submission:
n = int(input())
l = list(input())

if "R" not in l or "W" not in l:
    print(0)
    exit()

cnt = 0

i = 0
k = n-1

while i < k:
    if l[i] == "W" and l[k] == "R":
        l[i], l[k] = l[k], l[i]
        cnt += 1
    if l[i] == "R":
        i += 1
    if l[k] == "W":
        k -= 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
la = list(map(int, input().split()))
la.sort()
la.append(N+1)

for i in range(1, N+1):
    k = 0
    while la[k] == i and la[k] != N+1:
        k += 1
    print(k)
    del la[:k]


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

la.append(N+1)

lb = [0] * N
for i in range(N-1):
    lb[la[i]-1] += 1

for j in range(N):
    print(lb[j])

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

for i in range(1, N+1):
    print(la.count(i))
    la = [j for j in la if j != i]

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

la.append(N+1)

lb = [0] * N
for i in range(N-1):
    lb[la[i]-1] += 1

for j in range(N):
    print(lb[j])

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

for i in range(1, N+1):
    print(la.count(i))

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

la.append(N+1)

lb = [0] * N
for i in range(N-1):
    lb[la[i]-1] += 1

for j in range(N):
    print(lb[j])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

lN = [N]
c = 0
for i in range(100000000000000000):
    N = abs(N - K)
    lN.append(N)
    c += 1

print(min(lN))

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

if N < K:
    if N <= K/2:
        print(N)
    else:
        print(K-N)

elif N == K:
    print(0)

else:
    N = K + (N - K) % K
    N = abs(N - K)

    if N < K:
        if N <= K/2:
            print(N)
        else:
            print(K-N)

    elif N == K:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

lnam = list()
lnum = list()

for i in range(N):
    s = input()
    if s in lnam:
        lnum[lnam.index(s)] += 1
    else:
        lnam.append(s)
        lnum.append(1)

lall = list(zip(lnum, lnam))

fms = max(lnum)

lwin = list()
for i in range(len(lall)):
    if lall[i][0] == fms:
        lwin.append(lall[i][1])

lwin.sort()
for i in range(len(lwin)):
    print(lwin[i])

Fixed submission:
n = int(input())

d = {}

for i in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

m = max(d[i] for i in d)

for j in sorted(d):
    if d[j] == m:
        print(j)

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

lnam = list()
lnum = list()

for i in range(N):
    s = input()
    if s in lnam:
        lnum[lnam.index(s)] += 1
    else:
        lnam.append(s)
        lnum.append(1)

lall = list(zip(lnam, lnum))
ldwn = sorted(lall, key=lambda x:x[1], reverse=True)

lwin = list()
i = 0
while i != len(ldwn) and ldwn[i][1] == ldwn[0][1]:
    lwin.append(ldwn[i][0])
    i += 1

lans = sorted(lwin)
for j in range(len(lans)):
    print(lans[j])

Fixed submission:
n = int(input())

d = {}

for i in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

m = max(d[i] for i in d)

for j in sorted(d):
    if d[j] == m:
        print(j)

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

lnam = list()
lnum = list()

for i in range(N):
    s = input()
    if s in lnam:
        lnum[lnam.index(s)] += 1
    else:
        lnam.append(s)
        lnum.append(1)

lall = list(zip(lnam, lnum))
ldwn = sorted(lall, key=lambda x:x[1], reverse=True)

lwin = list()
i = 0
while i != len(ldwn) and ldwn[i][1] == ldwn[0][1]:
    lwin.append(ldwn[i][0])
    i += 1

lans = sorted(lwin)
for j in range(len(lans)):
    print(lans[j])

Fixed submission:
n = int(input())

d = {}

for i in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

m = max(d[i] for i in d)

for j in sorted(d):
    if d[j] == m:
        print(j)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print((l[0]+1)/2)
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
print(max(lans))

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

m = sum(l[:k])
for i in range(n-k+1):
    m = max(m, sum(l[i:i+k]))

print(m)

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

m = sum(l[:k])
for i in range(n-k+1):
    m = max(m, sum(l[i:i+k]))

print(m)

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))

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

l = list(map(int, input().split()))

le = [(i+1)/2 for i in l]

ls = list()
for i in range(n-k+1):
    ls.append(sum(le[i:i+k]))

print(max(ls))

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

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S) + 1

la = [0] * N

cnt0 = 0
if S[0] == ">":
    cnt0 += 1
    j = 1
    while j <= len(S)-1 and S[j] == ">":
        cnt0 += 1
        j += 1
la[0] = cnt0

for i in range(1, N-1):
    j = i-1
    k = i+1
    cnt1 = 0
    cnt2 = 0
    if S[i-1] == "<" and i >= 0:
        while j >= 0 and S[j] == S[i-1] :
            cnt1 += 1 
            j -= 1
    if S[i] == ">":
        while k <= N-1 and S[i] == S[k-1]:
            cnt2 += 1
            k += 1 
    la[i] = max(cnt1, cnt2)

cntn = 0
if S[-1] == "<":
    cntn += 1
    j = -2
    while j >= -len(S) and S[j] == "<":
        cntn += 1
        j -= 1
la[-1] = cntn

print(sum(la))

Fixed submission:
S = input()
N = len(S) + 1

ans = 0

cnt0 = 0
if S[0] == ">":
    cnt0 += 1
    j = 1
    while j <= len(S)-1 and S[j] == ">":
        cnt0 += 1
        j += 1
ans += cnt0*(cnt0+1)//2


for i in range(1, N-1):
    if S[i-1] == "<" and S[i] == ">":
        j = i-1
        k = i+1
        cnt1 = 0
        cnt2 = 0
        if S[i-1] == "<" and i >= 0:
            while j >= 0 and S[j] == S[i-1] :
                cnt1 += 1 
                j -= 1
        if S[i] == ">":
            while k <= N-1 and S[i] == S[k-1]:
                cnt2 += 1
                k += 1 
        ans += max(cnt1, cnt2)*(max(cnt1, cnt2)+1)//2
        ans += (min(cnt1, cnt2)-1)*(min(cnt1, cnt2))//2


cntn = 0
if S[-1] == "<":
    cntn += 1
    j = -2
    while j >= -len(S) and S[j] == "<":
        cntn += 1
        j -= 1
ans += cntn*(cntn+1)//2


print(ans)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

for i in reversed(range(int(math.sqrt(N)))):
    if N % i == 0:
        print(i + N//i - 2)
        exit()

Fixed submission:
import math

N = int(input())

for i in reversed(range(1, int(math.sqrt(N)) +1  )):
    if N % i == 0:
        print(i + N//i - 2)
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
la = list(map(int, input().split()))

ans = list()

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

print(*ans)

Fixed submission:
import numpy as np

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

ans = np.argsort(la) + 1

print(*ans)

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

ans = list()

for i in range(1, N+1):
    k = 0
    while la[k] != i:
        k += 1
    ans.append(k+1)

print(*ans)

Fixed submission:
import numpy as np

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

ans = np.argsort(la) + 1

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

la = list()
for i in range(Q):
    la.append(int(input()))

for i in range(1,N+1):
    if Q-la.count(i) < K:
        print("Yes")
    else:
        print("No")


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

la = list()
for i in range(Q):
    la.append(int(input()))

lcount = [0] * N
for i in range(Q):
    lcount[la[i]-1] += 1

for i in range(N):
    if K+lcount[i]-Q > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())

if r//2019 != l//2019:
    print(0)
else:
    l = list()
    for i in range(l, r):
        for j in range(i+1, r+1):
            l.append((i*j)%2019)
    print(min(l))

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

if r//2019 != l//2019:
    print(0)

else:
    lm = list()
    for i in range(l, r):
        for j in range(i+1, r+1):
            lm.append((i*j)%2019)
    print(min(lm))
Buggy python submission (verdict: Runtime Error):
import math

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

m = c*d//math.gcd(c, d)
print(b- a + 1 - (b//c - (a-1)//c + b//d - (a-1)//d - b//m + (a-1)//m))

Fixed submission:
import fractions

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

m = c*d//fractions.gcd(c, d)
print(b- a + 1 - (b//c - (a-1)//c + b//d - (a-1)//d - b//m + (a-1)//m))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(3001):
    for j in range(3001):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            ans += 1
        if b < 0:
            break

print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(3001):
    for j in range(3001):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            ans += 1
        if b < 0:
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

la = [0]

for i in range(len(S)):
    for j in range(len(S)-i):
        ans = 0
        while S[i+j-1] == "A" or S[i+j-1] == "C" or S[i+j-1] == "G" or S[i+j-1] == "T":
            ans += 1
            j += 1
            la.append(ans)

print(max(la))

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

s = list()
for i in range(N):
    if S[i] == "A" or S[i] == "T" or S[i] == "G" or S[i] == "C":
        s.append(1)
    else:
        s.append(0)
#print(s)

lz = list()
cnt = 0
for i in range(N):
    if s[i] == 1:
        if cnt == 0:
            cnt = 1
        else:
            cnt += 1
    else:
        lz.append(cnt)
        cnt = 0
lz.append(cnt)
print(max(lz))
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count("AC"))

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

lc = [0]
c = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        c += 1
    lc.append(c)

for i in range(q):
    l, r = map(int, input().split())
    print(lc[r-1]-lc[l-1])

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

lac = list()
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        lac.append(i)


for i in range(q):
    l, r = map(int, input().split())
    print(sum(1 for x in lac if l-1 <= x <= r-2))


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

lc = [0]
c = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        c += 1
    lc.append(c)

for i in range(q):
    l, r = map(int, input().split())
    print(lc[r-1]-lc[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count("AC"))

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

lc = [0]
c = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        c += 1
    lc.append(c)

for i in range(q):
    l, r = map(int, input().split())
    print(lc[r-1]-lc[l-1])
Buggy python submission (verdict: Runtime Error):
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.isclose(math.log(i, j), round(math.log(i, j)), rel_tol = 0.0000001):
            print(i)
            exit()
    if i == 1:
        print(1)


Fixed submission:
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)

Buggy python submission (verdict: Runtime Error):
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.isclose(math.log(i, j), round(math.log(i, j)), rel_tol = 0.0000001):
            print(i)
            exit()
    if i == 1:
        print(1)


Fixed submission:
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)

Buggy python submission (verdict: Runtime Error):
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.isclose(math.log(i, j), round(math.log(i, j)), rel_tol = 0.0000001):
            print(i)
            exit()
    if i == 1:
        print(1)


Fixed submission:
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if abs(math.log(i, j) - round(math.log(i, j))) <= 0.0000001:
            print(i)
            exit()
    if i == 1:
        print(1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

la = [0] * (m+2)
li = [0] + [1]*m + [0]

lall = [la]
for i in range(n):
    lall.append(li)
lall.append(la)

# print(lall)
lcnt = [[0]*(m+2)]
for i in range(n+1):
    lcnt.append([0]*(m+2))
#nprint("lcnt =", lcnt)
 
for i in range(1, n+1):
    for j in range(1, m+1):
#        if lall[i-1][j-1:j+2] == [1,1,1] and lall[i][j-1] == 1 and lall[i][j+1] == 1 and lall[i+1][j-1:j+2] == [1,1,1]:
        for p in range(3):
            for q in range(3):
                lcnt[i-1+p][j-1+q] += 1
#                 print(i-1+p,j-1+q, lcnt[i-1+p][j-1+q], lcnt)

ans = 0
for i in range(1, n+1):
    for j in range(1, m+1):
        if lcnt[i][j] % 2 == 1:
            ans += 1

print(ans)

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

if min(n, m) == 1:
    if max(n, m) == 1:
        print(1)
    else:
        print(max(n, m)-2)
elif min(n, m) == 2:
    print(0)
else:
    print((n-2)*(m-2))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n, y = map(int, input().split())

t = (1000, 5000, 10000)
l = list(itertools.combinations_with_replacement(t, n))

for i in range(len(l)):
    if sum(l[i]) == y:
        print(l[i].count(10000), l[i].count(5000), l[i].count(1000))
        exit()
        
print('-1 -1 -1')

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

for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
N = int(input())
la = list(map(int, input().split()))

lcnt = [0] * (max(la) + 1)

for i in range(N):
    lcnt[la[i]-2] += 1
    lcnt[la[i]-1] += 1
    lcnt[la[i]] += 1

print(max(lcnt))

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

lcnt = [0] * (max(la) + 3)

for i in range(N):
    lcnt[la[i]+2] += 1
    lcnt[la[i]+1] += 1
    lcnt[la[i]] += 1

print(max(lcnt))