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

Solution (Python):



import math

X = int(input())
A = 1
found = False

while True:
    a5 = math.pow(A, 5)
    b5max = math.pow(A - 1, 5)
    if a5 + b5max >= X and a5 - b5max <= X:
        found = True
        for B in range(A):
            b5 = math.pow(B, 5)
            if a5 - b5 == X:
                print(A, B)
                break
            if a5 + b5 == X:
                print(A, -B)
                break
        A += 1
    elif found:
        break
    else:
        A += 1

Solution (Python):
from sys import stdin, setrecursionlimit
from collections import defaultdict

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()


def binary_search(n):
    left, right = 0, 10 ** 10
    while right - left > 1:
        mid = (left + right) // 2
        if mid ** 5 <= n:
            left = mid
        else:
            right = mid

    return left


X = int(input())
for i in range(10 ** 1000):
    B = i
    A5 = X + B ** 5
    n = binary_search(A5)
    if n ** 5 == A5:
        print(n, B)
        break

    B = -i
    A5 = X + B ** 5
    if A5 >= 0:
        n = binary_search(A5)
    else:
        n = -binary_search(-A5)
    if n ** 5 == A5:
        print(n, B)
        break

Solution (Python):
x = int(input())

is_get = False
for a in range(10000):
    for b in range(a + 1):
        aa = a ** 5
        bb = b ** 5
        xx = abs(x)
        if aa - bb == xx:
            if x >= 0:
                print(a, b)
            else:
                print(-a, -b)
            is_get = True
            break
        elif aa + bb == xx:
            if x >= 0:
                print(a, -b)
            else:
                print(-a, b)
            is_get = True
            break
    if is_get:
        break

Solution (Python):
ans = int(input())
res = 10*round(ans**0.2)

for i in range(-res, res+1):
    for j in range(-res, res+1):
        if i**5 - j**5 == ans:
            print(i,j)
            exit()

Solution (Python):
X = int(input())

gojyous = []

for i in range(-200, 201):
    gojyous.append(i ** 5)



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

Solution (Python):
x = int(input())

for i in range(-1000,1000) :
    flag = 0
    for j in range(-1000,i) :
        if x%(i-j) != 0 :
            continue
        v = x//(i-j)
        c = i**4+j**4+i*j*(i**2+i*j+j**2)
        if v == c :
            print(i,j)
            flag = 1
            break
    if flag == 1 :
        break

Solution (Python):
x = int(input())
l = []
for i in range(-400,400):
    l.append(i**5)
ans =[]
for i in l:
    for j in l:
        if i - j == x:
            ans.append([i,j])
i,j = ans[0][0],ans[0][1]
print(l.index(i)-400,l.index(j)-400)

Solution (Python):

from bisect import bisect_left


def solve(*args: str) -> str:
    x = int(args[0])

    P = [pow(i, 5) for i in range(128)]
    ret = None
    for b, b5 in enumerate(P):
        a5 = x+b5
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a, b)
                break

        a5 = abs(x-b5)
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a if b5 < x else -like_a, -b)
                break

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Solution (Python):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)

    divisors.sort()
    return divisors


def check(x, y):
    return x ** 4 + x ** 3 * y + x ** 2 * y ** 2 + x * y ** 3 + y ** 4


X = readint()
l = make_divisors(X)

