Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


H, W, M = MI()

R = np.zeros(H + 1)
C = np.zeros(W + 1)
bombs = []
for _ in range(M):
    h, w = MI()
    bombs.append((h, w))
    R[h] += 1
    C[w] += 1

R_max = np.where(R == max(R))
C_max = np.where(C == max(C))

ans = max(R) + max(C)
for r in R_max[0]:
    for c in C_max[0]:
        if (r, c) not in bombs:
            print(int(ans))
            exit()

print(int(ans - 1))


Fixed submission:
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


H, W, M = MI()

R = np.zeros(H + 1)
C = np.zeros(W + 1)
bombs = []
for _ in range(M):
    h, w = MI()
    bombs.append((h, w))
    R[h] += 1
    C[w] += 1

R_max = [R == max(R)]
ans = max(R) + max(C)
C_max = [C == max(C)]

cnt = 0
for h, w in bombs:
    if R_max[0][h] and C_max[0][w]:
        cnt += 1

if cnt == np.count_nonzero(R_max) * np.count_nonzero(C_max):
    print(int(ans - 1))
else:
    print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


def print_sum(d):
    s = 0
    for k, v in d.items():
        s += k * v
    print(s)


n = I()
al = list(MI())
q = I()

a = Counter(al)

for i in range(q):
    b, c = MI()
    if b in a.keys():
        v = a.pop(b)
        if c in a.keys():
            a[c] += v
        else:
            a[c] = v

    print_sum(a)


Fixed submission:
import sys
from collections import Counter

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


n = I()
al = list(MI())
q = I()

a = Counter(al)

s = sum(al)
for _ in range(q):
    b, c = MI()
    if b in a.keys():
        v = a.pop(b)
        if c in a.keys():
            a[c] += v
        else:
            a[c] = v
        s += (c - b) * v
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


n = I()
al = list(MI())

ans = 1
for i in al:
    ans *= i

if ans > 10 ** 18:
    print("-1")
else:
    print(ans)


Fixed submission:
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


n = I()
a = list(MI())

if 0 in a:
    print("0")
    exit()
else:
    ans = 1
    for i in a:
        if i == 1:
            continue
        ans *= i
        if ans > 10 ** 18:
            print("-1")
            exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
