Problem:


Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    x = int(input())
    for i1 in range(-201, 201):
        for i2 in range(-201, 201):
            if i1**5 - i2**5 == x:
                print(i1, i2)
                sys.exit()

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())
def check():
    for a in range(-200,200):
        for b in range(-200,200):
            if a**5-b**5==X:
                print(a,b)
                return 0
check()

Submission status: Accepted

Solution code:
def main():
    x = int(input())

    for b in range(-200, 200):
        for a in range(b + 1, 200):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                exit()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve():
    x = int(input())
    for i in range(-150, 151):
        for j in range(-150,i):
            if i ** 5 - j ** 5 == x:
                print(i,j)
                return

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-150, 151):
    for j in range(-150,i):
        if i ** 5 - j ** 5 == x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1000):
    for j in range(i):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            exit()
        if i ** 5 + j ** 5 == x:
            print(i, -j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())

quint = [0] * 1001

for i in range(1, 1001):
  quint[i] = i ** 5
  
for i in range(0, 1001):
  a = X - quint[i] 
  b = X + quint[i]
  try:
    c = quint.index(a)
    print("{} {}".format(c, -i))
    break
  except:
    try:
      c = quint.index(b)
      print("{} {}".format(c, i))
      break
    except:
      continue

Submission status: Accepted

Solution code:
X = int(input())

for a in range(200):
    for b in range(-200, 1):
        if a**5-b**5==X:
            print(str(a) + " " + str(b))
            exit()

a = 0
b = 0

while True:
    cand = a**5-b**5
    if cand == X:
        print(str(a) + " " + str(b))
        exit()
    elif cand < X:
        a += 1
    else:
        b += 1

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-200,200):
    for j in range(-200,200):
        if i**5 - j**5 == x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    for i in range(-118, 120):
        for j in range(-119, 119):
            if i**5 - j**5 == x:
                print(i, j)
                exit()

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
X = int(input())
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]
div = make_divisors(X)
for i in range(len(div)):
    x = div[i]
    z = x**4 - X/x
    if z%5 == 0:
        s = z / 5
        if x**4 - 4*s >=0:
            y1 =( -x**2 + np.sqrt(x**4 - 4 * s)) / 2
            y2 =( -x**2 - np.sqrt(x**4 - 4 * s)) / 2 
            B1 = (-x + np.sqrt(x**2 + 4*y1))/2
            if B1.is_integer():
                B = B1
                A = B + x
                break
            B12 = (-x + np.sqrt(x**2 + 4*y2))/2
            if B12.is_integer():
                B = B12
                A = B + x
                break
            B2 = (-x - np.sqrt(x**2 + 4*y1))/2
            if B2.is_integer():
                B = B2
                A = B + x
                break
            B21 = (-x - np.sqrt(x**2 + 4*y2))/2
            if B21.is_integer():
                B = B21
                A = B + x
                break
print(int(A),int(B))

Submission status: Accepted

Solution code:
x=int(input())
for a in range(-200,200):
    for b in range(-200,200):
        if a**5-b**5==x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
x=int(input())

for a in range(-200,200):
    for b in range(-200,200):
        
        if a**5 - b**5 == x:
            print(a,b)
            break
        
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())

for A in range(-1000, 1000):
    for B in range(-1000, 1000):
        if A ** 5 - B ** 5 == X:
            print('%d %d' % (A, B))
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())

a = 0
b = 0
flg = True

while True:
  a += 1
  for i in range(a):
    if a**5 - i**5 == x:
      a = a
      b = i
      flg = False
      break
    elif a**5 + i**5 == x:
      a = a
      b = -i
      flg = False
      break
  if flg == False:
    break
  
a = str(a)
b = str(b)
print(a+' '+b)

Submission status: Accepted

Solution code:
x = int(input())

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]

p = make_divisors(x)

for i in p:
  for b in range(-1000,1000):
    if (b+i)**5 - b**5 == x:
      print(b+i,b)
      exit()

Submission status: Accepted

Solution code:
def main():
	X = int(input())
	fifth_power = [x ** 5 for x in range(201)]
	for i in range(len(fifth_power)):
		p = fifth_power[i]
		q1 = abs(X - p)
		q2 = abs(X + p)
		if q1 in fifth_power:
			if p + q1 == X:
				print(fifth_power.index(p), -fifth_power.index(q1))
			elif p - q1 == X:
				print(fifth_power.index(p), fifth_power.index(q1))
			return 0
		if q2 in fifth_power:
			print(fifth_power.index(q2), fifth_power.index(p))
			return 0

