Problem:


Score : 400 points

Problem Statement

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

Constraints

1 \leq X \leq 10^9

X is an integer.

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

Input

Input is given from Standard Input in the following format:

X

Output

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

A B

Sample Input 1

33

Sample Output 1

2 -1

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

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
X=int(input())
lst=[]
N=500000
for i in range(-N,N+1):
    lst.append([i**5,i])
B=set([A for A,a in lst])
dic=defaultdict(int)
for A,a in lst:
    dic[A]=a
for A,a in lst:
    if A-X in B:
        print(a,dic[A-X])
        exit()

Submission status: Accepted

Solution code:
from math import *

a=[]
for i in range(-501,501):
	a.append([int(pow(i,5)),i])

b=[]
for i in range(len(a)):
	for j in range(len(a)):
		if a[i][0]-a[j][0]>0:
			b.append([a[i][0]-a[j][0],a[i][1],a[j][1]])

x=int(input())

for i in range(len(b)):
	if b[i][0]==x:
		print(b[i][1],b[i][2])
		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:
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())
for i in make_divisors(x):
    b = -i//2
    a = b + i
    while a**5-b**5 <= x:
        if a**5-b**5 == x:
            print(a,b)
            exit()
        a += 1
        b += 1

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(f"{a} {b}")
            exit()

Submission status: Accepted

Solution code:
import numpy as np
x = int(input())
for i in range(100000):
    if(i ** 5 -x > 0):
        b = int(pow(i**5-x,1/5))
        if(b**5 == i**5-x):
            print(i,b)
            break
    else:
        b = int(pow(-i**5+x,1/5))
        if(b**5 == -i**5+x):
            print(i,-b)
            break

Submission status: Accepted

Solution code:
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def main():
    X = get_input(int)
    A5_cache = {}
    for A in range(10000000):
        A5 = A**5
        A5_cache[A5] = A

        B5 = A5 - X
        if B5 in A5_cache:
            B = A5_cache[B5]
            break
        elif -B5 in A5_cache:
            B = -A5_cache[-B5]
            break
    assert A**5 - B**5 == X
    print(A, B)

        

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

for i in range(-178,178):
    for j in range(-178,178):
        if ((i**5)-(j**5) == X):
            A = i
            B = j
            break

print(A,B)

Submission status: Accepted

Solution code:
x = int(input())

f5=list()

i=0
while i**5<=10**12+6:
    f5.append(i**5)
    i+=1


for i in range(len(f5)):
    for j in range(len(f5)):
        if f5[i] + f5[j]== x:
            a=i
            b=-j
        if f5[i] - f5[j] == x:
            a=i
            b=j

print(a,b)

Submission status: Accepted

Solution code:
x = int(input())
a = int(x**(1/4))
for i in range(1,a+1):
    for l in range(-a,i):
        if i**5-l**5==x:
            print(i,l)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

from itertools import product
tot_comb = [el for el in product(list(range(-120, 121)), list(range(-120, 121))) if el[0]!=el[1]]
tot_comb += [(0,0)]
num_dict = {el[0]**5 - el[1]**5: el for el in tot_comb}
pair = num_dict[x]
print(pair[0], pair[1])

Submission status: Accepted

Solution code:
import math

def solve():
    powers = []
    n = 0
    c = 0
    while n < (2 * 10 ** 20):
        n = c ** 5
        c += 1
        powers.append(n)
    for p in powers:
        for pp in powers:
            if p - pp == k:
                print(round(p ** (1/5)), round(pp ** (1/5)), sep=" ")
                exit()
            elif p + pp == k:
                print(round(p ** (1/5)), -round(pp ** (1/5)), sep=" ")
                exit()
    return


k = int(input())
solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys, bisect, math, itertools
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

x = inp()
a = 0
b = -100
@lru_cache(maxsize=None)
def dp(a,b):
    return a**5-b**5
while True:
    while True:
        if dp(a,b) >= x:
            break
        a += 1
    while True:
        if dp(a,b) <= x:
            break
        b += 1
    if dp(a, b) == x:
        break
print(a,b)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import copy
x=int(input())

alist=[i for i in range(121)]
blist=copy.deepcopy(alist)

