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:
#!/usr/bin/env python3

X = int(input())

for i in range(0, 1000):
    for j in range(0, 1000):
        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(999):
  for b in range(-99,999):
    if a**5-b**5==x: print(a,b); exit()

Submission status: Accepted

Solution code:
import math
x = int(input())
def ok(y):
    top = 10**500
    bottom = -y//2
    while top - bottom > 1:
        b = (top + bottom)//2
        z = (b+y)**5 - b**5
        if z == x:
            print(b+y,b)
            exit(0)
        elif z > x:
            top = b
        else:
            bottom = b
    if (bottom+y)**5 - b**5 == x:
        print(bottom+y,x)
        exit(0)
    elif (top+y)**5 - b**5 == x:
        print(top+y,top)
        exit(0)
    else:
        return
i = 1
while i*i <= x:
    if x%i == 0:
        ok(i)
        ok(x//i)
    i += 1

Submission status: Accepted

Solution code:
X=int(input())
N=10**3
L=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(i):
    L[i][j]=i**5-j**5
C=[]
M=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(N):
    M[i][j]=i**5+j**5
for i in range(N):
  for j in range(i):
    if L[i][j]==X:
      C.append([i,j])
for i in range(N):
  for j in range(N):
    if M[i][j]==X:
      C.append([i,-j])
print(C[0][0],C[0][1])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

from collections import deque
z = []
u = deque([])
for a in range(0,1000):
    for b in range(-1000,1000):
        z.append(a**5-b**5)
        u.append((a,b))

for i in range(10**6+1):
    if z[i] == x:
        print(u[i][0],u[i][1])
        break

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

Submission status: Accepted

Solution code:

x = int(input())
for a in range(-300,301):
  if(a<0):
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break
  else:
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 12:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())

arr=[]
for i in range(0,640):
    arr.append(i**5)
    arr.append(-i**5)

arr2=[]
arr3=[]
import itertools
l=itertools.combinations_with_replacement(arr,2)
for i in l:
    arr2.append(i[0]-i[1])
    arr3.append([i[0],i[1]])
import math

ans=arr3[arr2.index(X)]
print(int(math.pow(abs(ans[0]), 1/5))*(1 if ans[0]>=0 else -1), int(math.pow(abs(ans[1]), 1/5))*(1 if ans[1]>=0 else -1))

Submission status: Accepted

Solution code:
import sys

x = int(input())

a = 0
a_list = []
b = 0
b_list = []
c = 0
c_list = []

while a ** 5 < 10 ** 18:
  a_list.append(a)
  a += 1
  b_list.append(b)
  b -= 1
  c_list.append(c)
  c += 1


for i in a_list:
  for j, k in zip(b_list, c_list):
    if(i ** 5 - j ** 5 == x):
      print(i, j)
      sys.exit()
    elif(i ** 5 - k ** 5 == x):
      print(i, k)
      sys.exit()

Submission status: Accepted

Solution code:
N=int(input())

for i in range(800,-800,-1):
  for j in range(-800,800):
    if pow(i,5)-pow(j,5)==N:
      print(i,j)
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
x=int(input())
import math
def fl(x):
    digits = 10
    form = '%.'+str(digits-1)+'e'
    return float((form % x))

for a in range(300):
    if a**5 >= x :
        B=a**5-x
        b = math.pow(B, 1.0/5.0)
        #print(a,b,B)
        if fl(b).is_integer()==True:
            b=int(b)
            print(a,b)
            break
    else:
        B=x-a**5
        b=math.pow(B, 1.0/5.0)
        #print(a,b,B)
        if fl(b).is_integer()==True:
            b=int(b)
            print(a,-b)
            break

Submission status: Accepted

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

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
    if a ** 5 - b ** 5 == x:
        break

Submission status: Accepted

Solution code:
import sys

X=int(input())
five=[]

for i in range(-1000,1001):
    five.append(i**5)
l=len(five)


for j in range(l):
    for k in range(j+1,l):
        if five[k]-five[j]==X:
            print(-1000+k,-1000+j)
            sys.exit()

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

X = inputI()

