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:
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())
A = []
for i in factorization(X):
  for j in range(1,i[1]+1):
    a = i[0]**j
    b = X//a
    if(a<b):
      A.append([a,b])
    else:
      A.append([b,a])

A = list(map(list, set(map(tuple, A))))
flag = 0
for i in A:
  r = list(range(1,int(i[1]**(1/4))+100+1))
  for a in r:
    b = a - i[0]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[1]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break
  r = list(range(1,int(i[0]**(1/4))+100+1))
  for a in r:
    b = a - i[1]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[0]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break

Submission status: Wrong Answer

Solution code:
from sys import exit
from math import sqrt

def divisor(x):
    i = 1
    x_divisor = []
    for i in range(1, int(sqrt(x)) + 1):
        if x % i == 0:
            x_divisor.append(i)
            x_divisor.append(x // i)
    result = set(x_divisor)
    return result

x = int(input())
div = divisor(x)
for k in div:
    if x ==  k ** 5:
        print(str(0), str(-k), sep = " ")
        exit()
    else:
        for a in range(1, int(x ** (1/5)) + 1):
            if x == a ** 5 - (a - k) ** 5:
                print(str(a), str(a - k), sep = " ")
                exit()

Submission status: Wrong Answer

Solution code:
from math import ceil
x = int(input())
n = 10 ** 9
for a in range(ceil(x ** 0.2), n):
    b = (a ** 5 - x) ** 0.2
    if b == int(b):
        b = int(b)
        break
print(a, b)

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(X):
    B = i ** 5 -X
    if B < 0:
        C = (-B) ** (1/5)
        flg = 1
    else:
        C = B ** (1/5)
    if not type(C) == complex:
        if C.is_integer():
            if flg == 0:
                print(i,int(C))
                exit()
            else:
                print(i,-int(C))
                exit()

Submission status: Wrong Answer

Solution code:
#coding: utf-8
from math import ceil, floor
X = int(input())
a = 0
a2 = -a
def sign(v):
    if v < 0:
        return -1
    else:
        return 1
def counter(a):
    v = abs(a)
    for i in range(1, int(v**0.5)+2):
        if v % i == 0:
            if v == i**5:
                return True
    return False
while True:
    a2 = -a
    b = (a**5 - X)
    b2 = (a2**5 - X)
    if counter(b):
        if a**5 - b == X:
            print(a, int(abs(b)**(1/5))*sign(b))
            quit()
    if counter(b2):
        if a2 ** 5 - b2 == X:
            print(a2, int(abs(b)**(1/5))*sign(b2))
            quit()
    a += 1

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(-10**4,10**4,2):
        for j in range(10**4,-10**4,-2):
            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()
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:

X = int(input())

def gen_divisor(x):
    for i in range(1, x + 1):
        if x % i == 0:
            yield i

def gen_candidates(divisor):
    a = 0
    while True:
        a = a + 1
        b = a - divisor
        if a**5 - b**5 == X:
            yield (a, b)
        elif a**5 - b**5 > X:
            break


for divisor in gen_divisor(X):
    for a, b in gen_candidates(divisor):
        print(a,b)
        break
    else:
        continue
    break

Submission status: Wrong Answer

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


def solve(X: int):
    def func(A):
        return pow(X+A**5, 1/5)

    for A in range(-10**2, 10**2):
        for B in range(-10**2, 10**2):
            if X == A**5-B**5:
                print(A, B)
                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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

kouho = make_divisors(x)

for i in kouho:
    for j in range(i+1):
        if x % (j - (i-j))  == 0:
            if j**5-(i-j)**5 == x:
                print(j,i-j)
                break
            elif (i-j)**5-j**5 == x:
                print(i-j,j)
                break

        if x % (-j - (i+j))  == 0:
            if -j**5-(i+j)**5 == x:
                print(-j,i+j)
                break
            elif (i+j)**5+j**5 == x:
                print(i+j,-j)
                break

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
divisors=[]

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

for y in range(0,K):
	KKK=0
	A=-1
	while KKK<X:
		A=A+1
		KKK=A**5-(A-divisors[y])**5
	if KKK==X:
		print(A,A-divisors[y])
		break

Submission status: Wrong Answer

Solution code:
x=int(input())
i=0
for i in range(3):
    a=(i**5-x)
    if(a<0):
        ans=-(-a)**(1/5)
    else:
        ans=a**(1/5)
    if(int(ans)**5==a):
        print(i,int(ans))
        break
    
    a=(i**5+x)
    if(a<0):
        ans=-(-a)**(1/5)
    else:
        ans=a**(1/5)
    if(int(ans)**5==a):
        print(int(ans),i)
        break

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


x = int(input())
li = []
for i in range(-int(x**(1/5)),int(x**(1/5))+1):
    li.append(i)
for i in range(10000):
    for j in range(len(li)):
        if i-li[j]**5 == x:
            print(i,li[j])
            sys.exit()

Submission status: Wrong Answer

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

def solve(X: int):
    A = int(math.pow(X, 1.0/5.0) + 0.5)
    B5 = A ** 5 - X
    if B5 < 0:
        B = -1 * int(math.pow(-B5, 1.0/5.0))
    else:
        B = int(math.pow(B5, 1.0/5.0))
    print(A, B)
    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: Wrong Answer

Solution code:
x=int(input())
c=1

while c**5<x:
  c+=1
b=0  
for i in range(c-1,-1,-1):
  if c**5-i**5==x:
    b=i
    break
    
print(c,b)

Submission status: Wrong Answer

Solution code:
def resolve():
    x = int(input())
    five = []
    for i in range(-1000, 1001):
        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 - 999, j - 999))
                exit()
            elif x == five[j] - five[i]:
                print("{} {}".format(j - 999, i - 999))
                exit()

