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: Wrong Answer

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

import math

def main():
     x = int(input())
     # x は 正の整数
     # ans = a^5 - b^5 = x となる a, b

     x_5div = math.floor(pow(x, 1/5)) + 1
     num_list = [pow(i, 5) for i in range(x_5div)]
     
     # print(x_5div)
     # print(num_list)
     for i in range(x_5div):
          for j in range(i, x_5div):
               i_5div = num_list[i]
               j_5div = num_list[j]

               if i_5div - j_5div == x:
                    print('{} {}'.format(i, j))
                    break
               if j_5div - i_5div == x:
                    print('{} {}'.format(j, i))
                    break
               if i_5div + j_5div == x:
                    print('{} {}'.format(i, j * (-1)))
                    break
               if j_5div + i_5div == x:
                    print('{} {}'.format(j, i * (-1)))
                    break

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math

X = int(input())


def _pow(a, x):
    if a < 0:
        return -math.pow(-a, x)
    else:
        return math.pow(a, x)


pa = 0
while True:
    pb1 = _pow(pa ** 5 - X, 1 / 5)
    pb2 = _pow((-pa)**5 - X, 1 / 5)
    if pb1.is_integer():
        print(pa, int(pb1))
        exit()
    elif pb2.is_integer():
        print(-pa, int(pb2))
        exit()
    pa += 1

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

X = int(input().rstrip())
for A in range(100):
    A_val = A**5
    val = abs(A_val - X)
    l = prime_factorize(val)
    if len(l) == 5 and len(set(l)) == 1:
        B = prime_factorize(X - A**5)
        print(A, B[0])
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
A = 0
B = 0

lim = int(x**(1/5))

for i in range(-(lim*3)-1, lim*3+2):
    b = i
    a = int(x+b**5)
    if a**5-b**5 == x:
        A = a
        B = b
        break

print(A, B)

Submission status: Wrong Answer

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(100):
	if s==0:
		for j in range(i,200):
			if j**5+-i**5==x:
				print(j,i)
				s+=1	
				break
	else:
		break

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
import math

x=int(input())
A=np.array([i**5 for i in range(0,1001)])
B=A*(-1)
c=x-A
cnt=0
for i in c:
    if i in A:
        print(cnt,(-1)*(np.where(A==i)[0][0]))
        break
    elif i in B:
        print(cnt,(-1)*(np.where(B==i)[0][0]))
        break
    cnt+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

N = math.ceil(pow(abs(X), 0.2))
M = math.floor(pow(abs(X), 0.2))

a = pow(abs(pow(N, 5) - abs(X)), 0.2)
b = pow(abs(pow(M, 5) - abs(X)), 0.2)

if a.is_integer() == True and b.is_integer() == True:
  if X < 0:
    print(int(-N))
    print(int(-a))
  else:
    print(int(N))
    print(int(a))
elif a.is_integer():
  if X < 0:
    print(int(-N))
    print(int(-a))
  else:
    print(int(N))
    print(int(a))
    
