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):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    X = int(input())
    
    B = 0
    while B**5 < X:
        B += 1
    B *= -1
    for A in range(10**6):
        while A**5 - B**5 > X:
            B += 1
        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            return
    


if __name__ == '__main__':
    main()

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

my_dict = dict()

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

for i in range(-1000, 1000):
    target = x + (i ** 5)
    if (- target) in my_dict:
        print(-my_dict[-target], i)
        exit()
    elif target in my_dict:
        print(my_dict[target], i)
        exit()

Solution (Python):
fives = []
m = {}

i = 0 
while i**5 <= 10**15:
    m[i**5] = i
    m[-1 * i**5] = -1*i
    i+=1
x = int(input())

def fun():
    for i in m.keys():
        for j in m.keys():
            if i-j == x:
                print(str(m[i]) + " " + str(m[j]))
                return

fun()

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

N = []
for i in range(123):
    N.append(i**5)

for i in reversed(range(123)):
    for j in reversed(range(i)):
        if X == N[i] - N[j]:
            print(i, j)
            break
        if X == N[i] + N[j]:
            print(i, j * -1)
            break

Solution (Python):
import sys

x = int(input())

a_max = pow(10, 4)
b_max = pow(10, 4)

for a in range(a_max):
    for b in range(b_max):
        if pow(a, 5) - pow(b, 5) == x:
            print(a, b)
            sys.exit()
        elif pow(-a, 5) - pow(b, 5) == x:
            print(-a, b)
            sys.exit()
        elif pow(a, 5) - pow(-b, 5) == x:
            print(a, -b)
            sys.exit()
        elif pow(-a, 5) - pow(-b, 5) == x:
            print(-a, -b)
            sys.exit()

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

if x==1:
    print(0,-1);exit()

num_li = [i**5 for i in range(1,1000)]

for i in range(1000):
    a = num_li[i]
    if x-a in num_li:
        b = num_li.index(x-a)+1
        a = -(num_li.index(a)+1)
        break
    if x+a in num_li:
        b = num_li.index(x+a)+1
        a = num_li.index(a)+1
        break

print(b,a)

Solution (Python):
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(-1,-1))
isloop=True
for a in range(10**3):
    if(isloop==False):
        break
    for b in range(10**3):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break

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

for i in range(-1000,1000):
  for j in range(-1000,1000):
    X = (i-j)*(i**4 + i**3*j + i**2*j**2 + i*j**3 + j**4)
    if X==x:
      print(i,j)
      exit()

Solution (Python):
x = int(input())
d = [[0 for i in range(500)] for j in range(500)]
e = [[0 for i in range(500)] for j in range(500)]
f = [[0 for i in range(500)] for j in range(500)]
for i in range(500):
    d[0][i] = i**5
    d[i][0] = i**5
for i in range(1,500):
    for j in range(1,500):
        d[i][j] = d[0][j]-d[i][0]
        e[i][j] = d[0][j]+d[i][0]
for m in range(500):
    if x in d[m]:
        print(d[m].index(x),m)
        break
    elif x in e[m]:
        print(e[m].index(x),-m)
        break

Solution (Python):
import numpy as np
X = int(input())

t = np.arange(0, 2000001, 1)
t = t**5
S = set(t)

