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:
x = int(input())

oil = []
for i in range(500,-1,-1):
    oil.append(pow(-(i),5))

for i in range(500):
    oil.append(pow((i+1),5))

cnt = -500


for i in oil:
    cnt_2 = -500
    for j in oil:
        if i-j == x:
            print(cnt,cnt_2)
            exit()
        cnt_2 +=1
    cnt += 1

Submission status: Accepted

Solution code:
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

yaku = make_divisors(X)
def fun(x, a):
    return(5*x**4-10*a*x**3+10*a**2*x**2-5*a**3*x+a**4)


for one in yaku:
    for i in range(10**5):
        if fun(i, one)==X/one:
            print(i, i-one)
            exit()

Submission status: Accepted

Solution code:
X = int(input())

def check():
    for i in range(1000):
        for j in range(1000):
            if i**5 + j**5 == X:
                print(i, -j)
                return
            elif i**5 - j**5 == X:
                print(i, j)
                break

check()

Submission status: Accepted

Solution code:
x = int(input())

m = 2*10**9
l = []

a = 0
b = 0
p = 0
#while b <= m:
while p < 1000:
  b = a**5
  l.append(b)
  a += 1
  p += 1


flg = 0
for i in range(len(l)):
  
  if flg == 1:
    break
  for j in range(i+1,len(l)):
    if l[i] + l[j] == x:
      res = [i,-j]
      flg = 1
      break
    elif l[i] - l[j] == x:
      res = [i,j]
      flg = 1
      break
    elif -l[i] + l[j] == x:
      res = [-i,-j]
      flg = 1
      break
    elif -l[i] - l[j] == x:
      res = [-i,j]
      flg = 1
      break
      
      
print(res[0],res[1])

Submission status: Accepted

Solution code:
import sys
import numpy as np

x = int(input())