main()

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    x = I()

    for a in range(-118,119+1):
        for b in range(-119,118+1):
            if a**5-b**5==x:
                break
        if a**5-b**5==x:
            break
    print(a,b)
main()

Submission status: Accepted

Solution code:
def getval():
    return int(input())

def main(x):
    for i in range(-200,201):
        flag = False
        for j in range(-200,201):
            if i**5-j**5==x:
                print("{a} {b}".format(a=str(i),b=str(j)))
                flag = True
                break
        if flag:
            break
                
                

if __name__=="__main__":
    main(getval())

Submission status: Accepted

Solution code:
X = int(input())

N = 200

for a in range(-N, N):
    for b in range(-N, N):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())

l = [i**5 for i in range(1000)]

for i in range(len(l)-1):
    for j in range(i+1,len(l)):
        if l[j]-l[i]==x:
            print(int(l[j]**(1/5)),int(l[i]**(1/5)))
            exit()
        if l[j]+l[i]==x:
            print(int(l[j]**(1/5)),-int(l[i]**(1/5)))
            exit()
print('Not found')

Submission status: Accepted

Solution code:
a=int(input())
b=0
c=int(a**(1/2))
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if((i**5)-(j**5)==a):
            b=1
            break
    if(b==1):
        break
print(i,j)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-200, 200):
    k = i**5
    for j in range(-200, 200):
        if k - j**5 == x:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from itertools import chain

# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter
import math


def get_factors(X):
    """Xの約数を求める"""
    factors = []
    for i in range(1, math.ceil(X ** 0.5) + 1):
        if X % i == 0:
            factors.append(i)
            factors.append(X // i)
    factors.append(X)
    return sorted(factors)


def solve(X: int):
    factors = get_factors(X)

    # B < 0 の時
    a_max = math.floor(X ** (1 / 5))
    # A - B は X の約数
    for amb in factors:
        for a in range(1, a_max + 1):
            b = a - amb
            if a ** 5 - b ** 5 == X:
                return str(a) + ' ' + str(b)

    # B >= 0 の時
    a_min = math.ceil(X ** (1 / 5))
    a_max = math.floor(X ** (1 / 4))
    # A - B は X の約数
    for amb in factors:
        for a in range(a_min, a_max + 1):
            b = a - amb
            if a ** 5 - b ** 5 == X:
                return str(a) + ' ' + str(b)

    return (0, 0)


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    # X = map(int, line.split())
    X = int(next(tokens))  # type: int
    answer = solve(X)
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())

for i in range(-118,120):
    for j in range(-118,120) :
        if i**5-j**5==x :
            print(i,j)
            exit()
        else :
            continue

Submission status: Accepted

Solution code:
X = int(input())

check = False
for i in range(-118,120):
  for j in range(-118,120):
    if i ** 5 - j ** 5 == X:
      ans = [i,j]
      check = True
      break
  if check:
    break
    
print(*ans)

Submission status: Accepted

Solution code:
X = int(input())
Ans = 0
for A in range(1,1000):
    for B in range(-A,A):
        Tar = A**5 - B**5
        if Tar == X:
            Ans = [A,B]
            break
    if Ans != 0:
        break
print(*Ans)

Submission status: Accepted

Solution code:
def divisor(n):
    result = []
    i = 1
    while True:
        if i * i > n:
            break
        if n % i == 0:
            result.append(i)
            if i != int(n / i):
                result.append(int(n / i))
        i += 1
    return result


def calc(a, b):
    return a * a * a * a * a - b * b * b * b * b


MX = 100000

INF = int(MX**6)


def main():
    X = int(input())
    drs = divisor(X)
    for dr in drs:
        right = MX - dr
        left = -MX
        while right - left > 8:
            bp = int(left + (right - left) / 3)
            bq = int(left + 2 * (right - left) / 3)
            cp = calc(bp + dr, bp)
            cq = calc(bq + dr, bq)
            if cp > cq:
                left = bp
            else:
                right = bq

        mn = INF
        mnb = -2 * MX
        for bi in range(left - 64, right + 64):
            c = calc(bi + dr, bi)
            if mn > c:
                mnb = bi
                mn = c

        left = mnb
        right = MX - dr
        while left <= right:
            b = int((left + right) / 2)
            c = calc(b + dr, b)
            if c == X:
                print(b + dr, b)
                return
            elif c < X:
                left = b + 1
            else:
                right = b - 1

        left = -MX
        right = mnb
        while left <= right:
            b = int((left + right) / 2)
            c = calc(b + dr, b)
            if c == X:
                print(b + dr, b)
                return
            elif c < X:
                left = b + 1
            else:
                right = b - 1