for a in alist:
    for b in blist:
        if a**5 - b**5 == x:
            print(a,b)
            sys.exit()
        elif a**5 + b**5 == x:
            print(a,-b)
            sys.exit() 


print(";;")

Submission status: Accepted

Solution code:
import math
x = int(input())
a = []
for i in range(1,int(math.sqrt(x))+1):
    if x % i == 0:
        a.append(i)
for j in range(len(a)):
    for k in range(int(math.sqrt(x))+1):
        y = k - a[j]
        if (k-y) * (k**4 + y * k**3 + (k**2)*(y**2) + k * (y**3) + y **4) == x:
            print(k,y)
            exit()

Submission status: Accepted

Solution code:
x = int( input() )

for a in range( 10001 ):
    for b in range( a + 1 ):
        if a ** 5 + b ** 5 == x:
            print( str( a ) + " " + str( -b ) )
            exit()
        elif a ** 5 - b ** 5 == x:
            print( str( a ) + " " + str( b ) )
            exit()

Submission status: Accepted

Solution code:
x = int(input())
a = 0
f = False
res = 0

#while True:
while f == False:
    for i in range(a+1):
        if (a ** 5) - (i ** 5) == x:
            f = True
            res = i
            break
        elif (a ** 5) - (-i ** 5) == x:
            f = True
            res = -i
            break    
    a += 1

print(str(a-1) + " " + str(res))

Submission status: Accepted

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

    for a in range(-2000, 2001):
        for b in range(-2000, 2001):
            if a**5 - b**5 == X:
                return f'{a} {b}'
    return None

print(d_i_hate_factorization())

Submission status: Accepted

Solution code:
def f(a, b5, rev=False):
    ok = -1
    ng = 300
    while ng - ok > 1:
        mid = (ng+ok)//2
        if N[mid] == b5:
            print(a, mid - 300)
            exit()
        elif N[mid] > b5:
            ng = mid
        else:
            ok = mid
    

N = [i**5 for i in range(-300,300)]
X = int(input())
for a in range(-300,300):
    b5 = N[a + 300] - X
    f(a, b5)

Submission status: Accepted

Solution code:
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s+=a
        yield s


sys.setrecursionlimit(200005)


def main():
    X = iRaw()
    yakusus = []
    for x in range(1,int(math.sqrt(X))+1):
        if X%x ==0:
            yakusus.append(x)
    a = 1
    while True:
        a5 = a**5
        for y in yakusus:
            b = a -y
            b5 = b**5
            if a5-b5==X:
                return " ".join([str(a),str(b)])
        a+=1


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a = int(input())
    ansdict= {}
    count = 1000
    mcount =1000 *(-1)

    for i in range(0,1000):
        c = i **5
        ansdict[i]=c
        ansdict[i*(-1)]=c*(-1)
    flag = 0

    for i in range(mcount+1,count):
        for j in range(mcount+1,count):
            ans = ansdict[j]-ansdict[i]
            if ans ==a:
                print(str(j) + " " +str(i))
                flag+=1
                break
        if flag == 1:
            break

Submission status: Accepted

Solution code:
def main():
    paramX = int(input())
    size = 200
    for a in range(size * -1, size):
        for b in range(size * -1, size):
            if pow(a, 5) - pow(b, 5) == paramX:
                print(a, b)
                return
    print(1, 1)
main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

T = [None] * 121
for i in range(121):
    T[i] = i ** 5

ok = False
for a in range(121):
    for b in range(0, 120):
        if T[a] - T[b] == X:
            ok = True
            print(a, b)
            break
    for b in range(0, 121):
        if T[a] + T[b] == X:
            ok = True
            print(a, -b)
            break
    if ok:
        break

Submission status: Accepted

Solution code:

x = int(input())

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

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

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def main(X=None):
    if X is None:
        X = ii()
    for a in range(-100000, 100000):
        b5 = a**5 - X
        b = meg(lambda v: v**5<=b5, -10000000, 10000000)
        if a**5 - X == b**5:
            print(a, b)
            return

main()

