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())
b = 0
ans = []
while True:
    n = x - b**5
    if n < 0:
        break
    a = int(math.pow(n, 1/5))
    if a**5 == n:
       ans.append(a)
       ans.append(-b)
       break
    b += 1

if len(ans) != 0:
    print(*ans)
else:
    b = 0
    while True:
        n = x + b**5
        a = int(math.pow(n, 1/5))
        if a**5 == n:
           ans.append(a)
           ans.append(b)
           break
        b += 1
    print(*ans)

Solution (Python):
import math

if __name__ == '__main__':
    x = int(input())
    limit = math.ceil(x ** 0.2) + 100
    count = 0
    for a in range(limit):
        if a ** 5 < x:
            
            for b in range(0, -limit, -1):
                if a ** 5 - b ** 5 == x:
                    print(a, b)
                    exit(0)
        else:
            for b in range(limit):
                if a ** 5 - b ** 5 == x:
                    print(a, b)
                    exit(0)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

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


def main():
    X=I()
    S=set()
    for i in range(10**5):
        S.add(i**5)
        S.add(-i**5)
    for s in S:
        if(X-s in S):
            B=int(pow(abs(X-s),1/5))
            if(X-s<0):
                B*=-1
            A=int(pow(abs(s),1/5))
            if(s<0):
                A*=-1
            print(A,-B)
            break

if __name__ == '__main__':
    main()

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

a = max(0,int(math.pow(x,0.2)) - 1)
while a**5 - (a-1)**5 <= x:
    tmp = a**5 - x
    if tmp < 0:
        a += 1
        continue
    b = int(math.pow(tmp,0.2))
    if a**5 - b**5 == x:
        finished = True
        print(a,b)
        break
    a += 1
if not finished:
    a = 1
    while a**5 < x:
        tmp = x - a**5
        b = int(math.pow(tmp,0.2))
        if a**5 + b**5 == x:
            finished = True
            print(a,-b)
            break
        a += 1

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

for i in range(300):
    a=i**5
    l.append(a)
    l.append(-a)
        

for j in l:
    for k in l:
        aa=j-k
        if j!=k and aa==x:
            ans=[]
            for z in [j,k]:
                aaa=abs(z)**(1/5)
                if z>=0:
                    ans.append(int(aaa))
                else:
                    ans.append(int(-aaa))
            print(*ans)                
            exit()

Solution (Python):
import math