main()

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
x=int(input())
for a in range(-10**3,10**3):
    for b in range(-10**3,a):
        if pow(a,5)-pow(b,5)==x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-120, 120):
    for j in range(-120, 120):
        if i**5 - j**5 == X:
            print(i, j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import numpy as np

X = int(input())

x = np.arange(-300, 300, dtype=np.int64)

x5 = x**5
diff = np.subtract.outer(x5, x5)

i = np.where(diff == X)


x, y = i[0][0], i[0][1]
x -= 300
y -= 300

print(x, -y)

Submission status: Accepted

Solution code:
x=int(input())
l=[i**5 for i in range(-1000,1001)]
ok=False
for i in range(len(l)):
    if ok:
        break
    for j in range(len(l)):
        if l[i]-l[j]==x:
            print(i-1000,j-1000)
            ok=True
            break

Submission status: Accepted

Solution code:
X=int(input())
for i in range(-200,201):
    for j in range(-200,201):
        if (i**5)-(j**5)==X:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
def resolve():
    X = int(input())
    for a in range(-200, 201):
        for b in range(-200, 201):
            if a**5 - b**5 == X:
                print(a, b)
                return
    assert False


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
X=int(input())
a=True
while a==True:
    for i in range(-1000,1001):
        for j in range(i,1001):
            if j**5-i**5==X:
                print(j,i)
                exit()

Submission status: Accepted

Solution code:
x = int(input())
import sys
for i in range(121):
  for j in range(-121,121):
    if i**5 - (j**5) == x:
      print(i,j)
      sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
A = 0
f = 1
while f:
  a = A ** 5
  B = 0
  while f:
    b = B ** 5
    if a <= X:
      if a + b == X:
        print(str(A)+" "+str(-B))
        f = 0
      elif a + b > X:
        break
    if a > X:
      if a - b == X:
        print(str(A)+" "+str(B))
        f = 0
      elif a - b < X:
        break
    B += 1
  A += 1

Submission status: Accepted

Solution code:
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

X = I()

for a in range(1,120):
 for b in range(-119,119):
   if a**5-b**5==X:
     print(a,b)
     exit()

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if (a ** 5) - (b ** 5) == X:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
# import itertools
# import math
import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

X = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

for a in range(-130, 130):
    for b in range(-130, 130):
        _ = a ** 5 - b ** 5
        if _ == X:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())
for a in range(-120,121):
    for b in range(-120,121):
        if a**5 - b**5 == x:
            print(a,b)
            exit(0)

Submission status: Accepted

Solution code:
X = int(input())

ok = False
for a in range(200):
    for b in range(200):
        if a**5 - b**5 == X:
            ok = True
            A, B = a, b
            break
        
        if a**5 + b**5 == X:
            ok = True
            A, B = a, -b
            break
    
    if ok == True:
        break

print(A, end=' ')
print(B)

Submission status: Accepted

Solution code:
x = int(input())
a = 0
while True:
    for b in range(a):
        if abs(a ** 5 - b ** 5) == abs(x):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                exit()
            else:
                print(-a, -b)
                exit()
        elif abs(a ** 5 + b ** 5) == abs(x):
            if a ** 5 + b ** 5 == x:
                print(a, -b)
                exit()
            else:
                print(-a, b)
                exit()
    a += 1

Submission status: Accepted

Solution code:
x=int(input())
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    X = int(input())
    for A in range(-118, 120):
        for B in range(-118, 120):
            if A ** 5 - B ** 5 == X:
                print(A, B)
                sys.exit()

main()

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-10**3, 10**3):
  for b in range(-10**3, 10**3):
    if a**5 - b**5 == X:
      print(a, b)
      exit()

Submission status: Accepted

Solution code:
X=int(input())
A=0
B=0
for i in range(-120,120):
    for k in range(-120,120):
        if i**5==X+k**5:
            A=i
            B=k
            break
print(A,B)

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-118, 120):
  for b in range(-119, 119):
    if a**5 - b**5 == X:
      print(str(a) + " " + str(b))
      exit()

Submission status: Accepted

Solution code:
X = int(input()) 
flag = 0
for j in range(-120, 120):
    if flag == 1:
        break
    for k in range(j+1, 120):
        if k**5 - j**5 == X:
            print(k,j)
            flag = 1
            break

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i ** 5 - j ** 5 == X:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:

