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())
a = 1
flug = True
while flug:
    b = -119
    while b <= 118:
        if a ** 5 - b ** 5 == X:
            print(a, b)
            flug = False
            break
        else:
            b += 1
    a += 1

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

X = I()

for a in range(500):
    for b in range(500):
        if a**5-b**5 == X:
            print(a,b)
            exit()
        if a**5-(-b)**5 == X:
            print(a,-b)
            exit()
        if (-a)**5-(-b)**5 == X:
            print(-a,-b)
            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())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5==j**5+X:
            A=i
            B=j
            break
print(A,B)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys

def main():
    X = int(input())
    for a in range(-200, 200):
        a5 = pow(a,5)
        for b in range(-200, 200):
            b5 = pow(b,5)
            if a5-b5 == X:
                print(a,b)
                sys.exit()

if __name__ == '__main__':
    main()

Submission status: Accepted

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

#-118<a<119 -119<b<118で全捜索
for a in range(-118, 120):
    for b in range(-119, 119):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

for a in range(10**3):
    for b in range(10**3):
        if(a**5 + b**5 == x):
            print(a, -b)
            break
        elif(a**5 - b**5 == x):
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())
M = []
for i in range(120):
    M.append(i**5)
for i in range(120):
    for j in range(120):
      if(M[i] - M[j] == X):
          A = i
          B = j
      elif(M[i] + M[j] == X):
          A = i
          B = -1*j

print(A,B)

Submission status: Accepted

Solution code:
X = int(input())

p = [0]*1000

flag = False
for i in range(1000):
    p[i] = i**5

for i in range(1000):
    for j in range(1000):
        if p[i]-p[j] == X:
            a = i
        
            b = j
            flag=True
        if p[i] + p[j] ==X:
            a=i
            b=-j
            flag=True


        if flag:
            break
    if flag:
        break

print(str(a)+" "+str(b))

Submission status: Accepted

Solution code:
X = int(input())
f = False
i = 0
while i < 3000:
    if f:
        break
    j = i-1
    while True:
        if X < (i**5-j**5):
            break
        if X == (i**5-j**5):
            print(i, j)
            f = True
            break
        j -= 1
    i += 1

Submission status: Accepted

Solution code:
import sys

X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

N=120
for i in range(N):
  for j in range(N):
    if i**5-j**5==X:
      print(i,j)
      break
    elif -i**5-j**5==X:
      print(-i,j)   
      break 
    elif i**5+j**5==X:
      print(i,-j)
      break
    elif -i**5+j**5==X:
      print(-i,-j)
      break 
  else:
    continue
  break

Submission status: Accepted

Solution code:
import math

x = int(input())

for a in range(-118, 119):
    for b in range(-119, 118):
        if math.pow(a, 5) - math.pow(b, 5) == x:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

import sys


def input():
    return sys.stdin.readline()


def resolve():
    x = int(input())

    exponentiation5_list = [i**5 for i in range(-200,200)]

    ex5_dict = {}
    for i in range(0, 400):
        ex5_dict[str(exponentiation5_list[i])] = i - 200

    for a in exponentiation5_list:
        for b in exponentiation5_list:
            if a - b == x:
                print(ex5_dict[str(a)], ex5_dict[str(b)])
                exit()






if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

def main():
    x = int(input())
    p = [0, 1]
    i = 2
    while p[-1] <= x*x:
        p.append(pow(i, 5))
        i += 1

    p_ = set(p)
    for z in p:
        if z - x in p_:
            print(int(pow(z, 1/5)), int(pow(z-x, 1/5)))
            return

        if x - z in p_:
            print(int(pow(abs(x-z), 1/5)), int(-pow(z, 1/5)))
            return


main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = [0] * 2

    for A in range(0, 1000):
        for B in range(0, 1000):
            if pow(A, 5) - pow(B, 5) == X:
                ans[0], ans[1] = A, B
                break
            if pow(A, 5) - pow(-B, 5) == X:
                ans[0], ans[1] = A, -B
                break
            if pow(-A, 5) - pow(B, 5) == X:
                ans[0], ans[1] = -A, B
                break
            if pow(-A, 5) - pow(-B, 5) == X:
                ans[0], ans[1] = -A, -B
                break
    print(ans[0], ans[1])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