resolve()

Submission status: Wrong Answer

Solution code:
import bisect

D = 100

X = int(input())

L = [i**5 for i in range(-D, D)]
L2 = [i for i in range(-D, D)]

idx = bisect.bisect_left(L, X)-1

B = L[:idx]
A = L[idx:]

for a in A:
    for b in B:
        if a - b == X:
            break
    else:
        continue
    break

print(L2[L.index(a)], L2[L.index(b)])

Submission status: Wrong Answer

Solution code:
x = int(input())

x2 = int(x**0.5)
if x2**5 == x:
  print(x2, 0)
  exit()
elif x2**5-1 == x:
  print(X2, -1)
  exit()

for i in range(1, int(x*0.5)+2):
  if x%i == 0:
    tmp1 = 0
    tmp2 = 0
    a1 = i
    b1 = 0
    a2 = i-1
    b2 = -1
    while tmp1 <= x or tmp2 <= x:
      tmp1 = a1**5 - b1**5
      tmp2 = a2**5 - b2**5
      if tmp1 == x:
        print(a1, b1)
        exit()
      elif tmp2 == x:
        print(a2, b2)
        exit()
      a1+=1
      b1+=1
      a2-=1
      b2-=1

Submission status: Wrong Answer

Solution code:
x=int(input())

list=[]

for i in range(1, int(x**0.5)+1):
  if x % i == 0:
    list.append(i)
    if i != x // i:
      list.append(x//i)
          
for a in range(-(x+1),x+1):
  for l in list:
    b=a-l
    c=a**4+a**3*b+a**2*b**2+a*b**3+b**4
    if (x/c==(a-b)):
      break
    else:
      continue
  break
      
print(a,b)

Submission status: Wrong Answer

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

    for a in range(1, 101):
        b = 0
        if a ** 5 - x < 0:
            b = ((a ** 5 - x)*(-1)) ** 0.2
        else:
            b = (a ** 5 - x) ** 0.2

        if b.is_integer():
            print(a, int(b))
            exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x=int(input())
a=0
b=0
i=0
flag=1
while(flag!=0):
    a=i**5
    b=a-x
    if a-x>=0:
        if (b**(1/5)).is_integer():
            a=i
            b=int(b**(1/5))
            flag=0
    else:
        b=b*(-1)
        if (b**(1/5)).is_integer():
            a=i
            b=int(b**(1/5))*(-1)
            flag=0    
    i=i+1
print(a,b)

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())
if X == 1:
    A = 0
    B =-1
else:
    for i in range(2, X):
        if X % i == 0:
            t = i
            h = X // i
            break
    N = np.roots([5, -10 * t, 10 * t ** 2, -5 * t ** 3, t ** 4 - h])
    A = int(N[3])
    B = A - t

print(A,B)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import math
X = int(input())
 
a = X**(1/5)
 
a = math.floor(a)
 
  
b = (a**5 - X)**(1/5)
    
print(a,math.floor(abs(b)))

Submission status: Wrong Answer

Solution code:
X=int(input())
A=100000
small=2
if X!=1:
    while True:
        if X%small==0:
            break
        small+=1
    for i in range(200000):
        B=A-small
        if (A**4+A**3*B+A**2*B**2+A*B**3+B**4 == X/(A-B)):
            break
        A-=1
    print(str(A)+" "+str(B))
elif X==1:
    print("0 -1")

Submission status: Wrong Answer

Solution code:
import numpy as np

