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())
for i in range(-200,200):
  for j in range(-200,200):
    if (i**5)-(j**5)==X:
      print(i,j)
      exit()

Submission status: Accepted

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

for i in range(-2*int(abs(x**0.2)),2*int(abs(x**0.2))+1):
    for j in range(-2*int(abs(x**0.2)), 2*int(abs(x**0.2))+1):
        if i**5-j**5==x:
            print(f"{i} {j}")
            bf=1
            break
    if bf==1:
        break

Submission status: Accepted

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

def solve():

    X = int(input().rstrip())

    for A in range(1000):
        A5 = A*A*A*A*A
        for B in range(-1000,1000):
            B5 = B*B*B*B*B
            if A5-B5 == X:
                print(f'{A} {B}')
                return

solve()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

x = int(readline())
for a in range(-500, 500):
    for b in range(-500, 500):
        if pow(a, 5) == x + pow(b, 5):
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

pow_li = [pow(i,5) for i in range(1000)]

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

Submission status: Accepted

Solution code:
X = int(input())

#A**5,B**5でとり得る可能性のある数をあらかじめリストで用意する

N = [i**5 for i in range(10000)]
 
#A,Bで別々の数を扱うので、変数はi,jの２種を用意する

for i in range(10000):
	for j in range(10000):

#リストから２つの数を抽出し、Xになるか計算を繰り返す
#Xは正の整数であるため、Aが負になる可能性は除外

		if N[j] - N[i] == X:
			print(j, i)
			exit()

#Bが負の場合、符号が変わる可能性があるため、もう１パターン計算

		if N[j] + N[i] == X:
			print(j, -i)
			exit()

Submission status: Accepted

Solution code:
X = int(input())

A = range(-118,120)
B = range(-118,120)
flag = 0
for a in A:
  for b in B:
    ans = a**5 - b**5
    if ans == X:
      print("{} {}".format(a,b))
      flag=1
      break
  if flag:
    break

Submission status: Accepted

Solution code:
X = int(input())

#A**5,B**5でとり得る可能性のある数をあらかじめリストで用意する

N = [i**5 for i in range(1000)]
 
#A,Bで別々の数を扱うので、変数はi,jの２種を用意する

for i in range(1000):
	for j in range(1000):

#リストから２つの数を抽出し、Xになるか計算を繰り返す
#Xは正の整数であるため、Aが負になる可能性は除外

		if N[j] - N[i] == X:
			print(j, i)
			exit()

#Bが負の場合、符号が変わる可能性があるため、もう１パターン計算

		if N[j] + N[i] == X:
			print(j, -i)
			exit()

Submission status: Accepted

Solution code:
X = int(input())

#A**5,B**5でとり得る可能性のある数をあらかじめリストで用意する

N = [i**5 for i in range(1000)]
 
#A,Bで別々の処理をするため、変数はi,jの２種を用意する


for i in range(1000):
	for j in range(i, 1000):

#リストから２つの数を抽出し、Xになるか計算を繰り返す
#Xは正の整数であるため、Aが負になる可能性は除外

		if N[j] - N[i] == X:
			print(j, i)
			exit()

#Bが負の場合、符号が変わる可能性があるため、もう１パターン計算

		if N[j] + N[i] == X:
			print(j, -i)
			exit()

Submission status: Accepted

Solution code:
X = int(input())

#A**5,B**5でとり得る可能性のある数をあらかじめリストで用意する

N = [i**5 for i in range(1000)]
 
#A,Bで別々の処理をするため、変数はi,jの２種を用意する


for i in range(1000):
	for j in range(1000):

#リストから２つの数を抽出し、Xになるか計算を繰り返す
#Xは正の整数であるため、Aが負になる可能性は除外

		if N[j] - N[i] == X:
			print(j, i)
			exit()

#Bが負の場合、符号が変わる可能性があるため、もう１パターン計算

		if N[j] + N[i] == X:
			print(j, -i)
			exit()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)

# A and B will be less than 119


def main():
    X = int(input().strip())
    for A in range(-119, 120):
        for B in range(-119, 120):
            if A ** 5 - B ** 5 == X:
                return "{} {}".format(A, B)

    else:
        return "Invalid X"


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

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:
            A = a
            B = b
print(A, B)

Submission status: Accepted

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

# b<=0

for i in range(0,int(x**(1/4))+1):
    for j in range(0,int(x**(1/4))+1):
        if i**5 - j**5 == x:
            print(i,j)
            sys.exit()