x = int(input())

res = {}

for a in range(-200, 200):
    for b in range(-200, 200):
        temp = math.pow(a, 5) - math.pow(b, 5)
        res[temp] = (a, b)

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

Submission status: Accepted

Solution code:
X = int(input())

for b in range(-10**6, 10**6):
    a5 = abs(b**5 + X)
    a = int(pow(a5, 1 / 5))

    if a5 < 0:
        a = -a

    if a**5 - b**5 == X:
        print(a, b)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

cands = [(i**5,i) for i in range(-500,500)]

for a,i in cands:
  for b,j in cands:
    if a-b == x:
      print(i,j)
      exit()

Submission status: Accepted

Solution code:
x = int(input())

a = -1000
b = -1000

for _ in range(2000):
    for _ in range(2000):
        if (a ** 5) - (b ** 5) == x:
            print('{0} {1}'.format(a,b))
            exit()
        b += 1
    b = -2000
    a += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

for b in range(-10**6, 10**6):
    a5 = abs(b**5 + X)
    a = pow(a5, 1 / 5)

    if a5 < 0:
        a = -a

    a = int(a)
    if a**5 - b**5 == X:
        print(a, b)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

a=b=0

n=200

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

Submission status: Accepted

Solution code:
X = int(input())
N = 200
for i in range(N):
    for j in range(N):
        if i**5 - j**5 == X:
            print(i, j)
            exit()
        if (-i)**5 - j**5 == X:
            print(-i, j)
            exit()
        if i**5 - (-j)**5 == X:
            print(i, -j)
            exit()
        if (-i)**5 - (-j)**5 == X:
            print(-i, -j)
            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)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X=int(input())
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())
A=0
B=0
flag = False
for a in range(120):
    for b in range(120):
        if a**5 - b**5 == X:
            A=a
            B=b
            flag = True

        if a ** 5 + b**5 == X:
            A=a
            B=-b

        if -a**5 + b**5 ==X:
            A =-a
            B = b

        if flag:
            break
    if flag:
        break
print(str(A)+" "+str(B))

Submission status: Accepted

Solution code:
X = int(input())
flag = 0
            
#Aの範囲
for i in range(-118, 119):
    for j in range(-119, 118):
        if(i ** 5 - j ** 5 == X and flag == 0):
            print(i, j)
            flag += 1

Submission status: Accepted

Solution code:
x = int(input())

for a in range(10**4):
    for b in range(10**4):
        if(a**5 + b**5 == x):
            print(a, -b)
            break
        elif(a**5 - b**5 == x):
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
a=int(input())
ok=False
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==a:
            print(i,j)
            ok=True
            break
    if ok:
        break

Submission status: Accepted

Solution code:
import sys
import itertools
X = int(input())
N = 120
ABs = []
for i in range(N):
    ABs.append(i**5)
    