def main():
    x = int(input())
    kouhodic = dict()
    for i in range(200):
        kouhodic[i ** 5] = i
        kouhodic[-i ** 5] = -i
    
    kouhodic = sorted(kouhodic.items())
    kazu = len(kouhodic)
    #print(kouhodic)

    for i in range(kazu):
        for j in range(i+1, kazu):
            if kouhodic[j][0] - kouhodic[i][0] == x:
                print(kouhodic[j][1], kouhodic[i][1])
                exit()
    
    
    




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/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())


X = I()

for a in range(-118, 120):
    for b in range(-119, 119):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-118, 120):
    for j in range(-119, i):
        if i ** 5 - j ** 5 == x:
            a = i
            b = j
print(a, b)

Submission status: Accepted

Solution code:
X = int(input())

break_flag = 0

for a in range(-200, 201):
    if break_flag == 1:
        break
    for b in range(-200, 201):
        if a**5 - b**5 == X:
            print(a, b)
            break_flag = 1
            break

Submission status: Accepted

Solution code:
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

x = I()

A = []
As = []
B = []
Bs = []

for i in range(250):
  n = i ** 5
  A.append(i)
  As.append(n)
  B.append(i)
  Bs.append(n)
  B.append(-i)
  Bs.append(-n)

xs = [a-x for a in As]
for i, x in enumerate(xs):
  if x in Bs:
    print(A[i], B[Bs.index(x)])
    break

Submission status: Accepted

Solution code:
from decimal import Decimal

x = int(input())
cnt = 0

while True:
    a = cnt ** 5
    if a < x:
        a = x - a
        z = -1
    else:
        a -= x
        z = 1

    a = Decimal(a) ** Decimal("0.2")
    if a % 1 == 0:
        print(cnt, int(a * z))
        break

    cnt += 1

Submission status: Accepted

Solution code:
from sys import stdin,stdout
# n,e=list(map(int,stdin.readline().split()))
n=int(stdin.readline())
for a in range(-400,400):
    for b in range(-400,400):
        if abs(a**5-b**5)==n:
            print(max(a,b),min(a,b))
            exit(0)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
X=int(input())
L=list()
R=list()
for i in range(-1000,1001):
  L.append(i**5)
  R.append(i)
for i in range(-1000,1001):
  if (i**5)+X in L:
    n=L.index((i**5)+X)
    print(R[n],i)
    exit()

Submission status: Accepted

Solution code:
X=int(input())
for i in range(-120,120):
    for j in range(max(i+1,1),120):
        if j**5-i**5==X:
            print(j,' ',i)
            exit()

Submission status: Accepted

Solution code:
X=int(input())
A=[]
i,p=0,True
while p:
  a=i**5
  A.append(a)
  for b in A:
    if a-b==X:
      p=False
      print(i,A.index(b))
      break
    elif a+b==X:
      p=False
      print(i,-1*A.index(b))
      break
  i+=1

Submission status: Accepted

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    x = int(input())

    for i in range(-120,120):
        for j in range(-120,120):
            if i**5 - j ** 5 == x:
                print(i, j)
                exit()

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
import functools
X = int(input())

@functools.lru_cache(maxsize=None)
def pow5(x):
    return x ** 5

@functools.lru_cache(maxsize=None)
def root5(x):
    i = 0
    while True:
        i5 = pow5(i)
        if x < i5:
            return None
        if i5 == x:
            return i
        i += 1

a = 0
while True:
    a5 = pow5(a)
    b = root5(a5 + X)
    if b is not None:
        print(-a, -b)
        break
    if a5 <= X:
        b = root5(X - a5)
        if b is not None:
            print(a, -b)
            break
    else:
        b = root5(a5 - X)
        if b is not None:
            print(a, b)
            break
    a += 1

Submission status: Accepted

Solution code:
x = int(input())
five = [i**5 for i in range(150)]
for i in range(150):
    for j in range(i+1):
        if five[i] - five[j] == x:
            print(i,j)
            exit()
        if five[i] + five[j] == x:
            print(i,-j)

Submission status: Accepted

Solution code:
import math

X = int(input())
absX = abs(X)
X = math.pow(X, 1/5)
#print(X)
X = math.floor(X)
#print(X)

Pow = []
Dif = []

for i in range(64):
    Pow.append(int(math.pow(i, 5)))


for i in range(1, 1000):
    Dif.append(i**5 - (i-1)**5)
    if ((i+1)**5 - i**5) > 1000000000:
        break
#print(len(Dif))

#print(Pow)
#print(Dif)

