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:
x = int(input())
for i in range(500):
    for j in range(-500, 500):
        if i**5 - j**5 == x:
            a = i
            b = j
            break
print(a, b)

Submission status: Accepted

Solution code:
#MLE注意！0や1のケースに注意

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    n = int(pow(x,0.2))
    m = int(pow(x,0.25))

    ans = (0,0)
# B<0
    for a in range(n+1):
        for b in range(n+1):
            if a**5 + b**5 == x:
                ans = (a,-b)
# B>=0
    for a in range(m+1):
        for b in range(m+1):
            if a**5 - b**5 == x:
                ans = (a,b)
    
    print(ans[0],ans[1])
main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

x=I()
five=[i**5 for i in range(200)]
plus=[]
minus=[]
for i in range(200):
    for j in range(i,200):
        plus.append([five[i]+five[j],j,i])
        minus.append([five[j]-five[i],j,i])
#print(plus)
#print(minus)
for u in plus:
    if x==u[0]:
        print(u[1],end=" ")
        print(-u[2])
        sys.exit()
for u in minus:
    if x==u[0]:
        print(u[1],end=" ")
        print(u[2])
        sys.exit()

Submission status: Accepted

Solution code:
X=int(input())

def func(num):
    cand=[]
    for b in range(-500,501):
        a=b+num
        temp=a**4+a**3*b+a**2*b**2+a*b**3+b**4
        cand.append(temp)
    return cand

yaku=[]

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

for item in yaku:
    lis=func(item)
    for i in range(len(lis)):
        if lis[i]*item==X:
            i-=500
            print(i+item,i)
            exit()

Submission status: Accepted

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

import itertools


L = 10 ** 16
SIGNS = [(1, 1), (1, -1), (-1, 1), (-1, -1)]


def enum_fifth_powers(limit=None):
    if limit is None:
        limit = L
    res = []
    for i in itertools.count():
        i5 = i * i * i * i * i
        if i5 > limit:
            return res
        else:
            res.append(i5)


def solve(x):
    pow_table = enum_fifth_powers()
    for sa, sb in SIGNS:
        for (a, a5), (b, b5) in itertools.product(enumerate(pow_table), repeat=2):
            if sa * a5 - sb * b5 == x:
                return sa * a, sb * b


def test():
    vs = enum_fifth_powers()
    # print(vs)
    print(len(vs))


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

d = 1
while d * d <= x:
	if (x % d) == 0:
		for b in range(-200, 200):
			a = b + d
			if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == x // d:
				print(a, b)
				exit(0)
	d += 1

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    X = int(input())
    T = [i**5 for i in range(-1000, 1000)]
    for ai, a in enumerate(T):
        for bi, b in enumerate(T):
            if a - b == X:
                print(ai-1000, bi-1000)
                return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

for i in range(100):
    for j in range(100):
        if i ** 5 + j ** 5 == X:
            print(i, -j)
            exit()
            
        if i ** 5 + j ** 5 > X:
            continue

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

Submission status: Accepted

Solution code:
from itertools import combinations

x = int(input())
num = [i**5 for i in range(1000)]

for a, b in combinations(num, 2):
    if a - b == x:
        print(int(a**0.2), int(b**0.2))
    elif a + b == x:
        print(int(a**0.2), -int(b**0.2))
    elif b - a == x:
        print(int(b**0.2), int(a**0.2))
    elif b + a == x:
        print(int(b**0.2), -int(a**0.2))
    else:
        continue
    break

Submission status: Accepted