def sign(i):
  if i>=0:
    return 1
  else:
    return -1
  
l = [pow(i,5) for i in range(-500,500)]

for i in l:
  for j in l:
    if i-j == X:
      print(int(pow(abs(i),0.2)*sign(i)) ,int(pow(abs(j),0.2)*sign(j)))
      exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Code for D - I hate Factorization
# Use input() to fetch data from STDIN
import sys

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

    divisors.sort()
    return divisors

divs = make_divisors(X)
for div in divs:
    x = X / div
    for a in range(0, 100000):
        b = a - div
        t = (a ** 4 + (a ** 3) * b + (a ** 2) * (b ** 2) + a * (b ** 3) + b ** 4)

        if t == x:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
X =int(input())
A =[i**5 for i in range(1,121)]
a =[i for i in range(1,120)]
B =[i**5 for i in range(-120,121)]
b =[i for i in range(-120,121)]

flg =False
for i in range(len(A)):
    for j in range(len(B)):
        if A[i]  -  B[j]  == X:
            print("{} {}".format(a[i],b[j]))
            flg =True
            break
    if flg:
        break

Submission status: Accepted

Solution code:
import sys
import numpy as np
x = int(input())
a = np.arange(1500)
a = np.power(a, 5)

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

Submission status: Accepted

Solution code:
import math

X = int(input())
yaku = []

def nibu(a):
  small = -a//2-1
  big = 10**10
  while big-small > 1:
    mid = (small+big)//2
    isx = (mid+a)**5 - mid**5
    if isx > X:
      big = mid
    elif isx < X:
      small = mid
    else:
      print(mid+a,mid)
      exit()