for n in range(len(Pow)):
    p = Pow[n]
    m = n
    while m < len(Pow):
        q = Pow[m]
        if p + q > absX:
            break
        #print('p: {}, q: {}'.format(p, q))
        if p + q == absX :
            #print(absX)
            if X < 0:
                print(-n, m)
            else:
                print(n, -m)
            exit(0)
        m += 1

for n in range(len(Dif)):
    sam = 0
    m = n
    while m < len(Dif):
        sam += Dif[m]
        if sam > absX:
            break
        #print('sam: {}'.format(sam))
        if sam == absX:
            if X <= 0:
                print(n, m+1)
            else:
                print(-n,-(m+1))
            exit(0)
        m += 1

Submission status: Accepted

Solution code:
N=int(input())
L=[i**5 for i in range(150)]
for i in L:
    if N-i in L:
        if i-N>0:
            print(L.index(i),L.index(i-N))
        else:
            print(L.index(i),-1*L.index(N-i))
        break
    elif N+i in L:
        print(L.index(i+N),L.index(i))
        break

Submission status: Accepted

Solution code:
import sys

n = int(input())
for a in range(-200, 201):
    for b in range(-200, 201):
        if a * a * a * a * a - b * b * b * b * b == n:
            print(a, b)
            sys.exit(0)

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-120, 120):
  for b in range(-120, 120):
    if a**5-b**5==X:
      print(a, b)
      exit(0)

Submission status: Accepted

Solution code:
n=int(input())
for i in range(-150,150):
    for j in range(-150,150):
        if(i**5-j**5==n):
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
n=int(input())
for i in range(-900,900):
    for j in range(-900,900):
        if(i**5-j**5==n):
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
n=int(input())
for i in range(-200,200):
    for j in range(-200,200):
        if(i**5-j**5==n):
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
import sys

x = int(input())

for i in range(-120,120):
    for j in range(-120,120):
        if (i)**5 - j**5 == x:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5-j**5==x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5 - j**5 == X:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for a in range(1, 1000):
    a5 = a**5
    for b in range(-a+1, a):
        b5 = b**5
        if a5-b5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    X=ii()

    def is_ok(a,b):
        return a**5 <= X+b**5

    for a in range(-1010,1010):
        l,r = -INF,INF
        while r-l > 1:
            mid = (r+l)//2
            if is_ok(a,mid):
                r = mid
            else:
                l = mid
        b=r
        # print(a,b)
        if a**5-b**5==X:
            print(a,b)
            exit()




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
X=int(input())
for i in range(121):
    for j in range(-121,121):
        if i**5 - j**5 == X:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-200,200):
    for b in range(-200,200):
        if a ** 5 - b ** 5 == X:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
import sys
X = int(input())
for a in range(-200,200):
    for b in range(-200,200):
        if a ** 5 - b ** 5 == X:
            print(a,b)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
for A in range(-1000, 1001):
    for B in range(-1000, 1001):
        if A**5-B**5 == X:
            print(A, B); exit()

Submission status: Accepted

Solution code:
def solve():
    X = int(input())
    memo = {}
    for A in range(500):
        for B in range(500):
            memo[A**5-B**5] = (A,B)
            memo[A**5+B**5] = (A,-B)
    A,B = memo[X]
    print(A, B)

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def main():
    X = int(input())

    for A in range(-200, 200):
        for B in range(-200, 200):
            if A**5 - B**5 == X:
                print(A, B)
                exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())
A_max=120
B_max=119
A_min=-119
B_min=-120
for i in range(-119,120):
	for j in range(-120,119):
		if i**5-j**5==X:
			print(i,j)
			break
	else:
		continue
	break

Submission status: Accepted

Solution code:
X = int(input())

for i in range(-200, 201):
    for j in range(-200, 201):
        if i**5 - j**5 == X:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
def resolve():
    X = int(input())

    for a in range(200):
        for b in range(-199, 199):
            if (a**5 - b**5) == X:
                print(a, b)
                return

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
x=int(input())
A=[i**5 for i in range(-2000,2000)]
for i in range(4000):
    for j in range(i):
        if A[i]-A[j]==x:
            print(*[i-2000,j-2000]);exit()

Submission status: Accepted

Solution code:
x = int(input())

min_x = -int(pow(x,0.2))-1
for a in range(x):
    for b in range(min_x,x):
        test = pow(a,5) - pow(b,5)
        if b > 0 and test < x:
            break
        if test == x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
import math
X = int(input())

d =math.floor(math.pow(X, 1.0/4.0))
for i in range(-d-1,d+1,1):
    for j in range(-d-1,d+1,1):
        if X+j**5==i**5:
            print(i,j)
            exit()