Submission status: Accepted

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
x=int(input())
l=[]
for a in range(-1000,1000):
	for b in range(-1000,1000):
		p=a**5-b**5
		if p==x:
			l.append([a,b])

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

Submission status: Accepted

Solution code:
X = int(input())
C = 0
for i in range(-1000,1000):
	if C == 1:
		break
	for j in range(-1000,1000):
		if i**5-j**5 == X:
			print(i,j)
			C += 1
			break

Submission status: Accepted

Solution code:
x = int(input())

a = 1
b = 0
y = 1

while y != x:
    if y > x:
        if a - b == 1:
            break
        b += 1
    else:
        a += 1
    y = a**5 - b**5

if y == x:
    print(a, b)
    exit()

num = 1
while num**5 < x:
    num += 1
num -= 1

# binary search
for a in range(num, 0, -1):
    start = 1
    stop = a
    while start < stop:
        b = (start + stop) // 2
        y = a**5 + b**5
        if y == x:
            print(a, -b)
            exit()
        elif y < x:
            start = b + 1
        else:
            stop = b - 1
    if a**5 + start**5 == x:
        print(a, -start)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

m = 1000
bs = {}
for i in range(0, m + 1):
    bs[i ** 5] = i
    bs[i ** 5 * -1] = -i

# print(bs)
for a in range(-m, m + 1):
    b = a ** 5 - x
    if b in bs:
        print(a, bs[b])
        exit(0)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

a = 1
b = 1
for i in range(-200, 200):
  for j in range(-200, 200):
    if ((i ** 5) - (j ** 5) == n):
      a = i
      b = j

print("%d %d" %(a, b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
MAX = 150
al = []
for i in range(MAX):
    al.append(i**5)
    al.append(-i**5)

for i,A in enumerate(al):
    for j,B in enumerate(al):
        if(A-B==X):
            a = i//2 if i%2==0 else -(i//2)
            b = j//2 if j%2==0 else -(j//2)
            print("{} {}".format(a,b))
            exit(0)

Submission status: Accepted

Solution code:
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


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


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

    B = 0
    res = {}
    while True:
        b = B ** 5
        if b not in res:
            res[b] = B
        if -b not in res:
            res[-b] = -B
        if X + b in res:
            return print(res[X + b], B)
        if X - b in res:
            return print(res[X - b], -B)
        B += 1


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


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


def main():
    X = int(input())
    M = 120
    A = [i**5 for i in range(M)]

    for i in range(M):
        for j in range(i, M):
            if A[j] - A[i] == X:
                print(j, i)
                break
            elif A[j] + A[i] == X:
                print(j, -i)
                break

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())

M=130

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

Submission status: Accepted

Solution code:

def solve(x):
    for b in xrange(-200, 200):
        a5 = (b ** 5) + x
        s = -1 if a5 < 0 else 1
        a = s * int(pow(abs(a5), 0.2) + 0.1)
        if a ** 5 == a5:
            return a, b

def test(x):
    a, b = solve(x)
    assert x == (a ** 5 - b ** 5)

test(33)
test(1)

from random import randint
for i in xrange(100):
    a = randint(-10 ** 3, 10 ** 3)
    b = randint(-10 ** 3, 10 ** 3)
    u = a ** 5 - b ** 5
    if abs(u) > 10 ** 9:
        continue
    test(a ** 5 - b ** 5)


x = int(raw_input())
a, b = solve(x)
print a, b

Submission status: Accepted

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

for i in range(1000):
    for j in range(1,1000):
        tmp = (i*i*i*i*i) + (j*j*j*j*j)
        if x == tmp:
            a = i
            b = -j
            break

for i in range(1000):
    for j in range(1,1000):
        tmp = (i*i*i*i*i) - (j*j*j*j*j)
        if x == tmp:
            a = i
            b = j
            break

print(a,b)

Submission status: Accepted

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


def solve(X: int):
    xs = [i for i in range(-180, 181)]
    # xs = [i ** 5 for i in range(-3, 4)]
    L = list(combinations_with_replacement(xs, 2))
    for l in L:
        l5 = (pow(l[0], 5), pow(l[1], 5))
        if max(l5) - min(l5) == X:
            print("{0} {1}".format(max(l), min(l)))
            return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
input = sys.stdin.readline
x = int(input())
for a in range(2000):
    for b in range(-2000, a):
        if a**5 - b**5 == x:
            print(a, b)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
L1=[]
Hash={}
for i in range(300+1):
    L1.append(i**5)
    Hash[i**5]=i
FLAG=0
for i in L1:
    for j in L1:
        if i-j==X:
            print(Hash[i],Hash[j])
            FLAG=1
            break
        elif i+j==X:
            print(Hash[i],-Hash[j])
            FLAG=1
            break
    if FLAG==1:
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
for A in range(10**5):
    k=A**5-x
    if k>=0:
        l=int(k**0.2)
        if l**5==k:
            print(A,l)
            break
    else:
        k=-k
        l=int(k**0.2)
        if l**5==k:
            print(A,-l)
            break

Submission status: Accepted

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

a = 0
b = 0
for i in range(len(fives)):
    for j in range(len(fives)):
        if fives[i] - fives[j] == x:
            a = i
            b = j
        elif fives[j] - fives[i] == x:
            a = j
            b = i
        elif fives[i] + fives[j] == x:
            a = i
            b = -1*j

print(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
x = int(input())
lis = []
for i in range(-120, 121):
    lis.append(i**5)
flag = False
for i in range(1, len(lis)):
    for j in range(i):
        if lis[i] - lis[j] == x:
            print("{} {}".format(-120 + i, -120+j))
            flag = True
        if flag:
            break
    if flag:
        break

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])
 