x=int(input())

tmp_list=[]
c=0
tmp_2=0
while(1):
    tmp_1=c**5
    if (tmp_1 - tmp_2)<x:
        tmp_list+=[tmp_1]
    else:
        break
    tmp_2=tmp_1
    c+=1

tmp_list = np.array(tmp_list)

# 生側
ans=0
target = tmp_list
for i in np.flipud(target):
    for j in target:
        if x==i+j:
            print(int(i**(1/5)),int(j**(1/5)*(-1)))
            ans=1
            break
        if ans==1:
            break
if ans==0:
    # ふがわ
    for i in np.flipud(target):
        for j in target:
            if x==i-j:
                print(int(i**(1/5)),int(j**(1/5)))
                ans=1
                break
        if ans==1:
            break

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import itertools
x = int(input())
a = 0
b = 0
num_list = [i**5 for i in range(40, -39, -1)]
combi = list(itertools.combinations(num_list, 2))


for item in combi:
    # print(item)
    if item[0] - item[1] == x:
        #print(item[0], item[1])
        a = int(item[0] ** (1 / 5))
        b = int((-item[1]) ** (1 / 5))
        break


print(a, -b)

Submission status: Wrong Answer

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

def trial_division(n):
    #素因数を格納するリスト
    count = 0
    tmp = n
    #2から5√n以下の数字で割っていく
    for _ in range(5):
    	tmp = int(math.sqrt(tmp)) + 1
       
    if n == 0:
      return True,0
    if n == 1:
      return True,1
    
    for num in range(2,tmp):
      if n%num == 0:
        while n % num == 0:
            n //= num
            count += 1
        if n == 1 and count == 5:
          return True,num
       	else:
          break
            
    return False,0

for i in range(0,int(1E5)):
  a = i**5
  y = abs(a-x)
  flg,num = trial_division(y)
  if flg:
    if a-x>=0:
      print(str(a)+' '+str(num))
    else:
      print(str(a)+' '+str(-1*num))
    break

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(-10**4,10**4,2):
        for j in range(-10**4,-10**4,-2):
            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()
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
five = [0] * 70
five_inv = [0] * 70
for i in range(70):
  five[i] = i ** 5
  five_inv[i] = -five[i]

def check(x):
  A = 0
  B = 0
  for i in range(70):
    if X + five[i] in five:
      B = i
      A = five.index(five[i] + X)
      break
    elif X - five[i] in five:
      B = -i
      A = five.index(-five[i] + X)
      break
    elif X - five[i] in five_inv:
      B = -i
      A = -five_inv.index(-five[i] + X)
      break
  return "{} {}".format(A,B)

print(check(X))

Submission status: Wrong Answer

Solution code:
a_list = [0,1]
b_list = [-1]
X = int(input())
i = 1
b=i
while (True):
    a = b
    b = (i + 1) ** 5
    if b - a > X:
        break
    else:
        i += 1
        a_list.append(b)
        b_list.append(-b)
b_list.reverse()
b_list.extend(a_list)
K=len(b_list)

flag=False
for i in range(K-1) :
    for j in range(i+1,K) :
        if b_list[j]-b_list[i]==X :
            print(str(b_list[j])+' '+str(b_list[i]))
            flag=True
            break
    if flag :
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(X):
  a_5 = a**5
  b = (a_5-X)*0.2
  if b%1 == 0:
    print(str(a)+" "+str(int(b)))
    break

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


x = int(input())
li = []
for i in range(-int(x**(1/5)),int(x**(1/5))+1):
    li.append(i)
for i in range(10000000):
    for j in range(len(li)):
        if i-li[j]**5 == x:
            print(i,li[j])
            sys.exit()

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,x+1):
            b = a - d
            if a**5 - b**5 == x:
                print(a, b)
                exit()
            elif a**5 - b**5 > x:
                break

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
# ABC166 D

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
X=int(input())

N=int(X**(0.2))+1
for i in range(N):
  for j in range(N):
    if i**5-j**5==X:
      print(i,j)
      break
    elif -i**5-j**5==X:
      print(-i,j)   
      break 
    elif i**5+j**5==X:
      print(i,-j)
      break
    elif -i**5+j**5==X:
      print(-i,j)
      break 
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
import itertools
X=int(input())
#li=[i**5 for i in range(int(X**0.2+1))]
#li=[i**5 for i in range(64)]#
li=[i**5 for i in range(100)]#
#li2=[-1*(i**5) for i in range(64)]#
#li.extend(li2)
for v in itertools.permutations(li, 2):
    v=list(v)
    v.sort()
    if v[0]-v[1]==X:#両方プラスの時
        A=v[0]**0.2
        B=v[1]**0.2
        print(str(int(A))+" "+str(int(B)))
        break
    elif v[0]+v[1]==X:#v[1]がマイナスの時
        A=v[0]**0.2
        B=-1*((v[1])**0.2)
        print(str(int(A))+" "+str(int(B)))
        break
