Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))

b_list = []

for i, a in enumerate(a_list):
    if i % 2 == 0:
        b_list.insert(0, a)
    else:
        b_list.append(a)

if n % 2 ==0:
    b_list.reverse()
print(" ".join(map(str, b_list)))


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

b_list_even = []
b_list_odd = []
for i, a in enumerate(a_list , start=1):
    if i % 2 == 0:
        b_list_even.append(a)
    else:
        b_list_odd.append(a)


if n % 2 != 0:
    b_list_odd.reverse()
    b_list = b_list_odd + b_list_even
else:
    b_list_even.reverse()
    b_list = b_list_even + b_list_odd

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

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

b_list = []

for a in a_list:
    b_list.append(a)
    b_list.reverse()

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


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

b_list_even = []
b_list_odd = []
for i, a in enumerate(a_list , start=1):
    if i % 2 == 0:
        b_list_even.append(a)
    else:
        b_list_odd.append(a)


if n % 2 != 0:
    b_list_odd.reverse()
    b_list = b_list_odd + b_list_even
else:
    b_list_even.reverse()
    b_list = b_list_even + b_list_odd

print(" ".join(map(str, b_list)))
Buggy python submission (verdict: Runtime Error):
rgb = input()
print("YES" if int(rgb) % 4 == 0 else "NO")

Fixed submission:
r, g, b = input().split()
print("YES" if int(r+g+b) % 4 == 0 else "NO")
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

result = []
for h in range(1, (H+1)//2):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, (W+1)//2):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))


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

result = []
for h in range(1, H):
    Sa = W * h

    remain = H - h
    h2 = (remain + 1) // 2
    Sb1 = W * h2
    Sc1 = W * (remain - h2)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    w = (W + 1) // 2
    Sb2 = w * remain
    Sc2 = (W - w) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

for w in range(1, W):
    Sa = H * w

    remain = W - w
    w3 = (remain + 1) // 2
    Sb1 = H * w3
    Sc1 = H * (remain - w3)
    result.append(max(Sa, Sb1, Sc1) - min(Sa, Sb1, Sc1))

    h = (H + 1) // 2
    Sb2 = h * remain
    Sc2 = (H - h) * remain
    result.append(max(Sa, Sb2, Sc2) - min(Sa, Sb2, Sc2))

print(min(result))
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
items = []

start = []
diff = float("inf")
p = []
prev = [[False] * W for _ in range(H)]
for i in range(H):
    items.append(list(input()))
    for j in range(W):
        s = items[i][j]
        if s == "S":
            start = [i, j]
            diff = min(diff, min(i, H - 1 - i, min(j, W - 1 - j)))
            p = [i, j]
            prev[i][j] = True

from collections import deque

que = deque([])

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]

for i in range(4):
    x = dx[i]
    y = dy[i]
    if 0 <= start[0] + y <= H - 1 and 0 <= start[1] + x <= W - 1:
        tmp = items[start[0] + y][start[1] + x]
        if tmp == ".":
            que.append((start[0] + y, start[1] + x))
k = K
while len(que) != 0:
    q = que.popleft()
    a = q[0]
    b = q[1]
    if abs(start[0] - a) + abs(start[1] - b) > K:
        continue

    prev[a][b] = True
    c = min(min(a, H - 1 - a), min(b, W - 1 - b))
    if c < diff:
        diff = c
        p = (a, b)

    for i in range(4):
        x = dx[i]
        y = dy[i]
        if 0 <= a + y <= H - 1 and 0 <= b + x <= W - 1:
            if prev[a + y][b + x]:
                continue
            tmp = items[a + y][b + x]
            if tmp == ".":
                que.append((a + y, b + x))
    k -= 1

ans = 1
if diff == 0:
    print(ans)