# b>0

for i in range(0,int(x**(1/4)+1)):
    for j in range(-int(x**(1/4))-2,0):
        if i**5 - j**5 == x:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())

for a in range(0,200):
  a5 = a**5
  b5 = a5 - x
  if b5 >= 0:
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,b)
      break
  else:
    b5 = -b5
    b = int( float(b5)**0.2 )
    if b**5 == b5:
      print(a,-b)
      break
#

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy
def main():
    X = int(input())
    now = 1
    for A in range(-118, 120):
        for B in range(-119, 118):
            if A ** 5 - B ** 5 == X:
                print(A, B)
                sys.exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(-120,120):
    for j in range(-120,120):
        res = i**5 - j**5
        if(res == x):
            flag = 1
            break
    if(flag == 1):
        break

print(i,j)

Submission status: Accepted

Solution code:
X = int(input())
def f():
    for i in range(-118, 120):
        for j in range(-119, 119):
            if i**5 - j**5 == X:
                print(i, j)
                return
f()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = input()
    x = int(x)

    flag = False
    a = 0
    b = 0
    for i in range(1,120):
        for j in range(1,120):
            ab = i**5 - (i-j)**5
            if ab == x:
                flag = True
                a = i
                b = i-j
                break
        if flag:
            break

    print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
flag = False
for a in range(-200, 200):
  for b in range(-200, a):
    if a**5 - b**5 == X:
      flag = True
      print(a, b, sep = " ")
      break
  if flag:
    break

Submission status: Accepted

Solution code:
def solve(string):
    x = int(string)
    a = {i**5: i for i in range(-120, 121)}
    for i in range(-121, 121):
        if x + i ** 5 in a:
            return str(f"{a[x+i**5]} {i}")


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
x = int(input())
a, b = 0,0
done = False
for i in range(-2000, 2000):
    for l in range(2000,-2000, -1):
        if((i**5)-(l**5)==x):
            a = i
            b = l
            print(a,b)
            done  = True
            break
    if(done):
        break

Submission status: Accepted

Solution code:
def solve(string):
    x = int(string)
    a = {i**5: i for i in range(-10000, 10000)}
    for i in range(-10000, 10000):
        if x + i ** 5 in a:
            return str(f"{a[x+i**5]} {i}")


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
import sys

x = int(input())
for a in range(-150, 150):
    for b in range(-150, a):
        if a**5 - b**5 == x:
            print(*[a, b])
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())

for i in range(290):
        n=x+(i-145)**5
        for j in range(290):
            if (j-145)**5==n:
                print(j-145,i-145)
                exit()

Submission status: Accepted

Solution code:
import sys
x = int(input())
l = range(201)
for i in l:
  for j in l:
    if i**5+j**5 == x:
      print(' '.join([str(i),str(-j)]))
      sys.exit()
    elif i**5-j**5 == x:
      print(' '.join([str(i),str(j)]))
      sys.exit()
    else:
      pass

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    a = 1
    diff = 1
    while True:
        res = a ** 5 - (a - diff) ** 5
        if res < x:
            a += 1
            continue
        if res == x:
            print(a, a - diff)
            break
        while True:
            diff += 1
            if x % diff == 0:
                break
        a = (diff + 1) // 2

if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

a = 1
diff = 1
while True:
    res = a ** 5 - (a - diff) ** 5
    if res == x:
        print(a, a - diff)
        break
    if res < x:
        a += 1
        continue
    while True:
        diff += 1
        if x % diff == 0:
            break
    a = (diff + 1) // 2

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    for i in range(150, 0, -1):
        for j in range(i, -150, -1):
            cal = i ** 5 - j ** 5
            if cal == x:
                print(i, j)
                exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(a,b)

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 0
clr_flg = False
score = 0
while score <= X and clr_flg == False:
    while score <= X:
        score = A**5 + B**5
        if score == X:
            clr_flg = True
            print(A,-B)
            break
        B += 1
    B = 0
    score = A**5 + B**5
    A += 1
A = 0
B = 0
while clr_flg == False:
    score = A**5 - B**5
    if score > X:
        B += 1
    elif score < X:
        A += 1
    else:
        print(A,B)
        break

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-500, 501, 1):
    for b in range(-500, 501, 1):
        if a**5 - b**5 == X:
            print(a, b)
            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)
            break
    else:
        continue
    break