for B in range(0,200001,1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break
    if X-B**5 in S:
        print("%d %d"%((X-B**5)**0.2, -B))
        break

Solution (Python):


import sys

X = int(input())

powers = {}
def powered(i):
    if i in powers:
        return powers[i]
    powered = pow(i, 5)
    powers[i] = powered
    return powered

for a in range(1000, 0, -1):
    for b in range(0, 1000):
        poweredA = powered(a)
        poweredB = powered(b)
        if poweredA - poweredB == X:
            print(a, b)
            sys.exit()
        elif poweredA + poweredB == X:
            print(a, -b)
            sys.exit()

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

for i in range(2,10**5):
    if i ** 5 - (i-1)**5 == X:
        print(i,i-1);exit()

for x in range(-200,200):
    for y in range(-200,200):
        if x** 5 - y ** 5 == X:
            print(x,y);exit()

Solution (Python):
import math

x = int(input())

l = math.floor(math.log(abs(x), 5)) + 1000

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

a, b = [0,0]

for i in range(l):
    for j in range(l):
        if s[i] +s[j] == x:
            a, b = i, -j
            break
        elif s[i] - s[j] == x:
            a, b = i, j
            break

print(str(a) + " " + str(b))

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


if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
a = 0
b = 0
while a ** 5 - b ** 5 != x and a ** 5 + b ** 5 != x:
    B = a ** 5 - x
    b = int(abs(B ** (1/5)))
    if a ** 5 - b ** 5 == x or a ** 5 + b ** 5 == x:
        break

    a += 1

if a ** 5 - b ** 5 == x:
    print(a, b)
else:
    print(a, -1 * b)

Solution (Python):
from decimal import Decimal

X=Decimal(input())
ansa=0
ansb=0



















for a in range(-1000,1000):
    b5 = Decimal(a**5) - X
    sig = False
    if a==100:
        print()
    if b5 < 0:
        sig = True
        b5 = abs(b5)
    b1 = pow(b5,Decimal('0.2'))

    if sig:
        b1 *= -1

    if b1 == int(b1):
        ansa=a
        ansb=int(b1)
        break
print(ansa,ansb)

Solution (Python):

''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    sq = [i**5 for i in range(120)]
    for i in range(1, 120):
        i5 = sq[i]
        for j in range(-i, i):
            j5 = sq[j] if j >= 0 else -sq[-j]
            if i5-j5 == x:
                return f"{i} {j}"


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

Solution (Python):
X = int(input())
Y = [i**5 for i in range(0, 501)]
for i in range(0, 501):
    for j in range(0, 501):
        if (Y[i]-Y[j] == X):
            print('{0} {1}'.format(i, j))
            exit(0)
        if (Y[i]+Y[j] == X):
            print('{0} {1}'.format(i, -j))
            exit(0)

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

for i in range(10000):
  a = pow(i, 5)
  for j in range(10000):
    b = pow(j, 5)
    if a-b == x:
      print(i, j)
      sys.exit()
    elif a+b == x:
      print(i, -j)
      sys.exit()

Solution (Python):







flag=True
A=0
B=0
Ax=0
Bx=0
X=int(input())
while flag:
    for B in range(0,A+1):
        if X== (pow(A,5)-pow(B,5)):
            if flag==True:
               Bx=B
               Ax=A
            flag=False
        elif X== (pow(A,5)+pow(B,5)):
            if flag==True:
               Bx=-B
               Ax=A
            flag=False
    A+=1
print(str(Ax)+" "+str(Bx))

Solution (Python):



                            
                            
                            
                            



import sys
import math as mt


def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

def printwsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end="tst, ")

MOD = int(1e9+7); BABYMOD = 998244353;



x = int(input())
i = 0
se = set()
d = {}
while(True):
    num = i ** 5
    if num > 1e18 :
        break
    d[num] = i
    se.add(num)
    i += 1

for i in se:
    y = i + x
    if y in se:
        
        a = max(d[i], d[y]) 
        b = min(d[i], d[y])
        print(a, b)
        break
    y = abs(i-x)
    if y in se:
        
        
        print(d[i], -d[y])
        break


'''
THE LOGIC AND APPROACH WAS DEVELOPED BY ME @luctivud.
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
PLEASE DO NOT PLAGIARISE.
'''

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

i = -1
lst = []
k = 1
while k == 1:
    i += 1
    j = i**5
    lst.append(j)
    for l, n in enumerate(lst):
        if j - n == N:
            print(i,l)
            k = 0
            break
        if j + n == N:
            print(i,-l)
            k=0
            break

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

def grouper(n, iterable, fillvalue=None):
    "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
    args = [iter(iterable)] * n
    return zip_longest(fillvalue=fillvalue, *args)



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

    return divisors