elif b.is_integer():
  if X < 0:
    print(int(-M))
    print(int(b))
  else:
    print(int(M))
    print(int(-b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


x=int(input())

if(x==1):
    print("1 0")
    exit()

ee=0
for i in range(2,int(x/2+1)):
    if(x%i==0):
        ee=i
        break
#fact=factorization(x)

#print(ee)
b=0
a=ee
flag=0
while(1):

    aaa=a**5-b**5
    if(aaa==x):
        print(a,b)
        exit()
    else:
        b+=1
        a=b+ee
        
    if(aaa>x):
        flag=1
        break
    
aaa=0
b=-1
a=ee-1
flag=0
while(1):
    
    aaa=a**5-b**5
    #print(a,b,aaa)
    if(aaa==x):
        print(a,b)
        exit()
    else:
        b-=1
        a=b+ee        
    if(aaa>x):
        flag=1
        break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N, M = map(int, input().split(' '))
X = int(input())

gojou = []
i = 0
saidai = 10**11

while 1:
    temp = i**5
    if temp > saidai:
        break
    gojou.insert(0, [i, temp])
    gojou.insert(0, [-i, -temp])
    i += 1

ls = len(gojou)
for i in range(ls):
    for j in range(i, ls):
        if gojou[i][1]-gojou[j][1] == X:
            print(gojou[i][0], gojou[j][0])

Submission status: Wrong Answer

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

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

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    for i in range(0,1000,1):
        for j in range(0,-1000,-1):
            if i == j:
                 continue
            if X % (i - j) == 0:
                if (i-j) * (pow(i,4) + pow(i,3)*j + pow(i,2)*pow(j,2) + i*pow(j,3) + pow(j,4)) == X:
                    print(i,j)
                    exit()
                else:
                    break
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

# n,m,q = map(int, input().split())
# abcd = [map(int, input().split())for _ in range(q)]

# a = list(map(int, input().split()))

_numbers = make_divisors(x)
numbers = []
for i in _numbers:
    numbers.append(i)
    numbers.append(-i)
make = []
for a in range(-100,100):
    for b in range(-100, 100):
        if a**4 + b*a**3 + (a**2)*(b**2) + a*(b**3) + b**4 in numbers:
            if a**5 - b**5 == x:
                print(a,b)
                exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
X=int(input())
flag=1
for c in range(np.power(10,9)):
    c+=1
    x=X
    if x%c==0:
        print(c)
        x=x//c
        print(x)
        for a in range(np.power(10,3)):
            if (np.power(a,4) + np.power(a,3)*(a-c) + np.power(a,2)*np.power(a-c,2) + a*np.power(a-c,3) + np.power(a-c,4))==x:
                print(a,a-c)
                flag=0
                break
    if flag==0:
        break

Submission status: Wrong Answer

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 calc(a, b):
    return (a**5 - b**5)

lst = factorization(X)

ans_A = 0
ans_B = 0
flag = True
for l in lst:
    p = l[0]
    a = p
    b = 0
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        falg = False
    while flag and calc(a, b) < X:
        a += 1
        b += 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            falg = False

    a = p-1
    b = -1
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        falg = False

    while flag and calc(a, b) < X:
        a -= 1
        b -= 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            falg = False


    a = 1
    b = 0
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        falg = False
    while flag and calc(a, b) < X:
        a += 1
        b += 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            falg = False

    a = 0
    b = -1
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        falg = False

    while flag and calc(a, b) < X:
        a -= 1
        b -= 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            falg = False


print(str(ans_A), str(ans_B))

Submission status: Wrong Answer

Solution code:
x = int(input())

xset = set([])

for i in range(1000):
    xset.add(i**5)
    xset.add(-i**5)

for xx in xset:
    if xx+x in xset:
        a5 = xx
        b5 = xx+x

if a5 < 0:
    a = -pow(-a5, 0.2)
else:
    a = pow(a5, 0.2)

if b5 < 0:
    b = -pow(-b5, 0.2)
else:
    b = pow(b5, 0.2)

print(int(a), int(b))

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

def calc(a, b):
  return a**5 - b**5
  
for i in range(-100, 101):
  for j in range(-100, 101):
    if calc(i, j) == n:
      print(i, j)
      sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

a = 2
b = 1

n = int((X ** (1 / 5)) // 1) * 100
# print(n)


for a in range(1, n + 10):
    minus = 1
    b5 = (a ** 5) - X
    if b5 < 0:
        minus = -1
        b5 *= - 1
    b = int(pow(b5, (1 / 5)))
    if (a ** 5 - b ** 5 * minus) == X:
        print(X)
        print(a, b * minus)
        # print(a, b * minus)
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(1,int(pow(x,0.5)+1)):
    if x % i == 0:
        for j in range(-x,x+1):
            if pow(j,5) + pow(i,5) == x:
                print("{} {}".format(i,j))
                exit()

Submission status: Wrong Answer

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

for i in range(100):
  a = pow(i, 5)
  for j in range(100):
    b = pow(j, 5)
    if a-b == x:
      print(i, j)
      sys.exit()
    elif a+b == x:
      print(i, -j)
      sys.exit()
    if b > x:
      break

Submission status: Wrong Answer

Solution code:
from itertools import combinations
def main():
    gojo_lst = [i**5 for i in range(-200,200)]
    gojo_dict = {}
    for i in range(-200,200):
        gojo_dict[i**5] = i
    kumiawase = combinations(gojo_lst,2)
    x = int(input())
    for a,b in kumiawase:
        #print(a,b)
        if a - b == x or b - a == x:
            print(gojo_dict[a],gojo_dict[b])
            break



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

for d in range(1, int(x**0.5)+1):
    if x % d == 0:
        for a in range(0,d+1):
            b = a - d
            if a**5 - b**5 == x:
                print(a, b)
                break

Submission status: Wrong Answer

Solution code:
X=int(input())
tmp=False

for a in range(1,3):
  b5=(int(a**5)-X)
  if b5<0:
    b5=-b5
    tmp=True
  b=int(b5**0.2)
  
  if tmp==True:
    b=-b
    
  if a**5-b**5==X:
    print(a,b)
    break

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#約数列挙
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

#main
X = int(input())
F = make_divisors(X)
#intのみのlistは、直接.join()できない
S = [int(x) for x in F]

for i in range(len(S)):
    tmp = S[i]
    for A in range(tmp-10, tmp+11):
        B = A - tmp
        if A**5 - B**5 == X:
            print(str(A) + ' ' + str(B))

            break
    else:
        continue
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

x = int(input())

c5 = []
for i in range(-100, 100, 1):
    c5.append(i**5)

a, b = 0, 0
for i in c5:
    for j in c5:
        if i - j == x:
            a, b = i, j
            break

print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math


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

    MAX = 10 ** 9

    for b in range(0, MAX + 1):
        # b = 1,2,3...
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        print(f'b={b} a={a}')
        # print(f'b={b} a={a}')
        if round(a) ** 5 == abs(b ** 5 + X):
            if b ** 5 + X > 0:
                print(int(a), b)
                return
            else:
                print(-int(a), b)
                return

        # b = -1, -2, -3
        a = math.pow(abs(- b ** 5 + X), 1 / 5)
        # print(f'b={-b} a={a}')
        if round(a) ** 5 == abs(- b ** 5 + X):
            if - b ** 5 + X > 0:
                print(int(a), -b)
                return
            else:
                print(-int(a), -b)
                return

    raise ValueError()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
X = int(raw_input())

for A in range(X+1):
    A5 = A**5.0
    t = X - A5
    if t < 0:
        t = X + A5
    B = t**(1/5.0)
    if float.is_integer(B):
        if A5 - B**5 == X:
            print int(A), int(B)
        else:
            print int(A), int(-B)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

def search(x):
    for a in range(10000):
        for b in range(10000):
            a5 = a**5
            b5 = b**5
            if (a5 - b5 == X):
                print(a, b)
                return
            elif (a5 + b5 == X): 
                print(a, -b)
                return
            elif (-a5 + b5 == X):
                print(-a, b)
                return

search(X)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
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

def main():
    x=int(input())
    x_lis=make_divisors(x)
    for xx in x_lis:#xの約数
        xx_lis=make_divisors(xx)
        for q in xx_lis:#xの約数の約数
            a=0
            b=a-q
            while a**5-b**5<=x:
                if a**5-b**5==x:
                    print(a,b)
                    sys.exit()
                a+=1
                b+=1
            a=q
            b=q-a
            while a**5-b**5<=x:
                if a**5-b**5==x:
                    print(a,b)
                    sys.exit()
                a+=1
                b-=1


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
x=int(input())
a=int(pow(x, 0.2))
b=-1*int(pow(x-a**5, 0.2))
print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
a = int(X**0.2) + 2
if X == 0:
  print(0,0)
else:
  for i in range(-a,a):
    for j in range(-a,a):
      if i==j:
        continue
      else:
        if X%(i-j) == 0:
          if X == i**5 - j**5:
            print(i,j)
            exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
l = [x**5 for x in range(-100, 100)]
for i,y in enumerate(l):
    if y+x in l:
        print(f'{l.index(y+x)-99} {i-99}')
        break

Submission status: Wrong Answer

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


def main():
    x = ii()

    if x == 1:
        print(0,-1)
        return
    xc = x
    ggg = []
    for i in range(10**9):
        for j in range(2,xc+1):
            if xc%j == 0:
                ggg.append(j)
                xc = xc//j
                break
        
        if xc == 1:
            break

    ll = len(ggg)

    for i in range(1,2**ll):
        idx = 1
        for j in range(ll):
            if (i >> j) & 1 == 1:
                idx *= ggg[j]

        for j in range(10**9):
            b = -1
            a = b+idx
            clc = a**5 - b**5
            # print(a,b,clc)
            if clc == x:
                print(a,b)
                return
            if clc > x:
                break


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
X=int(input())
for j in range(2,int(X**0.5)+1):
    if X%j==0:
        for a in range(10**5):
            b=a-j
            S=j*(a**4+b**4+(a**3)*b+(a**2)*(b**2)+a*(b**3))
            if S==X:
                print(a,b)
                exit(0)
if X==1:
    print(0,-1)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
end=0
for i in range(1,63):
    check1=math.pow( i+1, 5 )
    check2=math.pow(i-1,5)
    check3=pow(i+2,5)
    check4=pow(i,5)
    if check2<x<check1 :
        m=x-pow(i,5)
        if m<0:
            m=-m
            end=1
        b=pow(m,1/5)
        out=int(b)
        if out<b<out+1:
            end=0
        if out==b:
            break
if end:
    out=-out
print(i,end=' ')
print(out)

Submission status: Wrong Answer

Solution code:
x = int(input())

for a in range(1001001001):
    _b = a**5 - x
    if _b >= 0:
        if _b**0.2 == int(_b**0.2):
            print(a, int(_b**0.2))
            break
    elif _b < 0:
        if (-1*_b)**0.2 == int((-1*_b)**0.2):
            print(a, int((-1*_b)**0.2))
            break

Submission status: Wrong Answer

Solution code:

x = int(input())

j = -int(x**0.2)
i = int((x + j**5)**0.2)

print(i,j)

Submission status: Wrong Answer

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
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
		# print(s)
		if s ==x:
			a=p
			b=p-l
		elif s==(-x):
			b=p-l
			a=p
	if a is not None:
		break
	p += 1
print(a,b)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
import itertools

X = int(input())

ansL1 = [i for i in range(130)]
ansL2 = [i * (-1) for i in range(1, 130)]
ansL1.extend(ansL2)

L1 = [pow(i, 5)for i in range(130)]
L2 = [pow((-1)*i, 5)for i in range(1, 130)]
L1.extend(L2)

print(L1)
for v in itertools.combinations(L1, 2):
    if v[0] - v[1] == X:
        for i in range(len(L1)):
            if v[0] == L1[i]:
                ans1 = ansL1[i]
            if v[1] == L1[i]:
                ans2 = ansL1[i]
        print(ans1, ans2)
        exit()

Submission status: Wrong Answer

Solution code:
import sys, math


input = sys.stdin.readline

gets = lambda: input().rstrip()
getn = lambda: int(input())
getmul = lambda: (int(i) for i in input().split())
getlist = lambda: [int(i) for i in input().split()]

x = getn()


for b in range(0, 100000):
    b5 = b ** 5
    a5 = x + b5
    a = a5 ** (1 / 5)
    if a5 == a ** 5:
        print(int(a), b)
        exit()
    a5 = x - b5
    a = a5 ** (1 / 5)
    if a5 == a ** 5:
        print(int(a), -b)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def main():
  x = int(input())
  r = range(-100,100)
  for i in r:
    for j in r:
      if math.pow(i, 5) - math.pow(j, 5) == x:
        print(str(i) + ' ' + str(j))
        return
main()

Submission status: Wrong Answer

Solution code:
x = int(input())

ans = []
for i in range(0, x//2+1):
    a = i**5
    diff = x - a
    print(diff)

    if diff == 0:
        ans.append(i)
        ans.append(0)
        break

    elif diff < 0:
        j = 0
        while True:
            b = j**5
            if diff*(-1) < b:
                break
            if a-b == x:
                ans.append(i)
                ans.append(j)
                break
            j += 1

    elif diff > 0:
        j = 0
        while True:
            b = j**5
            if diff < b:
                break
            if a+b == x:
                ans.append(i)
                ans.append(j*(-1))
                break
            j += 1

    if len(ans) != 0:
        break

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

Submission status: Wrong Answer

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

a = 0
while a < 100:
  b = -100
  while b < 100:
    if a ** 5 - b ** 5 == x:
      print(a, b)
      sys.exit()
    b += 1
  a += 1

Submission status: Wrong Answer

Solution code:
def resolve():
    x = int(input())
    five = []
    for i in range(-100, 101):
        five.append(i**5)

    for i in range(len(five)):
        for j in range(len(five)):
            if x == five[i]-five[j]:
                print("{} {}".format(i-99, j-99))
                exit()
resolve()

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X = I()

a = [0,1]
for i in range(2,60):
  a.append(i**5)
#print(a)

for i,j in itertools.combinations(a, 2):
  #print(i,j)
  for k in [-1,1]:
    if j - i*k == X:
      print(int(j**0.2), int(i**0.2)*k)
      exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
i = 2
j = 1
while x > i ** 5:
    if x % (i ** 5) == 0:
        j *= i
        x //= i ** 5
        i = 2
    else:
        i += 1
else:
    for a in range(x):
        b = int(((a ** 5 - x).real ** 0.2).real)
        if a ** 5 - b ** 5 == x:
            print(a * j, b * j)
            break

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
yaku = []

def nibu(a, b):
  small = -10**10
  big = 10**10
  while big-small > 1:
    mid = (small+big)//2
    x = X + pow(mid,5)
    if x > b:
      big = mid
    elif x < b:
      small = mid
    else:
      print(x,mid)
      exit()

for i in range(1,int(X**0.5+1)):
  if X%i == 0:
    yaku.append([i,X//i])
    
for el in yaku:
  a = el[0]
  b = el[1]
  nibu(a,b**5)
  nibu(b,a**5)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import itertools
x = int(input())
l = [0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000, 161051, 248832, 371293, 537824, 759375, 1048576, 1419857, 1889568, 2476099, 3200000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176, 69343957, 79235168, 90224199, 102400000, 115856201, 130691232, 147008443, 164916224, 184528125, 205962976, 229345007, 254803968, 282475249, 312500000, 345025251, 380204032, 418195493, 459165024, 503284375, 550731776, 601692057, 656356768, 714924299, 777600000, 844596301, 916132832, 992436543]
for comb in itertools.combinations_with_replacement(l, 2):
    if comb[0] - comb[1] == x:
        print(l.index(comb[0]), l.index(comb[1]))
        exit()
    elif comb[0] + comb[1] == x:
        print(l.index(comb[0]), -(l.index(comb[1])))
        exit()
    elif - comb[0] + comb[1] == x:
        print(-(l.index(comb[0])), -(l.index(comb[1])))
        exit()
    elif - comb[0] - comb[1] == x:
        print(-(l.index(comb[0])), l.index(comb[1]))
        exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
for j in range(2,int(X**0.5)+1):
    if X%j==0:
        for a in range(10**4):
            b=a-j
            S=j*(a**4+b**4+(a**3)*b+(a**2)*(b**2)+a*(b**3))
            if S==X:
                print(a,b)
                exit(0)
if X==1:
    print(0,-1)

Submission status: Wrong Answer

Solution code:
X = int(input())

for a in range(-100,101) :
    powa = pow(a,5)
    for b in range(-100,101) :
        powb = pow(b,5)
        # print(a,b,powa,powb)
        if (powa - powb == X) :
            print(a,b)
            exit()

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
n = round(math.log(x,5))
if n ** 5 > x: n2 = n-1
elif n ** 5 <= x: n2 = n+1

ans = -1
for i in range(n+1):
    if abs(x-i**5) == 1:
        ans = 1
        break
    elif abs(i**5-x) == 0:
        ans = 0
        break
    else:
        a = math.log(n,5)
        if int(a)-a == 0:
            ans = round(a)
if ans == -1:
    for i in range(n2+1):
        if abs(x-i**5) == 1:
            ans = 1
            break
        elif abs(x-i**5) == 0:
            ans = 0
            break
        else:
            a = math.log(n,5)
            if int(a)-a == 0:
                ans = round(a)
print(n, ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

"""
    - A > B
    -
"""

A5 = [i ** 5 for i in range(0, 65)]
B5 = [i ** 5 for i in range(-65, 65)]

b = 0
for a5 in A5:
    b5 = a5 - X
    a = int(pow(a5, 1/5))
    if b5 in B5:
        if b5 > 0:
            print(a, int(pow(b5, 1/5)))
        else:
            print(a, int(-1 * pow(-1 * b5, 1/5)))
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N, M = map(int, input().split(' '))
X = int(input())

gojou = []
i = 0
saidai = 10**10

while 1:
    temp = i**5
    if temp > saidai:
        break
    gojou.insert(0, [i, temp])
    gojou.insert(0, [-i, -temp])
    i += 1

ls = len(gojou)
for i in range(ls):
    for j in range(i, ls):
        if gojou[i][1]-gojou[j][1] == X:
            print(gojou[i][0], gojou[j][0])

Submission status: Wrong Answer

Solution code:
A= int(input())
nu = set()
for i in range(0,100):
    nu.add(i**5)
for j in range(0,100):
    B = A-j**5
    if B in nu:
        print(j,-1 * int(pow(B,1/5)))
        exit()
    B= A+j**5
    if B in nu:
        F = min(j,int(pow(B,1/5)))
        D = max(j,int(pow(B,1/5)))
        print(D,F)
        exit()

Submission status: Wrong Answer

Solution code:
X=int(input())

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

Submission status: Wrong Answer

Solution code:
import math
from itertools import combinations

a = int(input())
base = int(math.sqrt(math.sqrt(a)))
num = list(range(base+1))
num.extend(list(range(-base,0)))
conmb = list(combinations(num,2))
for i in conmb:
  z = i[0]**5 - i[1]**5
  if z == a:
    print(str(i[0])+" "+str(i[1]))
    exit()