Submission status: Accepted

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

for xi in range(-150,150):
    for yi in range(-150,150):
        if (xi**5 - yi**5)==X:
            print(xi,yi)
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())
m=list()
n=list()
for i in range(200):
    m.append(i**5)
    n.append(-i**5)
    if (x+(i**5)) in m:
        a=m.index(x+(i**5))
        b=i
        break
    if (x-i**5) in m:
        a=m.index(x-(i**5))
        b=-i
        break
    if (x-(i**5)) in n:
        a=i
        b=n.index(x-i**5)
        break    
print(a," ",b)

Submission status: Accepted

Solution code:
from collections import Counter

X = int(input())

l = [0]
i = 0
while i**5 - (i-1)**5 <= X:
    i+=1
    l.append(i**5)

for i in l:
    if Counter(l)[X - i]==1:
        print(l.index((X-i)), -l.index(i))
        quit()
    if Counter(l)[X + i]==1:
        print(l.index(X+i), l.index(i))

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)
            break
    else:
        continue
    break

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:
            pass
        else:
            print(i,j)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#D
X=int(input())
for i in range(1000):
    for a in range(1000):
        if a**5-(a-i)**5==X:
            print(a,a-i)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

flag = True

for a in range(1, 1000):
    a5 = pow(a, 5)
    for b in range(-1000, 1000):
        b5 = pow(b, 5)
        if a5 - b5 == x and flag:
            print(a, b)
            flag = False

Submission status: Accepted

Solution code:
x = int(input())
a = 0
while True:
    po = pow(a, 5)
    b = po - x
    c = x - po
    if b > 0:
        ans = int(pow(b, 0.2))
    else:
        ans = - int(c ** 0.2)
    ans_p = pow(ans, 5)
    if ans_p == b or ans_p == c: 
        print(a, ans)
        break
    else:
        a += 1

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-120, 120):
  f_a = a**5
  d = f_a-x
  b = round(abs(d)**(1/5).real)
  if d<0: b *= -1
  if f_a - b**5 == x:
    print(a, b)
    break

Submission status: Accepted

Solution code:
x = int(input())
l = []
for i in range(130):
    l.append(i ** 5)
for i in l:
    a = int(i ** 0.2)
    b = i - x
    c = x - i
    if b in l or c in l:
        if b > 0:
            ans = int(b ** 0.2)
        else:
            ans = - int(c ** 0.2)
        print(a, ans)
        break
else:
    print("NO")

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-120, 120):
  f_a = a**5
  r_b = (x-f_a)**(1/5).real
  b = round(r_b.real)
  if f_a - b**5 == x:
    print(a, b)
    break

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

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-120, 120):
  f_a = a**5
  r_b = (x-f_a)**(1/5).real
  b = round(r_b.real)
  if f_a - b**5 == x:
    print(a, b)
    break
  b *= -1
  if f_a - b**5 == x:
    print(a, b)
    break

Submission status: Accepted

Solution code:
x = int(input())

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

    break

Submission status: Accepted

Solution code:
x = int(input())
ans = []
for i in range(10000):
	b = i**5 - x
	if b <0:
		B = -b
		s = int(pow(B,0.2))
		if s**5 == B:
			ans = [i, -s]
			break
	else:
		s = int(pow(b,0.2))
		if s**5 == b:
			ans = [i, s]
			break
print(ans[0], ans[1])

Submission status: Accepted

Solution code:
X = int(input())

result = [0, 0]
powers = [x**5 for x in range(1001)]

end_flag = False
for i in range(1001):
    a5 = powers[i]
    for j in range(i, 1001):
        b5 = powers[j]
        x = a5 - b5
        if (x == X):
            result[0] = i
            result[1] = j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = -j
            end_flag = True
            break
        x = a5 + b5
        if (x == X):
            result[0] = i
            result[1] = -j
            end_flag = True
            break
        elif (-x == X):
            result[0] = -i
            result[1] = j
            end_flag = True
            break
    if end_flag:
        break

A, B = result
print(f"{A} {B}")

Submission status: Accepted

Solution code:
#A = 1
#B = 0
#
#while True:
#    print(A,B)
#    print(A**5 - B**5)
#    A += 10
#    B += 10
#    if A**5 - B**5 >= 10**10:
#        eAit()
#上記コードで検証したところ
# 10**9は大体A=120で超える。
#マイナスを加味しても、A:240通り、B:240通り程度と考え240*240=57600通り程度。全探索余裕。