def m_exist(n, m):
    
    
    a_max = int(abs(m)**(1/2))
    for a in range(a_max):
        calc = 5 * (a**4 - 2*n*a**3 + 2*(n**2)*a**2 - (n**3)*a  )+ n**4
        if calc == m:
            return a
    return -1

x = int(input())




D_Lis = get_divisors(x)
if len(D_Lis) %2 == 1:
    D_Lis.append(D_Lis[-1])
for n, m in grouper(2, D_Lis):
    a = m_exist(n,m)
    if a == -1:
        pass
    else:
        print(a, a-n)
        break
    a = m_exist(m, n)
    if a == -1:
        pass
    else:
        print(a, a-n)
        break

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

b=0
while True:
    p,m=b, -b
    xp, xm = x+p**5, x+m**5
    flag=False
    for i in range(math.ceil(abs(xp)**0.2)+1):
        if i**5 - p**5 == x:
            ans=[i,p]
            flag=True
            break
        if (-1*i)**5 - p**5 == x:
            ans=[-1*i,p]
            flag=True
            break
    for i in range(math.ceil(abs(xm)**0.2)+1):
        if i**5 - m**5 == x:
            ans=[i,m]
            flag=True
            break
        if (-1*i)**5 - m**5 == x:
            ans=[-1*i,m]
            flag=True
            break
    if flag:
        break
    b+=1

print(" ".join(list(map(str,ans))))

Solution (Python):
x=int(input())
ab=[]
for i in range(1000):
    ab.append(i**5)
found=0
for a in ab:
    for b in ab:
        if found==1:
            break
        if a-b==x:
            print(int(a**0.2),int((b**0.2)))
            found=1
        elif a+b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        else:
            continue

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

Solution (Python):
x=int(input())
import math
x5=math.ceil(x**0.2)

import numpy as np 
while(True):
    for ii in np.arange(x5,-1,-1):
        for jj in range(x5+1):
            
            if ii**5-jj**5==x:
                print(ii,jj)
                exit()
            if ii**5+jj**5==x:
                print(ii,-jj)
                exit()
    x5*=2

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

q = 0
while abs(x) > q**4:
  q += 1

deta = False
for A in range(-q, q+1):
  if deta:
    break
  for B in range(-q, q+1):
    if A**5 - B**5 == x:
      print(A,B)
      deta = True
      break

Solution (Python):
X = int(input())
if X == 0:
    print(0,0)
    exit()
for i in range(0,10000):
    for j in range(0,10000):
        if i!=j and (X % abs(i-j) == 0 or X % abs(i+j) == 0):
            if i**5 - j**5 ==X:
                print(i,j)
                exit()
            if i**5 + j**5 ==X:
                print(i,-j)
                exit()
            if -i**5 + j**5 ==X:
                print(-i,-j)
                exit()
            if - i**5 - j**5 ==X:
                print(-i,j)
                exit()

Solution (Python):


import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

X = I()

P = [pow(i, 5) for i in range(1000000)]

m = False
i = 0
j = 0
for q, a in enumerate(P):
    s1 = bisect.bisect_left(P, a - X)
    s2 = bisect.bisect_left(P, X - a)

    if a - X == P[s1]:
        i = q
        j = s1
        break
    if X - a == P[s2]:
        i = q
        j = s2
        m = True
        break

print(i, end=" ")
print("-" if m else "", end ="")
print(j)

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

a = -1
b = 1
def f(x,y): return x**5-y**5

while f(a, b) != X:
    a += 1
    b = a
    while f(a, b) < X:
        b -= 1
        

print(a, b)

Solution (Python):
X = int(input())
fact = [(i,i**5) for i in range(-10**3,10**3)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)

Solution (Python):
a_list = [0,1]
b_list = [-1]
X = int(input())
i = 1
b=i
while (True):
    a = b
    b = (i + 1) ** 5
    if b - a > X:
        break
    else:
        i += 1
        a_list.append(b)
        b_list.append(-b)
b_list.reverse()
b_list.extend(a_list)
K=len(b_list)
M=int((K-1)/2)