Solution code:
x = int(input())
i = 0
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:
import sys
input=lambda: sys.stdin.readline().rstrip()
x=int(input())
A=[int(i) for i in range(5000)]
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())
c = 0
for a in range(500):
    for b in range(-500, 500):
        if a**5-b**5 == x:
            print(a, b)
            c = 1
            break;
    if c == 1:
        break;

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:
inpl = lambda: list(map(int,input().split()))
from math import sqrt, ceil
def divisors(n, sort=True, reverse=False):
    sqn = int(ceil(sqrt(n)))
    div_list = []
    if sqn*sqn == n:
        div_list.append(sqn)
    for i in range(1,sqn):
        if n % i == 0:
            div_list.append(i)
            div_list.append(n//i)
    if sort:
        div_list.sort(reverse=reverse)
    return div_list

X = int(input())
divs = divisors(X)
for y in divs:
    a, b = y, 0
    while a**5 - b**5 < X:
        a += 1
        b += 1
    if a**5 - b**5 == X:
        print(a, b)
        exit()
    
    for b in range(1, y//2 + 1):
        a = y - b
        if a**5 + b**5 == X:
            print(a, -b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

#facx = fac(x)
a,b = 0,0
for i in range(1000):
    u = i**5
    if u <= x:
        for j in range(1000):
            v = j**5
            if u + v > x:
                break
            elif u + v == x:
                a,b = i,-j
    elif u == x:
        a,b = i,0
    else:
        for j in range(i):
            v = j**5
            if u-v < x:
                break
            elif u-v == x:
                a,b = i,j
print(a,b)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
X = int(input())
x = X**(0.2)
x = int(x)
x = max(x,1)
flag = 0
for A in range(1,10*x):
    if flag == 1:
        break
    for B in range(-10*x,A+1):
        if A ** 5 - B ** 5 == X:
            print(A,B)
            flag = 1
            break

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    x=int(input())
    ans=[0,0]
    m=-500
    M=-m
    for i in range(m,M):
        for j in range(m,M):
            if j**5-i**5==x:
                ans=[j,i]
                break
    print(*ans)






if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
X = int(input())

d = {}
k = {}
for i in range(-1000,1001):
    d[i] = pow(i,5)
    k[d[i]] = i
i = 1000

while True:
    if X + d[i] in d.values():
        b = i
        a = k[X + d[i]]
        break
    i -= 1

print(a, b)

Submission status: Accepted

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

ans_1=0
for i in range(len(a)):
    for j in range(len(b)):
        if a[i] - b[j] == x:
            ans_1 = c[i]
            ans_2 = c[j]
            break
    if ans_1 != 0:
        break
print(str(ans_1) + ' ' + str(ans_2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    A = 1
    B = 0
    while A <= 10**9:
        for B in range(A-1, A*(-1)-1, -1):    
            x = A ** 5 - B ** 5
            if x == X:
                print(A, B, sep=" ")
                return
            elif x > X:
                break
        # break
        A += 1

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(10**3+1):
    for j in range(2*10**3+2):
        if i**5-(j-1000)**5 == x:
            print(i,j-1000)
            flag =True
            break
    if flag:
        break

Submission status: Accepted

Solution code:

import sys
import math
import itertools
import collections


def solve(X):
    l = [i for i in range(-1000,1000,1)]
    # for n in range(1000):
    #     print("{}**5:{}".format(n,n**5))
    for A in range(1000):
        for B in range(-1000,1000,1):
            if(X == (A**5 - B**5)):
                print(A,B)
                sys.exit()
def main():
    X = int(input())
    solve(X)
    # print(solve())

if __name__ == "__main__":
    main()

Submission status: Accepted

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

X=int(input())

S=[0]*200

A=0
B=0
for i in range(200):
    S[i]=i**5

for i in range(200):
    for j in range(200):
        if S[i] + S[j] == X:
            A=i
            B=-j 
            break
        if S[i] - S[j] == X:
            A=i
            B=j
            break

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

x=int(input())
# xは1<10**9
def make_divisor(x):
    pass

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return sorted(ass) #sortされていない
    
k=(divisor(x))
# l=len(k)
# print(k)
def f(a,b):
    return a**4+a**3*b+a**2*b**2+a*b**3+b**4
for i in k:
    # print(i)
    for a in range(0,int(x**0.5)+1):
        b=a-i
        # print("ab",a,b)
        # print(x//i,a**4+a**3*b+a**2*b**2+a*b**3+b**4)
        if x//i==f(a,b):
            print(a,b)
            exit()










# print(a,b)

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

Submission status: Accepted

Solution code:
x=int(input())

a=[0]#x^5 list
for i in range(1,201):
    a.append(i**5)

I=0
J=0
b=0
for i in range(0,201):
    for j in range(0,201):
        if a[i]-a[j]==x:
            I=i
            J=j
            b=1
            break
    if b==1:
        break

for i in range(0,201):
    for j in range(0,201):
        if a[i]+a[j]==x:
            I=i
            J=-j
            b=1
            break
    if b==1:
        break
print(I,J)

Submission status: Accepted

Solution code:
X = int(input())

for i in range(-300, 300, 1):
    for j in range(-300 , 300, 1):
        if i ** 5 - j ** 5 == X:
            print(i, end = ' ')
            print(j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

def main():
    #N, M = map(int, input().split())
    X = int(input())
    LARGE = 100000

    d = {}
    for a in range(LARGE):
        d[a**5] = a

    for a in range(LARGE):
        A = a ** 5
        remain = A - X
        abs_remain = abs(remain)
        if abs_remain in d:
            b = d[abs_remain]
            if remain < 0:
                b = -b
            break

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
A=0
B=0
for i in range(1000):
  for j in range(i+1):
    a=pow(i,5)
    b=pow(j,5)
    if a-b==x:
      A=i
      B=j
for i in range(80):
  for j in range(80):
    a=pow(i,5)
    b=pow(j,5)
    if a+b==x:
      A=i
      B=-j
print(A,B)

Submission status: Accepted

Solution code:
X=int(input())
A=0
while True:
    B=0
    while A**5-B**5>=X:
        if A**5-B**5==X:
            print(A,B)
            exit()
        B+=1
    while A**5-B**5<=X:
        if A**5-B**5==X:
            print(A,B)
            exit()
        B-=1
    A+=1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    X = I()

    i = 0
    while i**5<X:
        i += 1
    
    B = -(i-1)
    while True:
        A = int((B**5+X)**0.2)
        if A**5==B**5+X:
            break
        B += 1

    print(A, B)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    from sys import stdin
    # from collections import defaultdict, deque
    # import math
    # import random
    input = stdin.readline


    x = int(input())

    squared = [0]*401
    for i in range(-200, 201):
        squared[i+200] = i**5

    ans_dict = dict()
    
    for i in range(401):
        for j in range(i, 401):
            temp = squared[j]-squared[i]
            ans_dict[temp] = (j-200, i-200)
    a, b = ans_dict[x]
    print(a, b)

Submission status: Accepted

Solution code:
x = int(input())
i = 0
for i in range(10**9):
    d = i**5 - x
    if d < 0:
        a = -1
    else:
        a = 1
    for j in range(i):
        if a*(j**5) == d:
            print(i, a*j)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ans = (-1,-1)
gojo = [i**5 for i in range(200)]
for i in range(200):
    for j in range(200):
        if gojo[i]+gojo[j]==x:
            ans = (i,-j)
        if gojo [i]- gojo[j]==x:
            ans = (i,j)
        
print(ans[0],ans[1])

Submission status: Accepted

Solution code:
X = int(input())

lists = [i ** 5 for i in range(1000)]

for a, i in enumerate(lists):
    for b, j in enumerate(lists):
        if X == i - j:
            print(a, b)
            exit()
        elif X == i + j:
            print(a, -b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a = []
for x in range(-150,150):
    a.append(x**5)
    
    
import itertools

seq = (x for x in range(300))
ptr = list(itertools.combinations(seq,2))

for i in range(len(ptr)):
    tmp = a[ptr[i][0]]-a[ptr[i][1]]
    if abs(tmp) == X:
        if tmp == X:
            A = ptr[i][0] - 150
            B = ptr[i][1] - 150
        else:
            A = ptr[i][1] - 150
            B = ptr[i][0] - 150
            
            
print(A,B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
a=1
while (a)**5-(a-1)**5<x:
  a+=1
#print(a)
import itertools
seq=[i for i in range((-1)*a,a+1)]
lis=list(itertools.permutations(seq, r=2))
now=0
b=0
while now==0:
  if (lis[b][0])**5-(lis[b][1])**5==x:
    print(lis[b][0],lis[b][1])
    now=1
  else:
    b+=1

Submission status: Accepted

Solution code:
X = int(input())
l = []
for i in range(-1000,1001):
    l.append(i**5)
for i in range(len(l)-1):
    for j in range(i,len(l)):
        if abs(l[i]-l[j]) == X:
            ai = i-1000
            aj = j-1000
            break

print(aj,ai)

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
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 SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 

X=II()

for i in range(0, 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())
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 a in range(10**4):
        a5 = a**5
        tar = a5 - x
        if 0 <= tar:
            L, R = 0, 10**5
            while L+1 < R:
                P = (L+R)//2
                p5 = P**5
                if p5 <= tar:
                    L = P
                else:
                    R = P
            if L**5 == tar:
                print(a, L)
                break
        else:
            L, R = -(10**5), 0
            while L+1 < R:
                P = (L+R)//2
                p5 = P**5
                if p5 <= tar:
                    L = P
                else:
                    R = P
            if L**5 == tar:
                print(a, L)
                break

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())
ans=[0,0]
t=False
for a in range(1000):
  for b in range(-a,a+1):
    if a**5-b**5==x:
      ans=[a,b]
      t=True
      break
  if t:
    break
print(ans[0],' ',ans[1])

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 0
for i in range(10 ** 3):
    for j in range(- 10 ** 3, 10 ** 3):
        if i ** 5 - j ** 5 == X:
            A = i
            B = j
print(A, B)

Submission status: Accepted

Solution code:
from itertools import combinations

X = int(input())
for i, j in combinations(range(1000), 2):
    b = i
    a = j
    i = i ** 5
    j = j ** 5
    if j - i == X:
        print(a, b)
        exit()
    if j + i == X:
        print(a, -b)
        exit()

Submission status: Accepted

Solution code:
def f(y, b):
    return y**4 + 5*(y**3)*b + 10*(y**2)*(b**2) + 10*y*(b**3) + 5*(b**4)

X = int(input())
for y in range(1, int(X**0.5)+1):
    if X%y==0:
        tmp = X//y
        right = int(tmp**(1/4))+1
        left = -right
        while left < right:
            b = (right + left)//2
            fyb = f(y, b)
            if  fyb == tmp:
                break
            elif fyb > tmp:
                right = b
            else:
                left = b + 1
        if fyb == tmp:
            break
print(y+b, b)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math

def solve(X: int):
    lim = 200

    for A in range(-lim, lim):
        for B in range(-lim, lim):
            x = math.pow(A, 5) - math.pow(B, 5)
            if X == int(x):
                print(A, B)
                return
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    X = int(input())
    N = 2*10**2
    for i in range(N):
        for j in range(i,N):
            tmp = j**5 - i**5
            if tmp == X:
                print(j,i)
                exit()
            elif tmp == X - 2*(i**5):
                print(j,-i)
                exit()

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())
i = 1
ok = False
while i * i <= X and not ok:
  if X % i == 0:
    for x in (i, X//i):
      A = -10000
      while A <= 10000:
        if A**5-(A-x)**5 == X:
          print(A, A-x)
          ok = True
          break
        A += 1
      if ok:
        break
  i += 1

Submission status: Accepted

Solution code:
X = int(input())
# m = 0
# n = -1
# while X >= m**5-n**5:
#     m += 1
#     n += 1
# hazimete = 0
# while X >= hazimete ** 5:
#     hazimete += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
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


X = int(input())
divs = make_divisors(X)

# a = b+p
for p in divs:
    for b in range(-10000, 10000):
        a = b+p
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

x=ii()

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

Submission status: Accepted

Solution code:
import sys
K = int(input())
num = [i**5 for i in range(150)]
for i in range(len(num)):
    for j in range(len(num)):
        if num[i] - num[j] == K :
            print(i,j)
            sys.exit()
        elif num[i] + num[j] == K:
            print(i,-j)
            sys.exit()

Submission status: Accepted

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

for v in itertools.permutations(range(-300,300),2):
    if (v[0])**5 - (v[1])**5 == x:
        print(v[0], v[1])
        break

Submission status: Accepted

Solution code:
X = int(input())
A = [a ** 5 for a in range(200)]
for b in range(200):
    B = b ** 5
    if X + B in A:
        print(A.index(X + B), b)
        break
    if X - B in A:
        print(A.index(X - B), -b)
        break

Submission status: Accepted

Solution code:
x = int(input())

v = [0] * 200
mv = [0] * 200
for i in range(200):
    v[i] = i*i*i*i*i
    mv[i] = i*i*i*i*i*(-1)

result_a = 0
result_b = 0
for i in range(200):
    for j in range(200):
        if(v[i] - v[j] == x):
            result_a = i
            result_b = j
        if(v[i] - mv[j] == x):
            result_a = i
            result_b = j*(-1)

print(result_a, result_b)

Submission status: Accepted

Solution code:
X=int(input())


for A in range(120):
    B5=abs(A**5-X)
    Bfugou=A**5>X
    B=B5**0.2
    B=int(B)
    if Bfugou==False:
        B=-B
    if A**5-B**5==X:
        print(A,B)
        break
    A+=1

Submission status: Accepted

Solution code:
#author: raghav_0901
from math import *

mod = (10**9) + 7


def _in():
    return [int(x) for x in input().split(' ')]


def main():
    x = int(input())
    for i in range(-1001, 1001):
        for j in range(-1001, 1001):
            a = pow(i, 5) - pow(j, 5)
            if(a == x):
                print(i, j)
                return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt

x = int(input())

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

x = ii()
dp = [0]*201
for i in range(1,201):
    dp[i] = i**5
from bisect import bisect_left as bl
'''index  =  bl(list,num)'''
for i in range(1,200):
    index = bl(dp,dp[i]+x)
    if index == 201:
        continue
    if dp[index] == dp[i] +x:
        print(index,i)
        exit()

for i in range(1,200):
    index = bl(dp,-dp[i]+x)
    if index == 201:
        continue
    if dp[index] == -dp[i] +x:
        print(index,-i)
        exit()

Submission status: Accepted

Solution code:
x = int(input())
isLoop = True
for i in range(0, 121):
    a = i ** 5
    for j in range(0, i):
        b = j ** 5
    
        if a - b == x:
            print("{} {}".format(i,j))
            isLoop = False
            break
        elif a + b == x:
            print("{} {}".format(i,-j))
            break
    if isLoop == False:
        break

Submission status: Accepted

Solution code:
X=int(input())
D={}
D[0]=0
for i in range(1,200001):
    D[i**5]=i
    D[-i**5]=-i
#print(len(L))
for i in range(-200000,200001):
    if X+i**5 in D:
        print(D[X+i**5],i)
        exit()