#ans=(i-j)*(i**4+(i**3)*j+(i**2)*(j**2)+i*(j**3)+j**4)
#(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋小さい

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(int(x**(2/5)+1)*10):
    for j in range(-int((x)**(1/5))-1,int((x)**(1/5))+1):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
x = int(input())

flag = False

for i in range(int(pow(x, 1/5))+1):
    a = x - i**5
    for j in range(int(pow(a, 1/5))+1):
        if j**5 == a:
            flag = True
            break
    if flag:
        print(j, -i)
        break

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(-10**4,10**4,2):
        for j in range(-1,-10**4,-2):
            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()
if __name__ == '__main__':
  main()

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)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

for number in factorization(x):
  for a in range(round(x/number)):
    b = a - number
    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 math
X=int(input()) 
a = math.sqrt(X)
for i in range(0,4):
    a = math.sqrt(a)
a = math.ceil(a)
b = X - a ** 5
for i in range(0,5):
    b = math.sqrt(b)
b = math.ceil(b)

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

Submission status: Wrong Answer

Solution code:
x = int(input())
i = 0
while i**5 < x and (i + 1)**5 < x:
    i += 1
tmp1 = i ** 5
rest1 = x - tmp1
j = 0
flag = 0
start, end = 0, rest1
while start <= end:
    middle = (start + end)//2
    if tmp1 + middle ** 5 > x:
        end = middle - 1
    elif tmp1 + middle ** 5 == x:
        flag = 1
        print(i, -middle)
        break
    else:
        start = middle + 1
if not flag:
    tmp2 = (i+1) ** 5
    rest1 = tmp2 - x
    start, end = 0, rest1
    while start <= end:
        middle = (start + end) // 2
        if tmp2 - middle ** 5 > x:
            start = middle + 1
        elif tmp2 - middle ** 5 == x:
            flag = 1
            print(i, middle)
            break
        else:
            end = middle - 1

Submission status: Wrong Answer

Solution code:
x = int(input())
count = 0
for i in range(-100,100, 1):
    for j in range(-100,100, 1):
        if i^5-j^5 == x:
            print(i,j)
            count=1
            break
    if count == 1:
        break

Submission status: Wrong Answer

Solution code:
import sys

X = int(input())
a = X ** (1 / 5)
if a.is_integer():
    print(int(a), 0)
    sys.exit()

a = (X + 1) ** (1 / 5)
if a.is_integer():
    print(int(a), 1)
    sys.exit()

a = (X - 1) ** (1 / 5)
if a.is_integer():
    print(int(a), -1)
    sys.exit()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import math
X = int(input())

a = X**(1/5)

a = math.floor(a)

if a > 0:
        
    
    b = (a**5 - X)**(1/5)
    print(-a,round(abs(b)))
    
if a < 0:
        
    
    b = (-1)**(2/5)*(-X + a**5)**(1/5)
    print(a,-round(abs(b)))

Submission status: Wrong Answer

Solution code:
import collections
import sys
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")
elif X == 2:
    print("1 1")
else:
    for i in range(sys.maxsize):#i = B
        c = factorization(X+pow(i,5))
        flag = 0
        for j in range(len(c)):
            if c[j][1] % 5 != 0:
                flag = 1
                break
        if flag ==0:
            B = i
            A = 1
            for j in range(len(c)):
                A *= c[j][0]
            break
        if X -pow(i,5)> 1:
            c = factorization(X-pow(i,5))
            flag = 0
            for j in range(len(c)):
                if c[j][1] % 5 != 0:
                    flag = 1
                    break
            if flag ==0:
                B = i * -1
                A = 1
                for j in range(len(c)):
                    A *= c[j][0]
                break
    print(A,B)

Submission status: Wrong Answer

Solution code:
X = int(input())
print(int((X-1)**(1/5)), -1)

Submission status: Wrong Answer

Solution code:
import collections


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())
targets = prime_factorize(x)
# targets.append(1)
# targets.append(x)
targets = sorted(list(set(targets)))
if len(targets) == 0:
    targets.append(1)

# print(targets)

# for target in targets


def test():
    for i in range(targets[0] + 1):
        for j in range(-targets[0], targets[0] + 1):
            # print(targets[0], i, j, i - j, i ** 5 - j ** 5)
            if i ** 5 - j ** 5 == x:
                # if i - j == targets[0] and i ** 5 - j ** 5 == x:
                print(str(i) + ' ' + str(j))
                return


