Problem:


Score : 400 points

Problem Statement

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

Constraints

1 \leq X \leq 10^9

X is an integer.

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

Input

Input is given from Standard Input in the following format:

X

Output

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

A B

Sample Input 1

33

Sample Output 1

2 -1

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

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Accepted

Solution code:

MOD = 10 ** 9 + 7
RLIMIT = 1000
DEBUG = 1

def main():
    for _ in inputt(1):
        x, = inputi()
        D = {0: 0}
        for i in count(1):
            d = i ** 5
            debug(i, d, x - d)
            if x - d in D:
                print(i, D[x - d])
                break
            D[d] = -i
            D[-d] = i




# region M


# region import

from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(RLIMIT)

# endregion

# region fastio

BUFSIZE = 8192
class FastIO(io.IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = io.BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(io.IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    if args:
        sys.stdout.write(str(args[0]))
        split = kwargs.pop("split", " ")
        for arg in args[1:]:
            sys.stdout.write(split)
            sys.stdout.write(str(arg))
    sys.stdout.write(kwargs.pop("end", "\n"))
def debug(*args, **kwargs):
    if DEBUG and not __debug__:
        print("debug", *args, **kwargs)
        sys.stdout.flush()
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip()
inputt = lambda t = 0: range(t) if t else range(int(input()))
inputs = lambda: input().split()
inputi = lambda k = int: map(k, inputs())
inputl = lambda t = 0, k = lambda: list(inputi()): [k() for _ in range(t)] if t else list(k())

# endregion

# region bisect

def len(a):
    if isinstance(a, range):
        return -((a.start - a.stop) // a.step)
    return builtins.len(a)
def bisect_left(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if key(a[mid]) < x: lo = mid + 1
        else: hi = mid
    return lo
def bisect_right(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if x < key(a[mid]): hi = mid
        else: lo = mid + 1
    return lo
def insort_left(a, x, key = None, lo = 0, hi = None):
    lo = bisect_left(a, x, key, lo, hi)
    a.insert(lo, x)
def insort_right(a, x, key = None, lo = 0, hi = None):
    lo = bisect_right(a, x, key, lo, hi)
    a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right
def index(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi and key(a[i]) == x: return a[i]
    if default != None: return default
    raise ValueError
def find_lt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_le(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_gt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError
def find_ge(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError

# endregion

# region csgraph
# TODO

class Tree:
    def __init__(n):
        self._n = n
        self._conn = [[] for _ in range(n)]
        self._list = [0] * n
    def connect(a, b):
        pass

# endregion

# region ntheory

class Sieve:
    def __init__(self):
        self._n = 6
        self._list = [2, 3, 5, 7, 11, 13]
    def extend(self, n):
        if n <= self._list[-1]: return
        maxbase = int(n ** 0.5) + 1
        self.extend(maxbase)
        begin = self._list[-1] + 1
        newsieve = [i for i in range(begin, n + 1)]
        for p in self.primerange(2, maxbase):
            for i in range(-begin % p, len(newsieve), p):
                newsieve[i] = 0
        self._list.extend([x for x in newsieve if x])
    def extend_to_no(self, i):
        while len(self._list) < i: 
            self.extend(int(self._list[-1] * 1.5))
    def primerange(self, a, b):
        a = max(2, a)
        if a >= b: return
        self.extend(b)
        i = self.search(a)[1]
        maxi = len(self._list) + 1
        while i < maxi:
            p = self._list[i - 1]
            if p < b:
                yield p
                i += 1
            else: return
    def search(self, n):
        if n < 2: raise ValueError
        if n > self._list[-1]: self.extend(n)
        b = bisect(self._list, n)
        if self._list[b - 1] == n: return b, b
        else: return b, b + 1
    def __contains__(self, n):
        if n < 2: raise ValueError
        if not n % 2: return n == 2
        a, b = self.search(n)
        return a == b
    def __getitem__(self, n):
        if isinstance(n, slice):
            self.extend_to_no(n.stop + 1)
            return self._list[n.start: n.stop: n.step]
        else:
            self.extend_to_no(n + 1)
            return self._list[n]
sieve = Sieve()
def isprime(n):
    if n <= sieve._list[-1]:
        return n in sieve
    for i in sieve:
        if not n % i: return False
        if n < i * i: return True
prime = sieve.__getitem__
primerange = lambda a, b = 0: sieve.primerange(a, b) if b else sieve.primerange(2, a)
def factorint(n):
    factors = []
    for i in sieve:
        if n < i * i: break
        while not n % i:
            factors.append(i)
            n //= i
    if n != 1: factors.append(n)
    return factors
factordict = lambda n: Counter(factorint(n))

# endregion

# region main

if __name__ == "__main__":
    main()

# endregion


# endregion

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

g = int(readline())

def pow(n,p): #繰り返し二乗法(nのp乗)
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2
            p //= 2
        else:
            res = res * n
            p -= 1
    return res

for i in range(200):
    for j in range(200):
        k = pow(i,5)
        l = pow(j,5)
        if k-l == g:
            print(i,j)
            exit()
        elif k+l == g:
            print(i,-j)
            exit()

Submission status: Accepted

Solution code:
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass


x = int(input())
d_l = divisor(x)

for d in d_l:
    for b in range(-1004,1004):
        if (b+d)**5 - b**5 == x:
            print(b+d,b)
            exit()
        if (b-d)**5 - b**5 == x:
            print(b-d,b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
a = 1
while True:
    for b in range(0, a):
        if a**5 - b**5 == x:
            print(a, b)
            sys.exit()
        if a**5 + b**5 == x:
            print(a, -b)
            sys.exit()
    a += 1

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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


def solve(X: int):
    ns = []
    for i in range(10000):
        ns.append(i**5)
    nsSet = set(ns)
    for bi in range(len(ns)):
        # assume a must be positive
        # print(f"assume b is {bi},b^5={ns[bi]},then A^5 must be {X+ns[bi]} or {X-ns[bi]}")
        if X+ns[bi] in nsSet:
            ai = ns.index(X+ns[bi])
            print(ai,bi)
            exit()
        if X - ns[bi] in nsSet:
            ai = ns.index(X - ns[bi])
            print(ai, -(bi))
            exit()
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
f=0
for i in range(-300,301):
    for j in range(-300,301):
        if i**5-j**5==x:
            print(i,j)
            f=1
            break
    if f==1:break

Submission status: Accepted

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

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

def main():
    mod=10**9+7
    X=I()
    
    flag=0
    
    for a in range(1000):
        if flag==1:
            break
        for b in range(1000):
            aa=pow(a,5)
            bb=pow(b,5)
            if aa-bb==X:
                print(a,b)
                flag=1
                break
            
            if aa+bb==X:
                print(a,-1*b)
                flag=1
                break
                

main()

Submission status: Accepted

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


def solve(X: int):
    l = set()
    for i in range(-10**3,10**3):
        l.add(i**5)

    for ll in l:
        a = X+ll
        if a in l:
            aa = 0
            bb = 0
            for i in range(-10**3,10**3):
                if i**5 == a:
                    aa = i
                    break
            for i in range(-10**3,10**3):
                if i**5 == ll:
                    bb = i
                    break

            print(aa,bb)
            return 

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
printn = lambda x: print('\n'.join(x))

x = ni()
for i in range(-500, 501):
    for j in range(-500, 501):
        if i**5 - j**5 == x:
            print(i, j)
            exit(0)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

x = inp()
for i in range(10**3):
    for j in range(-2000,2000):
        if pow(i,5) - pow(j,5) == x:
            print(i,j)
            quit()

Submission status: Accepted

Solution code:
x = int(input())

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

for i in range(2000):
    for j in range(i+1, 2000):
        if ansl[j] - ansl[i] == x:
            print(j-1000, i-1000)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

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

    b = 0
    b5 = b ** 5
    while a5 - b5 < x:
        b -= 1
        b5 = b ** 5
    if a5-b5 == x:
        print(a, b)
        exit()

    a += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
import itertools
for a,b in itertools.product(range(-1000,1001),repeat=2):
    if x==a**5-b**5:
        print(a,b)
        break

Submission status: Accepted

Solution code:
def sol(n):
    d = {}
    N = 100000
    for i in xrange(-N, N+1):
        d[i**5]=i
    for i in d:
        j = n+i
        if j in d:
            print d[j], d[i]
            return

def main():
    n = input()
    sol(n)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[i**5 for i in range(2000)]
    for i,a in enumerate(l):
        for j,b in enumerate(l):
            if a-b==X:
                print(i,j)
                exit()
            elif a+b==X:
                print(i,-j)
                exit()
    raise Exception
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
Five = [a**5 for a in range(120)]
X = int(input())
clear = 0
for o in range(119):#i<j
    for p in range(o+1,120):
        i = Five[o]
        j = Five[p]
        if j - i == X:
            print(f"{p} {o}")
            clear = 1
        if not clear and j + i == X:
            print(f"{p} {-o}")
            clear = 1
    if clear:break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x = int(input())
a = 0
b = 0
f = 1
if f == 1:
    for a_ in range(-300, 300):
        if f == 1:
            for b_ in range(-300, 300):
                if a_**5-b_**5==x:
                    f = 0
                    print(a_, b_)
                    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

X = int(input())

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if (a**5-b**5) == X:
            print(str(a)+" "+str(b))
            sys.exit()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
X = int(input())
for A in range(-10 ** 3, 10 ** 3):
  for B in range(-10 ** 3, 10 ** 3):
    if A ** 5 - B ** 5 == X:
      print(A, B)
      exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

def binary_search(b):
    l, r = -10 ** 9, 10 ** 9
    while r-l > 1:
        m = (l+r)//2
        x = m**5 - b**5
        if x < X:
            l = m
        else:
            r = m
    return r

for b in range(-10000, 10000):
    a = binary_search(b)
    if a ** 5 - b ** 5 == X:
        print(a, b)
        break

Submission status: Accepted

Solution code:
x = int(input())
l = [0]
for i in range(1, 121):
    l.append(i**5)
now = 0
for i in range(1, len(l)):
    if now == 1:
        break
    for j in range(i):
        if l[i]+l[j] == x:
            print(i, -j)
            now = 1
            break
        elif l[i]-l[j] == x:
            print(i, j)
            now = 1
            break

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x=int(input())

f=[i for i in range(-128,129)]

from itertools import combinations as cmb
ok=False
for b,a in cmb(f,2):
    if x==a**5-b**5:
        ok=True
        aa=a
        bb=b
        break
if ok:print(aa,bb)

Submission status: Accepted

Solution code:
X = int(input())

flag = 0

for A in range(0, 1000):
  for B in range(-1000, 1000):
    if A ** 5 - B ** 5 == X:
      print(A, B)
      flag = 1
      break
  if flag == 1:
    break

Submission status: Accepted

Solution code:
x = int(input())
d = []
for i in range(-1000, 1000):
    d.append([i**5, i])

for j in range(len(d)):
    for i in range(len(d)):
        tmp = d[i][0] - d[j][0]
        if x == tmp:
            print(d[i][1], d[j][1])
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
    n=int(input())
    rg=int(n**(0.25))+10
    # print(rg)
    for b in range(-rg,rg+1):
        # print((n+b**5)**(0.2))
        if (n+b**5)<0:
            l=-int((-n-b**5)**(0.2))
        else:
            l=int((n+b**5)**(0.2))
        while l**5<n+b**5:
            l+=1
        while l**5>n+b**5:
            l-=1
        if l**5-b**5==n:
            print(l,b)
            exit(0)
        

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools


def main():
  X = int(input())
  values = [0]

  for i in range(1, 200):
    values.append(i ** 5)

    if values[-1] - values[-2] > 1e9:
      break;

  for i, j in itertools.product(range(len(values)), repeat=2):
    if values[j] - values[i] == X:
      print('{} {}'.format(j, i))
      break
    elif values[j] + values[i] == X:
      print('{} {}'.format(j, -i))
      break
    elif -values[j] + values[i] == X:
      print('{} {}'.format(-j, -i))
      break


if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = 0
B = 0
flag = False
for i in range(1, 1000):
    if flag == True:
        break
    for j in range(-1000, i):
        if flag == True:
            break
        if i**5 - j**5 == X:
            A = i
            B = j
            flag = True
print(A,B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

X = int(input())

divider = []
for i in range(1,int(X**(1/2))+1):
    if X%i == 0:
        divider.append(i)
        divider.append(X//i)

for x in divider:
    B = -(x//2)
    while (B+x)**5-B**5<=X:
        if (B+x)**5-B**5==X:
            print(B+x,B)
            sys.exit()
        B+=1

Submission status: Accepted

Solution code:
x = int(input())


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

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	X = int(input())
	for i in range(-201, 201):
		for j in range(i + 1, 201):
			if j ** 5 - i ** 5 == X:
				print(j, i)
				return

	# for i in range(402):
	# 	for j in range(i + 1, 402):
	# 		if L[j] - L[i] == X:
	# 			print(L[j], L[i])
	# 			return

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
X=int(input())
Y=int(X**0.5)
for B in range(-Y,Y):
    A = B**5+X;
    if A<B:
        continue
    A = A**0.2
    Ai = int(A)
    if Ai**5-B**5==X:
        print(Ai,B)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import floor
input = sys.stdin.readline
def main():
    X = int(input())
    for a in range(301):
        for b in range(301):
            if a**5-b**5==X:
                print(a,b)
                exit()
            if a**5+b**5==X:
                print(a,-b)
                exit()

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
s = [pow(i, 5) for i in range(1000)]
for i in range(1000):
    for j in range(2000):
        if j % 2 == 0:
            if s[i] - s[j // 2] == x:
                print(i, j // 2)
                exit()
        else:
            if s[i] + s[j // 2] == x:
                print(i, -(j // 2))
                exit()

Submission status: Accepted

Solution code:
k = [i ** 5 for i in range(200)]
x = int(input())
for a, i in enumerate(k):
    for b, j in enumerate(k):
        if i - j == x:
            ans = (a, b)
            break
        elif i + j == x:
            ans = (a, -b)
            break
ans = str(ans[0]) + ' ' + str(ans[1])
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

def ans():
  for x in range(-900,901):
    for y in range(-900,901):
      if x**5-y**5==N:
        print(x,y)
        return 0
      
ans()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
MOD = 1000000007

X = int(input())

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

Submission status: Accepted

Solution code:
import math
x = int(input())
cnt = 10**5
res = 0,0
for b in range(cnt):
    val = x+int(pow(b,5))
    if (int(val**0.2))**5 == val:
        res = int(val**0.2),b
        break
    val = x-b**5
    if val < 0:
        continue
    if (int(val**0.2))**5 == val:
        res = int(val**0.2),-b
        break
print(*res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding: utf-8
# Last Modified: 03/May/20 05:49:15 PM


import sys


def main():
    arr = []
    for i in range(-(10 ** 4), 10 ** 4):
        arr.append((pow(i, 5), i))
    x = int(input())
    from bisect import bisect_left

    ans = False
    A, B = -1, -1
    for i in arr:
        c = i[0] - x
        idx = bisect_left(arr, (c, -(10 ** 20)))

        if idx < len(arr) and arr[idx][0] == c:
            ans = True
            A = i[1]
            B = arr[idx][1]
            break
    print(A, B)


get_array = lambda: list(map(int, sys.stdin.readline().split()))


get_ints = lambda: map(int, sys.stdin.readline().split())


input = lambda: sys.stdin.readline().strip()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-1000, 1000):
    i5 = i ** 5
    j5 = i5 - x
    if j5 < 0:
        j = (-j5) ** (1/5)
        j *= -1
    else:
        j = j5 ** (1/5)
    j = int(j)
    for cand in range(j - 10, j + 10):
        if i5 - cand ** 5 == x:
            print(i, cand)
            exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())


def ab(x):
    for a in range(70):
        for b in range(70):
            if a ** 5 + b ** 5 == x:
                return (a, -b)

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

a, b = ab(x)
print(a, b)

Submission status: Accepted

Solution code:
x = int(input())
ls = []
for i in range(-100000,100000):
  ls.append(i**5)
import bisect
for i in range(len(ls)):
  b = ls[i]
  ai = bisect.bisect_left(ls,x+b)
  if ai < len(ls) and ls[ai]-b == x:
    print(ai-100000,i-100000)
    break

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    X = int(input())
    for B in range(1001):
        A5 = X + B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, B)
            return 

        A5 = X - B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, -B)
            return 

    print(-1)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def slv(X):
    b = {}
    for i in range(0, 10**3):
        b[i**5] = i

    for a in range(0, 10**3):
        rem = X - (a ** 5)
        if rem in b:
            return (a, -b[rem])
        elif -rem in b:
            return (a, +b[rem])
        a *= -1
        rem = X - (a ** 5)
        if rem in b:
            return (a, -b[rem])
        elif -rem in b:
            return (a, +b[rem])

    assert False



def main():
    X = read_int()
    print(*slv(X))


if __name__ == '__main__':
    main()