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:
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
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

#code-------------------------------------------------
x = ini()
for b in range(-121,121):
    for a in range(b,121):
        if (a ** 5) - (b ** 5) == x:
            break
    else:
        continue
    break
    
print(a,b)

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())
Pow = [1]
curr = 2
while True:
    if curr**5 - Pow[-1]**5 > x:
        break
    Pow.append(curr)
    curr += 1

mx = Pow[-1]
for i in range(mx + 1):
    Pow.append(-i)

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

Submission status: Accepted

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

a = 0
b = 0
res = False
i = 0
while not res:
    sign = 1 - 2*(n[i] < x)
    for j in range(i+1):
        if (n[i] - n[j] * sign) == x:
            print(i,j*sign)
            res = True
    i += 1

Submission status: Accepted

Solution code:
x = int(input())

p5 = []
m = 1000
for i in range(-m, m+1):
    p5.append(i**5)

for ci in range(2*m+1):
    if p5[ci] - x in p5:
        a = [ci-m, p5.index(p5[ci] - x)-m]
        break
a = [str(i) for i in a]
print(' '.join(a))

Submission status: Accepted

Solution code:
import math

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

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

if __name__=="__main__":
    main()

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())
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())
for A in range(-118,120):
    for B in range(-118,120):
        if X==A**5-B**5:
            print(A,B)
            exit()

Submission status: Accepted

Solution code:
cinq = [i ** 5 for i in range(300)]
X = int(input())
for a in cinq:
  if a + X in cinq:
    print(cinq.index(a+X), cinq.index(a))
    break
  elif X-a in cinq:
    print(cinq.index(a), -cinq.index(X-a))
    break

Submission status: Accepted

Solution code:
x = int(input())
count =0
for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == x:
            A = a
            B = b

print(A, B)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import product
def main():
    x = int(input())
    n5 = [i**5 for i in range(1000)]
    c = product(n5, repeat=2)
    for ce in c:
        if ce[0] + ce[1] == x:
            r = (int(ce[0]**0.2), int(ce[1]**0.2)* -1)
            break
        elif ce[0] - ce[1] == x:
            r = (int(ce[0] ** 0.2), int(ce[1] ** 0.2))
            break
    print(*r, sep=' ')
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
NUM=1000

X=int(input())

flg=False

for i in reversed(range(NUM)):
    for j in range(-1*NUM,NUM):
        res=(i**5)-(j**5)
        if res==X:
            ans_A=i
            ans_B=j
            flg=True
            break
    if flg:
        break

print(ans_A,ans_B)

Submission status: Accepted

Solution code:
x=int(input())
ans=[0,0]
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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix
# CreatedDate:  2020-08-08 01:53:55 +0900
# LastModified: 2020-08-08 01:56:11 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    x = int(input())
    for a in range(-120, 120):
        for b in range(-120, a):
            if a**5-b**5 == x:
                print("{} {}".format(a, b))
                return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
X=int(input())
for A in range(800):
    for B in range(-800,A+1):
        if X==A**5-B**5:
            print('{} {}'.format(A,B))
            sys.exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

    X = int(input())

    for a in range(-150, 151):
        for b in range(-150, 151):
            if a ** 5 - b ** 5 == X:
                print(a, b, sep=' ')
                return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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

    if flag:
        break

Submission status: Accepted

Solution code:
x = int(input())

C=[]
for i in range(10*100) :
    C.append(i**5)

# print( C )

for j in range(len(C)):
    for i in range(len(C)):
        if C[j]-C[i]==x :
            print( j, i )
            exit()
        elif C[j]+C[i]==x :
            print( j, 0-(i) )
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

# -100 ~ 100 ^ 5
pow5 = {}
for i in range(-1000, 1001):
    pow5[i] = int(math.pow(i, 5))

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

Submission status: Accepted

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


def main():
    x = int(readline().rstrip())
    a, b, c = 0, 0, 1

    while a < 1000:
        k = a ** 5 - x
        c = 1 if k >= 0 else - 1
        b = abs(k) ** 0.2
        if int(b) ** 5 == abs(k):
            print(a, c * abs(int(b)))
            return
        a += 1


if __name__ == '__main__':
    main()

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:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()

    for i in range(-200, 200):
        for j in range(-200, 200):
            if i ** 5 - j ** 5 == N:
                print(i, j)
                return


main()

Submission status: Accepted

Solution code:

X = int(input())

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

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

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-121,121):
    for b in range(-121, 121):
        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:
            print(i,j)
            exit()

Submission status: Accepted

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

for i in range(-1000, 1001):
    for j in range(-1000, 1001):
        if i**5-j**5 == x:
            print(i, j)
            sys.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:
X = int(input())
A = []
for i in range(200):
    A.append(pow(i, 5))
for i in range(200):
    for j in range(200):
        a = abs(A[i] - A[j])
        b = A[i] + A[j]
        if a == X:
            if i <= j:
                B = [j, i]
            else:
                B = [i, j]
            print(' '.join(map(str, B)))
            exit()
        elif b == X:
            B = [i, -j]
            print(' '.join(map(str, B)))
            exit()

Submission status: Accepted

Solution code:
x=int(input())
a=0
b=0
for i in range(1000):
    for j in range(1000):
        if i**5-j**5==x:
            a=i
            b=j
            break
        elif i**5+j**5==x:
            a=i
            b=-j
            break
    if a!=0 or b!=0:
        break
print(str(a)+" "+str(b))

Submission status: Accepted

Solution code:
l=[]
for i in range(0,120):
    l.append(i**5)
n=int(input())
for i in range(0,120):
    if((l[i]-n) in l):
        print(i,l.index(l[i]-n))
        break
    elif((n-l[i]) in l):
        print(i,-l.index(-l[i]+n))
        break

Submission status: Accepted

Solution code:
l=[]
for i in range(0,1001):
    l.append(i**5)
n=int(input())
for i in range(0,1001):
    if((l[i]-n) in l):
        print(i,l.index(l[i]-n))
        break
    elif((n-l[i]) in l):
        print(i,-l.index(-l[i]+n))
        break

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
x_3zyoukon=x**(1/3)
x_5zyoukon=x**(1/5)

for a in range(int(x_3zyoukon+1)):
    for b in range(a):
        if a**5-b**5==x:
            print(str(a)+" "+str(b))
            exit()

for a in range(int(x_5zyoukon+1)):
    for b in range(-1,(-1)*int(x_5zyoukon+1),-1):
        if a**5-b**5==x:
            print(str(a)+" "+str(b))
            exit()

Submission status: Accepted

Solution code:
X = int(input())
ans = ''
for i in range(-120, 120):
  for j in range(-120, 120):
    if i**5-j**5 == X:
      ans = i, j
      break
print(' '.join(map(str,ans)))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

flag = False
for i in range(1000, -1, -1):
  #print(i)
  for j in range(i, -1001, -1):
    #print(j)
    if i - j != 0:
      if x % (i - j) == 0:
        y = x / (i - j)
        t = i ** 4 + (i ** 3) * j + (i ** 2) * (j ** 2) + i * (j ** 3) + j ** 4
        if y == t:
          lst = [str(i), str(j)]
          print(' '.join(lst))
          flag = True
          break
    else:
      if x == 0:
        print('0 0')
        flag = True
        break
  if flag:
    break

Submission status: Accepted

Solution code:
import sys

x = int(input())
for a in range(0,1000):
    a_5 = a**5
    if a_5 > x:
        b = 0
        s = x+1
        while s > x:
            s = a_5 - b**5
            if s == x:
                print(a, b)
                sys.exit()
            b += 1
            
    elif a_5 < x:
        b = 0
        s = x-1
        while s < x:
            s = a_5 - b**5
            if s == x:
                print(a, b)
                sys.exit()
            b -= 1
    else:
        print(a,0)
        sys.exit()

Submission status: Accepted

Solution code:
import sys

x = int(input())
for a in range(1,1000):
    a_5 = a**5
    if a_5 > x:
        b = 1
        s = x+1
        while s > x:
            s = a_5 - b**5
            if s == x:
                print(a, b)
                sys.exit()
            b += 1
            
    elif a_5 < x:
        b = -1
        s = x-1
        while s < x:
            s = a_5 - b**5
            if s == x:
                print(a, b)
                sys.exit()
            b -= 1
    else:
        print(a,0)
        sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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


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

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


if(__name__ == '__main__'):
  main()

Submission status: Accepted

Solution code:
import sys
x = int(input())
box = [a**5 for a in range(0,200)]
for i in range(200):
    for j in range(200):
        if box[i] - box[j] == x:
            print(i,j)
            sys.exit()
for k in range(200):
    for l in range(200):
        if (-1)*box[k] + box[l] == x:
            print(-(k),-(l))
            sys.exit()
for s in range(200):
    for t in range(200):
        if box[s] + box[t] == x:
            print(s,-(t))
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

X = int(input())
flag = 0
for i in range(-150,150):
  for j in range(-150,150):
    if(i**5 - j**5 == X):
      print(i,j)
      flag = 1
      break
  if(flag==1):
    break

Submission status: Accepted

Solution code:
import collections