test()

# a - b = 1 3 11 33

Submission status: Wrong Answer

Solution code:
x = int(input())
n = 10*5

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while r-l>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            l = mid+1
        else:
            r = mid-1
    return 0

def bln(dp,num):
    l = 0
    r = len(dp)-1
    while l-r>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            r = mid+1
        else:
            l = mid-1
    return 0
            
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]

for b in range(-n,n):
    num = x + b**5
    a = max(blp(ap,num),bln(an,num))
    if a:print(a,b) ; break

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())
A = []
for i in factorization(X):
  for j in range(1,i[1]+1):
    a = i[0]**j
    b = X//a
    if(a<b):
      A.append([a,b])
    else:
      A.append([b,a])

A = list(map(list, set(map(tuple, A))))
flag = 0
for i in A:
  r = list(range(1,int(i[1]**(1/4))+100+1))
  for a in r:
    b = a - i[0]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[1]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
a = 0
for i in range(-10**2,10**2):
    for j in range(-10**2,10**2):
        if (i-j) != 0:
            if i**5 - j**5 == X:
                print("{} {}".format(i, j))
                exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
a = 0
Flag = True
while True:
    b = a ** 5 - X ** (1 / 5)
    if ｂ.is_integer() :
        print(a, int(b))
        break
    a += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

#x^5-y^5=(x-y)(x^4+x^3y+x^2y^2+xy^3+y^4)

#for x in range(1, 121):
#  if ((x**5) - ((x-1)**5)) >= 1000000000:
#    print(x)

for a in range(1, 121):
  for b in range(-100, 120):
    if b**5 == a**5-X:
      print(a, b)
      break

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

for i in range(1000000000):
    if i**5 == X:
        print(i, 0)
        sys.exit()

    elif i**5>X:
        overX = i**5
        answerover = i
        if ((overX-X)**(1/5))%1 == 0:
            print(answerover, int((overX-X)**(1/5)))
            sys.exit()
    else:
        underX = i**5
        if underX < X:
            answerunder = i
            if ((X-underX)**(1/5))%1 == 0:
                print(answerunder, int((X-underX)**(1/5)*(-1)))
                sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
flag = True
for a in range(-100, 100):
    for b in range(-100, 100):
        if a ** 5 - b ** 5 == x:
            print(' '.join([str(a), str(b)]))
            flag = False
            break
    if not flag:
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(int(X**0.5)):
    if i**5 == X+1:
        print(i,1)
        exit()
    elif i**5 == X -1:
        print(i,-1)
        exit()

Submission status: Wrong Answer

Solution code:
import itertools

x = int(input())

y = itertools.combinations(range(-100,100), 2)
for n in y:
    if (n[0]**5 - n[1]**5) == x:
        print(n[0], n[1])
        break
    elif (n[1]**5 - n[0]**5) == x:
        print(n[1], n[0])
        break

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
end=0
for i in range(1,63):
    check1=int(math.pow( i+1, 5 )*100000)/100000
    check2=int(math.pow(i-1,5)*100000)/100000
    if check2<x<check1:
        m=x
        m=m-pow(i,5)
        if m<0:
            m=-m
            end=1
        b=int(math.pow(m,1/5)*100000)/100000
        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())
start = int(pow(x,0.2))
for i in range(-(start+1),start+1):
    k = pow(x + pow(i,5),0.2)
    if type(k) != type(1+1j) and k == int(k) and pow(int(k),5) - pow(i,5) == x:
        print(int(k),i)
        exit()

Submission status: Wrong Answer

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

xx = int(x ** (1/2))
for i in range(-xx, xx + 1):
    a5 = i ** 5
    b5 = a5 - x
    if b5 > 0:
        if b5 == int(b5 ** (1/5)):
            print(i, b5)
            break

    else:
        if (-1*b5) == int((-1*b5) ** (1/5)):
            print(i, b5)
            break

Submission status: Wrong Answer

Solution code:
import numpy as np
x=int(input())
#ａ⁵－ｂ⁵＝(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋ｂ⁴)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
d=make_divisors(x)
for i in range(len(d)):
  d.append(-d[i])
flag=False

for i in d:
  if flag==True:
    break
  tui=x//i
  ans=np.roots([5,10*i,10*i**2,5*i**3,i**4-tui])
  for j in ans:
    if flag==True:
      break
    a=j+i
    if a**5-j**5==x+0j:
      print(int(a.real),int(j.real))
      flag=True
      break