def main():
    x = inp()
    for a in range(-10**3,10**3):
        for b in range(-10**3,a):
            if a**5-b**5 == x:
                print(a,b)
                return
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
x5=[i**5 for i in range(0,10**3+1,1)]
for i in range(len(x5)):
    for j in range(len(x5)):
        if x5[i]-x5[j]==x:
            print(i,j)
            exit()
        if -x5[i]+x5[j]==x:
            print(-i,-j)
            exit()
        if x5[i]+x5[j]==x:
            print(i,-j)
            exit()
        if -x5[i]-x5[j]==x:
            print(-i,j)
            exit()

Submission status: Accepted

Solution code:
import itertools


def calc(num):
    abs_result = abs(num) ** (1/5)
    if num < 0:
        return int(-abs_result)
    else:
        return int(abs_result)


X = int(input())

s = set()
for i in range(0, 150):
    s.add(i**5)
    s.add(-i**5)

for comb in itertools.combinations(s, 2):
    if comb[0] - comb[1] == X:
        A = calc(comb[0])
        B = calc(comb[1])
        print(A, B)
        break
    if comb[1] - comb[0] == X:
        A = calc(comb[1])
        B = calc(comb[0])
        print(A, B)
        break

Submission status: Accepted

Solution code:

def resolve():
    X= int(input())
    nums = dict()
    for A in range(10**4):
        nums[A**5] = A
        nums[-A**5] = -A        

        if A**5 - X in nums:
            print(A,nums[A**5-X])
            break
    



    

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

breakflag = False

a = 0
b = 0

for i in range(1000):
    for j in range(i):

        if x == i ** 5 + j ** 5:
            a = i
            b = -j
            breakflag = True
            break

        elif x == i ** 5 - j ** 5:
            a = i
            b = j
            breakflag = True
            break

    if breakflag:
        break

output = ' '.join([str(a), str(b)])
print(output)

Submission status: Accepted

Solution code:
X = int(input())
a = 500
b = 500
for a_ in range(-a, a):
    for b_ in range(-b, b):
        if a_ ** 5 - b_ ** 5 == X:
            print(a_, b_)
            exit()
print("oops")

Submission status: Accepted

Solution code:
dat = {}

for i in range(0, 500):
	for j in range(0, 500):
		res = i ** 5 - j ** 5
		dat[res] = [i, j]
		res = i ** 5 + j ** 5
		dat[res] = [i, -j]

tmp = int(input())
if tmp in dat:
	print(dat[tmp][0], dat[tmp][1])

Submission status: Accepted

Solution code:
X = int(input())

for a in range(100):
    for b in range(-100, 0):
        if X == a**5 - b**5:
            print(str(a) + " " + str(b))
            exit()