flag=False
for i in range(K-1) :
    for j in range(i+1,K) :
        if b_list[j]-b_list[i]==X :

            print(str(j-M)+' '+str(i-M))
            flag=True
            break
    if flag :
        break

Solution (Python):
x = int(input())
count = 0
for i in range(-1000,1000, 1):
    for j in range(-1000,1000, 1):
        if i**5-j**5 == x:
            print(i,j)
            count=1
            break
    if count == 1:
        break

Solution (Python):
x = int(input())
def f(a,b):
    return pow(a,4) + b*pow(a,3) + pow(a*b,2) + a*pow(b,3) + pow(b,4)

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

lst = divisor(x)
for y in lst:
    for a in range(10000):
        div = x//y
        
        b = a - y
        if f(a,b) == div:
            print(a, b)
            exit()
            
        b = a + y
        if f(a, b) == (-1)*div:
            print(a,b)
            exit()

Solution (Python):


x = int(input())
P = 40000
p = []
b = 0
flag = 0

for i in range(1,P+1):
    if x % i == 0:
        p.append(i)

for i in p:
    a = 0
    while a <= 40000:
        b = a - i
        y = (a ** 5) - (b ** 5)
        if y == x:
            print("{} {}".format(a,b))
            flag = 1
            break
        a += 1
    if flag == 1:
        break

Solution (Python):
import sys
X = int(input())
from math import sqrt,floor
cand = []
for i in range(1,floor(sqrt(X))+1):
    
    if X%i == 0:
        k = X//i
        
        for j in range(10000):
            eq = (j-i)**4 + (j-i)**3 * j + (j-i)**2 * j**2 + (j-i) * j**3 + j**4
            
            if eq == k:
                print(j,j-i)
                sys.exit()

Solution (Python):
def resolve():
    X = int(input())
    max_num = 200
    for A in range(max_num):
        for B in range(max_num):
            if X == A**5 - B**5:
                print(A, B)
                return
            elif X == A**5 + B**5:
                print(A, -B)
                return

resolve()

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

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

Solution (Python):
import sys
x = int(input())
for a in range(10**3):
    for b in range(10**3):
        if a**5 - b**5 == x:
            print(a,b)
            sys.exit()
        elif a**5 + b**5 == x:
            print(a,-b)
            sys.exit()

Solution (Python):
import sys
import itertools


x = int(input())
for b in itertools.count():
    for a in itertools.count(b):
        a5b5 = a**5 + b**5
        if a5b5 == x:
            print(a, -b)
            sys.exit(0)
        a5b5 = a**5 - b**5
        if a5b5 == x:
            print(a, b)
            sys.exit(0)
        if x < a5b5:
            break

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

def calculate(X):
    for i in range(1,X+1):
        if X%i == 0:
            a = 0
            while True:
                b=a-i
                f = a**5 - b**5
                if f > X and b>0:
                    break
                if f == X:
                    return([a,b])
                a += 1


ans = calculate(X)
print(ans[0],ans[1])

Solution (Python):
x=int(input())
a=[]
for i in range(0,500):
  a.append(i**5)
for i in range(0,len(a)):
  for j in range(0,len(a)):
    if(a[i]-a[j]==x):
      print(i,j)
      break
    elif(a[i]+a[j]==x):
      if(i>j):
        print(i,-j)
      else:
        print(j,-i)
      break
  else:
    continue
  break

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X = INT()

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

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

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

Solution (Python):
from sys import exit
from math import sqrt