ans_A = 0
ans_B = 0
for n in l:
    
    A = n // 2
    B = A - n
    while A ** 5 - B ** 5 <= X:
        if check(A, B) == (X // n):
            ans_A = A
            ans_B = B
            break
        else:
            A -= 1
            B -= 1

    if ans_A:
        break


print(ans_A, ans_B)

Solution (Python):
x = int(input())
a = {i**5 for i in range(10**3)}
for p in a:
	if abs(p-x) in a:
		if p-x < 0:
			q = x-p
			print(int(p**(1/5)),int(-q**(1/5)))
			break
		else:
			q = p-x
			print(int(p**(1/5)),int(q**(1/5)))
			break

Solution (Python):
num=int(input())

def cal(num):
    return num*num*num*num*num

A=0
while(1):
    B=0
    while(cal(A)-cal(B)>num):
        B+=1
    if cal(A)-cal(B)==num:
        print(str(A)+" "+str(B))
        break
    B=0
    while(cal(A)-cal(B)<num):
        B-=1
    if cal(A)-cal(B)==num:
        print(str(A)+" "+str(B))
        break
    A+=1

Solution (Python):
x = int(input())
for i in range(int(x**(1/5))+1):
  ii = i**5
  for j in range(0,i+1):
    if ii + j**5 == x:
      print(i,-j)
      exit()
for i in range(2,1000):
  ii = i**5
  for j in range(1,i):
    if ii - j**5 == x:
      print(i,j)
      exit()

Solution (Python):
x = int(input())
for a in range(-121,121,1):
  for b in range(-121,121,1):
    if (a**5 - b**5) == x:
      print(a,b)
      break
  else:
    continue
  break

Solution (Python):
from math import pow, ceil
from itertools import product

X = int(input())
max_X = ceil(pow(10 ** 9, 1 / 5))

for a, b in product(range(-2 * max_X, 2 * max_X + 1), repeat=2):
    if (a ** 5 - b ** 5) == X:
        print(a, b)
        break

Solution (Python):
def solve(x):

    a = -1000
    while a <= 1000:
        b = -1000
        while b < 1000 :
            if x + b **5 == a**5:
                break
            else:
                b += 1
        if x + b **5 == a**5:
            break
        else:
            a+=1

    return "{0} {1}".format(a,b)

if __name__ == "__main__":
    x = int(input())
    print(solve(x))

Solution (Python):
x = int(input())

for i in range(-4000,4000) :
    flag = 0
    for j in range(-4000,i) :
        if x%(i-j) != 0 :
            continue
        v = x//(i-j)
        c = i**4+j**4+i*j*(i**2+i*j+j**2)
        if v == c :
            print(i,j)
            flag = 1
            break
    if flag == 1 :
        break

Solution (Python):

x=int(input())

def enum_div(n):
    ir=int(n**(0.5))+1

    ret=set()
    for i in range(1,ir):
        if n%i == 0:
            ret.add(i)

            if (i!= 1) & (i*i != n):

                ret.add(n//i)
    return ret

ret=enum_div(x)

y=20000
for ai in range(-y,y):
    yn=""
    for r in ret:
        bi=ai-r
        if ai**5-bi**5==x:
            yn="YES"
            break
        bi=ai+r
        if ai**5-bi**5==x:
            yn="YES"
            break
    if yn=="YES":
        break

if yn=="YES":
    print(ai,bi)

Solution (Python):
def resolve():
    '''
    code here
    '''
    X = int(input())

    max_num = int(2 * (10 ** 9) ** (1/5))

    is_flag = False
    for i in range(-1*max_num, max_num):
        for j in range(-1*max_num, max_num):
            if i ** 5 - j ** 5 == X:
                print(i, j)
                is_flag = True
                break
        
        if is_flag:
            break





if __name__ == "__main__":
    resolve()

Solution (Python):
L=[0]*10000
X=int(input())
for i in range(10000):
  L[i]=pow(i,5)
for i in range(10000):
  for j in range(10000):
    if L[i]-L[j]==X:
      print(i,j)
      exit()
    if L[i]+L[j]==X:
      print(i,-j)
      exit()

Solution (Python):
X = int(input())
for B in range(-10 ** 3, 10 ** 3):
    A_5 = B ** 5 + X
    A = A_5 ** (1 / 5)
    if type(A) is not float:
        continue
    A = int(A)
    if A ** 5 == A_5:
        print(A, B)
        exit()

Solution (Python):
def find(n):
  dif = 0
  i = 0
  while dif <=n:
    i+=1
    dif=i**5-(i-1)**5
  return i


X= int(input())
lim = find(X)
condition = True 
for i in range(lim):
  if condition:
    puissance = i**5-X
    signe = (abs(puissance)//puissance)
    entier = int(((puissance*signe)**(1/5)))
    if entier**5 == signe*puissance:
      print(i, entier*signe)
      condition = False

Solution (Python):
X = int(input())
flg = False

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

div_arr = sorted(make_divisors(X))

def cal_p2(a,b):
  return pow(a,4) + pow(a,3)*pow(b,1) + pow(a,2)*pow(b,2) + pow(a,1)*pow(b,3) + pow(b,4)


for div in div_arr:
  p1 = div
  p2 = X//div
  a = p1//2-1
  while True:
    a += 1
    b = a - p1
    if p2==cal_p2(a,b):
      flg = True
      break
    elif p2<cal_p2(a,b):
      break
  if flg:
    break
    
print(a,b)

Solution (Python):
X = int(input())





def fn(a):
    return 5 * a**4 - 10 * a**3 + 10 * a**2 - 5 * a + 1


A_max = 0
for a in range(3, 1000):
    if fn(a) > X and a**5 > X:
        A_max = a
        break

s = dict()
for a in range(0, A_max):
    s[a**5] = a

for a5 in s:
    if a5 - X in s:
        print(s[a5], s[a5 - X])
        exit()
    if X - a5 in s:
        print(s[a5], -s[X - a5])
        exit()

Solution (Python):
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
 
    return divisors


d = make_divisors(x)


for i in d:
    for b in range(-10000,10000):
        a = i + b
        if x // i == a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4:
            ans = [str(a),str(b)]
            break
        
print(*ans)

Solution (Python):
x = int(input())

c5 = []
iter5 = []
for i in range(-1000, 1000, 1): 
    c5.append(i**5)
    iter5.append(i)

a, b = 0, 0
for i in range(len(c5)):
    for j in range(len(c5)):
        if (c5[i] - c5[j]) == x:
            a, b = iter5[i], iter5[j]
            break

print(a,b)

Solution (Python):
X = int(input())
for B in range(-10 ** 3, 10 ** 3):
    for A in range(B + 1, 10 ** 3):
        if A ** 5 - B ** 5 == X:
            print(A, B)
            exit()

Solution (Python):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


def calc(a, b):
    return a ** 4 + a * (b ** 3) + (a * b) ** 2 + b * (a ** 3) + b ** 4

X = int(input())

for c in make_divisors(X):
    for b in range(-10000, 10000):
        a = c + b
        if calc(a, b) == X / c:
            print(a, b)
            break

Solution (Python):
x=int(input())

s=0
a=-1
z5=[]
ans=[]
aans=0
bans=0
while(s==0):
    a+=1
    z5.append(a**5)
    if (x+a**5) in z5:
        bans=a
        break
    elif  (x-a**5) in z5:
        bans=-a
        break

    elif (a**5-x) in z5:
        aans=a
        break
        

if aans==0:
    aans=int((x+bans**5)**(1.0/5.0))
if bans==0:
    bans=int((aans**5-x)**(1.0/5.0))

print(aans,bans)

Solution (Python):
X = abs(int(input()))
size = 1000
L = [i**5 for i in range(size)]
if X == 0:
    print(0, 0)
for l in range(size):
    for m in range(l+1):
        if L[l] + L[m] == X:
            print(l, -m)
            exit(0)
        if L[l] - L[m] == X:
            print(l, m)
            exit(0)

Solution (Python):
x=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n // i:
                divisors.append([i,n//i])
            else:
                divisors.append([i,i])
    return divisors
l=make_divisors(x)
for x,y in l:
    for i in range(10**4):
        p=i-x
        if i**4+(i**3)*p+(i**2)*(p**2)+i*(p**3)+p**4==y:
            print(i,p)
            break

Solution (Python):
x=int(input())
ulist=[]

for i in range(1,int(x**0.5)+1):
    if x%i==0:
        ulist.append(i)

def root(n):
    hanbun=int(n**0.5)
    if hanbun**2==n:
        return True
    return False
        

def niji(a,b,c):
    hanbetu=b**2-4*a*c
    if hanbetu>=0:
        if root(hanbetu):
            one=-b+int(hanbetu**0.5)
            two=-b-int(hanbetu**0.5)
            ans=[]
            if one%(2*a)==0:
                ans.append(one//(2*a))
            if two%(2*a)==0:
                ans.append(two//(2*a))
            if ans!=[]:
                return ans
    return False

for u in ulist:


    if niji(5*u,5*(u**3),u**5-x):
        plist=niji(5*u,5*(u**3),u**5-x)

        for p in plist:
            if niji(1,-u,-p):
                alist=niji(1,-u,-p)
                print(alist[0],alist[0]-u)
                break

Solution (Python):
n=int(input())
a=0
b=0
wa=0
frag=1
tmpa=[]
while frag:
    for i in range(wa+1):
        a=i
        b=wa-i
        
        if a ** 5 - b ** 5 == n:
            frag=0
            break
        b = 0 - b
        
        if a ** 5 - b ** 5 == n:
            frag=0
            break
    wa+=1
print(a,b)

Solution (Python):
x = int(input())
a = []
for i in range(-200, 200):
  for j in range(-200, 200):
    if i**5 - j**5 == x:
      a.append([i, j])
      break
      
print(*a[0])

Solution (Python):
n = int(input())
a = []
for i in range(1000):
         a.append(i ** 5)
for i in range(1000):
         for j in range(-1000,1000):
                  if (a[i]) - (j ** 5) == n:
                           print(i,j)
                           exit()

Solution (Python):
x = int(input())

fs = []
for e in range(-1000, 1001):
    fs.append(e ** 5)

for a in range(-1000, 1001):
    for b in range(-1000, 1001):
        if fs[a + 1000] - fs[b + 1000] == x:
            print(a, b)
            exit()

Solution (Python):
x = int(input())
import math
for i in range(10**5):
    z = (x - i ** 5)
    if z == 0:
        b = 0
    else:
        b = (x - i ** 5) ** (1/5)
    
    if i ** 5 - math.floor(abs(b)) ** 5 == x:
        print(i, math.floor(abs(b)))
        exit()
    if i ** 5 - (-math.floor(abs(b))) ** 5 == x:
        print(i, -math.floor(abs(b)))
        exit()
    if i ** 5 - math.ceil(abs(b)) ** 5 == x:
        print(i, math.ceil(abs(b)))
        exit()
    if i ** 5 - (-math.ceil(abs(b))) ** 5 == x:
        print(i, -math.ceil(abs(b)))
        exit()

Solution (Python):
x = int(input())

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

    
    return divisors

kouho = make_divisors(x)


for y in kouho:
    for a in range(1000):
        b = a-y
        if a**5 - b**5 == x:
            print(a,b)
            break

Solution (Python):
x = int(input())
a = 0
b = 0
for i in range(-500, 500):
    for j in range(-500, 500):
        if (i ** 5) - (j ** 5) == x:
            a = i
            b = j
            break
print("{} {}".format(a, b))

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X = int(input())

i = -1000
val = i**5
vals = defaultdict(int)
while val <= 10**9:
    vals[val] = i
    i += 1
    val = i**5

d = defaultdict(int)
for a, akon in vals.items():
    for b, bkon in vals.items():
        val = a-b
        if d[val] == 0:
            d[val] = (akon, bkon)

if X in d.keys():
    a, b = d[X]
    print(a, b)

Solution (Python):
x=int(input())
i=0
while True:
    i+=1
    for j in range(i):
        if i**5+j**5==x:
            print(i,-j)
            exit()
        elif i**5-j**5==x:
            print(i,j)
            exit()
        elif -i**5-j**5==x:
            print(-i,j)
            exit()
        elif -i**5+j**5==x:
            print(-i,-j)
            exit()
print(i,j)

Solution (Python):
X=int(input())

C=[0]
for i in range(1,64):
    C.append(pow(i,5))

c=0
ans1=0
ans2=0
while c<=X:
    temp=X-c
    if temp in C:
        ans2=C.index(temp)
        print(ans1,-ans2)
        break
    else:
        ans1+=1
        c=C[ans1]
else:
    for j in range(64,120):
        C.append(pow(j,5)) 
    
    c=0
    ans1=0
    ans2=0
    for k in range(120):
        if C[k]>=X:
            for l in range(k):
                if C[k]-C[l]==X:
                    print(k,l)
                    break
            else:
                continue
            break

Solution (Python):
from itertools import product

a=int(input())

multi_5 = [0]
tmp = 0
c = 0

while 1:
    c += 1
    tmp = c**5

    if tmp - multi_5[-1] > 10**9:
        break

    multi_5.append(tmp)



minus_multi_5 = []

for i in multi_5:
    minus_multi_5.append(i*(-1))



multi_5.extend(minus_multi_5)



for j,k in product(multi_5, multi_5):
    if j-k == a:
        if j >= 0:
            ansa = int(j**(1/5))
        else:
            ansa = int((j*(-1))**(1/5)) * (-1)

        if k >= 0:
            ansb = int(k**(1/5))
        else:
            ansb = int((k*(-1))**(1/5)) * (-1)

        
        print(ansa,ansb)
        break

Solution (Python):
import collections
X = int(input())

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

Solution (Python):
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right


from functools import reduce
from pprint import pprint

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

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

x = int(input())

N = 1000
for a in range(N):
    for b in range(-1*N,N):
        m = a**5 - b**5
        
        if x==m:
            print(a,b)
            exit()
        else:
            pass

Solution (Python):
import sys
X=int(input())
X2=int(X**0.5)
X5=int(X**0.2)

for i in range(1, X+1):
    if X%i==0:
        for j in range(-i,X+1):
            Xt=(j+i)**5-j**5
            if Xt>X and j>0:
                break
            if Xt==X:
                print(j+i,j)
                sys.exit()

Solution (Python):
x = int(input())

def search(num, x):
    res = 0
    a_ = 0
    b = 0
    for a in range(num):
        a_ = a
        b = num-a
        if a**5 - b**5 == x:
            res = 1
            break
        elif a**5 + b**5 == x:
            b = -b 
            res = 1
            break
    return a_, b ,res 

for i in range(555555):
    a, b, res = search(i,x)
    if res == 1:
        break

print("{} {}".format(a, b))

Solution (Python):
import math
x = int(input())
for b in range(-10000, 10000):
    p = b**5 + x
    if p < 0:
        a = int(math.floor(-((-p)**0.2)))
    else:
        a = int(math.floor(p**0.2))
    if (a-1)**5 == p:
        print(a-1, b)
        break
    elif a**5 == p:
        print(a,b)
        break
    elif (a+1)**5 == p:
        print(a+1, b)
        break

Solution (Python):
def d166(x):

    a = 0
    b = 0

    if x == 0:
        return "1" + " " + "1"
    if x < 0:
        for i in range(10000):
            ax = x + i**5
            if ax > 0:
                a = -i
                for w in range(i):
                    if ax-(w**5) == 0:
                        b = -w
                        return str(a) + " " + str(b)
            else:
                a = -i
                for w in range(i):
                    if ax+(w**5) == 0:
                        b = w
                        return str(a) + " " + str(b)

    else:
        for i in range(10000):
            ax = x - i**5
            if ax < 0:
                a = i
                for w in range(i):
                    if ax+(w**5) == 0:
                        b = w
                        return str(a) + " " + str(b)
            else:
                a = i
                for w in range(i):
                    if ax-(w**5) == 0:
                        b = -w
                        return str(a) + " " + str(b)

def main():
    x = int(input())
    print(d166(x))
if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
ans = []
arr = []
for i in range(1000):
    arr.append(i**5)
for i in range(1000):
    for j in range(i,1000):
        if arr[j] + arr[i] == x:
            ans.append(j)
            ans.append(i * -1)
        if arr[j] - arr[i] == x:
            ans.append(j)
            ans.append(i)
print(*ans[0:2])

Solution (Python):

import bisect
x = int(input())
T = [0] * ((10 ** 4) + 1)
for i in range(0, (10 ** 4)+1):
    T[i] = i ** 5

for i in range(len(T)):
    index = bisect.bisect_left(T, x + T[i])
    if index == len(T):
        break
    if T[index] == x + T[i]:
        print(' '.join(map(str,[index, i])))
        exit(0)


for i in range(len(T)):
    index = bisect.bisect_left(T, x - T[i])
    if index == len(T):
        break
    if T[index] == x - T[i]:
        print(' '.join(map(str,[index, -i])))
        exit(0)

Solution (Python):
X =int(input())
b =False
for x in range(-1000,1000):
    for y in range(-1000,1000):
        if (x**5)-(y**5)==X:
            print(x,y)
            b=True
    if b==True:
        break

Solution (Python):
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Solution (Python):
x = int(input())
for a in range(300):
  for b in range(300):
    if a**5-b**5==x:
      print(a,b)
      exit()
    if a**5+b**5==x:
      print(a,b*-1)
      exit()

Solution (Python):
X = int(input())

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

Solution (Python):
x = int(input())

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

Solution (Python):
x = int(input())
a = []
for i in range(1000):
    a.append(i**5)

for i in range(999):
    for j in range(i+1,1000):
        if a[i]-a[j]==x:
            A=i
            B=j
            break
        elif -a[i]-a[j]==x:
            A=-i
            B=j
            break
        elif -a[i]+a[j]==x:
            A=-i
            B=-j
            break
        elif a[i]+a[j]==x:
            A=i
            B=-j
            break
print('%d %d'%(A,B))

Solution (Python):
import itertools

z = []
for i in range(1000):
    a =i**5
    
    z.append(a)

X = int(input())

z_p = list(itertools.permutations(z, 2))
for i in range(len(z_p)):
    if z_p[i][0] - z_p[i][1] ==  X:
        print(z.index(z_p[i][0]),z.index(z_p[i][1]))
        exit()
    elif z_p[i][0] + z_p[i][1] ==  X:
        print(z.index(z_p[i][1]),-(z.index(z_p[i][0])))
        exit()

Solution (Python):
def f(n):
    l, r = 0, 1 << 10
    while r - l > 1:
        m = (l + r) // 2
        if m ** 5 <= n:
            l = m
        else:
            r = m
    return l if l ** 5 == n else 0

X = int(input())
for i in range(1 << 10):
    a = f(X + i ** 5)
    if a:
        print(a, i)
        break
    a = f(X - i ** 5)
    if a:
        print(a, -i)
        break

Solution (Python):
x=int(input())
ans=[]
for i in range(1000):
    for j in range(1000):
        if pow(i,5)+pow(j,5)==x:
            print(i,-j)
            exit()
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            exit()

Solution (Python):
X = int(input())
t = 0
for i in range(1000):
    if t == 1:
        break
    for j in range(1000):
        x5 = pow(i,5)
        y5 = pow(j,5)
        mx5 = -pow(i,5)
        my5 = -pow(j,5)
        if X == x5 - y5:
            print(i,j)
            t = 1
            break
        if X == mx5 - y5:
            print(-i,j)
            t = 1
            break
        if X == x5 - my5:
            print(i,-j)
            t = 1
            break

Solution (Python):
def main():
  x=int(input())
  
  for a in range(pow(10,3)):
    if a**5>x:
      for b in range(pow(10,3)):
        if a**5-b**5==x:
          print(a,b)
          exit()
    else:
      for b in range(-pow(10,3),1):
        if a**5-b**5==x:
          print(a,b)
          exit()
if __name__=='__main__':
  main()

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
























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

Solution (Python):
from itertools import combinations_with_replacement

x = int(input())

fivelist = dict()
for i in range(-1000, 1000):
    fivelist[i] = i**5

for a, ma in fivelist.items():
    for b, mb in fivelist.items():
        if ma - mb == x:
            print(f"{a} {b}")
            exit(0)

Solution (Python):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    c = {0:0}
    s = set([0])
    cnt = 1
    flag = True
    while flag:
        k = pow(cnt, 5)
        c[k] = cnt
        s.add(k)
        r = k-X
        if r in s:
            print(c[k], c[r])
            flag = False
            break
        if -r in s:
            print(c[k], -c[-r])
            flag = False
            break
        cnt += 1
resolve()

Solution (Python):
def pow_r(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n // 2)
    else:
        return x * pow_r(x ** 2, (n - 1) // 2)


x = int(input())
for a in range(-100, 1000):
    for b in range(-100, 1000):
        if x == (pow_r(a, 5)) - (pow_r(b, 5)):
            print(a, b)
            exit()

Solution (Python):
import sys
import math
X = int(sys.stdin.readline().rstrip())
y = 0
while True:
  a = y**5 + X
  b = (-y)**5 + X
  x1 = round(a**(1/5))
  if x1**5 == a:
    print(x1, y)
    break
  x2 = round((b**(1/5)).real)
  if x2**5 == b:
    print(x2, -y)
    break
  y += 1

Solution (Python):
import math
import sys
if __name__ == "__main__":
    x = int(input())

    for i in range(1, int(math.sqrt(x)) + 1):
        if x % i == 0:
            sm = i
            lg = x // i

            for a in range(1, 10 ** 5 + 1):
                b = a - sm
                if a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4 == lg:
                    print(a, b)
                    sys.exit(0)

Solution (Python):
from itertools import combinations
x = int(input())
n = 1000
c = []
for i in range(n):
    c.append(i**5)
for (i, j) in combinations(range(n), 2):
    if c[j] - c[i] == x:
        print(j, i)
        break
    if c[j] + c[i] == x:
        print(j, -i)
        break

Solution (Python):
def ihf(x):
    lookup = {}
    def printAns(k, s, x):
        lk, ls = lookup[k], lookup[s] 
        if k - s == x:
            print(lk, ls)
        elif k + s == x:
            print(lk, -ls)
        elif -k - s == x:
            print(-lk, ls)
        elif -k + s == x:
            print(-lk, -ls)

    for i in range(5000):
        lookup[i ** 5] = i
    for k in lookup.keys():
        search = (x + k, x - k)
        f2 = 1
        for i, s in enumerate(search):
            if s < 0:
                s = -s
                f2 = -1
            if lookup.get(s, None):
                printAns(k, s, x)
                return

if __name__ == "__main__":
    import sys
    x = int(input())
    ihf(x)

Solution (Python):
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()

Solution (Python):
X = int(input())
As = [0]*121
for i in range(1,121):
  As[i] = i**5

flag = 0
for i in range(1,121):
  a = As[i]
  for j in range(i+1):
    b = As[j]
    if a + b == X:
      print(i,-j)
      flag = 1
      break
    elif a - b == X:
      print(i, j)
      flag = 1
      break
  if flag == 1:
    break

Solution (Python):
import sys
readline = sys.stdin.readline

def ff(X):
    res = 1
    if X == 0:
        return 0
    if X <= 0:
        res = -1 
        X = -X
    ok = 10000
    ng = -1
    while abs(ok-ng) > 1:
        med = (ok+ng)//2
        if med**5 >= X:
            ok = med
        else:
            ng = med
    if ok**5 == X:
        return res*ok
    return None
X = int(readline())

for b in range(-1000, 10000):
    a = ff(pow(b, 5) + X)
    if a is not None:
        print(a, b)
        break