a = np.arange(255)
b = a**5
for i in range(255):
    for j in range(255):
        if b[i] + b[j] == x:
            print(i, -j)
            sys.exit()
        if b[i] - b[j] == x:
            print(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
for b in range(0, 10000):
    a5p = X + b**5
    a5m = X - b**5
    for a in range(abs(b)+1, 10000):
        a5 = a**5
        if a5 == a5p:
            b = b
            break
        elif a5 == a5m:
            b = -b
            break
    else:
        continue
    break

print(a, b)

Submission status: Accepted

Solution code:
x=int(input())
li=[]

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

step=len(li)

for j in range(step):
    for k in range(step):
        if li[j][1]-li[k][1]==x:
            print(li[j][0],li[k][0])
            exit()

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 0
for b in range(-500, 500):
    for a in range(b+1, 500):
        if a**5 - b**5 == X:
            A, B = a, b

print("{0} {1}".format(A, B))

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
X = int(input().rstrip('\n'))
a = 0
check = 0
while X>a**5:
  b1 = X-a**5
  b2 = b1**0.2
  b = float('{:.5f}'.format(b2))
  if b.is_integer():
    print(a,int(b)*(-1))
    check += 1
    break
  else:
    a +=1
while check < 1:
  b1 = a**5-X
  b2 = b1**0.2
  b = float('{:.5f}'.format(b2))
  if b.is_integer():
    print(a,int(b))
    break
  else:
    a +=1

Submission status: Accepted

Solution code:
x = int(input())

# fiflist = [i**5 for i in range(-100,100)]
for i in range(-500,500):
  for j in range(-500,500):
    if i**5 - j**5 == x:
      print(i,j)
      exit()

Submission status: Accepted

Solution code:
X = int(input())

gojo = []
i = 0
ans = 0
while ans <= 1000000000000000000:
    ans = i**5
    gojo.append(ans)
    i += 1

risou = 0
for j, B in enumerate(gojo):
    risou = B + X
    mirisou = X - B
    for k in range(j,len(gojo)):
        if gojo[k] == risou:
            print(k, j)
            exit()
        elif gojo[k] == mirisou:
            print(k, -j)
            exit()
        if gojo[k] > risou and gojo[k] > mirisou:
            break

Submission status: Accepted

Solution code:
import numpy as np
import sys
import math
read = sys.stdin.readline

X = int(input())


for a in range(1,1000):
    for b in range(0,1000):
        a4 = a ** 4
        b4 = b ** 4
        a3 = a ** 3
        b3 = b ** 3
        a2 = a ** 2
        b2 = b ** 2
        if ( (a-b)*( a4 + (a3*b) + (a2 * b2) + (b3 * a) + b4) ) == X:
            print(a,b)
            sys.exit()

        b = -1 * b
        b3 = -1 * b3
        if ( (a-b)*( a4 + (a3*b) + (a2 * b2) + (b3 * a) + b4) ) == X:
            print(a,b)
            flag = 1
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

flag =0

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

Submission status: Accepted

Solution code:
X = int(input())

N = 10**9
ab=[]
a = 0
b = 0
while len(ab) < 2:
  a += 1
  b = 0
  for i in range(a):
    #print(a,b)
    if X % (a-b)==0:
      #print(a, b)
      c = a ** 5 - b ** 5
      if c == X :
        ab.append(a)
        ab.append(b)
      if X*(-1) == c:
        ab.append(a)
        ab.append(b)
    b = -b
    if X % (a-b)==0:
      c = a ** 5 - b ** 5
      if c == X :
        ab.append(a)
        ab.append(b)
      if X*(-1) == c:
        ab.append(a)
        ab.append(b)
    b = -b + 1


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

Submission status: Accepted

Solution code:
X = int(input())
flag = False
for A in range(0,1000):
    for B in range(-1000, 1000):
        if A**5 - B**5 == X:
            print(A,B)
            flag = True
            break
    if flag: 
        break

Submission status: Accepted

Solution code:
N = 200
fac = [0]*(N)
for i in range(N):
    fac[i] = pow(i,5)
# print(fac[-1],fac[-2],fac[-1]-fac[-2])
# print(fac[-1]-fac[-2] > 10**9)
X = int(input())
for a in range(N):
    for b in range(N):
      if fac[a] - fac[b] == X:
          print(a,b)
          exit()
      if -fac[a] - fac[b] == X:
          print(-a,b)
          exit()
      if fac[a] + fac[b] == X:
          print(a,-b)
          exit()
      if -fac[a] + fac[b] == X:
          print(-a,-b)
          exit()

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
for A in range(0, 10**9):
    tmp = A**5 - X
    if tmp == 0:
        print(A, 0)
    elif tmp > 0:
        B = int(abs(tmp)**0.2)
        if tmp == B**5:
            print(A, B)
            break
    else:
        B = -int(abs(tmp)**0.2)
        if tmp == B**5:
            print(A, B)
            break

Submission status: Accepted

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

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 sorted(divisors)


X = int(input())

divisor = make_divisors(X)

for i in divisor:
    if i % 2 == 0:
        A = i // 2
    else:
        A = (i + 1) // 2
    
    ans = 0
    while(ans <= X):
        ans = A ** 5 - (A - i) ** 5
        if ans == X:
            print(A, A - i)
            exit()
        A += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = 0
B = 0
test = 10**3
for i in range(-test, test):
	a = (X + i**5)**0.2
	if type(a) == float:
		if round(a, 10).is_integer():
			A, B = int(a), i
			break
print(A, B)

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
#import sympy as syp(素因数分解とか)
Mod = 1000000007
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    x = int(input())
    for i in range(-500,501):
        for j in range(-500, 501):
            if i ** 5 - j ** 5 == x:
                print(i, j)
                exit()
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

Solution code:
x=int(input())
a=0
while True:
    b=a**5-x
    if b<0:
        b=-((-b)**(1/5))
    else:
        b=b**(1/5)
    c=int(b)
    if (a**5-c**5)==x:
        print(str(a)+" "+str(c))
        break
    a+=1

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    x = kwargs["x"]
    n = int(x ** 0.25) + 1
    R = [[0 for i in range(n)] for i in range(n)]
    done = False

    for i in range(n):
        R[0][i] = i ** 5
        R[i][0] = i ** 5

    for i in range(0, n):
        for j in range(i + 1, n):
            R[i][j] = R[0][j] - R[0][i]

            if R[i][j] == x:
                res = '{} {}'.format(j, i)
                done = True
                break

        for j in range(1, i):
            R[i][j] = R[i][0] + R[j][0]

            if R[i][j] == x:
                res = '{} {}'.format(i, -j)
                done = True
                break

        if done:
            break

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    kwargs["x"] = [int(i) for i in cin][0]
    #kwargs["n"], kwargs["k"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

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

def f(a, b):
    return (a ** 5) - (b ** 5)

sele = math.floor(x ** (1/4))

for j in range(-sele, sele + 1):
    for k in range(-sele, sele + 1):
        if f(j, k) == x:
            print(j, k)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce

MOD = 10**9 + 7
INF = float('inf')

X = int(input())
flag = 0
if X == 0:
    print("0 0")
    exit()

for i in range(1, int(1 + sqrt(X))):
    if flag == 1:
        exit()
    elif X % i == 0:
        B = 0
        while B**4 < X+1 and flag == 0:
            if ((B+i)**5 - B**5 == X) or (((-1*B+i)**5 + B**5 == X)):
                if ((B+i)**5 - B**5 == X):
                    print("{} {}".format(B+i, B))
                    flag = 1
                else:
                    print("{} {}".format(-1*B+i, -1*B))
                    flag = 1
            B += 1

Submission status: Accepted

Solution code:
import math
import itertools

X = int(input())

list = [0]

for i in range(1000):
    val = i**5
    list.append(val)

if X % 2 == 0 and X // 2 in list:
    print(int(math.pow(X//2, 1/5)), -int(math.pow(X//2, 1/5)))
elif X in list:
    print(int(math.pow(X, 1/5)), 0)
else:
    for i in itertools.combinations(list, 2):
        # print(i)
        if i[0] + i[1] == X:
            print(int(math.pow(i[0], 1/5)), -int(math.pow(i[1], 1/5)))
            break
        elif i[0] - i[1] == X:
            print(int(math.pow(i[0], 1/5)), int(math.pow(i[1], 1/5)))
            break
        elif i[0] + i[1] == X:
            print(int(math.pow(i[0], 1/5)), -int(math.pow(i[1], 1/5)))
            break
        elif i[1] - i[0] == X:
            print(int(math.pow(i[1], 1/5)), int(math.pow(i[0], 1/5)))
            break

Submission status: Accepted

Solution code:
X = int(input())
p5 = [i**5 for i in range(3000)]
p5s = set(p5)
M = 299**5
A = 0
while True:
    B5 = abs(A**5 - X)
    if B5 in p5s:
        B = p5.index(B5) if A**5 >= X else -p5.index(B5)
        print(A, B)
        exit()
    A += 1

Submission status: Accepted

Solution code:
def m():
    X = int(input())
    length = 1001
    plus = [pow(i, 5) for i in range(0, length)]
    minas = [pow(i, 5) for i in range(-(length-1), 1)]
    minas.reverse()

    for i in range(length):
        for s in range(length):
            if (plus[i] - plus[s]) == X:
                return f'{i} {s}'

        for t in range(length):
            if (plus[i] - minas[t]) == X:
                return f'{i} {-t}'

    for i in range(length):
        for s in range(length):
            if (minas[i] - plus[s]) == X:
                return f'{-i} {s}'

        for t in range(length):
            if (minas[i] - minas[t]) == X:
                return f'{-i} {-t}'


print(m())

Submission status: Accepted

Solution code:
import math

X = int(input())

for i in range(1001):
    f = round((X + i ** 5) ** 0.2)
    if f ** 5 - i ** 5 == X:
        print(int((X + i ** 5) ** 0.2), i)
        exit()

for i in range(1, 1001):
    f = round(abs(X - i ** 5) ** 0.2)
    if X - i ** 5 > 0:
        if f ** 5 - (-i) ** 5 == X:
            print(f, -i)
            exit()
    else:
        if (-f) ** 5 - (-i) ** 5 == X:
            print(-f, -i)
            exit()

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1, 10 ** 5):
    i5 = i ** 5
    flag = False
    for j in range(i):
        j5 = j ** 5
        if i5 + j5 == x:
            flag = True
            print(i, -j)
            break
        elif i5 - j5 == x:
            flag = True
            print(i, j)
    if flag:
        break

Submission status: Accepted

Solution code:
x = int(input())

def f(x):
    return x**5

def idx(i):
    if(i%2==0): return i//2
    else: return -(i//2)

five = []
for i in range(200):
    five.append(f(i))
    five.append(f(-i))


res = [0, 0]
flg = False
for i in range(400):
    for j in range(400):
        a = five[i]
        b = five[j]
        
        if(a - b == x):
            res = [idx(i), idx(j)]
            flg = True
            break
    if flg:
        break
        

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

Submission status: Accepted

Solution code:
X = int(input())

A = 0
while True:
    n = X - A ** 5
    if n == 0:
        print(A, 0)
    elif n > 0:
        B = int(n ** (1 / 5))
        if B ** 5 == n:
            print(A, -B)
            break
        B += 1
        if B ** 5 == n:
            print(A, -B)
            break
        A += 1
    else:
        B = - int((-n) ** (1 / 5))
        if B ** 5 == n:
            print(A, -B)
            break
        B -= 1
        if B ** 5 == n:
            print(A, -B)
            break
        A += 1

Submission status: Accepted

Solution code:
x = int(input())
def check(i):
    a = 1
    while True:
        b = a - i
        temp = pow(a, 5) - pow(b, 5)
        #if i == 17:print(temp, a, b)
        if temp == x:
            return (a, b)
        if b > 0 and temp > x:
            return -1
        a += 1

num = int(pow(x, 0.5)//1)
for i in range(1, num + 1):

    if x % i == 0:
        temp = check(i)
        if temp == -1:continue
        else:
            print(*temp)
            exit()

Submission status: Accepted

Solution code:
x = int(input())


gap = 1
while True:
    a, b = 0, -gap
    while True:
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()
        elif a ** 5 - b ** 5 > x and a > 0 and b > 0:
            break
        else:
            a += 1
            b += 1
    gap += 1

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x=int(input())
a=0
b=0
def f(n):
    n1 = n**(1/5)
    if n1==int(n1):
        return True

l=set()
l.add(0)
i=1
while i**5<100*x:
    i1=i**5
    l.add(i1)
    if i%2==1:
        l.add(-i1)
    i+=1

for i in l:
    b=i
    a=x+b
    if a in l:
        if a!=0 and b!=0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(int(a1),int(b1))
        elif b==0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            print(int(a1),0)
        else:
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(0,int(b1))
        break

Submission status: Accepted

Solution code:
x = int(input())
s = []
flag = 0

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

a = -200

for n in s:
    b = -200
    for m in s:
        if n-m == x:
            print(a,b)
            flag = 1
            break
        if flag:
            break
        b += 1

    a += 1

Submission status: Accepted

Solution code:
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())
ans = 0
k = make_divisors(x)
for i in k:
    j = x//i
    l, r = 0, x
    flag = False
    while r-l > 1:
        key = (r+l)//2
        a, b = key+i, key
        if a**4+a**3*b+a**2*b**2+a*b**3+b**4 == j:
            ans = (a, b)
            flag = True
            break
        elif(a**4+a**3*b+a**2*b**2+a*b**3+b**4) > j:
            r = key 
        else:
            l = key
    if flag:
        break
    a, b = l+i, l
    if a**4+a**3*b+a**2*b**2+a*b**3+b**4 == j:
        ans = (a, b)
        flag = True
        break
    a, b = r+i, r
    if a**4+a**3*b+a**2*b**2+a*b**3+b**4 == j:
        ans = (a, b)
        flag = True
        break

if ans == 0:
    for i in range(1, 100):
        for j in range(1, 100):
            if i**5+j**5 == x:
                ans = (i, -j)
                break
        if ans != 0:
            break
    pass

print(*ans)

Submission status: Accepted

Solution code:
import math
from collections import Counter
x=int(input())
a=0
b=0
l=[]
for i in range(0,201):
	l.append(pow(i,5))
f=True
for i in range(len(l)):
	if not f:
		break
	for j in range(len(l)):
		if not f:
			break
		if l[i]-l[j]==x:
			print(i,j)
			f=False
		elif l[i]+l[j]==x:
			print(i,-j)
			f=False

Submission status: Accepted

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

    _n = int(x ** .2)
    for n in range(_n-2, _n+3):
        if n ** 5 == x:
            print(n, 0)
            return
    
    for i in range(1, 100):
        if x - i ** 5 < 0:
            continue
        _n = int((x - i ** 5) ** .2)
        for n in range(_n-2, _n+3):
            if n ** 5 == (x - i ** 5):
                print(i, -n)
                return
    
    for i in range(1, 1000):
        fif = x + i ** 5
        _n = int(fif ** .2)
        for n in range(_n-2, _n+3):
            if n ** 5 == fif:
                print(n, i)
                return

main()

Submission status: Accepted

Solution code:
X = int(input())

i = 0
p = 0
d = {}
while True:
    d[i] = i**5
    if d[i] - p > X*2:
        break
    p = d[i]
    i+=1

rd = list(d.items())
rd.reverse()


for p in range(len(rd)):
    k, v = rd[p]

    for q in range(p+1, len(rd)):
        kn, vn = rd[q]

        if v - vn == X:
            print(k, kn)
            exit()
        elif v + vn == X:
            print(k, kn*-1)
            exit()

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x = ii()
l = [0]
i = 0
num = 0
while num < 10**11:
    i += 1
    num = i**5
    l.append(num)
#print(l[-1]-l[-2])
l = set(l)
for item in l:
    if item > x:
        if item - x in l:
            print(int(item**0.2),int((item-x)**0.2))
            exit()
    else:
        if x - item in l:
            print(int(item**0.2),int((x-item)**0.2)*(-1))
            exit()

'''
    if x - item in l:#Aがitemでx-itemは-B**5
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
    elif item - x in l:#Aがitemでx-itemはB**5
#        print(item,item-x)
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
'''

Submission status: Accepted

Solution code:
def div(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 check(a,b):
    if x == a**5-b**5:
        return 0
    return a**5-b**5    

x = int(input())
s = div(x)
s.sort()
for i in s:
    for j in range(i//2+1):
        if(check(i-j,-j)==0):
            print(i-j,-j)
            exit()
    k = 1        
    while(check(i+k,k)<=x):
        if check(i+k,k)==0:
            print(i+k,k)
            exit()
        k+=1

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(x):
	l = []
	d = {}
	for i in range(-1000,1000):
		zz = i**5
		d[zz] = i
		l.append(zz)
	for a in range(-2000,2000):
		zz = a**5
		if(zz - x in l):
			print(a,d[zz-x])
			return

X = int(stdin.readline())
ans = solve(X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

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

lists = make_divisors(X) 

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

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

X = int(input())

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

for i in range(len(l)):
    for j in range(len(l)):
        if l[i] - l[j] == X:
            print(i, j)
            sys.exit()
        if l[i] + l[j] == X:
            print(i, -j)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def foo():
    for i in range(len(F)):
        for j in range(len(F)):
            if F[i] + F[j] == X:
                print(i, -j)
                return
            if F[i] - F[j] == X:
                print(i, j)
                return
X = int(input())
F = [i**5 for i in range(1000)]
flg = False
foo()

Submission status: Accepted

Solution code:
import sys
X = int(input())
MOD = 10**9+7
M = [i*m for i in range(0, 10**4) for m in [-1, 1]]
for i in range(0, 10**4):
  for j in M:
    if i == j:
      break
    if X%(i-j)==0:
      if i**5-j**5==X:
        print(i, j)
        sys.exit(0)

Submission status: Accepted

Solution code:
X = int( input().strip() ) ;

d = {} ;
for x in range ( 150 ) : 
	v1 = pow ( x, 5 ) ; 
	d[x] = v1 ; 
	d[-x] = -v1 ;
ans = None ;
for A in d :
	if not ans is None :
		break ;
	for B in d :
		if d[A] - d[B] == X : 
			ans = ( A, B, ) ; 
			break ;
if not ans is None :
	print ( "{0} {1}".format ( ans[0] , ans[1] ) );

Submission status: Accepted

Solution code:
x = int(input())


for a in range(-1, 20000):
    # ubとlbは余裕を持って大きく（小さく）取っておく
    ub = 1000**5
    lb = -1000**5
    while lb + 1 < ub:
        target = (ub+lb)//2
        if a**5 - x == target**5:
            print(a, target)
            exit()
        elif (a**5 - x >= target**5):
            lb = target
        else:
            ub = target
    if a**5 - target**5-x == 0:
        print(a, target)

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
def f(x):
    a = 0
    # a >= 0, b <= 0
    while True:
        ap = a ** 5
        b = -a
        while True:
            s = ap - b ** 5
            if s > x:
                break
            if s == x:
                return a, b
            b -= 1
        a += 1
        if a ** 5 > x // 2:
            break
    # 0 <= b < a
    while True:
        ap = a ** 5
        for b in range(0, a):
            if ap - b ** 5 == x:
                return a, b
        a += 1


if __name__ == '__main__':
    x = int(input())
    print(' '.join(map(str, f(x))))

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x = ii()
l = [0]
i = 0
num = 0
while num < 10**15:
    i += 1
    num = i**5
    l.append(num)
#print(l[-1]-l[-2])
l = set(l)
for item in l:
    if item > x:
        if item - x in l:
            print(int(item**0.2),int((item-x)**0.2))
            exit()
    else:
        if x - item in l:
            print(int(item**0.2),int((x-item)**0.2)*(-1))
            exit()

'''
    if x - item in l:#Aがitemでx-itemは-B**5
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
    elif item - x in l:#Aがitemでx-itemはB**5
#        print(item,item-x)
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
'''

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

    X = int(input())

    min_num =  6000

    for i in range(-min_num,min_num+2):
        A_5 = i ** 5

        for j in range(-min_num,min_num+2):
            B_5 = j ** 5

            if(A_5 - B_5 == X):
                print(i,j)
                return

if __name__ == "__main__":
    main()

Submission status: Accepted

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

def show():
    for i in range(100):
        print(i, i**5)

def solve(X: int):
    A = [(i ** 5, i) for i in range(1000)]
    for a, b in A:
        for aa, bb in A:
            if a  - aa == X:
                return b, bb
            if a + aa == X:
                return b, -bb
    raise


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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
    print(*solve(X))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
    #show()

Submission status: Accepted

Solution code:
import itertools

x = int(input())

num = []

for i in range(201):
    num.append(i ** 5)

for a5, b5 in itertools.permutations(num, 2):
    if a5 - b5 == x:
        print(num.index(a5), num.index(b5))
        break
    elif a5 + b5 == x:
        print(num.index(a5), num.index(b5) * (-1))
        break

Submission status: Accepted

Solution code:
x = int(input())

rs = [i ** 5 for i in range(300)]

for r in rs:
    if r <= x:
        if x - r in rs:
            print(rs.index(r), - rs.index(x - r))
            break
    if r > x:
        if r - x in rs:
            print(rs.index(r), rs.index(r - x))
            break