def divisor(x):
    i = 1
    x_divisor = []
    for i in range(1, int(sqrt(x)) + 1):
        if x % i == 0:
            x_divisor.append(i)
            x_divisor.append(x // i)
    result = set(x_divisor)
    return result

x = int(input())
div = divisor(x)
for k in div:
    if x ==  k ** 5:
        print(str(0), str(-k), sep = " ")
        exit()
    else:
        for a in range(1, int(x ** (1/4)) + 1):
            if x == a ** 5 - (a - k) ** 5:
                print(str(a), str(a - k), sep = " ")
                exit()

Solution (Python):






"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple

MAX_X = pow(10, 9)
MAX_SQ5 = 2 * int(pow(MAX_X, 1 / 5))


def solve(nb: int) -> Optional[Tuple[int, int]]:
    all_sq5 = set(pow(x, 5) for x in range(MAX_SQ5 + 1))
    for a in range(MAX_SQ5 + 1):
        a5 = pow(a, 5)
        if nb - a5 in all_sq5:
            return int(pow(nb - a5, 1 / 5)), -a
        if nb + a5 in all_sq5:
            return int(pow(nb + a5, 1 / 5)), a
    return None


def do_job():
    "Do the work"
    LOG.debug("Start working")
    
    X = int(input())
    
    
    
    result = solve(X)
    print(*result)


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case 
    
    


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None

if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            
            
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)

Solution (Python):
import math
x = int(input())
i = 0
while True:
  if (i**5 <= x):
    s = (x-i**5)**0.2
    s = math.floor(s*(10**7))/(10**7)
  t = (x+i**5)**0.2
  t = math.floor(t*(10**7))/(10**7)
  if s.is_integer() and i**5 <= x:
    print(int(s),-i)
    break
  elif t.is_integer():
    print(int(t), i)
    break
  i += 1

Solution (Python):
def main():
    n = int(input())
    ans = 0
    for i in range(-200,201):
        if ans:
            break
        else:
            for j in range(-201,200):
                if i**5 - j**5 == n:
                    print(i,j)
                    ans = 1
                    break

if __name__ == '__main__':
    main()

Solution (Python):
X=int(input())
for j in range(int(X**0.5)+2,0,-1):
    if X%j==0:
        for a in range(2*(10**4)):
            b=a-j
            S=j*(a**4+b**4+(a**3)*b+(a**2)*(b**2)+a*(b**3))
            if S==X:
                print(a,b)
                exit(0)

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

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

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

a=0
b=0
for i in range(1000):
    a=i
    for j in range(-500,500):
        b=j
        if (a**5)-(b**5)==x:
            break
    else:
        continue
    break

print(a,b)

Solution (Python):
x=int(input())
i=0
while True:
    a=(i**5-x)
    if(a<0):
        ans=-(-a)**(1/5)
    else:
        ans=a**(1/5)
    if(int(ans)**5==a):
        print(i,int(ans))
        break
    
    a=(i**5+x)
    if(a<0):
        ans=-(-a)**(1/5)
    else:
        ans=a**(1/5)
    if(int(ans)**5==a):
        print(int(ans),i)
        break
    
    i+=1

Solution (Python):
import itertools
import math
X=int(input())
arr=[]
arr2=[]
arr3=[]
for i in range(0,640):
    arr.append(i**5)
    arr.append(-i**5)
l=itertools.combinations_with_replacement(arr,2)
for i in l:
    arr2.append(i[0]-i[1])
    arr3.append([i[0],i[1]])
ans=arr3[arr2.index(X)]
print(int(math.pow(abs(ans[0]), 1/5))*(1 if ans[0]>=0 else -1), int(math.pow(abs(ans[1]), 1/5))*(1 if ans[1]>=0 else -1))

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

def fun(x):

    res = []

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            mult = a**5 - b**5
            if mult == x:
                res = a, b
                break
    print(res[0], res[1])

fun(x)

Solution (Python):
X = int(input())
for i in range(-500, 500):
    A = pow(i, 5)
    for j in range(-500, 500):
        B = pow(j, 5)
        if A-B == X:
            print(i, j)
            exit(0)

Solution (Python):
X = int(input())
a = 0
for i in range(10**3,-10**3,-1):
    for j in range(10**3,-10**3,-1):
        if i**5 - j**5 == X:
            print("{} {}".format(i, j))
            exit()

Solution (Python):


X = int(input())

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

Solution (Python):
x=int(input())
for a in range(999):
  for b in range(-99,999):
    if a**5-b**5==x: print(a,b); exit()

