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:
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	x = int(rl())
	for a in range(-200, 201):
		for b in range(-200, 201):
			if a**5-b**5 == x:
				ans = " ".join([str(a), str(b)])
				stdout.write(ans);stdout.write("\n")
				stdout.close()
				return 

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    x = ni()

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




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
x = int(input())
 
for a in range(-120, 120):
    for b in range(-120, 120):
        if pow(a, 5) - pow(b, 5) == x:
            print(a, b)
            sys.exit(0)

Submission status: Accepted

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

for a in range(-120, 120):
    for b in range(-120, 120):
        if pow(a, 5) - pow(b, 5) == x:
            print(a, b)
            sys.exit(0)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

X = ir()

A = np.arange(-300, 300, dtype=np.int64)
A5 = A ** 5
B = np.subtract.outer(A5, A5)
index = np.where(B == X)
a = index[0][0] - 300
b = index[1][0] - 300
assert a ** 5 - b ** 5 == X
print(a, b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ok = 0

for i in range(-118, 120):
    if ok > 0:
        break
        
    for j in range(-118, 120):
        if i**5 - j**5 == x:
            print(i, j)
            ok += 1
            break

Submission status: Accepted

Solution code:
import sys
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(str(i)+" "+str(j))
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

# a = n ** 5 - (n-1)**5を考える。
for i in range(-118, 120):
    for j in range(-118, 120):
        if x == i**5 - j**5:
            print(i, j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys

x = int(input())

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

Submission status: Accepted

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


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 (i**5 - j ** 5) == x:
            print(i,j)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i=j=x=int(input())
while(i:=-~i%127)**5-j**5-x:j=j%257-i
print(i,j)

Submission status: Accepted

Solution code:
X=int(input())
B=0
for i in range(-118,120):
    for j in range(-119,119):
        if X==i**5-j**5:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
import sys
import math
x = int(input())
for i in range(-120,120):
    for j in range(-120,i):
        if (i ** 5 - j ** 5 == x):
            print(i,j)
            sys.exit()

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
r = 0

for i in range(500):
    if i ** 5 - (i - 1) ** 5 > 10 ** 9:
        r = i

x = int(stdin.readline().rstrip())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x=int(input())
    for a in range(-118,120):
        for diff in range(1,238):
            if a**5-(a-diff)**5>10**9:
                break
            if a**5-(a-diff)**5==x:
                print(a,a-diff)
                sys.exit()

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x=int(input())
    for a in range(-118,120):
        for diff in range(238):
            if a**5-(a-diff)**5>10**9:
                break
            if a**5-(a-diff)**5==x:
                print(a,a-diff)
                sys.exit()

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin

x = int(stdin.readline().rstrip())

for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    x=int(input())
    for i in range(-300,300):
        for j in range(-300,300):
            if i**5-j**5==x:
                print(i,j)
                sys.exit()

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

b=0
while(True):
    bi=b**5
    ai=x+bi
#    print(ai,bi,(ai**(1/5))%1.0)
    #X-B^5 は整数を５乗した数か判定
    if(int((ai**(1/5))%1.0) == 0):

        aj=int((ai**(1/5))//1)
#        print(ai,aj,bi,b)
        if((aj**5)==ai):
            print(aj,b)
            break
    b*=-1

    bi=b**5
    ai=x+bi

    if(ai>=0 and int((ai**(1/5))%1.0) == 0):
        aj=int((ai**(1/5))//1)
#        print(ai,aj,bi,b)
        if((aj**5)==ai):
            print(aj,b)
            break
    b*=-1

    b+=1

Submission status: Accepted

Solution code:
X=int(input())

def calc(X):
    for a in range(1000):
        for b in range(-1000,a):
            if a**5 - b**5 == X:
                return (a,b)



a,b=calc(X)
print(f"{a} {b}")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
x=0
list=[]
for i in range(-118,120,1):
    for j in range(-119,119,1):
        x=i**5-j**5
        if x==X:
            print((str(i)+' '+str(j)))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X=int(input())
x=0
list=[]
for i in range(-118,120,1):

    for j in range(-119,119,1):
        x=i**5-j**5
        if x==X:
            list.append((str(i)+' '+str(j)))

print(list[0])

Submission status: Accepted

Solution code:
x = int(input())
flg = False
for i in range(1, int(x**0.5)+1):
  if flg:
    break
  if x % i == 0:
    a = 0
    b = - i
    while True:
      cnt = a**5 - b**5
      if cnt == x:
        flg = True
        print(a, b)
        break
      else:
        if a > 0 and b > 0:
          if cnt > x:
            break
        a += 1
        b += 1

Submission status: Accepted

Solution code:
X=int(input())

a=0
b=0

while True:
    hantei_p=(X+b**5)**0.2
    hantei_n=(X-b**5)**0.2

    if abs(int(hantei_p)-hantei_p)<1:
       a=int(hantei_p)
       if a**5-b**5==X:
           print("{} {}".format(a,b))
           break
    if isinstance(hantei_n**0.2,float):
        if abs(int(hantei_n)-hantei_n)<1:
            a=int(hantei_n)
            if a**5+b**5==X:
                print("{} {}".format(a,-b))
                break
    
    b +=1

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-118, 121):
    for b in range(-118, 121):
        if (a**5 - b**5) == X:
            break
    else:
        continue
    break
print(a, b)

Submission status: Accepted

Solution code:
import sys
# sys.stdin = open('input.txt')

x = int(input())

for a in range(1000):
    a5 = a**5
    for b in range(-1000, 1000):
        b5 = b**5
        if a5 - b5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
x=int(input())

L=[0]*122
for i in range(1,121):
    ii=i**2
    iii=ii**2
    L[i]=i*iii

ans="ERROR"

for j in range(122):
    a=L[j]
    if x-a in L:
        ans=[int(a**0.2),int(-((x-a)**0.2))]
    elif a-x in L:
        ans=[int(a**0.2),int((a-x)**0.2)]
    else:
        pass

print(*ans)

Submission status: Accepted

Solution code:
import math
import sys

# print(math.pow(10**9,1/5))

x = int(input())

maxn = 128
for a in range(maxn):
    for b in range(a+1,maxn):
        if b**5 - a**5 == x:
            print(b,a)
            sys.exit()
        elif a**5 + b**5 == x:
            print(a,-1*b)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
f = [i**5 for i in range(1000)]

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

Submission status: Accepted

Solution code:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
def f(a,p):
    return 5*a**4+10*(a**3)*p+10*(a**2)*(p**2)+5*a*(p**3)+p**4
for i in range(1,x+1):
    if i*i>x:
        break
    if x%i==0:
        p=i;q=x//i
        if p**4%5==q%5:
            for b in range(-1000,1000):
                if f(b,p)==q:
                    print(b+p,b)
                    exit(0)
        p=-1*i;q=(-1)*(x//i)

        for b in range(-1000,1000):
            if f(b,p)==q:
                print(b,b+p)
                exit(0)

Submission status: Accepted

Solution code:
x = int(input())

flag = False
for a in range(-1000, 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:
x = int(input())
for i in range(-150,150):
  for j in range(-150,150):
    if (i**5 - j**5 == x):
      print(i,j)
      exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

judge = False
for a in range(1001):
    for b in range(-200, 200):
        s = a**5 - b**5
        if s == x:
            judge = True
            break
    if judge:
        break

print(a, b)

Submission status: Accepted

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

flag = 0
a_s = 0
if x == 1:
  print(1, 0)
else:
  l = make_divisors(x)
  for a in range(a_s, x+1):
    if flag == 1:
      break
    for b_a in l:
      if b_a <= a:
        b = a - b_a
        if a**5 - b**5 == x or a**5 + b**5 == x:
          flag += 1
          print(a, b)
          break
      if b_a > a:
        b = b_a - a
        if a**5 + b**5 == x:
          flag += 1
          print(a, -b)
          break

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-200, 201):
    for b in range(-200, 201):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            quit()

Submission status: Accepted

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

from math import sqrt
from itertools import product

def prime(n):
    assert(n > 1)
    n = int(n)
    sq_n = int(sqrt(n)) + 1
    hurui = [False] * sq_n
    ret = []
    for i in range(2, sq_n):
        cnt = 0
        if hurui[i]:
            continue
        for ii in range(i, sq_n, i):
            hurui[ii] = True
        while n % i == 0:
            n = n // i
            cnt += 1
        if cnt > 0:
            ret.append((i, cnt))
    if n != 1:
        ret.append((n, 1))
    return ret

def pairs(N):
    N = int(N)
    nlist = prime(N)
    n, cnt = zip(*nlist)
    ret = []
    for _cnt in product(*(list(range(c + 1)) for c in cnt)):
        val = 1
        for _n, _c in zip(n, _cnt):
            val *= _n ** _c
        ret.append([val, N // val])
    ret.sort()
    return ret

#X = int(1)
X = int(input())

if X == 1:
    print(0, -1)
    exit(0)

for n, m in pairs(X):
    #print(n, m)
    if (n**4 - m**4) % 5 != 0:
        continue
    for B in range(-n // 2 - 1, int(m ** 0.25)):
        A = B + n
        if A ** 5 - B ** 5 == X:
            break
    if A ** 5 - B ** 5 == X:
        break
print(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
 
a = [i**5 for i in range(120)]
for i in range(120):
    for j in range(i+1,120):
        if a[j]-a[i] == n:
            print(j,i)
            break
        if a[j]+a[i] == n:
            print(j,-i)
            break
    else: continue
    break

Submission status: Accepted

Solution code:
def main():
    import math
    x=int(input())
    stop=False
    #(a,b)==(+,-)
    for a in range(int(math.pow(10**9,1/5))+1):
        for b in range(int(math.pow(10**9,1/5))+1):
            if a**5-(-b)**5==x:
                print(a,-b)
                stop=True
                break
        if stop:
            break
    else:
        #(a,b)==(+,+)
        a_range_num=int(math.pow(10**9+(math.pow(2,1/4)*10**2)**5,1/5))
        for b in range(int(math.pow(10**9,1/4))+1):
            for a in range(b,a_range_num+1):
                if a**5-b**5==x:
                    print(a,b)
                    stop=True
                    break
            if stop:
                break
if __name__=="__main__":
    main()

Submission status: Accepted

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

stop=False
#(a,b)==(+,-)
for a in range(int(math.pow(10**9,1/5))+1):
    for b in range(int(math.pow(10**9,1/5))+1):
        if a**5-(-b)**5==x:
            print(a,-b)
            stop=True
            break
    if stop:
        break
else:
    #(a,b)==(+,+)
    a_range_num=int(math.pow(10**9+(math.pow(2,1/4)*10**2)**5,1/5))
    for b in range(int(math.pow(10**9,1/4))+1):
        for a in range(b,a_range_num+1):
            if a**5-b**5==x:
                print(a,b)
                stop=True
                break
        if stop:
            break

Submission status: Accepted

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

stop=False
for i in range(int(math.pow(10**9,1/5))+1):
    for j in range(int(math.pow(10**9,1/5))+1):
        if i**5-(-j)**5==x:
            print(i,-j)
            stop=True
            break
    if stop:
        break
else:
    stop=False
    range_num=int(math.pow(10**9+(math.pow(2,1/4)*10**2)**5,1/5))
    for i in range(int(math.pow(10**9,1/4))+1):
        for j in range(i,range_num+1):
            if j**5-i**5==x:
                print(j,i)
                stop=True
                break
        if stop:
            break

Submission status: Accepted

Solution code:
x=int(input())
a,b=-1,-1
for i in range(-130,131):
    for j in range(-130,131):
        if pow(i,5)-pow(j,5)==x:
            a=i
            b=j
            break
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = 0
while True:
    for B in range(A+1):
        if A ** 5 + B ** 5 == X:
            print(A, -B)
            sys.exit()
        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:
memorization_dict = dict()
max_number = 10 ** 13
i = 0
power_value = 0
while power_value <= max_number:
    power_value = i ** 5
    memorization_dict[power_value] = i
    i += 1

X = int(input())

solution_1 = 0
solution_2 = 0

for B in memorization_dict.keys():
    A = X + B
    if A in memorization_dict.keys():
        solution_1 = memorization_dict[A]
        solution_2 = memorization_dict[B]
        break
    A = X - B
    if A in memorization_dict.keys():
        solution_1 = memorization_dict[A]
        solution_2 = memorization_dict[B] * (-1)
        break

print(solution_1, solution_2)

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:
N = int(input())
MAX = 128

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

Submission status: Accepted

Solution code:
x = int(input())


#%%

flag = False
for a in range(10001):
    for b in range(-1000, 1000):
        s = a**5 - b**5
        if s == x:
            flag = True
            break
    if flag:
        break

print(a, b)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
import sys
import itertools


def solve(X: int):
    for a in range(-118, 119):
        for b in range(-119, 118):
            if a**5-b**5 == X:
                print(f'{a} {b}')
                return


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 get_answer():
  x = int(input())
  
  is_get = False
  for a in range(1000000000):
    if is_get:
      break
    for b in range(-1*a, a, 1):
      if x == a**5 - b**5:
        is_get = True
        break
        
  print(f"{a-1} {b}")

if __name__ == "__main__":
  get_answer()

Submission status: Accepted

Solution code:

x=int(input())
lists=[(i**5,i) for i in range(-1000,1000)]
N=len(lists)
def solve(x):
    for i in range(N):
        for j in range(i):
            if lists[i][0]-lists[j][0]==x:
                print(lists[i][1],lists[j][1])
                return True
solve(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
ans = 0 
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if x == a**5 - b**5:
            print(a, b)
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import math
x = int(input())
cand = {i: i ** 5 for i in range(-100000, 100000)}
r_cand = {j: i for i, j in cand.items()}
set_a = set(cand)
if r_cand.get(x, 0):
    print(f"{r_cand[x]} 0")
else:
    result = [(r_cand[x + b], r_cand[b]) for b in r_cand if r_cand.get(x + b, 0)][0]
    print(f"{result[0]} {result[1]}")

Submission status: Accepted

Solution code:
"""
n = 1
while n**5 < 10**9:
  n += 1
print(n)
# 64
"""
X = int(input())

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

Submission status: Accepted

Solution code:
import itertools
"""
n = 1
while n**5 < 10**9:
  n += 1
print(n)
# 64
"""
X = int(input())

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

Submission status: Accepted

Solution code:
from math import sqrt

x = int(input())

root = int(sqrt(sqrt(x)))

check = 0
for a in range(-1 * root, root * 2):
    for b in range(-1 * root, root * 2):
        if a * a * a * a * a - b * b * b * b * b == x:
            print(f"{a} {b}")
            check = 1
        if check == 1:
            break
    if check == 1:
        break

Submission status: Accepted

Solution code:
X = int(input())

flag = False
for a in range(-118,120):
    for b in range(-119,119):
        if a**5-b**5==X:
            print(a,b)
            flag = True
            break
    if flag:
        break

Submission status: Accepted

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


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

x = int(input())

fact_x = smallDivisors(x)

for f in fact_x:
    fact_const = divisors(abs((f ** 4) - (x // f)))
    fact_const.append(0)
    for a in fact_const:
        b = a - f
        if (a**4 + (a**3) * b + (a**2) * (b**2) + a * (b**3) + b**4) == x // f:
            print("{} {}".format(a, b))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X=int(input())
stp=0
for a in range(120):
    if stp==1:
        break
    else:
        for b in range(120):
            A=a**5
            B=b**5
            tmp1=A-B
            tmp2=-A+B
            tmp3=-A-B
            tmp4=A+B
            if tmp1==X:
                print(a,b)
                stp=1
                break
            elif tmp2==X:
                print(-a,-b)
                stp=1
                break
            elif tmp3==X:
                print(-a,b)
                stp=1
                break
            elif tmp4==X:
                print(a,-b)
                stp=1
                break

Submission status: Accepted

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

sol()

Submission status: Accepted

Solution code:
import sys
X = int(input())
#for a in range(-120,120):
#  b = a**5-X
#  if b < 0: b = -(-b)**0.2
#  else: b = b**0.2
#  if b.is_integer():
#    print(a,int(b))
#    break
    
for a in range(-120,120):
  for b in range(-120,120):
    if a**5-b**5 == X:
      print(a,b)
      sys.exit()

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:
import numpy as np
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()

Submission status: Accepted

Solution code:

X = int(input())
X_0 = int(X**0.5)
X_list = []
for i in range(1, X_0 + 1):
    if X%i == 0:
        X_list.append(i)

flag = False
ans = 0
for x in X_list:
    y = X/x
    y1 = y**0.5
    y2 = int(y**0.5)
    for A in range(x, y2+1):
        if A**5 - (A-x)**5 == X:
            flag = True
            ans = (A, A-x)
            break
if flag:
    print(ans[0], ans[1])
else:
    for x in X_list:
        for B in range(1, x+1):
            if (x-B)**5 + B**5 == X:
                flag = True
                ans = (x-B, -B)
    if flag:
        print(ans[0], ans[1])

Submission status: Accepted

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

for i in range(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())

def solve():
    for a in range(1000):
        for b in range(-1000,1000):
            if a**5 - b**5 == X:
                return a,b

a,b = solve()
print(a,b)

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

for i in range(len(make_divisors(X))):
    A = make_divisors(X)[i]
    for j in range(-64,119):
        if (A+j)**5-j**5==X:
            a = j + A
            b = j
            break
        else:
            continue
        break
    else:
        continue
    break
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
INF = 1000
A = [i ** 5 for i in range(INF)]
B = [i ** 5 for i in range(INF)]

def solve():

    for i in range(INF):
        for j in range(INF):
            if X == A[i] - B[j]:
                print(i, j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == A[i] + B[j]:
                print(i, -j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == -A[i] - B[j]:
                print(-i, j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == -A[i] + B[j]:
                print(-i, -j)
                return
            
solve()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
Ans = []
for i in range(0, 1000):
  for j in range(-1000, 1000):
    ab = i**5 - j **5
    if ab == X:
      Ans.append([i, j])
ans = Ans[0]
print(ans[0], ans[1])

Submission status: Accepted

Solution code:
x=int(input())
for i in range(0,1000):
    for j in range(-1000,1000):
        if i**5-j**5==x:
            print("{} {}".format(i,j))
            exit(0)

Submission status: Accepted

Solution code:
import math

x = int(input())


def check(x):
    i = 1
    while True:
        for j in range(i):
            if (i == j):
                continue
            elif (x % (i - j) == 0) and (x == ((i ** 5) - (j ** 5))):
                print(i, j)
                return
            elif (x % (i + j) == 0) and ( x == ((i ** 5) + (j ** 5))):
                print(i, -j)
                return
        i = i + 1

check(x)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
i=j=x=int(input())
while i**5-j**5-x:i=-~i%127;j=j%257-i
print(i,j)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    X = int(input())
    for a in range(-200, 200):
        a5 = a**5
        b5 = a5-X
        for b in range(-200, 200):
            if b**5 == b5:
                print(a, b)
                exit()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i=j=x=int(input())
while i**5-j**5-x:i=-~i%120;j=j%221-99
print(i,j)

Submission status: Accepted

Solution code:
i=j=x=int(input())
while i**5-j**5-x:i=-~i%120;j=-~j%217-98
print(i,j)

Submission status: Accepted

Solution code:
i=j=x=int(input())
while i**5-j**5-x:i=-~i%120;j=(j+99)%217-98
print(i,j)

Submission status: Accepted

Solution code:
x=int(input())
i=j=c=5**6
while i**5-j**5-x:c-=1;i=c%128;j=c>>7
print(i,j)