from math import sqrt, floor

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def main():
    a, b, n = MI()

    if b - 1 <= n:
        print((a * (b - 1)) // b)
    else:
        print((a * n) // b)) #- (a * (n // b)))


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt, floor

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def main():
    a, b, n = MI()

    if b - 1 <= n:
        print((a * (b - 1)) // b - (a * ((b - 1) // b)))
    else:
        print((a * n) // b - (a * (n // b)))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt, floor
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    a, b, n = MI()
    max = 0
    for x in range(1, n + 1):
        r = floor((a * x) / b) - a * floor(x / b)
        if max < r:
            max = r

    print(max)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt, floor

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def main():
    a, b, n = MI()

    if b - 1 <= n:
        print((a * (b - 1)) // b - (a * ((b - 1) // b)))
    else:
        print((a * n) // b - (a * (n // b)))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


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


def LI():
    return list(MI())


def LIN(n: int):
    return [I() for _ in range(n)]


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    s = input().rstrip()

    li = {}
    for i in range(6, 1000):
        n = str(19 * i)[-3:]
        if not ("0" in n):
            li[i] = n

    lens = len(s)
    c = 0
    for k, v in li.items():
        for pos in range(lens):
            if s[: pos + 1].endswith(v):
                if s[: pos + 1].endswith(str(2019 * k)):
                    c += 1

    print(c)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
import numpy as np

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


S = ST()

cnt = np.zeros(2019)
cnt[0] = 1
res = 0
tmp = 1
for s in S[::-1]:
    res += int(s) * tmp
    res %= 2019
    cnt[res] += 1
    tmp *= 10
    tmp %= 2019

ans = 0
for c in cnt[cnt >= 2]:
    ans += c * (c - 1) // 2

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


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


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    _ = I()
    a_list = input().split()

    c = Counter(a_list)
    dict = {}
    for k1, v1 in c.items():
        t = 0
        for k2, v2 in c.items():
            if k1 == k2:
                v2 -= 1
            if v2 >= 2:
                t += int(v2 * (v2 - 1) / 2)
            dict[k1] = t

    for a in a_list:
        print(dict[a])
    pass


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


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


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    _ = I()
    a_list = input().split()

    c = Counter(a_list)
    n = {}
    t = 0
    for k, v in c.items():
        n[k] = v - 1
        if v >= 2:
            t += int(v * (v - 1) / 2)

    for a in a_list:
        print(t - n[a])
    pass


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
num = [
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    5,
    2,
    2,
    1,
    5,
    1,
    2,
    1,
    14,
    1,
    5,
    1,
    5,
    2,
    2,
    1,
    15,
    2,
    2,
    5,
    4,
    1,
    4,
    1,
    51,
]
input = int(input())
print(num[input])


Fixed submission:
num = [
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    5,
    2,
    2,
    1,
    5,
    1,
    2,
    1,
    14,
    1,
    5,
    1,
    5,
    2,
    2,
    1,
    15,
    2,
    2,
    5,
    4,
    1,
    4,
    1,
    51,
]
input = int(input())
print(num[input - 1])

Buggy python submission (verdict: Runtime Error):
list = [
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    5,
    2,
    2,
    1,
    5,
    1,
    2,
    1,
    14,
    1,
    5,
    1,
    5,
    2,
    2,
    1,
    15,
    2,
    2,
    5,
    4,
    1,
    4,
    1,
    51,
]
input = int(input())
print(list[input])


Fixed submission:
num = [
    1,
    1,
    1,
    2,
    1,
    2,
    1,
    5,
    2,
    2,
    1,
    5,
    1,
    2,
    1,
    14,
    1,
    5,
    1,
    5,
    2,
    2,
    1,
    15,
    2,
    2,
    5,
    4,
    1,
    4,
    1,
    51,
]
input = int(input())
print(num[input - 1])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


S = ST()
Q = I()

for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        S = S[::-1]
    else:
        if query[1] == "1":
            S = query[2] + S
        else:
            S = S + query[2]

print(S)


Fixed submission:
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


S = ST()
Q = I()

switch = True
prefix = ""
suffix = ""
for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        if switch:
            switch = False
        else:
            switch = True
    else:
        if switch:
            if query[1] == "1":
                prefix = query[2] + prefix
            else:
                suffix = suffix + query[2]
        else:
            if query[1] == "1":
                suffix = suffix + query[2]
            else:
                prefix = query[2] + prefix

ans = prefix + S + suffix
if switch:
    print(ans)
else:
    print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


S = ST()
Q = I()

for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        S = S[::-1]
    else:
        if query[1] == "1":
            S = query[2] + S
        else:
            S = S + query[2]

print(S)


Fixed submission:
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


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


def LI():
    return list(MI())


S = ST()
Q = I()

switch = True
prefix = ""
suffix = ""
for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        if switch:
            switch = False
        else:
            switch = True
    else:
        if switch:
            if query[1] == "1":
                prefix = query[2] + prefix
            else:
                suffix = suffix + query[2]
        else:
            if query[1] == "1":
                suffix = suffix + query[2]
            else:
                prefix = query[2] + prefix

ans = prefix + S + suffix
if switch:
    print(ans)
else:
    print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n = I()
    a1 = MI()
    a2 = MI()

    max = 0
    for i in range(n):
        candy = sum(a1[0:i]) + sum(a2[i:n])
        if candy > max:
            max = candy
    print(max)
    pass


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n = I()
    a1 = LI()
    a2 = LI()

    max = 0
    for i in range(n):
        candy = sum(a1[0 : i + 1]) + sum(a2[i:n])
        if candy > max:
            max = candy
    print(max)
    pass


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    _ = I()
    a_list = MI()

    min = inf
    for a in a_list:
        c = 0
        while a % 2 == 0:
            c += 1

        if min > c:
            min = c

    print(min)
    pass


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    _ = I()
    a_list = MI()

    min = inf
    for a in a_list:
        c = 0
        while a % 2 == 0 and c < min:
            c += 1
            a /= 2

        if min > c:
            min = c

    print(min)
    pass


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, k = MI()
    a_list = MI()

    c = Counter(a_list)
    n_key = len(c)
    n_rewrite = 0
    while n_key > k:
        n_rewrite += c.pop(c.most_common()[-1][0])
        n_key -= 1

    print(n_rewrite)
    pass


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, k = MI()
    a_list = MI()

    c = Counter(a_list)
    sum = 0
    if len(c) <= k:
        print("0")
        exit()

    for l in c.most_common()[k:]:
        sum += l[1]
    print(sum)
    pass


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, k = MI()
    a_list = MI()

    c = Counter(a_list)
    n_key = len(c)
    n_rewrite = 0
    while n_key > k:
        n_rewrite += c.pop(c.most_common()[-1][0])
        n_key -= 1

    print(n_rewrite)
    pass


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    n, k = MI()
    a_list = MI()

    c = Counter(a_list)
    sum = 0
    if len(c) <= k:
        print("0")
        exit()

    for l in c.most_common()[k:]:
        sum += l[1]
    print(sum)
    pass


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = N // i + 1
    for j in range(1, cnt+1):
        if i * j >= N:
            break
#         print(1, j)
        ans += 1
print(ans)



Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = (N-1) // i
#     for j in range(1, cnt+1):
#         if i * j >= N:
#             break
#         print(1, j)
    ans += cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(1, N+1):
        if i * j >= N:
            break
#         print(1, j)
        ans += 1
print(ans)



Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = (N-1) // i
#     for j in range(1, cnt+1):
#         if i * j >= N:
#             break
#         print(1, j)
    ans += cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
mport sys
import numpy as np
import math
import collections
import copy
import decimal
import itertools
from collections import deque 
from functools import reduce
from itertools import product
from itertools import combinations

# input = sys.stdin.readline
N = int(input())
An = list(map(int, input().split()))
An_l = list(itertools.accumulate(An))
An_l.insert(0, 0)
ans = 0
for i, A in enumerate(An):
    tt = An_l[-1] - An_l[i+1]
#     print(i, An_l[-1], An_l[i], tt)
    At = A * tt
#     print(A, tt, At)
    ans = (ans+At) % (10**9+7)
#     print(ans)
print(ans)



Fixed submission:
N = int(input())
An = list(map(int, input().split()))
tt = sum(An)
total = tt
ans = 0
for A in An:
    At = A * (total-A)
#     if v == 1:
#         At = A * (tt-A)
#     else:
#         At = A * (tt-A*v)*v
#     print(A, total, At, ans)
#     md = At % (10**9+7)
    ans = (ans+At) % (10**9+7)
    total -= A
#     print(ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
An = list(map(int, input().split()))
An_s = collections.Counter(An)
total = 0
for k in An_s:
    total += k
ans = 0
for A, v in An_s.items():
    At = A * (total-A)*v
#     print(A, total, At, ans)
    ans = (ans+At) % (10**9+7)
#     print(ans)
print(ans//2)

Fixed submission:
N = int(input())
An = list(map(int, input().split()))
tt = sum(An)
total = tt
ans = 0
for A in An:
    At = A * (total-A)
#     if v == 1:
#         At = A * (tt-A)
#     else:
#         At = A * (tt-A*v)*v
#     print(A, total, At, ans)
#     md = At % (10**9+7)
    ans = (ans+At) % (10**9+7)
    total -= A
#     print(ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import math
import collections
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
ret = 0
for i in range(1, n+1):
    ls = make_divisors(i)
    ret += i * len(ls)
print(ret)
  




Fixed submission:
n = int(input())
ret = 0
for i in range(1, n+1):
    cnt = n // i
    tt = cnt * (cnt+1) * i // 2
    ret += tt
print(ret)
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

n = int(input())
az = "abcdefghijklmnopqrstuvwxyz"
cnt = 12
ret = []
ama = n % 26
na = n
for i in range(12, 0, -1):
    if 26**(i-1) > n:
        continue
    sho = na // (26**i)
    if sho > 0:
        ret.append(az[sho-1])
    else:
        if len(ret) > 0:
            ret.append('z')
    na -= sho * (26**i)
if (ret[0] == 'z'):
    del ret[0]
re = "".join(ret)
print(re)



Fixed submission:
import sys
import numpy as np
import math
import collections
from collections import deque 
from functools import reduce

# input = sys.stdin.readline
n = int(input())
ret = ''
while(n > 0):
    n -= 1
    ret += chr(ord('a') + n % 26)
    n //= 26
print(ret[::-1])
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
f = False
for i in range(x+1):
    for j in range(x+1):
        if (y == (i*2 + j*4)):
            if (x == i + j):
                f = True
                break
    if f:
        breakif f:
    print("Yes")
else:
    print("No")            


Fixed submission:
x, y = map(int, input().split())
f = False
for i in range(x+1):
    for j in range(x+1):
        if (y == (i*2 + j*4)):
            if (x == i + j):
                f = True
                break
    if f:
        break
if f:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
f = False
for i in range(x+1):
    for j in range(x+1):
        if (y == (i*2 * j*4)):
            if (x == i + j)
                f = True
                break;
if f:
    print("Yes")
else:
    print("No")            
            

Fixed submission:
x, y = map(int, input().split())
f = False
for i in range(x+1):
    for j in range(x+1):
        if (y == (i*2 + j*4)):
            if (x == i + j):
                f = True
                break
    if f:
        break
if f:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
an = map(int, input().split())
num = 1
num = 1
for i in an:
    num *= i
    if (i == 0):
        num = 0
        break
    
if num > 10**18:
    print(-1)
else:
    print(num)

Fixed submission:
n = int(input())
an = map(int, input().split())
num = 1
max = 10**18
for i in an:
    if num < max:
         num *= i
    if (i == 0):
        num = 0
        break
    
if num > 10**18:
    print(-1)
else:
    print(num)

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

an = map(int, input().split())

num = 1
for i in an:
    num *= i
    
if num > 10**18:
    print(-1)
else:
    print(num)    

Fixed submission:
n = int(input())
an = map(int, input().split())
num = 1
max = 10**18
for i in an:
    if num < max:
         num *= i
    if (i == 0):
        num = 0
        break
    
if num > 10**18:
    print(-1)
else:
    print(num)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

a = 0
while(True):
    a5 = a ** 5
    b = x - a5
    b = int(x ** (1 / 5))
    b5 = b**5
    if a5 - b5 == x:
        break
#     if a5 - (b5*-1) == x:
#         b *= -1
#         break
    b = x + a5
    b = int(x ** (1 / 5))
    b5 = b**5
    if a5 - b5 == x:
        a *= -1
        break
#     if a5 - (b5*-1) == x:
#         a *= -1
#         b *= -1
#         break
    a += 1
print(a, b)    

Fixed submission:
x = int(input())

flg = 'n'
for a in range(-120, 121, 1):
    for b in range(-120, 121, 1):
        if a ** 5 - b ** 5 == x:
            flg = 'y'
            break
    if flg == 'y':
        break
print(a, b)

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

a = 0
while(True):
    a5 = a ** 5
    b = x - a5
    b = int(x ** (1 / 5))
    b5 = b**5
    if a5 - b5 == x:
        break
    if a5 - (b5*-1) == x:
        b *= -1
        break
    b = x + a5
    b5 = b**5
    if a5 - b5 == x:
        a *= -1
        break
    if a5 - (b5*-1) == x:
        a *= -1
        b *= -1
        break
    a += 1
    
print(a, b) 

Fixed submission:
x = int(input())

flg = 'n'
for a in range(-120, 121, 1):
    for b in range(-120, 121, 1):
        if a ** 5 - b ** 5 == x:
            flg = 'y'
            break
    if flg == 'y':
        break
print(a, b)

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

a = 0
while(True):
    b = x - a ** 5
    b = int(x ** (1 / 5))
    if a ** 5 - b ** 5 == x:
        break
    if a ** 5 - (b*-1)** 5 == x:
        b *= -1
        break
    b = x + a ** 5
    if a ** 5 - b ** 5 == x:
        a *= -1
        break
    if a ** 5 - (b*-1)** 5 == x:
        a *= -1
        b *= -1
        break
    a += 1
print(a, b) 

Fixed submission:
x = int(input())

flg = 'n'
for a in range(-120, 121, 1):
    for b in range(-120, 121, 1):
        if a ** 5 - b ** 5 == x:
            flg = 'y'
            break
    if flg == 'y':
        break
print(a, b)