else:
    print(ans + (K - 1 + diff) // K)


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

sum_num = A + B + C

before_A = A
before_B = B
before_C = C
count = 1

if before_A % 2 == 1 or before_B % 2 == 1 or before_C % 2 == 1:
    print(0)
    exit()

while True:
    after_A = (sum_num - before_A) // 2
    after_B = (sum_num - before_B) // 2
    after_C = (sum_num - before_C) // 2
    if after_A == before_A and after_B == before_B and after_C == before_C:
        print(-1)
        exit()

    if after_A % 2 == 0 and after_B % 2 == 0 and after_C % 2 == 0:
        count += 1
        before_A = after_A
        before_B = after_B
        before_C = after_C

    else:
        print(count)
        exit()
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

ab_list = []
cd_list = []

for i in range(N):
    ab = list(map(int, input().split()))
    ab_list.append(ab)

for i in range(M):
    cd = list(map(int, input().split()))
    cd_list.append(cd)

for a, b in ab_list:
    num = -1
    min_num = 10 ** 10 + 1
    count = 0
    for c, d in cd_list:
        count += 1
        distance = abs(a-c) + abs(b-d)
        if distance < min_num:
            min_num = distance
            num = count
    print(num)

Fixed submission:
A, B = map(int, input().split())
if A+B < 24:
   print(A+B)
else:
    print(A+B-24)
Buggy python submission (verdict: Time Limit Exceeded):
N, C, K = map(int, input().split())
t_list = [int(input()) for i in range(N)]

t_list.sort()

count = 0
i = 0
while t_list:
    passenger = 1
    t = t_list.pop(0)
    count += 1
    while t_list:
        tmp = t_list.pop(0)

        if passenger < C and tmp - t <= K:
            passenger += 1
        else:
            t_list.insert(0, tmp)
            break

print(count)

Fixed submission:
N, C, K = map(int, input().split())
t_list = [int(input()) for i in range(N)]

t_list.sort()

count = 0
passenger = 0
time = 0

for t in t_list:
    if passenger == 0:
        passenger += 1
        count += 1
        time = t
    elif 1 <= passenger < C:
        if t - time <= K:
            passenger += 1
        else:
            passenger = 1
            count += 1
            time = t
    else:
        passenger = 1
        count += 1
        time = t

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(2, N+1):
    p *= i
print(p % (10**9 + 7))

Fixed submission:
N = int(input())
p = 1
for i in range(2, N+1):
    p = p * i % (10**9+7)
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(2, N+1):
    p *= i
print(p % (10**9 + 7))

Fixed submission:
N = int(input())
p = 1
for i in range(2, N+1):
    p = p * i % (10**9+7)
print(p)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a_list = []
b_list = []

for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

count = 0
for i in range(N-1, -1, -1):
    a = a_list[i]
    b = b_list[i]
    if b == 1:
        continue

    if b % a == 0:
        continue

    if count > 0:
        a += count

    margin = b - (a % b)
    count += margin
print(count)

Fixed submission:
N = int(input())
a_list = []
b_list = []

for i in range(N):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

count = 0
for i in range(N-1, -1, -1):
    a = a_list[i]
    b = b_list[i]
    if a == 0:
        continue
    if b == 1:
        continue

    if count > 0:
        a += count
    if a % b == 0:
        continue

    margin = b - (a % b)
    count += margin
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
zero = a_list.count(0)
D = 1000000000 + 7
a_set = set(a_list)
if zero == 1 and n -1 == 2 * a_set:
    print(2 ** ((n-1)//2) % D)
elif zero == 0 and n == 2 * a_set:
    print(2 ** (n//2) % D)
else:
    print(0)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
zero = a_list.count(0)
D = 1000000000 + 7
a_set = set(a_list)
if zero == 1 and n - 1 == 2 * (len(a_set)-1):
    print(2 ** ((n-1)//2) % D)
elif zero == 0 and n == 2 * len(a_set):
    print(2 ** (n//2) % D)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p_list = list(map(int, input().split()))

r = {}
for i in range(N):
    r[p_list[i]] = i + 1

a_list = []
b_list = []

for i in range(1, N + 1):
    a_list.append(30000 * i)
    b_list.append(30000 * (N - i) + r[i - 1])

print(*a_list)
print(*b_list)


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

r = {}
for i in range(N):
    r[p_list[i]] = i + 1

a_list = []
b_list = []
for i in range(1, N + 1):
    a_list.append(30000 * i)
    b_list.append(30000 * (N - i) + r[i])

print(*a_list)
print(*b_list)
Buggy python submission (verdict: Time Limit Exceeded):
X = input()

for i in range(len(X)//2):
    X = X.replace("ST", "")

print(len(X))

Fixed submission:
X = input()

x_length = len(X)
stack = []

for i in range(x_length):
    x = X[i]
    if x == "S":
        stack.append(x)

    elif x == "T" and stack and stack[-1] == "S":
        stack.pop()

    else:
        stack.append(x)
print(len(stack))
Buggy python submission (verdict: Time Limit Exceeded):
H, W, N = map(int, input().split())
ab = []
for i in range(N):
    a, b = map(int, input().split())
    ab.append((a - 1, b - 1))

comb_map = {}
if N >= 1:
    for i in range(0, H - 2):
        for j in range(0, W - 2):
            comb_map[(i, j)] = 0

    for a, b in ab:
        for k in range(3):
            for m in range(3):
                if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:
                    comb_map[(a - k, b - m)] += 1

count = [0 for _ in range(10)]

for v in comb_map.values():
    count[v] += 1

count[0] = (H - 2) * (W - 2) - sum(count[1:])

for c in count:
    print(c)


Fixed submission:
H, W, N = map(int, input().split())
ab = []
for i in range(N):
    a, b = map(int, input().split())
    ab.append((a - 1, b - 1))

comb_map = {}


for a, b in ab:
    for k in range(3):
        for m in range(3):
            if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:
                if (a-k, b-m) in comb_map.keys():
                    comb_map[(a - k, b - m)] += 1
                else:
                    comb_map[(a - k, b - m)] = 1

count = [0 for _ in range(10)]

for v in comb_map.values():
    count[v] += 1

count[0] = (H - 2) * (W - 2) - sum(count[1:])

for c in count:
    print(c)

Buggy python submission (verdict: Time Limit Exceeded):
H, W, N = map(int, input().split())
ab = []
for i in range(N):
    a, b = map(int, input().split())
    ab.append((a - 1, b - 1))

comb_map = {}
if N >= 1:
    for i in range(0, H - 2):
        for j in range(0, W - 2):
            comb_map[(i, j)] = 0

    for a, b in ab:
        for k in range(3):
            for m in range(3):
                if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:
                    comb_map[(a - k, b - m)] += 1

count = [0 for _ in range(10)]

for v in comb_map.values():
    count[v] += 1

count[0] = (H - 2) * (W - 2) - sum(count[1:])

for c in count:
    print(c)


Fixed submission:
H, W, N = map(int, input().split())
ab = []
for i in range(N):
    a, b = map(int, input().split())
    ab.append((a - 1, b - 1))

comb_map = {}


for a, b in ab:
    for k in range(3):
        for m in range(3):
            if 0 <= a - k < H - 2 and 0 <= b - m < W - 2:
                if (a-k, b-m) in comb_map.keys():
                    comb_map[(a - k, b - m)] += 1
                else:
                    comb_map[(a - k, b - m)] = 1

count = [0 for _ in range(10)]

for v in comb_map.values():
    count[v] += 1

count[0] = (H - 2) * (W - 2) - sum(count[1:])

for c in count:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
for i in range(N):
    cost = 0
    for j in range(N):
        cost += min(ex_list[N-i+j:N+1+j])

    cost += x * i
    ans = min(ans, cost)
print(ans)


Fixed submission:
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
cost_list = [float("inf") for _ in range(N)]
for i in range(N):
    cost = 0
    for j in range(N):
        if i == 0:
            cost += ex_list[N + j]
            cost_list[j] = ex_list[N + j]
        else:
            tmp = cost_list[j]
            if tmp > ex_list[N - i + j]:
                cost_list[j] = ex_list[N - i + j]
                cost += ex_list[N - i + j]
            else:
                cost += tmp

    cost += x * i
    ans = min(ans, cost)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
for i in range(N):
    cost = 0
    for j in range(N):
        cost += min(ex_list[N-i+j:N+1+j])

    cost += x * i
    ans = min(ans, cost)
print(ans)


Fixed submission:
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
ex_list = a_list.copy()
ex_list.extend(a_list)

ans = float("inf")
cost_list = [float("inf") for _ in range(N)]
for i in range(N):
    cost = 0
    for j in range(N):
        if i == 0:
            cost += ex_list[N + j]
            cost_list[j] = ex_list[N + j]
        else:
            tmp = cost_list[j]
            if tmp > ex_list[N - i + j]:
                cost_list[j] = ex_list[N - i + j]
                cost += ex_list[N - i + j]
            else:
                cost += tmp

    cost += x * i
    ans = min(ans, cost)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
fac = [1 for _ in range(10**6+1)]
for i in range(1, 10 **6):
    fac[i+1] = fac[i] * (i + 1)

def combination(n, r):
    result = fac[n] // (fac[r] * fac[n-r])
    return result

for i in range(B, W):
    ans += (combination(H - A - 1 + i, i) * combination(A - 1 + W - i - 1, W - i -1))
    ans %= mod
print(ans)


Fixed submission:
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
X = [i for i in range(H + W + 1)]
X[0] = 1
for i in range(2, H + W + 1):
    X[i] = X[i - 1] * i % mod
Y = X.copy()
Y[-1] = pow(Y[-1], mod - 2, mod)
for i in range(H + W, 1, -1):
    Y[i - 1] = i * Y[i] % mod


def combination(x, y):
    return X[x] * Y[y] * Y[x - y] % mod


for i in range(B, W):
    ans += (combination(H - A - 1 + i, i) * combination(A - 1 + W - i - 1, W - i -1))
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
fac = [1 for _ in range(10**6+1)]
for i in range(1, 10 **6):
    fac[i+1] = fac[i] * (i + 1)

def combination(n, r):
    result = fac[n] // (fac[r] * fac[n-r])
    return result

for i in range(B, W):
    ans += (combination(H - A - 1 + i, i) * combination(A - 1 + W - i - 1, W - i -1))
    ans %= mod
print(ans)


Fixed submission:
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
X = [i for i in range(H + W + 1)]
X[0] = 1
for i in range(2, H + W + 1):
    X[i] = X[i - 1] * i % mod
Y = X.copy()
Y[-1] = pow(Y[-1], mod - 2, mod)
for i in range(H + W, 1, -1):
    Y[i - 1] = i * Y[i] % mod


def combination(x, y):
    return X[x] * Y[y] * Y[x - y] % mod


for i in range(B, W):
    ans += (combination(H - A - 1 + i, i) * combination(A - 1 + W - i - 1, W - i -1))
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import sys

n,k = map(int, input().split())
hlist = input().split()
hlist.sort(reverse=True)

if (n-k) <= 0:
  print(0)
  sys.exit()
sum = 0
for i in range(n):
  if i > k-1:
    sum = sum + int(hlist[i])
print(sum)

Fixed submission:
import math

a,b = map(int, input().split())
print(math.ceil(a/b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int, input().split()))
tester=True
for i in range(n):
    for j in range(i+1,n):  
        if l[i]==l[j]:
            tester=False
            break

if tester==True:
    print('YES')
else:
    print('NO')




Fixed submission:
s,t=map(str, input().split())
a,b=map(int, input().split())
u=input()
if s==u:
    if t==u:
        print(a-1,b-1)
    else:
        print(a-1,b)
else:
    if t==u:
        print(a,b-1)
    else:
        print(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int, input().split()))
tester=True
for i in range(n):
    for j in range(i+1,n):  
        if l[i]==l[j]:
            tester=False
            break

if tester==True:
    print('YES')
else:
    print('NO')




Fixed submission:
n=int(input())
l=list(map(int, input().split()))
s=set(l)
if len(l)==len(s):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int, input().split()))
tester=True
for i in range(n):
    for j in range(n):
        if i!=j:
            if l[i]==l[j]:
                tester=False
                break
            
if tester==True:
    print('YES')
else:
    print('NO')




Fixed submission:
n=int(input())
l=list(map(int, input().split()))
s=set(l)
if len(l)==len(s):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n=int(input())
li=list(map(int, input().split()))
ans=1
for i in range(1,n):
    lis=li[:i]
    if min(lis)>=li[i]:
        ans=ans+1
print(ans)


Fixed submission:
n,m=map(int, input().split())
if n==m:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
li=list(map(int, input().split()))
ans=1
for i in range(1,n):
    lis=li[:i]
    if min(lis)>=li[i]:
        ans=ans+1
print(ans)


Fixed submission:
n=int(input())
li=list(map(int, input().split()))
ans=0
min=li[0]
for i in range(n):
    if li[i]<=min:
        ans=ans+1
        min=li[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
li_1=list(range(m))
li_2=list(range(m))
pr=list(range(n))
wa=0
ac=0
for i in range(n):
    pr[i]=0
for i in range(m):
    li_1[i],li_2[i]=map(str, input().split())
    li_1[i]=int(li_1[i])

for i in range(m):
    if li_2[i]=='AC':
        a=li_1[i]-1
        if pr[a]==0:
            for j in range(i):
                if li_1[j]==li_1[i]:
                    wa=wa+1
            pr[a]=1
            ac=ac+1
print(ac,wa)


Fixed submission:
alf=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
C=input()
counter=1
for i in alf:
    if i==C:
        ans=alf[counter]
    counter=counter+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
li_1=list(range(m))
li_2=list(range(m))
pr=list(range(n))
wa=0
ac=0
for i in range(n):
    pr[i]=0
for i in range(m):
    li_1[i],li_2[i]=map(str, input().split())
    li_1[i]=int(li_1[i])

for i in range(m):
    if li_2[i]=='AC':
        a=li_1[i]-1
        if pr[a]==0:
            for j in range(i):
                if li_1[j]==li_1[i]:
                    wa=wa+1
            pr[a]=1
            ac=ac+1
print(ac,wa)


Fixed submission:
n,m=map(int, input().split())
li_1=list(range(m))
li_2=list(range(m))
pr=list(range(n))
wr=list(range(n))
wa=0
ac=0
for i in range(n):
    pr[i]=0
    wr[i]=0
for i in range(m):
    li_1[i],li_2[i]=map(str, input().split())
    li_1[i]=int(li_1[i])

for i in range(m):
    if li_2[i]=='AC':
        a=li_1[i]-1
        if pr[a]==0:
            wa=wr[a]+wa
            pr[a]=1
            ac=ac+1
    else:
        a = li_1[i] - 1
        wr[a]=wr[a]+1
print(ac,wa)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
        break
if a.cout(0)>0:
    answer=0
print(answer)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
        break
if a.count(0)>0:
    answer=0
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
if a.count(0)>0:
    answer=0
print(answer)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
        break
if a.count(0)>0:
    answer=0
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
if answer>10**18:
    answer=-1
print(answer)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
answer=1
for i in range(n):
    answer*=a[i]
    if answer>10**18:
        answer=-1
        break
if a.count(0)>0:
    answer=0
print(answer)
Buggy python submission (verdict: Runtime Error):
x=int(input())
fifth_power=[0]*200
for i in range(200):
    fifth_power[i]=(i+1)**5
for i in range(200):
    t=x-fifth_power[i]
    if x==1:
        print(0,-1)
        break
    elif fifth_power.count(abs(t))==1:
        if i%2==0:
            print(fifth_power.index(abs(t))+1,i+1)
            break
        elif ifth_power[fifth_power.index(abs(t))]-fifth_power[1]==x:
            print(fifth_power.index(abs(t))+1,i+1)
            break
        else:
            print(fifth_power.index(abs(t))+1,-i-1)
            break

Fixed submission:
x=int(input())
fifth_power=[0]*200
for i in range(200):
    fifth_power[i]=(i+1)**5
for i in range(200):
    t=abs(x-fifth_power[i])
    if x==1:
        print(0,-1)
        break
    elif fifth_power.count(t)==1:
        if fifth_power[i]-t==x:
            print(i+1,fifth_power.index(t)+1)
            break
        else:
            print(i+1,-fifth_power.index(t)-1)
            break
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    print(a.count(i+1))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
number=[0]*n
for i in range(n-1):
    number[a[i]-1]+=1
for i in range(n):
    print(number[i])
Buggy python submission (verdict: Runtime Error):
print('No' if !(input().replace('hi','')) else 'Yes')

Fixed submission:
s=input()
answer='Yes'
for i in range(len(s)):
    if len(s)%2==1:
        answer='No'
        break
    elif i%2==0:
        if s[i]!='h' or s[i+1]!='i':
            answer='No'
print(answer)
Buggy python submission (verdict: Runtime Error):
import fraction
a,b=map(int,input().split())
print((a*b)//fraction.gcd(a,b))

Fixed submission:
import fractions
a,b=map(int,input().split())
print((a*b)//fractions.gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print((a*b)//math.gcd(a,b))

Fixed submission:
import fractions
a,b=map(int,input().split())
print((a*b)//fractions.gcd(a,b))