Problem:


Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

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

for k in range(1, 10000):
    for l in range(10000):
        if (l + k) ** 5 - l ** 5 == x:
            print(l + k, l)
            exit()
        if (l + k) ** 5 - l ** 5 > x:
            break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

##### 累乗 #####
# pow(x, y, z) -> x**y % z

##### 割り算の切り上げ #####
# tmp = -(-4 // 3)

##### dict の for文 #####
# for k, v in d.items():
#     print(k, v)

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	X = inputInt()

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


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# nCr mod m
# rがn/2に近いと非常に重くなる
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

# nHr mod m
# 問題によって、combination()を切り替えること
def H(n, r, mod=10**9+7):
	# comb = Combination(n+r-1, mod)
	# return comb(n+r-1, r)
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# dfs のサンプル
def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

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

Submission status: Accepted

Solution code:
import sys
x = int(input())
for b in range(-100000, 100000):
    a = (x+b**5)**(1/5)
    if type(a) == float:
        int_a = int(a)
        if int_a**5 - b**5 == x:
            print(int(a), b)
            exit()

Submission status: Accepted

Solution code:
from collections import defaultdict
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
x = inp()
a,b = 0,0
has = False
for i in range(1000):
    for j in range(1000,-1000,-1):
        if i**5 - j**5 == x:
            a,b = i,j
            has = True
            break
    if has:
        break
print(a,b)

Submission status: Accepted

Solution code:
A = [pow(n, 5) for n in range(300)]
B = [pow(n, 5) for n in range(300)]
a = -1
b = -1
x = int(input())
for n in range(300):
  for m in range(300):
    if A[n] - B[m] == x:
      a = n
      b = m
      break
    if A[n] + B[m] == x:
      a = n
      b = -m
      break
  if a >= n:
    break
print(a, b)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

x = INT()

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

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:
from sys import exit

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
arr = [0,1]
i = 2
while arr[-1]-arr[-2] <= 10**9:
    arr.append(i**5)
    i += 1

def printans(a,b,x,y):
    i = arr.index(a)
    j = arr.index(b)
    print(i*x,j*y)
    exit()

for a in arr:
    for b in arr:
        if a-b==X:
            printans(a,b,1,1)
        elif a+b==X:
            printans(a,b,1,-1)
        elif -a-b==X:
            printans(a,b,-1,1)
        elif -a+b==X:
            printans(a,b,-1,-1)

Submission status: Accepted

Solution code:
import sys
dic={}
for i in range(-300,300):
    dic[i**5]=i
x=int(input())
for b5 in dic:
    if x+b5 in dic:
        print(dic[x+b5],dic[b5])
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

pattern = [(item**5, item) for item in range(-300, 300)]
x = int(input())

for a, i in pattern:
    for b, j in pattern:
        if a == x + b:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
X = int(input())
for i in range(-300, 300):
    for j in range(-300, 300):
        if i**5 - j**5 == X:
            print(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())
flag = False
for a in range(0, 1000):
  for b in range(-1000, 1000):
    if a**5-b**5 == x:
      print(a, b)
      flag = True
      break
  if flag:
    break

Submission status: Accepted

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

#for i in range(-30,30):
#    print(i**5)

#for i in range(200):
#    print(i**5-(i-1)**5)

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

Submission status: Accepted

Solution code:
x = int(input())
for a in range(-200,201):
    for b in range(-200,201):
        if(a**5 - b**5 == x):
            print(' '.join(map(str,[a,b])))
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

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

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

x = int(input())

y = int(x**(1/3))

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

Submission status: Accepted

Solution code:
x=input()
a=[0]
d={}
d[0]=0
for i in range(1,1000):
	a+=[i**5]
	a+=[-i**5]
	d[i**5]=i
	d[-i**5]=-i

a.sort()
for i in range(len(a)):
    if x+a[i] in a:
        print d[a[i]+x],d[a[i]]
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

x = ni()

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    powers5 = dict()
    for i in range(-200, 200):
        powers5[i] = math.pow(i, 5)
    x = I()
    for i_key in powers5.keys():
        for j_key in powers5.keys():
            if powers5[i_key] - powers5[j_key] == x:
                print(i_key, j_key)
                return

main()

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-201,201):
  for b in range(-201,201):
    if a**5 - b**5 == X:
      print(a,b)
      quit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
for a in range(-200, 201):
    for b in range(-200, 201):
        if a ** 5 - b ** 5 == n:
            print(a, b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())

ans = -1
for ii in range(2001):
    i = ii-1000
    for jj in range(2001):
        j = jj-1000
        if(i*i*i*i*i - j*j*j*j*j == n):
            print(i,j)
            exit()

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 a in range(1000):
    b = a-1
    while 1:
        if a**5-b**5==x:
            print(a,b)
            exit()
        elif a**5-b**5>x:
            break
        else:
            b-=1

Submission status: Accepted

Solution code:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####

def solve(X):
    # A**5 - B**5 = X
    # (A-B)(A**4 + ... )
    for bb in xrange(1000):
        for b in (-bb, bb):
            target = X + b ** 5
            sign = 1 if target >= 0 else -1
            target = abs(target)
            a = int(target**0.2)
            if a ** 5 == target:
                return a * sign, b
            if (a+1)**5 == target:
                return a * sign, b
    
print "{} {}".format(*solve(rri()))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


X = int(sys.stdin.buffer.readline())