for t in range(200):
    for b in range(200):
        ans = t * (b**4*5 + b**3*t*10 + b**2*t**2*10 + b*t**3*5 + t**4)
        if X == ans:
            a = b + t
            print(str(a) + " " + str(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)
                exit()

    print('No')


def test():
    for i in range(-10, 11):
        for j in range(-10, 11):
            print(i**5-j**5)


if __name__ == "__main__":
    main()
    # test()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
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()

Submission status: Accepted

Solution code:
X = int(input())
a_fifth = {i ** 5 : i for i in range(700)}
b_fifth = {i ** 5: i for i in range(-1000, 1001, 1)}
for bf in b_fifth:
    if X + bf in a_fifth and bf < X + bf:
        print(a_fifth[X + bf], b_fifth[bf])
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(1, int(-(-n**0.5//1))+1):
        if temp%i==0:
            arr.append([i, temp//i])
    return arr

def main():
  X = int(input())
  Y = factorization(X)
  flg = 0
  for con in Y:
    N = con[0]
    M = con[1]
    for i in range((N//2) + 1, (10**9)+1):
      A = i
      B = i - N
      K = (A**4) + ((A**3)*B) + ((A**2)*(B**2)) + (A*(B**3)) + (B**4)
      if K > M:
        break
      elif K == M:
        print('{} {}'.format(A, B))
        flg = 1
        break
    if flg == 1:
      break
main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
d=dict()
for i in range(300):
    for j in range(300):
        d[i**5-j**5]=(i,j)
        d[i**5+j**5]=(i,-j)
a,b=d[n]
print(a,b)

Submission status: Accepted

Solution code:
x=int(input())
A=[]
C=[]
for i in range(100000):
    A.append((i)**5)
    C.append((-(i))**5)
for i in range(len(A)):
    for j in range(len(A)):
        if x==A[i]-A[j]:
            print(i,j)
            #print(A[i],A[j])
            #print(A)
            exit()
        elif x==A[i]-C[j]:
            print(i,-(j))
            #print(A[i],C[j])
            #print(C)
            exit()

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
def solve(x):
    for i in range(1001):
        for j in range(-1001,1001):
            if i**5-j**5==x:
                return (i,j)
            
def main():
    x=int(input())
    Ans=solve(x)
    print(*Ans)
    
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
def binarySearch(arr, l, r, key):
    if r>=1:
        m = (l+r)//2
        if arr[m] == key:
            return m
        elif arr[m] > key:
            return binarySearch(arr, l, m, key)
        else:
            return binarySearch(arr, m+1, r, key)
    else:
        return -1

n = 1000
positive_arr = [elm**5 for elm in range(n)]
negative_arr = [-elm for elm in positive_arr]
arr = negative_arr
arr.extend(positive_arr)
# print(arr)
x = int(input())
negative_a, negative_b, printed = False, False, False
for a in arr:
    for b in arr:
        if a - b == x:
            if a<0:
                a *= -1
                negative_a = True
            if b<0:
                b *= -1
                negative_b = True
            a = int(a**(1/5))
            b = int(b**(1/5))
            if negative_a:
                a *= -1
            if negative_b:
                b *= -1
            print(a,b)
            printed = True
            break
    if printed:
        break

Submission status: Accepted

Solution code:
X = int(input())
for i in range(0, 500):
    for j in range(0, 500):
        if i*i*i*i*i-j*j*j*j*j == X:
            print(i, j)
            quit()
        if i*i*i*i*i+j*j*j*j*j == X:
            print(i, -j)
            quit()

Submission status: Accepted

Solution code:
import math


def task(x):
    table = {}
    for i in range(-1000, 1000):
        table[i] = int(math.pow(i, 5))

    for i in range(-1000, 1000):
        for j in range(-1000, 1000):
            if table[i] - table[j] == x:
                print(i, j)
                return
    print(0, 0)


x = int(input())

task(x)

Submission status: Accepted

Solution code:
def main():
  x=int(input())
  for a in range(-250,251):
    for b in range(-250,251):
        if pow(a,5)-pow(b,5)==x:
            print(a,b)
            exit()
main()