def main():
    X = int(input())
    A, B = 0, 0
    for i in range(-120, 120):
        if A == 0 and B == 0:
            for j in range(-120, 120):
                if i ** 5 - j ** 5 == X:
                    A, B = i, j
                    break
        else:
            break

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

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

for i in range(-150,150):
    for j in range(-150,150):
        if i**5-j**5 == x: print(i,j); sys.exit()

Submission status: Accepted

Solution code:
# A**5 = X + B**5
X = int(input())

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

for b, b_5 in enumerate(l, start=-300):
    # print(b, b_5, X)
    if X+b_5 in l:
        a_5 = X+b_5
        a = l.index(a_5)-300
        print(a, b)
        break

Submission status: Accepted

Solution code:
x=int(input())

for a in range(-140,140):
  for b in range(-140,140):
    if (a**5-b**5)==x:
      c=a
      d=b
      break
      
print(str(c)+' '+str(d))

Submission status: Accepted

Solution code:
X=int(input())

ans=''
for a in range(-125,125):
    for b in range(-125,125):
        i = a**5-b**5
        if i == X:
            ans=[a,b]
print(' '.join(map(str,ans)))

Submission status: Accepted

Solution code:
x = int(input())
#5x^4 <= 10^9
#x = 150くらい？
for i in range(-150,150):
    for j in range(-151,149):
        if i**5 - j**5 == x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

ans = False
for a in range(-10**3,10**3):
    for b in range(-10**3,10**3):
        if a**5 - b**5 == x:
            print(a,b)
            ans = True
            break
    if ans:
        break

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())
l = [i**5 for i in range(10000)]
for idx, a in enumerate(l):
    b = a - x
    if b in l:
        print(idx, l.index(b))
        exit()
    elif -b in l:
        print(idx, -l.index(abs(b)))
        exit()

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np


def main():
    x = int(input())
    A = np.arange(-120, 120)
    a = A ** 5
    for i, a_1 in enumerate(a):
        for j, a_2 in enumerate(a):
            if a_1 - a_2 == x:
                print(A[i], A[j])
                return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=False
for i in range(200):
  for j in range(200):
    if i**5-j**5==n:
      print(i,j)
      a=True
    elif i**5+j**5==n:
      print(i,-j)
      a=True
  if a:
      break

Submission status: Accepted

Solution code:
X = int(input())

X_range = int(pow(X, 1/4))+1

for i in range(X_range, -X_range-1, -1):
    for j in range(-X_range, X_range+1):
        if pow(i, 5) - pow(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)
            exit()

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x = inp()
dp = []
for i in range(5000):
    dp.append(i**5)

for i in range(5000):
    if (x - dp[i]) in dp:
        print(i,-1 * dp.index((x - dp[i])))
        exit()
    if (dp[i] - x) in dp:
        print(i,dp.index((dp[i] - x)))
        exit()

Submission status: Accepted

Solution code:
x = int(input())
y = 10**4

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

Submission status: Accepted

Solution code:

X = int(input())
flag = True
for a in range(-200, 200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == X and flag:
            print(a, b)
            flag = False

Submission status: Accepted

Solution code:
#import time

def main():
    X = int(input())
    #print(isprime(int((9**5-5**5)/4)))
    lis = [[ [] for _ in range(240)] for _ in range(240)]
    ansA, ansB = 0, 0
    #print(type(ansA), ansB)
    for i in range (240):
        for j in range(240):
            lis[i][j].append(i-120)
            lis[i][j].append(j-120)
    
    for i in range(240):
        for j in range(240):
            A, B = lis[i][j]
            if A**5 - B**5 == X:
                ansA, ansB = A, B
                break
        else: #普通に終わったら実行される、breakならされない
            continue
        break #外側


    print(ansA, ansB)


if __name__ == '__main__':
    #start = time.time()
    main()
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Submission status: Accepted

Solution code:
X = int(input())
answer = (1001,1001)
for A in range(-1000, 1000):
    for B in range(-1000, 1000):
        if A ** 5 - B ** 5 == X:
            answer = (A, B)
            break
    if answer[0] != 1001:
        break
print(' '.join(map(str, answer)))

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 0
for i in range(-200, 201):
    for j in range(-200, 201):
        if i ** 5 - j ** 5 == X:
            A, B = i, j
            break

print(A, B)

Submission status: Accepted

Solution code:

x = int(input())
y = int(pow(x, 1/5))*2
A = [i**5 for i in range(y+1)]
B = [i**5 for i in range(y+1)]

for i in range(len(A)):
  for j in range(len(B)):
    if ( A[i] + B[j] ) == x:
      if A[i] > B[j]:
        exit(print(i, -j))
      else:
        exit(print(j, -i))
    elif ( A[i] - B[j] ) == x:
      exit(print(i, j))

Submission status: Accepted

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

import math
x = int(input())

#aもbも0以上のとき
border = 1;
while border ** 5 - (border - 1) ** 5 < x:
    border += 1

for i in range(border + 1):
    aa = ((x + i ** 5) ** (1.0 / 5.0)) #仮
    a = round(aa)
    if a ** 5 - i ** 5 == x:
        b = i
        print(a, b)
        break
else:
    b = -1

    while x + b ** 5 >= 0:

        aa = ((x + b ** 5) ** (1.0 / 5.0))  # 仮
        a = round(aa)
        if a ** 5 - b ** 5 == x:
            print(a, b)
            break
        b -= 1

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:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X = int(readline())
for a in range(-119,121):
    for b in range(-119,121):
        if (a**5-b**5) == X:
            print(a,b)
            sys.exit()

Submission status: Accepted

Solution code:
x  = int(input())
ans = False

for a in range(-200,201):
    for b in range(-200, 201):
        if a**5 - b ** 5 == x:
            ans = True
            break
    if ans:
        break
print(a,b)

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X = int(readline())
def make_divisors(n):
    lower_divisors = []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
        i += 1
    return lower_divisors 

A = make_divisors(X)
for a in A:
    for b in range(10**3,-(10**3),-1):
        Y = X // a
        if ((b+a)**4 + b*(b+a)**3 + b**2*(b+a)**2 + b**3*(b+a) + b**4) == Y:
            print(b+a,b)
            sys.exit()

Submission status: Accepted

Solution code:
import sys

x = int(input())

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(readline())

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

Submission status: Accepted

Solution code:
import math
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))
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(X):
    for A in range(-500, 510):
        for B in range(-500, 510):
            if A ** 5 - B ** 5 == X:
                return A, B
    return None, None

def main():
    X = int(input())
    print(*solve(X))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from numba import njit


@njit
def main(X):
    for a in range(-200, 201):
        for b in range(-200, 201):
            if pow(a, 5) - pow(b, 5) == X:
                print(a, b)
                return


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

Submission status: Accepted

Solution code:
from numba import njit


@njit
def main(X):
    for a in range(-2000, 2001):
        for b in range(-2000, 2001):
            if pow(a, 5) - pow(b, 5) == X:
                print(a, b)
                return


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

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:
# -*- coding: utf-8 -*-
import sys

X = int(input().strip())
#-----
calc = {}

for i in range(-118,120):
    calc[i] = i**5


for a in range(-118,120):
    for b in range(-118,120):
        if (calc[a] - calc[b]) == X:
            print(a,b)
            sys.exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

X = int(input().strip())
#-----

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

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:
x = int(input())
n=100
tes = [0]
for i in range(-250,250):
    for j in range(-250,250):
        if pow(i,5) - pow(j,5) == x:
            print(str(i)+" "+str(j))
            exit()

Submission status: Accepted

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    X = int(input())

    p = []
    def pow5(n):
        nonlocal p
        if len(p) > n:
            return p[n]
        ans = pow(n,5)
        p += ans,
        return ans

    a = 0
    b = 0
    while True:
        if abs(X) + pow5(b) == pow5(a) or abs(X) - pow5(b) == pow5(a) :
            a5 = pow5(a)
            b5 = pow5(b)
            if X == a5 - b5:
                print(a,b)
            elif X == a5 + b5:
                print(a, -b)
            elif X == -a5 - b5:
                print(-a, b)
            else:
                print(-a, -b)
            return
        while abs(X) + pow5(b) > pow5(a):
            a += 1
            if abs(X) + pow5(b) == pow5(a) or abs(X) - pow5(b) == pow5(a) :
                a5 = pow5(a)
                b5 = pow5(b)
                if X == a5 - b5:
                    print(a,b)
                elif X == a5 + b5:
                    print(a, -b)
                elif X == -a5 - b5:
                    print(-a, b)
                else:
                    print(-a, -b)
                return
        a = 0
        b += 1

main()

Submission status: Accepted

Solution code:
import math

X= int(input())

for A in range(-120,121):
    for B in range(-120,A+1):
        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:
# -*- coding: utf-8 -*-
X = int(input())

# A**5 - (A-1)**5 = X = 10**9(Xの最大) となるAが
# Aの最大値となる(それ以上Aが大きくなると、Xは上限値を超える)
# → 最大となるAは120

for A in range(-120, 120 + 1):
  for B in range(-120, 120):
    if A**5 - B**5 == X:
      print("{} {}".format(A, B))
      exit()