hist = []
for a in range(100000):
    hist.append(a ** 5)
    i = bisect.bisect_left(hist, a ** 5 - X)
    if i < len(hist) and hist[i] == a ** 5 - X:
        print(a, i)
        break
    i = bisect.bisect_left(hist, X - a ** 5)
    if i < len(hist) and hist[i] == X - a ** 5:
        print(a, -i)
        break

# while a ** 5 < 10 ** 18:
#     a += 1
# print(a)
# for _ in range(200):
#     hist.append(a ** 5)
#     a += 1
# print(hist)

Submission status: Accepted

Solution code:
x = int(input())
for a in range(0, 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())
ans = []

for a in range(-200, 201):
    A = a**5
    for b in range(-200, 201):
        B = b**5
        if A-B == X:
            ans.append([a, b])
            break
    if len(ans) > 0:
        break
print(*ans[0])

Submission status: Accepted

Solution code:
X = int(input())
choices = [(i, i ** 5) for i in range(-1000, 1001)]
for ai, a in choices:
	for bi, b in choices:
		if a - b == X:
			print(ai, bi)
			raise SystemExit

Submission status: Accepted

Solution code:
n = int(input())
for i in range(-500,500):
    for j in range(-500,500):
        if (j**5 - i**5) == n:
            a = j
            b = i
            break
            break
print(str(a)+" "+str(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
X = int(input())

for A in range(-1000, 1000):
  t = A**5-X
  if t>=0:
    t = int(t**0.2)
  else:
    t = int(-(-t)**0.2)
  for B in range(t-1, t+2):
    if A**5-B**5==X:
      print(A, B)
      exit(0)

Submission status: Accepted

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

x = int(input())
k = 200

def main():
    for a in range(-k, k):
        for b in range(-k, k):
            if a**5 - b**5 == x:
                print(a, b)
                return
    return 1/0

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
c = 0
for A in range(10**3+1):
  if c == 1:
    break
  for B in range(-10**3,10**3+1):
    if A**5-B**5 == X:
      print(A,B)
      c = 1
      break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
for a in range(1000):
    for b in range(1000):
        if a ** 5 + b ** 5 == x:
            print('{} {}'.format(a, -b))
            exit()
        elif a ** 5 - b ** 5 == x:
            print('{} {}'.format(a, b))
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

n5 = {}
for i in range(100000):
    n5[i**5] = i    

for i in range(-1000000, 1000000):
    b = i ** 5 + X
    if b in n5:
        print(n5[b], i)
        break

Submission status: Accepted

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

    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__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
x = int(input())
eps = 10**-10

B = [0]
for i in range(10**5):
    B.append(i)
    B.append(-i)

for b in B:
    if x + b**5 >= 0:
        c = (x + b**5) ** 0.2
        if abs(c - int(c)) < eps:
            print(int(c), b)
            break
        elif abs(c - (int(c)+1)) < eps:
            print(int(c)+1, b)
            break

Submission status: Accepted

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

X = int(input())


for B in range(10**3):
    for A in range(B+1, 10**14):
        t = A**5 - B**5
        if t > X:
            break
        elif t == X:
            a1, a2 = A, B
            break

for B in range(10**3):
    for A in range(10**3):
        t = A**5 + B**5
        if t > X:
            break
        elif t == X:
            a1, a2 = A, -B
            break

print(a1, a2)

Submission status: Accepted

Solution code:
"""

Wolfram Alpha

(A^5 - B^5)/(A - B) = A^4 + A^3 B + A^2 B^2 + A B^3 + B^4

"""

import sys

X = int(sys.stdin.readline().rstrip())

a = 0
while True:
	b = a
	target = (a**5) - X
	while (b**5) > target:
		b -= 1
	if (b**5) == target:
		print("%d %d" % (a, b))
		sys.exit(0)
	a += 1

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

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

x = INT()
arr = make_divisors(x)
for i, j in arr:
    for a in range(-1000, 1000):
        b = a - i
        if a ** 4 + (a ** 3) * b + (a ** 2) * (b ** 2) + a * (b ** 3) + b ** 4 == j:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

def go(x):
    for a in range(1, 1001):
        for b in range(-1000, 1001):
            if a**5-b**5 == x:
                print(a, b)
                return

go(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n):
        res = {1,n}
        i = 2
        while i**2 <= n:
            if n%i == 0:
                res.add(i)
                res.add(n//i)
            i += 1
        return res
    x = I()
    f = f(x)
    for a in range(10**7):
        a5 = a**5
        for l in f:
            b = a-l
            if a5 == x+b**5:
                print(a,b)
                return
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    x = ii()
    for a in range(-500, 500):
        for b in range(-500, 500):
            if a ** 5 - b ** 5 == x:
                print(f"{a} {b}")
                exit()



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    X = int( input())
    for i in range(-200, 201):
        for j in range(-200, 201):
            if i**5 - j**5 == X:
                print(i, j)
                return
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

X = Int()
import sys

for A in range(-1000,1001):
    tmp = A**5
    #print(A)
    for B in range(-1000,1001):
        if tmp - B**5==X:
            print(A,B)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
flag = False
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)
            flag=True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
lis = [i ** 5 for i in range(-300,300)]
x = int(input())
for i in range(len(lis)):
    for j in range(len(lis)):
        if lis[i] - lis[j] == x:
            print(i-300,j-300)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
cand = [0]
n = 1
while n**5 - (n-1)**5 <= X:
    cand.append(n)
    cand.append(-n)
    n += 1
for a in cand:
    for b in cand:
        if a**5 - b**5 == X:
            print(a, b)
            exit()