for i in range(N):
    for j in range(N):
        if ABs[i]-ABs[j] == X:
            print(i,j)
            sys.exit()
        elif ABs[i]+ABs[j] == X:
            print(i,-j)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-119,121):
    for j in range(-119,121):
        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(-120, 121):
  for j in range(-120, 121):
    if pow(i,5)-pow(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(str(A)+" "+str(B))
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
from bisect import bisect_right
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    x = int(readline())

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import itertools
X = int(input())
N = 300
ABs = []
for i in range(N):
    ABs.append(i**5)
    
for i in range(N):
    for j in range(N):
        if ABs[i]-ABs[j] == X:
            print(i,j)
            sys.exit()
        elif ABs[i]+ABs[j] == X:
            print(i,-j)
            sys.exit()

Submission status: Accepted

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

print(a, b)

Submission status: Accepted

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

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:
import sys
X = int(input())
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 - j**5 == X:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
flg = 0
for i in range(1000):
  for j in range(-1000, 1000):
    a5 = i ** 5
    b5 = j ** 5
    if a5 - b5 == X:
      print('{} {}'.format(i, j))
      flg = 1
  if flg == 1:
    break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

B = [n**5 for n in range(200)]

A = []

for i in range(200):
    a = i**5- X if i**5 >= X else X-i**5
    A.append(a)

for j in range(200):
    if A[j] in B:
        a = j
        b = B.index(A[j])
        if a**5-b**5 == X:
            print(a,b)
        elif a**5+b**5 == X:
            print(a,-b)
        else:
            print(b,a)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
M = 150

X = int(input())

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

Submission status: Accepted

Solution code:

x = int(input())

for i in range(100):
    for j in range(100):
        if pow(i, 5)+pow(j, 5) == x:
            print(i, -j)
            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


a = 0
for i in make_divisors(x):
    a = i
    b = 0
    while pow(a, 5)-pow(b, 5) <= x:
        if pow(a, 5)-pow(b, 5) == x:
            print(a, b)
            exit()
        b += 1
        a += 1

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    for B in range(-120,121):
        for A in range(B,121):
            xx = A**5 -B ** 5
            if X ==  xx:
                print(A,B)
                return
            elif X <xx:
                break

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = [0] * 2

    for A in range(-1000, 1000):
        for B in range(-1000, 1000):
            if pow(A, 5) - pow(B, 5) == X:
                ans[0], ans[1] = A, B
                break
            if pow(A, 5) - pow(-B, 5) == X:
                ans[0], ans[1] = A, -B
                break
            if pow(-A, 5) - pow(B, 5) == X:
                ans[0], ans[1] = -A, B
                break
            if pow(-A, 5) - pow(-B, 5) == X:
                ans[0], ans[1] = -A, -B
                break
    print(ans[0], ans[1])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())


def is5(n):
    mi = 0
    ma = n
    while mi != ma:
        mm = (mi + ma) // 2
        if mm ** 5 >= n:
            ma = mm
        else:
            mi = mm + 1
    return mi ** 5 == n, mi


a = 0
while True:
    bb = a ** 5 - x
    if bb >= 0:
        ok, b = is5(bb)
        if ok:
            print(a, b)
            break
    else:
        ok, b = is5(-bb)
        if ok:
            print(a, -b)
            break
    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())
L = make_divisors(x)
for i in L:
    for a in range(-118,120):
        if a**5 - (a-i)**5 == x:
            print('{} {}'.format(a,a-i))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
def f(B):
    if isinstance(B, float):
        if abs(B - int(B)) < 10**-6:
            return True
        else:
            return False
    return False


X = int(input())

for a in range(0, 10**5):
    bb = X + a**5
    B = bb**0.2
    if f(B):
        print(int(B), a)
        break

    a *= -1
    bb = X + a**5
    B = bb**0.2
    if f(B):
        print(int(B), a)
        break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import math

def main(X):
    lst = f(X)
    for L in lst:
        for l in L:
            for B in range(-120, 120, 1):
                A = B + l[0]
                if g(A, B):
                    print(A, B)
                    exit()

