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:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X = int(input())

i = -1000
val = i**5
vals = defaultdict(int)
while val <= 10**9:
    vals[val] = i
    i += 1
    val = i**5

d = defaultdict(int)
for a, akon in vals.items():
    for b, bkon in vals.items():
        val = a-b
        if d[val] == 0:
            d[val] = (akon, bkon)
# print(len(d))
if X in d.keys():
    a, b = d[X]
    print(a, b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

C=[0]
for i in range(1,64):
    C.append(pow(i,5))

c=0
ans1=0
ans2=0
while c<=X:
    temp=X-c
    if temp in C:
        ans2=C.index(temp)
        print(ans1,-ans2)
        break
    else:
        ans1+=1
        c=C[ans1]
else:
    for j in range(64,120):
        C.append(pow(j,5)) 
    #print(len(C))
    c=0
    ans1=0
    ans2=0
    for k in range(120):
        if C[k]>=X:
            for l in range(k):
                if C[k]-C[l]==X:
                    print(k,l)
                    break
            else:
                continue
            break

Submission status: Accepted

Solution code:
from itertools import product

a=int(input())

multi_5 = [0]
tmp = 0
c = 0

while 1:
    c += 1
    tmp = c**5

    if tmp - multi_5[-1] > 10**9:
        break

    multi_5.append(tmp)

# print(c)

minus_multi_5 = []

for i in multi_5:
    minus_multi_5.append(i*(-1))

# print(minus_multi_5)

multi_5.extend(minus_multi_5)

# print(len(multi_5))

for j,k in product(multi_5, multi_5):
    if j-k == a:
        if j >= 0:
            ansa = int(j**(1/5))
        else:
            ansa = int((j*(-1))**(1/5)) * (-1)

        if k >= 0:
            ansb = int(k**(1/5))
        else:
            ansb = int((k*(-1))**(1/5)) * (-1)

        
        print(ansa,ansb)
        break

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

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

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

x = int(input())

N = 1000
for a in range(N):
    for b in range(-1*N,N):
        m = a**5 - b**5
        # print(m)
        if x==m:
            print(a,b)
            exit()
        else:
            pass

Submission status: Accepted

Solution code:
import sys
X=int(input())
X2=int(X**0.5)
X5=int(X**0.2)

for i in range(1, X+1):
    if X%i==0:
        for j in range(-i,X+1):
            Xt=(j+i)**5-j**5
            if Xt>X and j>0:
                break
            if Xt==X:
                print(j+i,j)
                sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

def search(num, x):
    res = 0
    a_ = 0
    b = 0
    for a in range(num):
        a_ = a
        b = num-a
        if a**5 - b**5 == x:
            res = 1
            break
        elif a**5 + b**5 == x:
            b = -b 
            res = 1
            break
    return a_, b ,res 

for i in range(555555):
    a, b, res = search(i,x)
    if res == 1:
        break

print("{} {}".format(a, b))

Submission status: Accepted

Solution code:
import math
x = int(input())
for b in range(-10000, 10000):
    p = b**5 + x
    if p < 0:
        a = int(math.floor(-((-p)**0.2)))
    else:
        a = int(math.floor(p**0.2))
    if (a-1)**5 == p:
        print(a-1, b)
        break
    elif a**5 == p:
        print(a,b)
        break
    elif (a+1)**5 == p:
        print(a+1, b)
        break

Submission status: Accepted

Solution code:
def d166(x):

    a = 0
    b = 0

    if x == 0:
        return "1" + " " + "1"
    if x < 0:
        for i in range(10000):
            ax = x + i**5
            if ax > 0:
                a = -i
                for w in range(i):
                    if ax-(w**5) == 0:
                        b = -w
                        return str(a) + " " + str(b)
            else:
                a = -i
                for w in range(i):
                    if ax+(w**5) == 0:
                        b = w
                        return str(a) + " " + str(b)

    else:
        for i in range(10000):
            ax = x - i**5
            if ax < 0:
                a = i
                for w in range(i):
                    if ax+(w**5) == 0:
                        b = w
                        return str(a) + " " + str(b)
            else:
                a = i
                for w in range(i):
                    if ax-(w**5) == 0:
                        b = -w
                        return str(a) + " " + str(b)

def main():
    x = int(input())
    print(d166(x))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
ans = []
arr = []
for i in range(1000):
    arr.append(i**5)
for i in range(1000):
    for j in range(i,1000):
        if arr[j] + arr[i] == x:
            ans.append(j)
            ans.append(i * -1)
        if arr[j] - arr[i] == x:
            ans.append(j)
            ans.append(i)
print(*ans[0:2])

Submission status: Accepted

Solution code:

import bisect
x = int(input())
T = [0] * ((10 ** 4) + 1)
for i in range(0, (10 ** 4)+1):
    T[i] = i ** 5

for i in range(len(T)):
    index = bisect.bisect_left(T, x + T[i])
    if index == len(T):
        break
    if T[index] == x + T[i]:
        print(' '.join(map(str,[index, i])))
        exit(0)


for i in range(len(T)):
    index = bisect.bisect_left(T, x - T[i])
    if index == len(T):
        break
    if T[index] == x - T[i]:
        print(' '.join(map(str,[index, -i])))
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

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 fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
a = []
for i in range(1000):
    a.append(i**5)

for i in range(999):
    for j in range(i+1,1000):
        if a[i]-a[j]==x:
            A=i
            B=j
            break
        elif -a[i]-a[j]==x:
            A=-i
            B=j
            break
        elif -a[i]+a[j]==x:
            A=-i
            B=-j
            break
        elif a[i]+a[j]==x:
            A=i
            B=-j
            break
print('%d %d'%(A,B))

Submission status: Accepted

Solution code:
import itertools

z = []
for i in range(1000):
    a =i**5
    # print(a)
    z.append(a)

X = int(input())

z_p = list(itertools.permutations(z, 2))
for i in range(len(z_p)):
    if z_p[i][0] - z_p[i][1] ==  X:
        print(z.index(z_p[i][0]),z.index(z_p[i][1]))
        exit()
    elif z_p[i][0] + z_p[i][1] ==  X:
        print(z.index(z_p[i][1]),-(z.index(z_p[i][0])))
        exit()

Submission status: Accepted

Solution code:
def f(n):
    l, r = 0, 1 << 10
    while r - l > 1:
        m = (l + r) // 2
        if m ** 5 <= n:
            l = m
        else:
            r = m
    return l if l ** 5 == n else 0

X = int(input())
for i in range(1 << 10):
    a = f(X + i ** 5)
    if a:
        print(a, i)
        break
    a = f(X - i ** 5)
    if a:
        print(a, -i)
        break

Submission status: Accepted

Solution code:
x=int(input())
ans=[]
for i in range(1000):
    for j in range(1000):
        if pow(i,5)+pow(j,5)==x:
            print(i,-j)
            exit()
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
t = 0
for i in range(1000):
    if t == 1:
        break
    for j in range(1000):
        x5 = pow(i,5)
        y5 = pow(j,5)
        mx5 = -pow(i,5)
        my5 = -pow(j,5)
        if X == x5 - y5:
            print(i,j)
            t = 1
            break
        if X == mx5 - y5:
            print(-i,j)
            t = 1
            break
        if X == x5 - my5:
            print(i,-j)
            t = 1
            break

Submission status: Accepted

Solution code:
def main():
  x=int(input())
  
  for a in range(pow(10,3)):
    if a**5>x:
      for b in range(pow(10,3)):
        if a**5-b**5==x:
          print(a,b)
          exit()
    else:
      for b in range(-pow(10,3),1):
        if a**5-b**5==x:
          print(a,b)
          exit()
if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
import math
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
# yakusu = make_divisors(X)
# for div in yakusu:
#     for a in range(0,div + 1):
#         b =   a - div
#         print(f"{a,b}:{a ** 5 - b ** 5}")
#
#         if (a - b)  * ((a ** 4) + (a**3 * b) + (a **2 *  b ** 2) + (a * b ** 3 )+ (b ** 4)) == X:
#             print(a,b)
#             exit(0)
#



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



# (a - b)  * ((a ** 4) + (a**3 * b) + (a **2 *  b ** 2) + (a * b ** 3 )+ (b ** 4))



# if A % B == 0:
#     print(  min ( (A//B - 1) *B,A//B * N )

Submission status: Accepted

Solution code:
from itertools import combinations_with_replacement
#a, b = list(map(int, input().split(" ")))
x = int(input())

fivelist = dict()
for i in range(-1000, 1000):
    fivelist[i] = i**5

for a, ma in fivelist.items():
    for b, mb in fivelist.items():
        if ma - mb == x:
            print(f"{a} {b}")
            exit(0)

Submission status: Accepted

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    c = {0:0}
    s = set([0])
    cnt = 1
    flag = True
    while flag:
        k = pow(cnt, 5)
        c[k] = cnt
        s.add(k)
        r = k-X
        if r in s:
            print(c[k], c[r])
            flag = False
            break
        if -r in s:
            print(c[k], -c[-r])
            flag = False
            break
        cnt += 1
resolve()

Submission status: Accepted

Solution code:
def pow_r(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n // 2)
    else:
        return x * pow_r(x ** 2, (n - 1) // 2)


x = int(input())
for a in range(-100, 1000):
    for b in range(-100, 1000):
        if x == (pow_r(a, 5)) - (pow_r(b, 5)):
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
import sys
import math
X = int(sys.stdin.readline().rstrip())
y = 0
while True:
  a = y**5 + X
  b = (-y)**5 + X
  x1 = round(a**(1/5))
  if x1**5 == a:
    print(x1, y)
    break
  x2 = round((b**(1/5)).real)
  if x2**5 == b:
    print(x2, -y)
    break
  y += 1

Submission status: Accepted

Solution code:
import math
import sys
if __name__ == "__main__":
    x = int(input())

    for i in range(1, int(math.sqrt(x)) + 1):
        if x % i == 0:
            sm = i
            lg = x // i

            for a in range(1, 10 ** 5 + 1):
                b = a - sm
                if a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4 == lg:
                    print(a, b)
                    sys.exit(0)

Submission status: Accepted

Solution code:
from itertools import combinations
x = int(input())
n = 1000
c = []
for i in range(n):
    c.append(i**5)
for (i, j) in combinations(range(n), 2):
    if c[j] - c[i] == x:
        print(j, i)
        break
    if c[j] + c[i] == x:
        print(j, -i)
        break

Submission status: Accepted

Solution code:
def ihf(x):
    lookup = {}
    def printAns(k, s, x):
        lk, ls = lookup[k], lookup[s] 
        if k - s == x:
            print(lk, ls)
        elif k + s == x:
            print(lk, -ls)
        elif -k - s == x:
            print(-lk, ls)
        elif -k + s == x:
            print(-lk, -ls)

    for i in range(5000):
        lookup[i ** 5] = i
    for k in lookup.keys():
        search = (x + k, x - k)
        f2 = 1
        for i, s in enumerate(search):
            if s < 0:
                s = -s
                f2 = -1
            if lookup.get(s, None):
                printAns(k, s, x)
                return

if __name__ == "__main__":
    import sys
    x = int(input())
    ihf(x)

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:
X = int(input())
As = [0]*121
for i in range(1,121):
  As[i] = i**5

flag = 0
for i in range(1,121):
  a = As[i]
  for j in range(i+1):
    b = As[j]
    if a + b == X:
      print(i,-j)
      flag = 1
      break
    elif a - b == X:
      print(i, j)
      flag = 1
      break
  if flag == 1:
    break

Submission status: Accepted

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

def ff(X):
    res = 1
    if X == 0:
        return 0
    if X <= 0:
        res = -1 
        X = -X
    ok = 10000
    ng = -1
    while abs(ok-ng) > 1:
        med = (ok+ng)//2
        if med**5 >= X:
            ok = med
        else:
            ng = med
    if ok**5 == X:
        return res*ok
    return None
X = int(readline())

for b in range(-1000, 10000):
    a = ff(pow(b, 5) + X)
    if a is not None:
        print(a, b)
        break

Submission status: Accepted

Solution code:
mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

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

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))

x = II()
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

if x==0:
	print(0,0)
else:
	div = make_divisors(x)
	tmp = []
	for l in div:

		tmp.append(-1*l)
	div += tmp
	p = 0
	a = None
	b = None
	while(1):
		for l in div:
			s = p**5 - (p-l)**5
			# mp = -p
			# print(s)
			if s ==x:
				# print('!!!!!')
				a=p
				b=p-l
			if s==(-x):
				# print(p,l)
				b=p
				a=p-l

			# s = mp**5-(mp-l)**5
			# if s ==x:
			# 	a=mp
			# 	b=mp-l
			# elif s==(-x):
			# 	b=mp-l
			# 	a=mp

		if a is not None:
			break
		p += 1
	print(a,b)

Submission status: Accepted

Solution code:
X = int(input().strip())
a = 1
b = 0
while True:
    if X == a**5 - b**5:
        print(a, b)
        break
    elif X == a**5 + b**5:
        print(a, -b)
        break
    elif a**5 - b**5 < 0:
        b = 0
        a += 1
    else:
        b += 1

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

Solution code:
import math

x = int(input())

divisors = []

for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        divisors.append(i)

        if i != x//i:
            divisors.append(x//i)


for i in divisors:
    for a in range(i//2,x,1):
        b = a - i
        if a**5 - b**5 == x:
            print(a, b)
            break
        elif a**5 - b**5 > x:
            break

Submission status: Accepted

Solution code:
x= int(input())
s=0
for i in range(100):
	if s==0:
		for j in range(100):
			if i**5+j**5==x:
				print(j,-i)
				s+=1	
				break
	else:
		break

for i in range(400):
	if s==0:
		for j in range(i,500):
			if j**5-i**5==x:
				print(j,i)
				s+=1	
				break
	else:
		break

Submission status: Accepted

Solution code:
X = int(input())
Y = int(pow(X, 1/5) * 2)

for a in range(1, Y+1, 1):
  r = (a ** 5) - X
  b = 0
  if r >= 0:
    b = pow(r, 1/5)
  else:
    b = -pow(-r, 1/5)
  if round(b) ** 5 == r:
    print(a, int(b))
    break

Submission status: Accepted

Solution code:
import bisect as bs
import sys

x = int(input())

dic = {}

i = 1
while True:
  if i ** 5  > 10 ** 12:
    break
    
  dic[i ** 5] = i
  dic[-(i ** 5)] = -i
    
  i += 1
  
i = 0
while True:
  if i ** 5 > 10 ** 12:
    break
    
  tmp = x + (i ** 5)
  if tmp in dic.keys():
    print(dic[tmp], i)
    sys.exit(0)
    
  tmp = x - (i ** 5)
  if tmp in dic.keys():
    print(dic[tmp], -i)
    sys.exit(0)
    
  i += 1

Submission status: Accepted

Solution code:
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

x = int(input())

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

Submission status: Accepted

Solution code:
flag = 0
X = int(input())
for A in range(1000):
    if flag!=0:
        break
    for B in range(1000):
        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            flag=1
            break
        elif A**5 + B**5 == X:
            print(str(A) + " " + str(-B))
            flag=1
            break

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

d = make_divisors(X) 

ans =[0,0]

for i in d:

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

Submission status: Accepted

Solution code:
def cul(A,B):
	ret = pow(A,5)-pow(B,5)
	return ret

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(reverse = True)
    return divisors

if __name__ == '__main__':
	X = int(input())
	ls = make_divisors(X)
	c = 0
	A = 0
	B = 0
	#print(ls) #debug
	ls.append(0)
	for d in ls:
		a = d//2
		v = 0

		while(v < X):
			b = a-d
			v = cul(a,b)
			#print('{} {}'.format(a,b)) #debug
			#print(v) #debug
			if v == X:
				A = a
				B = b
				c = 1
			else:
				a += 1

		if c == 1:
			break

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

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

Y = make_divisors(X)

for i in range(2*len(Y)):
    if i%2 == 0:
        t = Y[i//2]
    else:
        t = -1*Y[i//2]
    for j in range(400):
        s = j-200
        if (s+t)**5 - s**5 == X:
            print(s+t,s)
            break
        else:
            pass

Submission status: Accepted

Solution code:

X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
import sys
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        a = pow(i, 5)
        b = pow(j, 5)
        if a - b == X:
            print(i, j)
            sys.exit(0)

Submission status: Accepted

Solution code:
x = int(input())
lim = int(x**(1/5))+1

for a in range(10**6):
    mul = 1
    if a**5 < x:
        mul = -1
    
    b = ((a**5 - x)*mul)**(1/5)
    b*=mul
    b = int(b)
    if a**5 - b**5 == x:
        print(a, b)
        exit()

Submission status: Accepted

Solution code:
m=int(input())
flag=True
for i in range(100000):
    n=(m+i**5)**0.2
    if round(n)**5-i**5==m:
        print(int(n),i)
        break
    if flag:
        n=(m-i**5)**0.2
        if type(n)==complex:
            flag=False
        elif round(n)**5+i**5==m:
            print(int(n),-i)
            break

Submission status: Accepted

Solution code:
num = int(input())
list = [i ** 5 for i in range(1000)]
ans = []
for a in range(1000):
    for b in range(1000):
        if list[a] - list[b] == num: 
            ans = [a, b]
            break
        if list[a] + list[b] == num:
            ans = [a, b * (-1)]
            break
print(' '.join(map(str, ans)))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import itertools
import numpy as np
x = int(input())
# hani = int(pow(x, 1/5))
# for a in range(-hani-1, hani+1):
#     for b in range(-hani-1, hani+1):
#         if (pow(a, 5) - pow(b, 5) == x):
#             print(a, b)
#             exit()
max_x = pow(10, 18)
v = 0
v_lis = [0]
i = 1
while max_x > v:
    v = pow(i, 5)
    v_lis.append(v)
    v_lis.append(-v)
    i += 1

for a5, b5 in itertools.combinations_with_replacement(v_lis, 2):
    if (a5 - b5 == x):
        if (a5 < 0):
            a = int(pow(a5*-1, 1 / 5)) * -1
        else:
            a = int(pow(a5, 1 / 5))
        if (b5 < 0):
            b = int(pow(b5*-1, 1/5))*-1
        else:
            b = int(pow(b5, 1/5))
        print(a, b)
        exit()


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


# arr = factorization(x)
# fact = []
# for prime, idx in arr:
#     fact.extend([prime]*idx)

# print(fact)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in range(1000):
    a = int(i/2)*(-1)**int(i)
    for j in range(1000):
        b = int(j/2)*(-1)**int(j)
        if a**5 - b**5 == x:
            ans = 1
            break
    if ans == 1:
        break
print(a,b)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    X = int(input())
    for A in range(-100,10000):
        for B in range(-100,A+1):
            if A**5-B**5==X:
                print(A, B)
                sys.exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
X = int(input())
res = False
for A in range(1,1000):
    for B in range(-1000, A):
        if math.pow(A, 5) - math.pow(B, 5) == X:
            res = True
            break

    if res:
        break

print(A, B)

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
x=int(input())
A=[int(i) for i in range(201)]
Ans=[]
for a in A:
  for b in A:
    if a**5+b**5==x and not Ans:
      Ans=[a,-b]
    if a**5-b**5==x and not Ans:
      Ans=[a,b]
print(*Ans)

Submission status: Accepted

Solution code:
X=int(input())

for a in range(1,110):
    if X%a==0:
        i=-a//2
        while (i+a)**5-i**5<=X:
            if (i+a)**5-i**5==X:
                print(i+a,i)
                break
            i+=1

Submission status: Accepted

Solution code:
x = int(input())
#print(x)

for b in range(121):
  for a in range(b+1,122):
    kx = (a**5) - (b**5)
    if kx == x:
      print('{} {}'.format(a,b))
      exit()
    elif kx > x:
      break

for b in range(121):
  for a in range(b+1,122):
    kx = (a**5) + (b**5)
    if kx == x:
      print('{} {}'.format(a,-b))
      exit()
    elif kx > x:
      break

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
  
lis = sorted(make_divisors(X))

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

Submission status: Accepted

Solution code:
X = int(input())
l = list()
i = int()
while i**5-(i-1)**5 <= 10**9:
    l.append(i**5)
    l.append(0-i**5)
    i += 1
for i in range(len(l)):
    for j in range(i, len(l)):
        if abs(l[i]-l[j])==X:
            if l[i]-l[j]==X:
                A=l[i]
                B=l[j]
            else:
                A=l[j]
                B=l[i]
            #print(A,B)
            ifAM=False
            ifBM=False
            if A<0:
                ifAM=True
            if B<0:
                ifBM=True
            A=int(abs(A)**0.2)
            B=int(abs(B)**0.2)
            if ifAM:
                A=0-A
            if ifBM:
                B=0-B
            print(A, B)
            exit()

Submission status: Accepted

Solution code:
i=int(input())
f=0
for j in range(150):
    for k in range(-150,150):
        if j**5-k**5==i:
            print(j, k)
            f=1
            break
    if f==1:
        break

Submission status: Accepted

Solution code:
import math
x=int(input())
flag=0
for i in range(150,0,-1):
    for j in range(-100,i):
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            flag=1
    if flag==1:
        break