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: Time Limit Exceeded

Solution code:
import sys
from math import ceil, sqrt
def input(): return sys.stdin.readline().strip()


def main():
    X = int(input())
    x = int(X ** (1/5))
    if x == X ** (1/5):
        print("{} {}".format(x, 0))
        return
    
    for B in range(x + 1):
        A = (X - B**5) ** (1/5)
        if int(A) == A:
            print("{} {}".format(int(A), -B))
            return
    
    B = 1
    while True:
        n = X + B ** 5
        A = n ** (1/ 5)
        if A == int(A):
            print("{} {}".format(int(A), B))
            return
        else:
            B += 1



if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
max = 10**9+1
flag = False
for i in range(1,max):
    if x%i == 0:
        for j in range(-i-1,i+1):
            tmp = (i-j)**5 - j**5
            if tmp == x:
                print(str(i-j)+" "+str(j))
                flag = True
                break
    if flag:
        break

Submission status: Time Limit Exceeded

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

P = [1]
for k in range(2,math.floor(math.sqrt(N))+1):
    if N % k == 0:
        P.append(k)
        P.append(N//k)
P = sorted(P)

for e in P:
    for x in range(2*e+1):
        y = x-e
        if x**4 + (x**3)*y + (x**2)*(y**2) + x*(y**3) + y**4 == N//e:
            print(x,y)
            exit(0)

Submission status: Time Limit Exceeded

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

from pprint import pprint
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float("inf")

x = int(input())


def find(x):
    for a in range(10 ** 4):
        for b in range(10 ** 4):
            b = -b
            if a ** 5 - b ** 5 == x:
                return [a, b]


a, b = find(x)
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for i in range(10**5):
    for j in range(-10**5,10**5):
        if i**5 - j**5 ==X:
            print(i,j)
            break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
res = [0,0]
for A in range(-1*abs(X), abs(X)):
  for B in range(-1*abs(X), abs(X)):
    if A**5-B**5==X:
      res[0] = A
      res[1] = B
      break
print(res[0],res[1])

Submission status: Time Limit Exceeded

Solution code:
import sys
x = int(input())
result = [1,1]
for i in range(10**8+1):
    for j in range(10**8+1):
        if x == pow(i, 5)+pow(j, 5):
            result = [i, -j]
            print(*result)
            sys.exit()
print(*result)

Submission status: Time Limit Exceeded

Solution code:


r=[]
for i in range(128):
    A=i-63
    for j in range(128):
        B=j-63
        r.append((A**5-B**5,A,B))
r.sort()

target=int(input())
lwbd = 0
upbd = len(r)

while lwbd<upbd:
    middle = lwbd+ (upbd-lwbd)//2
    if(r[middle][0]==target):
        break
    elif r[middle][0]>target:
        upbd = middle
    else:
        lwbd = middle
print(r[middle][1],r[middle][2])

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

A = 0
while True:
    n = X - A**5
    B = int(A**(1/5))
    if B ** 5 == n:
        print(A, -B)
        break
    B += 1
    if B ** 5 == n:
        print(A, -B)
        break
    A += 1

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    b = 10**6
    #for b in range(-200000,200000,1):
    while True:
        a = X + pow(b,5)
        if a != 0:
            p = pow(a,-5)
        #print(a,b,p)
        if int(p) == p:
            print(a,b)
            exit()
        b -= 1
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(read())

for a in range(pow(10, 9)):
    B_ = pow(a, 5) - X
    B = pow(B_, -5)
    if B_ == pow(B, 5):
        print(a, int(B))
        sys.exit()

Submission status: Time Limit Exceeded

Solution code:
sa = eval(input())
s, lists = sa // 10, []
if sa == 1:
    lists.append(0)
    lists.append(-1)
for i in range(-s, s):
    for x in range(-s, s):
        if i**5 - x**5 == sa:
            lists.append(i)
            lists.append(x)
            break
print(lists[-2], lists[-1])

Submission status: Time Limit Exceeded

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict
from sys import exit
import math

from bisect import  bisect_left
def main():
    x = getN()
    ruis = [i**5 for i in range(-1000000, 1000000)]
    # print(ruis)
    for a in ruis:
        b = a - x
        if b > ruis[-1]:
            continue
        idx = bisect_left(ruis, b)
        if ruis[idx] == b:
            # print(a, b, x, idx)
            print(a , idx - 1000000)
            return

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    b = -2000000
    #for b in range(-200000,200000,1):
    while True:
        a = X + pow(b,5)
        if a != 0:
            p = pow(a,-5)
        #print(a,b,p)
        if int(p) == p:
            print(a,b)
            exit()
        b += 1
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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(10000):
		for B in range(-10000,0,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: Time Limit Exceeded

Solution code:
x = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X=I()
    for A in range(10**7):
        B_=pow(A,5)-X
        B = int(pow(B_,-5))
        if(B**5==B_):
            print(A,B)
            return
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if n // i != i:
                divisor.append(n // i)
    # divisor.sort() # if you want sorted divisors
    return divisor


x = int(input())
cand = get_divisor(x)
# print(cand)
for d in cand:
    a = d
    b = 0
    while a**5 - b**5 < x:
        a += 1
        b += 1
    if a**5 - b**5 == x:
        print(a, b)
        break

    is_found = False
    for i in range(1, d):
        a = i
        b = i - d
        if a**5 - b**5 == x:
            print(a, b)
            is_found = True
            break
    if is_found:
        break

    a = 0
    b = -d
    while a**5 - b**5 < x:
        a -= 1
        b -= 1
    if a**5 - b**5 == x:
        print(a, b)
        break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for i in range(x):
    s = x - i**5
    if(s < 0):continue
    t = int(s ** 0.2)
    if(s == t**5):
        print(i,-t)
        exit()

Submission status: Accepted

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

#import
#import math
#import numpy as np
X = int(input())

li = [i ** 5 for i in range(1005)]

for a in range(1000):
    for b in range(1000):
        t1 = li[a] - li[b]
        t2 = li[a] + li[b] if b % 2 == 1 else t1
        if t1 == X:
            print(a, b)
            exit()
        elif  t2 == X:
            print(a, -b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

x = int(input())

tmp = [i ** 5 for i in range(ceil(x ** 0.25) + 1)]
res = 0

for a in range(len(tmp) - 1):
    for b in range(a + 1, len(tmp)):
        if tmp[a] - tmp[b] == x:
            res = f"{a} {b}"
            break
        elif tmp[a] + tmp[b] == x:
            res = f"{a} {-b}"
            break
        elif -tmp[a] + tmp[b] == x:
            res = f"{-a} {-b}"
            break
        elif -tmp[a] - tmp[b] == x:
            res = f"{-a} {b}"
            break

print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# author:  Taichicchi
# created: 25.09.2020 21:12:29

import sys

X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

s = []
for i in range(300):
    j = i ** 5
    s.append(j)
    s.append(-1*j)

for a in s:
    for b in s:
        ans = a - b
        if ans == x:
            if a >= 0:
                aa = int(a ** (1/5))
            else:
                aa = int(abs(a) ** (1/5)) * -1
            if b >= 0:
                bb = int(b ** (1/5))
            else:
                bb = int(abs(b) ** (1/5)) * -1
            print(aa,bb)
            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(a, b)
            exit()

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

# If a is positive: n ** 5 - (n - 1) ** 5 exceeds 10 ** 9 when i = 120
# If a is non-positive: n ** 5 - (n - 1) ** 5 exceeds 10 ** 9 when i = -119
# So, the valid range of A is from -118 to 119
for a in range(-118, 119 + 1):
    tgt = a ** 5 - X
    for b in range(-119, 119):
        if tgt == b ** 5:
            print(a, b)
            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:
X = int(input())
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X=int(input())

for a in range(10**4):
  for b in range(10**4):
    if a**5-b**5==X:print(a,b);exit()
    elif a**5+b**5==X:print(a,-b);exit()

Submission status: Accepted

Solution code:
X=int(input())
flagp=False
flagm=False
flage=True
for A in range(-10**3,10**3):
    B5=A**5-X
    for B in range(10**3):
        if B5==B**5:
            flagp=True
            flage=False
            break
        elif B5==-B**5:
            flagm=True
            flage=False
            break
    else:
        continue
    break
if flagp:
    print(A,B)
elif flage:
    raise Exception
else:
    print(A,-B)

Submission status: Accepted

Solution code:
X=int(input())
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:
def main():
    X = int(input())
    for A in range(200):
        for B in range(-200,200):
            if A**5 - B**5 ==X:
                print(A,B)
                return
        
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# import decimal
# from decimal import Decimal
# decimal.getcontext().prec = 10

# from heapq import heappush, heappop, heapify
# import math
# from math import gcd
# import itertools as it
# import collections
# from collections import deque 

def inp():
    return int(input())
def inps():
    return input().rstrip()
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

X = inp()

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:
def main():
    X = int(input())
    a_max = None
    a = 1
    while True:
        if a**5 - (a-1)**5 > X:
            a_max = a - 1
            break
        else:
            a += 1
    a_min = None
    a = -1
    while True:
        if a**5 - (a-1)**5 > X:
            a_min = a + 1
            break
        else:
            a -= 1

    for a in range(a_min, a_max+1):
        for b in range(a_min-1, a_max):
            if a**5 - b**5 == X:
                print(a, b)
                exit()


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:
X = int(input())
for i in range(10**4):
    for j in range(10**4):
        x = i - 10**4//2
        y = j - 10**4//2
        if x**5 - y**5 == X:
            s = str(x) + " " + str(y)
            print(s)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    a_lst = []
    b_lst = []
    for i in range(400):
        a_lst.append(-200 + i)
    for i in range(400):
        b_lst.append(-200 + i)

    flag = False
    for i in range(len(a_lst)):
        for j in range(len(b_lst)):

            a = a_lst[i]
            b = b_lst[j]
            if a ** 5 - b ** 5 == x:
                print(a, b)
                flag = True
                break

        if flag:
            break


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, sys

X = int(input())

if int(X**(1/5)) **5 ==X:
    print(*[ int(X**(1/5)) , 0])
    sys.exit()

for i in range(1,10**7):
    A = i**5
    B = A - X
    C = X - A

    if B > 0 and int(B**(1/5)) **5 == B:
        print(*[ i , int(B**(1/5)) ])
        sys.exit()

    if C > 0 and int(C**(1/5)) **5 ==C:
        print(*[ i , - int(C**(1/5)) ])
        sys.exit()

Submission status: Accepted

Solution code:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

x = ii()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())


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

print(ans[0],ans[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if a**5-b**5==X:
            print(a,b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


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


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')
import numpy as np

def main():
	x=II()
	for i in range(-300,300):
		for j in range(-300,300):
			if i**5==x+j**5:
				print(i,j)
				exit()






if __name__=="__main__":
	main()

Submission status: Accepted

Solution code:
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
x = ri()
for i in range(-200, 200):
    for j in range(-200, 200):
        if i**5 - j**5 == x:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())
a=0
while True:
    for b in range(10**3):
        if a**5-b**5==x:
            print(a,b)
            exit()
        elif a**5+b**5==x:
            print(a,-b)
            exit()
        elif -a**5+b**5==x:
            print(-a,-b)
            exit()
    a+=1

Submission status: Accepted

Solution code:
x = int(input())
a = 1
flag = True
while flag:
  upper = a**5-x
  b = a
  while True:
    if b**5 == upper:
      flag = False
      a -= 1
      break
    if b**5<upper:
      break
    b -= 1
  a += 1
print(a,b)

Submission status: Accepted

Solution code:
import math
X = int(input())
A, B = 1, 1


def is_ok(i, x):
    return pow(i, 5) >= x


def bisect(ng, ok, x):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, x):
            ok = mid
        else:
            ng = mid
    return ok


ss = math.ceil(X ** (1 / 4)) + 10
for a in range(1, math.ceil(X ** (1 / 4)) + 10):
    tmp = abs(pow(a, 5) - X)
    b = bisect(-1, ss, tmp)
    if tmp == pow(b, 5):
        A = a
        if a ** 5 - X > 0:
            B = b
        else:
            B = -1 * b
        break
print(A, B)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def make_divisors(n: int) -> list:
    return_list = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            return_list.append(i)
            if i != n // i:
                return_list.append(n//i)

    return sorted(return_list)

X = int(input())
list = make_divisors(X)
mlist = []
for li in list[::-1]:
    mlist.append(-li)
mlist += list
B = -120
while True:
    for i in mlist:
        if ((B + i) ** 5) - (B ** 5) == X:
            print(B+i,B)
            exit()
    B += 1

Submission status: Accepted

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

for i in range(120):
    for j in range(120):
        y = i**5 + j**5
        z = i**5 - j**5
        if z == x:
            a = i
            b = j
            print("{} {}".format(a, b))
            exit()
        if y == x:
            a = i
            b = -j
            print("{} {}".format(a, b))
            exit()

Submission status: Accepted

Solution code:

def main():
    x = int(input())
    for i in range(1,1000):
        for j in range(-1000,1000):
            if i**5-j**5 ==x:
                print(f"{i} {j}")
                return

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
flg = 0
for i in range(-118,120,1):
    for j in range(-119,119,1):
        if (i)**5 - (j)**5 == x:
            ans1 = i
            ans2 = j
        
print(str(ans1)+str(" ")+str(ans2))

Submission status: Accepted

Solution code:
import sys
import heapq
from decimal import Decimal

input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
import sys
import heapq
from decimal import Decimal

input = sys.stdin.readline

x = int(input())


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

Submission status: Accepted

Solution code:
x = int(input())
for i in range(400):
  for j in range(400):
    ii = i - 200
    jj = j - 200
    if ii**5 - jj**5 == x:
      print(ii,jj)
      exit()
assert false, "final"

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(str(i) + ' ' + str(j))
			exit()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    x = int(input())
    n5 = np.array([i**5 for i in range(-201, 201)])
    diff = np.subtract.outer(n5, n5)
    r = np.where(diff == x)
    # assert (r[0][0] - 201)**5 - (r[1][0] - 201)**5 == x
    print(r[0][0]-201, r[1][0]-201)

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
#import numpy as np
from itertools import product
def main():
    x = int(input())
    n5 = [i**5 for i in range(201)]

    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:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
from itertools import product
def main():
    x = int(input())
    n5 = [i**5 for i in range(201)]

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