x = int(input())

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

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('{} {}'.format(a,b))
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
import sys

x = int(input())

for i in range(-200, 200):
    for j in range(-200, 200):
        if i ** 5 - j ** 5 == x:
            print('{} {}'.format(i, j))
            sys.exit()

Submission status: Accepted

Solution code:
import sys

X = int(input())

for a in range(-118, 119+1):
    for b in range(-119, 118+1):
        if a**5 - b**5 == X:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
def func(x):
    for A in range(-118,120):
        for B in range(-119,119):
            if (A**5-B**5)==x:
                return A,B

def main():
    x=int(input())
    print("%d %d" %func(x))
                

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
# ABC166d


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    x = int(input())
    for i in range(-200, 200):
        for j in range(-200, 200):
            if (i ** 5 - j ** 5 == x):
                print(i, j)
                exit(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
M = 0
i = 1
while i ** 5 - (i-1) ** 5 <= 10**9:
    i += 1
M = i

X = int(input())
for B in range(-M, M + 1):
    for A in range(B + 1, M + 1):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
x = int(input())
# 下から
xr = int(x ** 0.2)
m = 0
for i in reversed(range(xr + 1)):
    for j in range(m,i):
        ip = i ** 5
        jp = j ** 5
        sumij = ip + jp
        if sumij < x:
            m = j
        elif sumij > x:
            break
        else:
            print(str(i) + " " + str(-1 * j))

#上から
m = 0
for i in range(xr + 1,1000):
    for j in range(m,i):
        ip = i ** 5
        jp = j ** 5
        subij = ip - jp
        if subij > x:
            m = j
        elif subij < x:
            break
        else:
            print(str(i) + " " + str(j))

Submission status: Accepted

Solution code:
import sys
l = sys.stdin.readline().strip()
x = int(l)
cands = []
for i in range(-121, 121):
    cands.append(i**5)
for i, one in enumerate(cands):
    for j, two in enumerate(cands):
        if one - two == x:
            print(i-121,j-121)
            sys.exit()

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:
            pass
        else:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
X=int(input())
ans = []
for a in range(1001):
    for b in range(-1000,1001):
        if a**5-b**5 == X:
            ans = [a,b]
            break
print(ans[0],ans[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

def main():
    answer = int( input() )
    a, b = 0, 0

    while True:
        if a ** 5 - b ** 5 == answer:
            break
        if a ** 5 > answer + ( b ** 5 ):
            a -= 1
        if a ** 5 < answer + ( b ** 5 ):
            a += 1
        if b ** 5 > ( a ** 5 ) - answer:
            b -= 1
        if b ** 5 < ( a ** 5 ) - answer:
            b += 1

    print('%d %d' % (a, b))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def f(x):
 return x*x*x*x*x

n=int(input())

for i in range(-500,500):
 for j in range(-500,500):
  if f(i)-f(j)==n:
   print(i,j)
   exit()

Submission status: Accepted

Solution code:
# for i in range(1,300):
#     a = i**5 - (i-1)**5
#     print(f"{i} : {a}, {a < 10**9}")

X = int(input())

def main():
    for a in range(-200, 200):
        for b in range(-200, 200):
            if X == a**5 - b**5:
                print(f"{a} {b}")
                return

main()

Submission status: Accepted

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

def main():
  X = int(readline().strip())
  ret = False
  for i in range(-120, 120):
    for j in range(-120, 120):
      if i**5-j**5 == X:
        ret = True
        print(i, j)
        break
    if ret:
      break

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
from sys import stdin, stdout
import math
import bisect
import re

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

for a in range(-500, 500):
    for b in range(-500, 500):
        if a ** 5 - b ** 5 == x:
            stdout.writelines(str(a) + ' ' + str(b) + '\n')
            exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
for i in range(-1000,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())
for i in range(-200,200):
    for j in range(-200,200):
        l=i**5-j**5
        if l==n:
            print(i,j)
            break
    if l==n:
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())
flag=0
for n in range(-118,119):
    if flag==1:
        break
    for m in range(-119,118):
        if n**5-m**5==s:
            flag=1
            print(n,m)
        if flag==1:
            break

Submission status: Accepted

Solution code:
x=int(input())
flag=True
for i in range(-118,120):
  if flag==False:
    break
  for j in range(-119,119):
    if x==(i**5-j**5):
      print(i,j)
      flag=False
      break

Submission status: Accepted

Solution code:
x = int(input())

a = b = -1
con = True
while con:
  a += 1
  b5 = a**5 - x
  b1 = int(abs(b5**0.2))
  if b1**5 == b5:
    b = b1 
    con = False
  elif b1**5 == -1*b5:
    b = -1*b1
    con = False
print(str(a)+' '+str(b))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
cnt=0
x=int(input())
sgn=[[1,1],[-1,-1],[-1,1],[1,-1]]
for i in range(0,201):
    for j in range(0,201):
        for k in range(4):
            if sgn[k][0]*i**5-sgn[k][1]*j**5==x:
                print(sgn[k][0]*i, sgn[k][1]*j)
                sys.exit()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
	x = int(input())
	for i in range(200):
		for j in range(-200, 200):
			if i**5 - j**5 == x:
				print(i, j)
				return
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    p5 = [k**5 for k in range(120)]
    X = int(input())
    for a in range(119, 0, -1):
        bend = max(-54, -a)
        for b in range(a - 1, bend - 1, -1):
            if b >= 0:
                if p5[a] - p5[b] == X:
                    return a, b
            else:
                if p5[a] + p5[-b] == X:
                    return a, b


print(*main())

Submission status: Accepted

Solution code:
import sys
x = int(input())
if x ==0:
    print(1, 1)
    sys.exit()
    
div = []
for i in range(1, round(x**0.5)+1):
    if x % i ==0:
        div.append(i)
        if i != x/i:
            div.append(x//i)

for d in div:
    minvalue = -d//2
    maxvalue = 1000
    while maxvalue - minvalue > 1:
        midvalue = (minvalue + maxvalue)//2
        if (midvalue+d)**5 - midvalue**5 < x:
            minvalue = midvalue
        else:
            maxvalue = midvalue
            
        if (maxvalue+d)**5 - maxvalue**5 == x:
            break
    else:
        continue
    break
    
print(d+maxvalue, maxvalue)

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-118,120):
    for j in range(-119,119):
        if (i*i*i*i*i - j*j*j*j*j == x):
            print(i, j)
            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())
for i in range(-150, 150):
  for j in range(-150, 150):
    if(i*i*i*i*i - j*j*j*j*j == x):
      print(i, j)
      exit()

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
L = dict()
U = 10**4
for i, b in enumerate(range(-U, U+1), -U):
    L[b**5] = i
for b in range(-U, U+1):
    if b**5 + x in L:
        print(L[b**5 + x], b)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

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

x = int(input())
lb, rb = -119, 119
for a in range(lb, rb + 1):
	for b in range(lb, rb + 1):
		if pow(a, 5) - pow(b, 5) == x:
			exit(print(a, b))

Submission status: Accepted

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

x = int(input())
lb, rb = -500, 500
for a in range(lb, rb + 1):
	for b in range(lb, rb + 1):
		if pow(a, 5) - pow(b, 5) == x:
			exit(print(a, b))

Submission status: Accepted

Solution code:
N=int(input())
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==N:
            a=i
            b=j
print(a,b)

Submission status: Accepted

Solution code:
n = int(raw_input())
import sys
for i in xrange(350):
    for j in xrange(i):
        a = i - 175;
        b = j - 175
        if (a**5 - b**5) == n:
            print "{} {}".format(a, b)
            sys.exit(0)

Submission status: Accepted

Solution code:
x = int(input())

for a in range(1000):
    for b in range(-1000, 1000):
        ai = pow(a,5)
        bi = pow(b,5)
        if ai - bi == x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
for i in range(1000):
  for j in range(1000):
    if i**5 - j**5 == X:
      ans += 1
      A = i
      B = j
    if i**5 - (-j)**5 == X:
      ans += 1
      A = i
      B = -j
    if (-i)**5 - j**5 == X:
      ans += 1
      A = -i
      B = j
    if (-j)**5 - j**5 == X:
      ans += 1
      A = -i
      B = -j

print(str(A)+" "+str(B))

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

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('{} {}'.format(a, b))
      exit()

Submission status: Accepted

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

Submission status: Accepted

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

A = 1
B = -1
found = False
while (True):
    A5 = A ** 5
    B = -A
    while (True):
        if (B >= A):
            break
        if (X == A5 - B ** 5):
            found = True
            break
        B += 1
    if (found):
        break
    A += 1
    if (A > X):
        break

print(A,' ',B)