def f(X):
    return [[[X // i, i], [i, X // i]] for i in range(1, math.floor(X ** 0.5) + 1) if X % i == 0]

def g(A, B):
    return A ** 5 - B ** 5 == X



if __name__ == '__main__':
    X = int(input())
    main(X)

Submission status: Accepted

Solution code:
x = int(input())
def function(a,b):
    return a**5-b**5

a = 0
for i in range(-119,119):
    for j in range(i+1,120):
        if function(j,i)==x:
            print(j,i)
            a = 1
            break
    if a == 1:
        break

Submission status: Accepted

Solution code:
X = int(input())

judge = False

for a in range(200, -200, -1):
    for b in range(200, -200, -1):
        if a**5-b**5 == X:
            print(a, b)
            judge = True
            break
    if judge:
        break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
from functools import lru_cache

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

    # divisors.sort()
    return divisors

#gはaと-bが近いときに最小？？
@lru_cache(maxsize=None)
def g(a, b):
    return a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4

def check(s, t):
    #a > b
    a = s//2
    b = a - s
    q = deque()
    q.append((a,b))
    q.append((a+1,b+1))
    q.append((a-1,b-1))
    while True:
        (a, b) = q.popleft()
        if g(a, b) == t:
            print(f'{a} {b}')
            exit()
        elif g(a, b) < t:
            #print(f'inner{s}: {a}, {b} -> {g(a,b)} < {t}')
            if a > s//2:
                q.append((a+1, b+1))
            elif a < s//2:
                q.append((a-1, b-1))
            else:
                pass
        else:
            #print(f'outer{s}: {a}, {b} -> {g(a,b)} > {t}')
            return

def main():
    X = int(input())
    factor = make_divisors(X)
    #print(factor)
    for s, t in factor:
        check(s, t)
        check(t, s)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

for i in range(-200, 200):
    for j in range(-200, 200):
        if i**5-j**5 == x:
            a = i
            b = j
            break
print(a, b)

Submission status: Accepted

Solution code:
import sys

x = int(input())

a = [i**5 for i in range(0, 300)]

for i in range(300):
    for j in range(300):
        if a[i] - a[j] == x:
            print(i,j)
            sys.exit()
            
        if a[i] + a[j] == x:
            print(i,-j)
            sys.exit()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

X = ri()

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

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-119,119):
    for b in range(-119,119):
        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(-200,200):
    for j in range(-200,200):
        if i ** 5 - j ** 5 == x:
            print(i,j)
            quit()

Submission status: Accepted

Solution code:
X=int(input())
for i in range(121):
    a=i
    for j in range(121):
        b=j
        if(a**5-b**5==X):
            A=a
            B=b
        b=-j
        if(a**5-b**5==X):
            A=a
            B=b
print(A,B)

Submission status: Accepted

Solution code:
import math
X=int(input())
a=pow(10,9)
c=math.ceil(a**0.3)
answers=[]
for a in range(-c,c+1):
    for b in range(-c,c+1):
        if pow(a,5)-pow(b,5)==X:
            answers.append(a)
            answers.append(b)
            break
print(answers[0],answers[1])

Submission status: Accepted

Solution code:
x = int(input())
a = 0
b = 0

for i in range(-130,130):
  for j in range(-130,130):
    if x == (i**5) - (j**5):
      a = i
      b = j
print(a,b)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True

def factorization(n):
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def main():
    X = I()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
for a in range(1000 + 1):
    for b in range(1000 + 1):
        A = pow(a, 5)
        B = pow(b, 5)
        if A - B == x:
            print(a, b)
            exit()
        if A + B == x:
            print(a, -b)
            exit()
print("wrong")

Submission status: Accepted

Solution code:
x=int(input())
n=120
gojou=[0]*(n+1)*2
for i in range(n+1):
    gojou[i]=i**5

for i in range(n+1):
    for j in range(n+1):
        if gojou[i]-gojou[j]==x:
            print(i,j)
            break
        elif gojou[i]+gojou[j]==x:
            if i**5 - (-j)**5 == x:
                print(i,-j)
                break
    else:
        continue
    break

Submission status: Accepted

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

for A in range(-118, 120) :
  for B in range(-119, 119) :
    if A ** 5 - B ** 5 == N :
      print(A, B)
      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:
      print(i,j)
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
x = int(input())

for i in range(1000):
    #for j in range(10)
    #print(i ** 5)
    for j in range(1000):
        #print(i ** 5 - j ** 5)
        if i ** 5 - j ** 5 == x:
            print(i, j)
            quit()
        elif i ** 5 - (-j) ** 5 == x:
            print(i, -j)
            quit()
        elif (-i) ** 5 - j ** 5 == x:
            print(-i, j)
            quit()
        elif (-i) ** 5 - (-j) ** 5 == x:
            print(-i, -j)
            quit()

Submission status: Accepted

Solution code:
import sys

x = int(input())

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

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:
import sys
X = int(input())
for i in range(-1000, 1000 + 1):
    for j in range(-1000, 1000 + 1):
        if i ** 5 - j ** 5 == X:
            print(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
X,=list(map(int,input().split()))
A=1
while((A+1) ** 5-A ** 5<10 ** 9):
  A+=1 
for j in range(10000):
  for i in range(-A,A+1):  
    if((i+j) ** 5 - i ** 5==X):
      print(i+j,i)
      exit()