Solution (Python):
import math
x = int(input())
def ok(y):
    top = 10**500
    bottom = -y//2
    while top - bottom > 1:
        b = (top + bottom)//2
        z = (b+y)**5 - b**5
        if z == x:
            print(b+y,b)
            exit(0)
        elif z > x:
            top = b
        else:
            bottom = b
    if (bottom+y)**5 - b**5 == x:
        print(bottom+y,x)
        exit(0)
    elif (top+y)**5 - b**5 == x:
        print(top+y,top)
        exit(0)
    else:
        return
i = 1
while i*i <= x:
    if x%i == 0:
        ok(i)
        ok(x//i)
    i += 1

Solution (Python):
X=int(input())
N=10**3
L=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(i):
    L[i][j]=i**5-j**5
C=[]
M=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(N):
    M[i][j]=i**5+j**5
for i in range(N):
  for j in range(i):
    if L[i][j]==X:
      C.append([i,j])
for i in range(N):
  for j in range(N):
    if M[i][j]==X:
      C.append([i,-j])
print(C[0][0],C[0][1])

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
Y = make_divisors(X)

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

Solution (Python):
n = int(input())
a = 0
b = 0

for i in range(-300,300):
  for j in range(-300,300):
    if i**5-j**5 == n:
      a = i
      b = j
      break
print(a,b)

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

from collections import deque
z = []
u = deque([])
for a in range(0,1000):
    for b in range(-1000,1000):
        z.append(a**5-b**5)
        u.append((a,b))

for i in range(10**6+1):
    if z[i] == x:
        print(u[i][0],u[i][1])
        break

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

for A in range(1000):
    for B in range(-1000, 1000):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Solution (Python):

x = int(input())
for a in range(-300,301):
  if(a<0):
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break
  else:
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break

Solution (Python):
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 12:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()

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

arr=[]
for i in range(0,640):
    arr.append(i**5)
    arr.append(-i**5)

arr2=[]
arr3=[]
import itertools
l=itertools.combinations_with_replacement(arr,2)
for i in l:
    arr2.append(i[0]-i[1])
    arr3.append([i[0],i[1]])
import math

ans=arr3[arr2.index(X)]
print(int(math.pow(abs(ans[0]), 1/5))*(1 if ans[0]>=0 else -1), int(math.pow(abs(ans[1]), 1/5))*(1 if ans[1]>=0 else -1))

Solution (Python):
import sys

x = int(input())

a = 0
a_list = []
b = 0
b_list = []
c = 0
c_list = []

while a ** 5 < 10 ** 18:
  a_list.append(a)
  a += 1
  b_list.append(b)
  b -= 1
  c_list.append(c)
  c += 1


for i in a_list:
  for j, k in zip(b_list, c_list):
    if(i ** 5 - j ** 5 == x):
      print(i, j)
      sys.exit()
    elif(i ** 5 - k ** 5 == x):
      print(i, k)
      sys.exit()

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

for i in range(800,-800,-1):
  for j in range(-800,800):
    if pow(i,5)-pow(j,5)==N:
      print(i,j)
      break
  else:
    continue
  break

Solution (Python):
x=int(input())
import math
def fl(x):
    digits = 10
    form = '%.'+str(digits-1)+'e'
    return float((form % x))

for a in range(300):
    if a**5 >= x :
        B=a**5-x
        b = math.pow(B, 1.0/5.0)
        
        if fl(b).is_integer()==True:
            b=int(b)
            print(a,b)
            break
    else:
        B=x-a**5
        b=math.pow(B, 1.0/5.0)
        
        if fl(b).is_integer()==True:
            b=int(b)
            print(a,-b)
            break

Solution (Python):
x=int(input())
a=0
b=0
flag=0
for i in range(-500,500):
  for j in range(-500,500):
    if i**5  -j**5==x:
      a=i
      b=j
      flag+=1
      break
    if flag:
      break
print(a,b)

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

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

Solution (Python):
import sys

X=int(input())
five=[]

for i in range(-1000,1001):
    five.append(i**5)
l=len(five)


for j in range(l):
    for k in range(j+1,l):
        if five[k]-five[j]==X:
            print(-1000+k,-1000+j)
            sys.exit()