def f(X):
    for i in range(1, int(math.sqrt(X)) + 1):
        if X%i == 0:
            ret = f2(X, i)
            if ret != None:
                return (ret+i, ret)

            ret = f2(X, X//i)
            if ret != None:
                return (ret+X//i, ret)


def f2(X, d):
    d2 = X//d

    v1 = 0
    v2 = math.ceil((d2/5)**.25)
    
    while v1+1 < v2:
        v = (v1+v2)//2
        a, b = v+d, v
        y = a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4
        if y == d2:
            return v

        if y < d2:
            v1 = v
        else:
            v2 = v

    return None


def g(X):
    for a in range(int(X**.2)):
        b = int((X-a**5)**.2 + 0.5)
        if a**5 + b**5 == X:
            return (b, -a)


X = int(input())
ans = f(X)
if ans == None:
    ans = g(X)

print(ans[0], ans[1])

Solution (Python):
import sys

x = int(input())

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

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

Solution (Python):
x = int(input())
for i in range(300):
  for j in range(-300,300):
    if i >= j:
      a = i**5 - j**5
      if a == x:
        b = i
        c = j
print(b, c)

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


for a in range(-200,200):
    for b in range(-200,200):
        if x == a**5-b**5:
            ans = [a,b]
            print(a,b)
            exit()

Solution (Python):
X = int(input())
y = {pow(i, 5):i for i in range(100000)}

for val in y:
  if (X + val) in y:
    print(y[X + val], y[val])
    exit()
  elif (X - val) in y:
    print(y[X - val], -1 * y[val])
    exit()
  elif -1 * (X + val) in y:
    print(-1 * y[X + val], y[val])
    exit()
  elif -1 * (X - val) in y:
    print(-1 * y[X - val], -1 * y[val])
    exit()

Solution (Python):
import math

def is_square(integer):
    root = math.sqrt(integer)
    return integer == int(root + 0.5) ** 2

x = int(input())

divisors = []

for i in range(1, math.ceil(math.sqrt(x)) + 1):
    if x % i == 0:
        divisors.append(i)
        divisors.append(-i)
        divisors.append(x//i)
        divisors.append(-x//i)

dpPairs = []

for delta in divisors:
    if ((x // delta) - delta**4) % 5 != 0:
        continue
    disc = delta**4 + 4 * (x // delta - delta**4) / 5
    if disc < 0 or not is_square(disc):
        continue
    sqdisc = int(math.sqrt(disc) + 0.5)
    if delta ** 2 % 2 != sqdisc % 2:
        continue
    dpPairs.append((delta, (- delta ** 2 - sqdisc) // 2))
    dpPairs.append((delta, (- delta ** 2 + sqdisc) // 2))

for (delta, prod) in dpPairs:
    disc = delta ** 2 + 4 * prod
    if disc < 0 or not is_square(disc):
        continue
    sqdisc = int(math.sqrt(disc) + 0.5)
    if delta % 2 != sqdisc % 2:
        continue
    b = (- delta + sqdisc) // 2
    a = b + delta
    print(a, b)
    break

Solution (Python):
x = int(input())
nums = []
i = 0
while i ** 5 <= 10 ** 14:
    nums.append(i ** 5)
    i += 1

for i in range(len(nums)):
    a5 = nums[i]
    for j in range(len(nums)):
        b5 = nums[j]
        if x == a5 - b5:
            print(i, j)
            exit()
        if x == a5 + b5:
            print(i, -j)
            exit()

Solution (Python):
x = int(input())
l = []
for i in range(150,-150,-1):
    l.append(i**5)
for i in range(299):
    for j in range(300):
        if l[i] - l[j] == x:
            print(150-i,150-j)
            exit()

Solution (Python):
from itertools import combinations
import numpy as np
import math
X = int(input())
if X == 0:
    print(1, 1)
    exit()

def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def judge(a, b):
    right = a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4
    if (a - b) * right == X:
        return True
    else:
        return False

prime = prime_factorize(X)
cand = []
if len(prime) == 1:
    cand = prime
else:
    for r in range(1, len(prime)):
        for i in list(combinations(prime, r)):
            tmp = np.prod(np.array(list(i)))
            if tmp * tmp <= X:
                cand.append(tmp)
    cand = set(cand)

for c in cand:
    for a in range(0, int(math.sqrt(X)) + 1)[::-1]:
        b = a - c
        if judge(a, b):
            print(a, b)
            exit()

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

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


for a in range(-200,200):
    for b in range(-200,200):
        if x == a**5-b**5:
            ans = [a,b]
            print(a,b)
            exit()

Solution (Python):
X=int(input())
A = []
a=0
while a**5 - (a-1)**5 < 10.0**9:
    A.append(a**5)
    a+=1

for i, a_5 in enumerate(A):
    for j, b_5 in enumerate(A[i+1:]):
        if b_5 - a_5 == X:
            print(str(i+j+1) + ' ' + str(i))
            exit()
        elif b_5 + a_5 == X:
            print(str(i+j+1) +' ' + str((-1)*i))
            exit()

Solution (Python):
X = int(input())
a = -1000
b = -1000
for i in range(2001):
    for k in range(2001):
        if (a+i)**5 - (b+k)**5 == X:
            print(a+i,b+k)
            break
    else:
        continue
    break

Solution (Python):
input = raw_input

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

def f(x, d):
    out = (x+d) ** 5 - x ** 5
    return out

ds = make_divisors(x)



found = False
for d in ds:
    if found:
        break

    d0 = d
    if d0 % 2 == 0:
        b = -d0 // 2
    else:
        b = -d0 // 2 + 1

    while True:
        aa = b+d
        bb = b
        ret = f(b, d)
        
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret > x:
            break
        b += 1

    if found:
        break

    
    if d0 % 2 == 0:
        b = -d0 // 2
    else:
        b = d0 // 2 - 1

    while True:
        aa = b+d
        bb = b

        ret = f(b, d)
        
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret > x:
            break
        b -= 1

    if found:
        break

    d0 = d
    d = -d
    
    if d0 % 2 == 0:
        b = d0 // 2
    else:
        b = d0 // 2 + 1

    while True:
        aa = b+d
        bb = b
        ret = f(b, d)
        
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret < x:
            break
        b += 1

    if found:
        break

    if d0 % 2 == 0:
        b = d0 // 2
    else:
        b = d0 // 2 - 1
    while True:
        aa = b+d
        bb = b

        ret = f(b, d)
        
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret < x:
            break
        b -= 1


assert found
print("%d %d" % (a, b))

Solution (Python):
import math
import numpy as np
x = int(input())
fac = []
fac2 = []

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

fac = fac + list(reversed(fac2))


flag = True
for i in range(len(fac)):
  factor = fac[i]
  a = 0
  while flag:
    b = a - factor
    tmp = a*a*a*a+b*b*b*b+a*b*(b*b+a*a+a*b)
    
    if int(tmp) == int(fac[-int(i+1)]):
      flag = False
      print("{} {}".format(a, b))
      break
    if b > 0 and tmp > fac[-(i+1)]:
      break
    a += 1
      
  if flag == False:
    break

Solution (Python):
X = int(input())
A, B = 0, 0
for a in range(-1000,1000):
    for b in range(-1000,a):
        if a**5 - b**5 == X:
            A, B = a, b
print(A, B)

Solution (Python):
x = int(input())
temp = int(x ** 0.25)
flag = True
for i in range(-temp, temp + 1):
    for j in range(-temp, temp + 1):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            flag = False
            break
    if flag == False:
        break

Solution (Python):
from sys import stdin
import math

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 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


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    X = int(_in[0])  
    
    X_fac = make_divisors(X)
    flag = False
    for fac in X_fac:
        A = math.ceil(fac/2)
        while True:
            B = A-fac
            if X == A**5-B**5:
                s = f'{A} {B}'
                flag == True
                break
            else:
                if A**5-B**5>X:
                    break
            A += 1
        if flag:
            break
    if flag==False:
        for fac in X_fac:
            A = math.ceil(fac/2)
            while True:
                B = A-fac
                if X == A**5-B**5:
                    s = f'{A} {B}'
                    flag == True
                    break
                else:
                    if A**5-B**5>X:
                        break
                A -= 1
            if flag:
                break
    
    print(s)

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

y = int((X**0.2) //1 + 1)

def array(y):
    a = [0]
    for i in range(1,y+1):
        a.append(i**5)
        a.append(-i**5)
    a.sort()
    return a

y = y*2
a = array(y)

N = len(a)
for i in range(N-1):
    for j in range(i+1,N):
        if a[j] - a[i] == X:
            A,B = -y+j, -y+i

print(A,B)

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

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

def ok(B):
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return i**5==B

def get(B):
    f = B/abs(B)
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return int(i*f)



A_cand=[]
i=0
while i**5<=10**10:
    A_cand.append(i)
    i+=1


for a in range(300):
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
        break
for a in A_cand:
    a*=-1
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
print(0/0)

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

for a in range(-1000,1001) :
    powa = pow(a,5)
    for b in range(-1000,1001) :
        powb = pow(b,5)
        
        if (powa - powb == X) :
            print(a,b)
            exit()

Solution (Python):
X = int(input())
for A in range(-122,123):
    for B in range(A,122):
        if A**5-B**5==X:
            print(A,B)
            exit()
        if A**5-B**5==-X:
            print(B,A)
            exit()

Solution (Python):
x = int(input())
for i in range(1000):
    for j in range(i):
        if i**5 - j**5 == x:
            print(i,j, sep=' ')
            break
        elif i**5 + j**5 == x:
            print(i,j*(-1), sep=' ')
            break

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

for a in range(-10**5//2,10**5//2):
  b5=(int(a**5)-X)
  if b5<0:
    b5=-b5
    tmp=True
  b=int(b5**0.2)
  
  if tmp==True:
    b=-b
    
  if a**5-b**5==X:
    print(a,b)
    break

Solution (Python):
def main():
    x = int(input())
    a = 0
    while True:
        b = a**5 - x
        if b < 0:
            b = abs(b-0)**(1/5)
            b = b * (-1)
        else:
            b = b**(1/5)
        b = int(b)

        if a**5 - b**5 == x:
            print(a,b)
            return 0
        else:
            a+=1
    
if __name__ == '__main__':
    main()

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)

    divisors.sort()
    return divisors

def main():
    X = int(input())
    x = make_divisors(X)
    for i in range(1, int(X**0.5)+1):
        for j in x:
            B = i-j
            if i**5-B**5==X:
                print(i,B)
                break
        else:
            continue
        break
main()

Solution (Python):
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X = I()

a = [0,1]
for i in range(2,300):
  a.append(i**5)


for i,j in itertools.combinations(a, 2):
  
  for k in [-1,1]:
    if j - i*k == X:
      print(int(j**0.2), int(i**0.2)*k)
      exit()
print(error)

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)

    divisors.sort()
    return divisors


x = int(input())






_numbers = make_divisors(x)
numbers = []
for i in _numbers:
    numbers.append(i)
    numbers.append(-i)
make = []
for a in range(-178,179):
    for b in range(-178, 179):
        if a**4 + b*a**3 + (a**2)*(b**2) + a*(b**3) + b**4 in numbers:
            if a**5 - b**5 == x:
                print(a,b)
                exit()

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

flag = False
for a in range(-200, 200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == x:
            flag = True
            print(str(a) + " " + str(b))
            break
    if flag:
        break

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

def search(x):
    for a in range(1000):
        for b in range(1000):
            a5 = a**5
            b5 = b**5
            if (a5 - b5 == X):
                print(a, b)
                return
            elif (a5 + b5 == X): 
                print(a, -b)
                return
            elif (-a5 - b5 == X):
                print(-a, b)
                return

search(X)

Solution (Python):
import sys
import math
import itertools
from functools import reduce

def prime_factors(n):
    for i in itertools.chain([2], itertools.count(3, 2)):
        if n <= 1:
            break
        while n % i == 0:
            n //= i
            yield i

def factors(n):    
    return set(reduce(list.__add__, 
                ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def main():
    X = int(input())
    divisors = factors(X)
    A = 0
    while True:
        for d in divisors:
            B = A - d
            check1 = A**5 - B**5
            check2 = -check1
            if check1 == X:
                print('{} {}'.format(A, B))
                sys.exit(0)
            if check2 == X:
                print('{} {}'.format(B, A))
                sys.exit(0)
        A += 1
            


if __name__ == "__main__":
    main()

Solution (Python):
import math
def main():
    x = int(input())
    tmp = [0] * 1000
    for i in range(1000):
        tmp[i] = i**5
    for i in range(1000):
        a = x+tmp[i]
        if abs(a) in tmp:

            print(int(a**0.2),i)
            return

        a = x - tmp[i]
        if abs(a) in tmp:

            print(int(a**0.2),-i)
            return

if __name__=='__main__':
    main()

Solution (Python):

x = int(input())


def five(n):
    ans = 1
    for i in range(5):
        ans *= n

    return ans


break_flag = False
for i in range(100000000):
    b_five = five(i)
    x_plus_b = x + b_five
    x_minus_b = x - b_five
    for k in range(100000000):
        a_five = five(k)
        a_five_minus = -1 * a_five
        if a_five == x_plus_b:
            a = k
            b = i
            break_flag = True
            break
        elif a_five == x_minus_b:
            a = k
            b = -i
            break_flag = True
            break
        elif a_five_minus == x_plus_b:
            a = -k
            b = i
            break_flag = True
            break
        elif a_five_minus == x_minus_b:
            a = -k
            b = -i
            break_flag = True
            break
        elif a_five > x_plus_b and a_five_minus < x_minus_b:
            break
    if break_flag:
        break

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

Solution (Python):
x = int(input())
for a in range(121):
    for b in range(120):
        a2 = a**5
        b2 = b**5
        if a2-b2 == x:
            print(str(a) +' '+str(b))
            break
        elif a2+b2 == x:
            print(str(a) +' '+str(-b))
            break
    else:
        continue
    break

Solution (Python):
import sys

n = int(input())

def calc(a, b):
  return a**5 - b**5
  
for i in range(-1000, 1001):
  for j in range(-1000, 1001):
    if calc(i, j) == n:
      print(i, j)
      sys.exit()

Solution (Python):

import itertools
x = int(input())
l = [0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000, 161051, 248832, 371293, 537824, 759375, 1048576, 1419857, 1889568, 2476099, 3200000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176, 69343957, 79235168, 90224199, 102400000, 115856201, 130691232, 147008443, 164916224, 184528125, 205962976, 229345007, 254803968, 282475249, 312500000, 345025251, 380204032, 418195493, 459165024, 503284375, 550731776, 601692057, 656356768, 714924299, 777600000, 844596301, 916132832, 992436543, 1073741824, 1160290625, 1252332576, 1350125107, 1453933568, 1564031349, 1680700000, 1804229351, 1934917632, 2073071593, 2219006624, 2373046875, 2535525376, 2706784157, 2887174368, 3077056399, 3276800000, 3486784401, 3707398432, 3939040643, 4182119424, 4437053125, 4704270176, 4984209207, 5277319168, 5584059449, 5904900000, 6240321451, 6590815232, 6956883693, 7339040224, 7737809375, 8153726976, 8587340257, 9039207968, 9509900499, 10000000000, 10510100501, 11040808032, 11592740743, 12166529024, 12762815625, 13382255776, 14025517307, 14693280768, 15386239549, 16105100000, 16850581551, 17623416832, 18424351793, 19254145824, 20113571875, 21003416576, 21924480357, 22877577568, 23863536599, 24883200000, 25937424601, 27027081632, 28153056843, 29316250624, 30517578125, 31757969376, 33038369407, 34359738368, 35723051649, 37129300000, 38579489651, 40074642432, 41615795893, 43204003424, 44840334375, 46525874176, 48261724457, 50049003168, 51888844699, 53782400000, 55730836701, 57735339232, 59797108943, 61917364224, 64097340625, 66338290976, 68641485507]
for comb in itertools.combinations_with_replacement(l, 2):
    if comb[0] - comb[1] == x:
        print(l.index(comb[0]), l.index(comb[1]))
        exit()
    elif comb[0] + comb[1] == x:
        print(l.index(comb[0]), -(l.index(comb[1])))
        exit()
    elif - comb[0] + comb[1] == x:
        print(-(l.index(comb[0])), -(l.index(comb[1])))
        exit()
    elif - comb[0] - comb[1] == x:
        print(-(l.index(comb[0])), l.index(comb[1]))
        exit()

Solution (Python):
import sys
import itertools
arr = [i for i in range(-150,151)]
X = int(input())
t = len(arr)

for v in itertools.permutations(arr,2):
   if v[0]**5 - v[1]**5==X:
      print("{0} {1}".format(v[0],v[1]))
      sys.exit()

Solution (Python):
from itertools import combinations
def main():
    gojo_lst = [i**5 for i in range(-200,200)]
    gojo_dict = {}
    for i in range(-200,200):
        gojo_dict[i**5] = i
    kumiawase = combinations(gojo_lst,2)
    x = int(input())
    for a,b in kumiawase:
        
        if a - b == x:
            print(gojo_dict[a],gojo_dict[b])
            break
        elif b - a == x:
            print(gojo_dict[b],gojo_dict[a])
            break



if __name__ == '__main__':
    main()

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)
    divisors.sort()
    return divisors

X = int(input())
di = make_divisors(X)
for i in range(len(di)):
    k = di[i]
    for b in range(-200, 201):
        val = 5 * k * b ** 4 + 10 * k ** 2 * b ** 3 + 10 * k ** 3 * b ** 2 + 5 * k ** 4 * b + k ** 5 - X
        if val == 0:
            a = k + b
            print(a, b)
            exit()

Solution (Python):
x = int(input())
flag = False
for i in range(120):
    if flag:
        break
    k = i**5
    for j in range(120):
        l = j**5
        if k - l == x:
            print(i, j)
            flag = True
            break
        if k + l == x:
            print(j, -i)
            flag = True
            break

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

l5 = [i**5 for i in range(0, 10000)]
for a5 in l5:
    for b5 in l5:
        if x == a5 - b5:
            print(int(a5**(1/5)), int(b5**(1/5)))
            exit()
        elif x == a5 + b5:
            print(int(a5**(1/5)), int((-1) * b5**(1/5)))
            exit()

Solution (Python):
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Solution (Python):
d = {}
for i in range(1, 1000):
    if i ** 5 - (i-1) ** 5 > 10 ** 9:
        break
    for j in range(i-1, -i-1, -1):
        if i ** 5 - j ** 5 > 10 ** 9:
            break
        d[i ** 5 - j ** 5] = (i, j)
print(*d[int(input())])

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

a = [i**5 for i in range(200)]

for i in range(200):
    for j in range(i+1,200):
        if a[j] - a[i] == X:
            print(j,i)
            break
        if a[j] + a[i] == X:
            print(j,-i)
            break
    else:
        continue
    break

Solution (Python):
x=int(input())
A=[i**5 for i in range(-1000,1000)]
B=[i**5 for i in range(-1000,1000)]

for a in A:
    for b in B:
        if a-b==x:
            if a<0:
                a=abs(a)
                a=a**0.2
                ans_a=int(-a)
            else:
                a=abs(a)
                a=a**0.2
                ans_a=int(a)
            if b<0:
                b=abs(b)
                b=b**0.2
                ans_b=int(-b)
            else:
                b=abs(b)
                b=b**0.2
                ans_b=int(b)                
print(ans_a,ans_b)

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

Solution (Python):
import time
X = int(input())
flag = 0
T_0 = time.time()

A = 0
B = 0
for a in range(2000):
    for b in range(2000):
        if (a-1000)**5 - (b-1000)**5 == X:
            flag = 1
            A = a-1000
            B = b-1000
            break
        else:
            pass
    if flag == 1:
        break
T_1 = time.time()

print(A,B)

Solution (Python):

X = int(input())
flag = -1
i1 = 0
j1 = 0
for i in range(1000):
    for j in range(-1000, 1000):
        if i ** 5 - j ** 5 == X:
            flag = 0
            i1 = i
            j1 = j
            break
    if flag == 0:
        break
print(i1, j1)

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

Solution (Python):
x = int(input())
done = False
for a in range(-120, 121):
  if done:
    break
  for b in range(-120, 121):
    if a**5 - b**5 == x:
      ans_a = a
      ans_b = b
      done = True
      break

print(ans_a, ans_b)

Solution (Python):
import sys,math,copy,queue,itertools,bisect,collections
from heapq import *
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(-1,0),(0,1),(0,-1))

X = NI()

y = math.ceil(math.pow(X/5,1/4))
for i in range(-y,y+1):
    for j in range(-y,y+1):
        if i**5 - j**5 == X:
            print(i,j)
            exit(0)

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

for a in range(1,1001):
    sub = a ** 5
    ss = sub - x
    for b in range(-1000, 1000):
        if b ** 5 == ss:
            print(a, b)
            exit()

Solution (Python):
x=int(input())
d={}
for i in range(200):
    b=i**5
    c=(-i)**5
    d[b]=i
    d[c]=-i
for i in range(200):
    y=x+i**5
    try:
        print(d[y],i)
        break
    except:
        None
    z=x+(-i)**5
    try:
        print(d[z],-i)
        break
    except:
        None

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

def check(n):
    m = int(n**0.2)
    if abs(m**5 - n) < 1e-6:
        return True
    else:
        return False

for i in range(10**7):
    y = abs(x-i**5)
    if check(y):
        if x-i**5>0:
            print(i, int(y**0.2)*(-1))
        else:
            print(i, int(y**0.2))
        exit()

Solution (Python):
def find(x):
    b = 0
    while True:
        right = pow(b,5)+x
        left = pow(right,1/5)
        if pow(int(left), 5)==right:
            return left, b
        right = pow(-b,5)+x
        if right>=0:
            left = pow(right,1/5)
            if pow(int(left), 5)==right:
                return left, -b
        b+=1
x = int(input())
a,b = find(x)
print(int(a),b)

Solution (Python):


def floorRoot5(n):
	if n == 0 or n == 1:
		return n
	low, high, ans = 1, n, 0
	while low <= high:
		mid = (low + high) // 2
		mid5 = mid * mid * mid * mid * mid

		if mid5 == n:
			return mid
		if mid5 < n:

			low = mid + 1
			ans = mid
		else:
			high = mid - 1

	return ans


val = int(input())
start = -floorRoot5(val) - 1

while True:
	b = start
	a = floorRoot5(val + b ** 5)
	for aa in range(a - 1, a + 2):
		for bb in range(b - 1, b + 2):
			if aa ** 5 - bb ** 5 == val:
				print(aa, bb)
				exit(0)
			if bb ** 5 - aa ** 5 == val:
				print(bb, aa)
				exit(0)
	start += 1

Solution (Python):
import numpy as np
X=int(input())
flag=1
for c in range(np.power(10,9)):
    c+=1
    x=X
    if x%c==0:
        x=x//c
        for a in range(np.power(10,3)):
            if (np.power(a,4) + np.power(a,3)*(a-c) + np.power(a,2)*np.power(a-c,2) + a*np.power(a-c,3) + np.power(a-c,4))==x:
                print(a,a-c)
                flag=0
                break
    if flag==0:
        break

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

l = []
for i in range(10 ** 9):
    if i ** 5 <= 10 ** 13:
        l.append(i)
        l.append(-i)
    else:
        break

for i in range(len(l) - 1):
    for j in range(i, len(l)):
        if l[i] ** 5 - l[j] ** 5 == x:
            print(l[i], l[j])
            exit()

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