for i in range(1,int(X**0.5+1)):
  if X%i == 0:
    yaku.append(i)
    yaku.append(X//i)
    
for el in yaku:
  nibu(el)

Submission status: Accepted

Solution code:
import sys
x=int(input())
div=[]
for i in range(1,int(x**0.5)+1):
  if x%i==0:
    div.append(i)
    if i != x // i:
      div.append(x//i)
div.sort()
div.reverse()
for i in div:
  for j in range(-10,1000):
    a=i-i+j
    b=-i+j
    other=(a**4)+(a**3)*b+(a**2)*(b**2)+a*(b**3)+(b**4)
    if i*other==x:
      print(a,b)
      sys.exit()

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest
import math

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

    a = math.floor(x ** 0.2) + 1

    b5 = a ** 5 - x

    if x == 1:
        a = 0
        b = -1
    elif b5 == 0:
        b = 0
    else:
        right = (10 ** 9)
        left = -1 * (10 ** 9)
        pre_right = (10 ** 9)
        pre_left = -1 * (10 ** 9)

        b = 0
        pre_mid = 10 ** 9
        while 1:
            mid = (right + left) // 2
            ans = mid ** 5
            # print(left, right)

            if ans > b5:
                right = mid - 1
            elif ans < b5:
                left = mid + 1
            else:
                b = mid
                break

            if [pre_right, pre_left] == [right, left]:
                a -= 1
                b5 = a ** 5 - x
                right = (10 ** 9)
                left = -1 * (10 ** 9)

            pre_right = right
            pre_left = left

    print(a, b, sep=' ')


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """33"""
        output = """2 -1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1"""
        output = """0 -1"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
import math

def main():
    X = int(input())
    kazu = int(math.sqrt(X)) + 1

    for index in range(-kazu-1,kazu+1):
        B = index
        A5 = B**5 + X
        if(A5 < 0):
            continue
        A = math.pow(A5, (1.0/5.0))
        if int(A)**5 - B**5 == X :
            print (str(int(A)) +" "+  str(B))
            break



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import itertools


max_num = 200
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    # print(a, b)
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break

Submission status: Accepted

Solution code:
X=int(input())
N=10**3
i=-1000
res=[]

while(i<N):
  j=-1000
  while(j<N):
    if(i**5 - j**5==X):
      res.append(i)
      res.append(j)
      break
    j+=1
  if(1<len(res)):
    break
  i+=1

print(str(res[0])+" " +str(res[1]))

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

X = inputI()

l = [pow(i,5) for i in range(-500,500)]

for i in l:
  for j in l:
    if i-j == X:
      if i!=0 and j!= 0:
        print(int(pow(abs(i),0.2)*i/abs(i)) ,int(pow(abs(j),0.2)*j/abs(j)))
        exit()
      elif i==0 and j!=0:
        print(0 ,int(pow(abs(j),0.2)*j/abs(j)))
        exit()
      elif i!=0 and j==0:
        print(int(pow(abs(i),0.2)*i/abs(i)) ,0)
        exit()
      else:
        print(0,0)
        exit()

Submission status: Accepted

Solution code:
x = int(input())
for a in range(-10000, 10001):
    p = a ** 5
    l, r = -10000, 10001
    while r - l > 1:
        m = (l + r) // 2
        if m ** 5 <= p - x:
            l = m
        else:
            r = m
    if l ** 5 == p - x:
        print(a, l)
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

    # divisors.sort()
    return divisors

tmp = make_divisors(x)
l = len(tmp) // 2
#print(tmp)

ans=0

for i in range(l):
  flg = 0
  a=tmp[2*i]
  b=0
  while flg == 0:
    t = a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
    #print(a,b,t)
    if t == tmp[2*i+1]:
      ans=[a,b]
      flg=1
    if t > tmp[2*i+1]:
      flg=2
    a += 1
    b += 1

  a=tmp[2*i]
  b=0
  c=a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
  while flg == 2:
    t=a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
    #print(a,b,t,2)
    if t == tmp[2*i+1]:
      ans=[a,b]
      flg=1
    if t > c:
      flg=3
    a -= 1
    b -= 1
  
  if flg==1:
    break

if x==1:
  print(0,-1)
else:
  print(ans[0],ans[1])

Submission status: Accepted

Solution code:
import sys
X = int(input())
for i in range(1,int(X**(0.5)+1)):
    if X % i ==0:
        a=0
        b=-i
        while a**5<X**2:
            a+=1
            b+=1
            if a**5-b**5==X:
                print(a,b)
                sys.exit()

Submission status: Accepted

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

import sys
import math
import bisect

debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
    
    (x, ) = [int(e) for e in lines[0].split(' ')]

    return (x, )


def solve(x):

    result = [0, 0]
    memo = dict()
    for a in range(-1000, 1001):
        if a in memo:
            aa = memo[a]
        else:
            aa = a**5
            memo[a] = aa

        for b in range(-1000, 1001):
            if b in memo:
                bb = memo[b]
            else:
                bb = b**5
                memo[b] = bb 

            if aa - bb == x:
                result = [a, b]

    return result

def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':
  
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

[X] = [int(x) for x in stdin.readline().rstrip().split()]

s = {}

for i in range(100000):
    r = i * i * i * i * i
    s[r] = i

for i in range(100000):
    r = i * i * i * i * i
    if X < r:
        if not (r - X) in s:
            continue
        print(str(i) + " " + str(s[r - X]))
        break
    else:
        if not (X - r) in s:
            continue
        print(str(i) + " " + str(-s[X - r]))
        break

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

def rt5(a):
  if a==0:
    return 0
  i=1
  while 1:
    s=i**5
    if a==s:
      return i
    elif a==-s:
      return -i
    elif abs(a)<s:
      return False
    i+=1

b=0

while 1:
  a5=x+b**5
  a=rt5(a5)
  if a==False:
    pass
  else:
    print(a,b)
    exit()
  
  a5=x-b**5
  a=rt5(a5)
  if a==False:
    pass
  else:
    print(a,-b)
    exit()
  b+=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
up=0
for i in range(1000):
    if (i+1)**5-i**5>10**9:
        up=i
        break
for a in range(-up-1,up+1):
    for b in range(-up-1,up+1):
        if a**5-b**5==x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

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

    # divisors.sort()
    return divisors
li = make_divisors(x)
#print(make_divisors(x))
#[1, 33, 3, 11]

for l in li:
    for k in range(-1000,1000):
        b = k
        a = b + l
        if a**4 +a**3*b +(a**2)*(b**2)+a*(b**3)+b**4 == x//l:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
five = [0] * 200
five_inv = [0] * 200
for i in range(200):
  five[i] = i ** 5
  five_inv[i] = -five[i]

def check(x):
  A = 0
  B = 0
  for i in range(200):
    if X + five[i] in five:
      B = i
      A = five.index(five[i] + X)
      break
    elif X - five[i] in five:
      B = -i
      A = five.index(-five[i] + X)
      break
    elif X - five[i] in five_inv:
      B = -i
      A = -five_inv.index(-five[i] + X)
      break
  return "{} {}".format(A,B)

print(check(X))

Submission status: Accepted

Solution code:
x = int(input())
m = 1000

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

Submission status: Accepted

Solution code:
X=int(input())
ans=[]
for i in range(1,150):
  for j in range(-150,150):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])

Submission status: Accepted

Solution code:
x = int(input())
flag = True
for a in range(-500, 500):
    for b in range(-500, 500):
        if a ** 5 - b ** 5 == x:
            print(' '.join([str(a), str(b)]))
            flag = False
            break
    if not flag:
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    X,=pin()


    #解が存在することが証明されているので、探索を行う
    for a in range(1000):
        cond=0        
        if a**5==X:print(a,0);break
        #search B for B**5==t
        A=a
        if A**5<X:#Bは負！
            t=X-A**5
            cond=1#後で負にする
            r=A+1 #rはBのかりの最大値
        elif A**5>X:
            t=(A**5)-X
            r=100+A+1
        #search B for B**5==t
        #print(a,t,cond,"K")
        for b in range(r):                
            #print(b**5,t)
            if b**5==t:
                #print("yeah")
                B=b
                if cond==1:B*=(-1)
                print(A,B)
                return
                
#%%submit!
resolve()

Submission status: Accepted

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

for a in range(1, 1500):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1500, 1500):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)
        if an < 0:
            break

        if an == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
fives = list(i**5 for i in range(1000))
for i, five in enumerate(fives):
    if five-X in fives:
        print(i, fives.index(five-X))
        break
    if X-five in fives:
        print(fives.index(X-five), -i)
        break

Submission status: Accepted

Solution code:
def f(a,b):
    def func(a,b):
        return a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4
    return (a-b)*func(a,b)

def calc(x):
    for a in range(0,100000):
        for b in range(-1000,1000):
            if(f(a,b)==x):
                print(a,b)
                return 0;
x = int(input())
calc(x)

Submission status: Accepted

Solution code:
X=int(input())
J=1000
N=[0]*J
for i in range(0,J):
    N[i]=i**5
for i in range(0,J):
    for j in range(0,J):
        if abs(N[i]-N[j])==X:
            print(int(max(N[i],N[j])**(1/5)),int(min(N[i],N[j])**(1/5)))
            exit()
        elif N[i]+N[j]==X:
            print(int(N[i]**(1/5)),int(-1*N[j]**(1/5)))
            exit()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)

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


def main():
    X = int(input())
    divisors = make_divisors(X)
    root_X = int(X ** 0.5)
    for d in divisors:
        lim = int(X ** 0.25)
        for b in range(-lim, lim+1):
            a = b + d
            if a ** 4 + (a**3) * b + (a ** 2) * (b** 2) + (a) * (b ** 3) + b ** 4 == X // d:
                print(a, b)
                sys.exit()
        

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

notsolved = True
for a in range(-500, 500):
    if notsolved:
        for b in range(-500, 500):
            if a**5-b**5 < x:
                continue
            if a**5-b**5 == x:
                print(str(a)+" "+str(b))
                notsolved = False

Submission status: Accepted

Solution code:
import itertools

x = int(input())

y = itertools.combinations(range(-1000,1000), 2)
for n in y:
    if (n[0]**5 - n[1]**5) == x:
        print(n[0], n[1])
        break
    elif (n[1]**5 - n[0]**5) == x:
        print(n[1], n[0])
        break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(10 ** 4):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break

if ans != "":
    print(ans)
else:
    print(aaa)