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 five(x):
  if x >= 0:
    return x**(1/5)
  elif x < 0:
    return -(abs(x)**(1/5))

x = int(input())

a = 0
b = 0

for i in range(0, x):
  s = i ** 5
  t = s - x
  t_five = five(t)
  if t_five.is_integer():
    b = t_five
    break

a = i

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

Submission status: Wrong Answer

Solution code:
s = int(input())
j= -1
for i in range(-s, s):
    if i**5-j**5 == s:
        if i == abs(j)+1 or j == abs(i)+1:
            print(i, j)
            j += 1
            break

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)
if a - math.floor(a) < 1e-5:
  a = float(math.floor(a))

b = pow(abs(pow(M, 5) - abs(X)), 0.2)
if b - math.floor(b) < 1e-5:
  b = float(math.floor(b))
    
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(sys.stdin.readline())

temp = [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, 1073741824,1160290625,
1252332576,1350125107,1453933568,1564031349,
1680700000,1804229351,1934917632,2073071593,
2219006624,2373046875,2535525376,2706784157,
2887174368,3077056399,3276800000,3486784401,
3707398432,3939040643,4182119424,4437053125,
4704270176,4984209207,5277319168,5584059449,
5904900000,6240321451,6590815232,6956883693,
7339040224,7737809375,8153726976,8587340257,
9039207968,9509900499,10000000000,10510100501,
11040808032,
11592740743,
12166529024,
12762815625,
13382255776,
14025517307,
14693280768,
15386239549,
16105100000,
16850581551,
17623416832,
18424351793,
19254145824,
20113571875,
21003416576,
21924480357,
22877577568,
23863536599,
24883200000]

for i, x in enumerate(temp):
    if x >= X:
        for j, y in enumerate(temp):
            if x - y == X:
                print(i, j)
                exit()
        temp_x = temp[i-1]
        for j, y in enumerate(temp):
            if temp_x + y == X:
                print(i-1, -j)
                exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(70):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy
import math

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

X = int(input())
lis = make_divisors(X)

for i in range(len(lis)):
    Y = lis[i]
    Z = X // Y
    tmp = numpy.roots([5, 10*Y, 10*pow(Y, 2), 5*pow(Y, 3), pow(Y, 4)-Z])
    ans = []
    for j in range(len(tmp)):
        if math.isclose(tmp[j].imag, 0):
            ans.append(int(tmp[j].real))
    if len(ans) == 2:
        tmp = ans[0]**5 - ans[1]**5
        if tmp != X:
            ans[0], ans[1] = ans[1], ans[0]
            tmp = ans[0]**5 - ans[1]**5
            if tmp == X:
                break
        else:
            break

print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
x = int(input())
tmp_a = 0
while tmp_a ** 5 < x:
    tmp_a += 1

tmp_a_big = tmp_a
tmp_a_lit = tmp_a - 1

if tmp_a_lit ** 5 - x == 0:
    ans_a = tmp_a_lit
    ans_b = 0
elif tmp_a_lit ** 5 < x:
    tmp_b = 0
    while tmp_b ** 5 <= abs(x - tmp_a_lit ** 5):
        tmp_b += 1
    if (tmp_b - 1) ** 5 == abs(x - tmp_a_lit ** 5):
        ans_a = tmp_a_lit
        ans_b = -1 * (tmp_b - 1)
    else:
        tmp_b = 0
        while tmp_b ** 5 <= abs(x - tmp_a_big ** 5):
            tmp_b += 1
        ans_a = tmp_a_big
        ans_b = -1 * (tmp_b - 1)

print(ans_a, ans_b)

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):
  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
    elif X - five[i] in five_inv:
      B = -i
      A = -five_inv.index(-five[i] + X)
      break
  return "{} {}".format(A,B)

print(five)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple

MAX_X = pow(10, 9)


def solve(nb: int) -> Optional[Tuple[int, int]]:
    all_sq5 = set(pow(x, 5) for x in range(int(pow(MAX_X, 1 / 5)) + 1))
    for a in range(nb + 1):
        a5 = pow(a, 5)
        if nb - a5 in all_sq5:
            return a, int(pow(nb - a5, 1 / 5))
        if nb + a5 in all_sq5:
            return -a, int(pow(nb + a5, 1 / 5))
    return None


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    X = int(input())
    # values = []
    # for _ in range(N):
    #     values.append(input().split())
    result = solve(X)
    print(*result)


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result))


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            # uncachable -- for instance, passing a list as an argument.
            # Better to not cache than to blow up entirely.
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)

Submission status: Wrong Answer

Solution code:
import itertools


max_num = 2000
num_list = [i for i in range(-max_num,  max_num+1)]
num_list_5 = [i ** 5 for i in num_list]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = num_list_5[a]
    b5 = num_list_5[b]
    if a5 - b5 == x:
        print(num_list[a], num_list[b])
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

buf= pow(x,0.2)
a = int(buf)

while True:
    f = 0
    a5 = pow(a,5)
    b5 = a5 - x
    if b5 < 0:
        b5 = b5 * (-1)
        f = 1
    b = pow(b5,0.2)
    if f == 1:
        b = b * (-1)
    if b.is_integer:
        break
    a+=1
    
print(a,int(b))

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

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())
if X == 1:
  print(1,0)
  sys.exit()

tmp = prime_factorize(X)
Xp = tmp[0]
Xpp = X/Xp

a_1 = 5
a_2 = - 10*Xp
a_3 =  10*Xp*Xp
a_4 = - 5*Xp*Xp*Xp
a_5 =  Xp*Xp*Xp*Xp - Xpp

ANS = np.roots([a_1, a_2, a_3, a_4, a_5])

for ans in ANS:
  if ans.imag == 0:
    A = int(ans.real)
    B = A - Xp
    print(A,B)
    sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
i=0
s=2
ans1 =0
ans2 =0
while (i**5<=10**9):
    t.append(i**5)
    i+=1
for j in t:
    if(N + j) in t:
        ans1 = j
        ans2 = N + j
        s = 0
        break
    elif(N-j) in t:
        ans1 = -j
        ans2 = N - j
        s = 1
        break
if(s==0):
    ans3 = t.index(j) 
    ans4 = t.index(ans2)
else:
    ans3 = (t.index(j))*(-1)
    ans4 = t.index(ans2)
print(ans4,ans3)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

x = int(input())
a = [i**5 for i in range(-100, 100)]
b = a.copy()
for i in a:
    for j in b:
        if i-j==x:
            print(i, j)
            sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(10**6):
    b = ((a**5)-x)**(1/5)
    if type(b) != complex:
        if b.is_integer() == True:
            print(str(a)+" "+str(int(b)))
            break

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    """Calculate prime factorization and return unique numbers and 1.
    """
    ans = set()
    ans_add = ans.add
    ans_add(1)
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    x = int(input())
    # 素因数分解してユニークな因数を取る。
    insu = prime_factorize(x)
    # a^5 - b^5 も a - b も，ある因数の倍数となる。

    # a は足す一方なので，
    b_min = -int(x ** (1 / 5))
    for n in insu:
        a = b = b_min
        while 1:
            a += n
            cand = a ** 5 - b ** 5
            if cand == x:
                return f'{a} {b}'
            elif cand > x:
                break


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

Submission status: Wrong Answer

Solution code:
import sys
L = []
for i in range(-100,100):
    a = i**5
    L.append(a)
X = int(input())
for i in range(-100,100):
    for j in range(-100,100):
        if i**5-j**5 == X:
            print("{0} {1}".format(i,j))
            sys.exit(0)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
max = 40

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

Submission status: Wrong Answer

Solution code:
X = int(input())

A = 0
B = 0
for a in range(10**2):
    for b in range(-10**2, 10**2):
        if X == a ** 5 - b ** 5:
            A = a
            B = b
            break
print(A, B)

Submission status: Wrong Answer

Solution code:
x = int(input())


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append((i, cnt))
    if tmp != 1:
        retval.append((tmp, 1))
    if not retval:
        retval.append((n, 1))
    return retval


fact = factorization(x)
a = fact[0][0]
a -= 1
b = -1

print(a, b)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

a = 1
while a < math.pow(X, 1.0/5.0):
    a *= 10

while a > 0:
    b = a - 1
    while a**5 - b**5 <= X:
        if a**5 - b**5 == X:
            print(a, b)
            exit()
        b -= 1
    a -= 1

Submission status: Wrong Answer

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
X = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
A = 0
#cnt = 0
while True:
    #cnt +=1 
    #print(cnt)
    b = ((X-A**5))
    #print(b)
    if b ==0:
        print(A,int(b))
        break
    elif b > 0:
        B = b**(1/5)
        if B-int(B) == 0:
            print(A,int(-B))
            break
        else:
            A +=1
            
    else:
        B = (-1*b)**(1/5)
        if B -int(B) == 0:
            print(A,int(B))
            break
        else:
            A +=1


#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
#print(cnt)

Submission status: Wrong Answer

Solution code:
try:
  x=int(input())
  for a in range(33):
      for b in range(-1,-33,-1):
          if (a**5-b**5)==x:
              m,n=a,b
              break
  print(m,n)
except:
  pass

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    x=int(readline())
    to=1001
    memo=[0]*to
    #memo={}
    for i in range(to):
        memo[i]=i**5

    a=0
    b=0
    if x==0:
        print(a,b)
        return

    for i in range(to):
        z1=x-memo[i]
        z2=memo[i]-x
        if z1 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j*-1
            print(a,b)
        if z2 in memo:
            a=i
            for j in range(to):
                if memo[j]==z2:
                    b=j
            print(a,b)
    #if a!=0 or b!=0:
    #    print(a,b)
    #    return
    print(a,b)
    return
    
    b=1000**5
    for i in range(1001,100000000):
        a=b
        b=i**5
        if (b-a)==x:
            print(i,(i-1))
            return

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Wrong Answer

Solution code:
X=int(input())
import numpy as np
t=int(X**(1/5))+10
i=0
while  i < t:
    if i**5>= X:
        s=((i**5)-X)**(1/5)
        if s==int(s):
            print(i,int(s))
            break
    if X>=i**5:
        u=(X-(i**5))**(1/5)
        if u==int(u):
            print(i,-int(u))
            break
    i+=1

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
start, end = 0, rest1
while start <= end:
    middle = (start + end)//2
    if tmp1 + middle ** 5 > x:
        end = middle - 1
    elif tmp1 + middle ** 5 == x:
        print(i, -middle)
        break
    else:
        start = middle + 1

Submission status: Wrong Answer

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

for a in range(1, 1500):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1, 1350):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)

        if an == X:
            print(a, b)
            exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
t=int(x**0.2)
for i in [t-3,t-2,t-1,t,t+1,t+2,t+3]:
  if  i**5+1==x:
    print(i,-1,sep=' ')
  elif i**5-1==x:
    print(i,1,sep=' ')

Submission status: Wrong Answer

Solution code:
x = int(input())
a = [i**5 for i in range(1500)]
for i in range(1500):
  for j in range(1500):
    if a[i] - a[j] == x:
      print(a[i],a[j])
      break

Submission status: Wrong Answer

Solution code:
#coding:utf-8

x = int(input())
P = 40000
p = []
b = 0
flag = 0

for i in range(1,P+1):
    if x % i == 0:
        p.append(i)

for i in p:
    a = 0
    while a <= i:
        b = a - i
        y = (a ** 5) - (b ** 5)
        if y == x:
            print("{} {}".format(a,b))
            flag = 1
            break
        a += 1
    if flag == 1:
        break

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

def calc(a,b):
    return a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4

x = int(input())
div = make_divisors(x)
ls = max(len(div)//2,1)
for i in range(ls):
    for j in range(x):
        if div[i]*calc(j+div[i],j) == x:
            print(j+div[i],j)
            break

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
count = -1
while(1):
    i = count**5
    dum = (x+i)**(1/5)
    #print(dum)
    if type(dum) != complex:
        dum = dum % 1
        if dum % 1 == 0:
            #print(dum)
            print(math.ceil(dum), count)
            break
    count += 1

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)
if a - math.floor(a) < 1e-6:
  a = float(math.floor(a))

b = pow(abs(pow(M, 5) - abs(X)), 0.2)
if b - math.floor(b) < 1e-10:
  b = float(math.floor(b))
    
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:
x = int(input())

for a in range(-70, 70):
    for b in range(-70, 70):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            break
    if a ** 5 - b ** 5 == x:
        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 = a ** 5 - X
print(str(a) + " " + str(b))

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

x = int(input())
a = [i**5 for i in range(-100, 100)]
b = a.copy()
for i in a:
    for j in b:
        if j-i==x:
            print(i, j)
            sys.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)

    # divisors.sort()
    return divisors
  
divisors = make_divisors(x)

for d in divisors:
  ab = -d // 2
  minf = True
  maxf = True
  f = False
  while True:
    if maxf:
      b = ab
      if (b+d)**5 - b**5 == x:
        f = True
        break
      elif (b+d)**5 - b**5 > x:
        maxf = False
    if minf:
      b = -ab
      if (b+d)**5 - b**5 == x:
        f = True
        break
      elif (b+d)**5 - b**5 < x:
        minf = False
    ab += 1
    if not (maxf and minf):
      break
  if f:
    print(b+d, b)
    break

Submission status: Wrong Answer

Solution code:
import sys

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

def trial_division(n):
    prime_factors = list()
    while n % 2 == 0:
        prime_factors.append(2)
        n //= 2
    p = 3
    while p * p <= n:
        if n % p == 0:
            prime_factors.append(p)
            n //= p
        else:
            p += 2
    if n != 1:
        prime_factors.append(n)
    return prime_factors

def keisan(A,B):
    return A**4 + A**3 * B + A**2 * B**2 + A * B ** 3 + B**4

def main():
    X = int(input())
    if X == 1:
        print(1,0)
        exit()
    soinsu = trial_division(X)
    soinsu = list(set(soinsu))
    A = 1
    for s in soinsu:
        B = A - s
        if A**5 - B**5 == X:
            print(A,B)
            exit()


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
X = int(input())
for B in range(X + 1):
    p_A = (B ** 5 + X) ** (1 / 5)
    n_A = ((-1 * B) ** 5 + X) ** (1 / 5)
    if isinstance(p_A, complex):
        pass
    elif isinstance(n_A, complex):
        pass
    else:
        if int(p_A) ** 5 - B ** 5 == X:
            print(int(p_A), B)
        if int(n_A) ** 5 - (-1 * B) ** 5 == X:
            print(int(n_A), -1 * B)

Submission status: Wrong Answer

Solution code:
import sys,bisect,string,math,time,functools,random
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            a,b,c=(inp+[1])[:3]
            org_inp.append(inp)
        else:
            index=0
            a,b,c=(ls[i]+[1])[:3]
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

class Tree:
    def __init__(self,inp_size=None,init=True):
        if init:
            self.stdin(inp_size)
        return

    def stdin(self,inp_size=None):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1)
        return
    
    def listin(self,ls):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls)
        return

    def __str__(self):
        return  str(self.edges)

    def dfs(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append(x)
        v=[-1]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==-1:
                    q.append(nb)
                    v[nb]=func(v[c],nb,d)
        return v

    def EulerTour(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append((-1,x))
        v=[None]*self.size
        v[x]=root_v
        et=[]
        while q:
            cb,ce=q.pop()
            et.append(ce)
            for nb,d in self.edges[ce]:
                if v[nb]==None:
                    q.append((nb,ce))
                    q.append((ce,nb))
                    v[nb]=func(v[ce],nb,d)
        vid=[[-1,-1]for i in range(self.size)]
        for i,j in enumerate(et):
            if vid[j][0]==-1:
                vid[j][0]=i
            else:
                vid[j][1]=i
        return v,et,vid
    
    def LCA_init(self,depth,et):
        self.st=SegTree(self.size*2-1,func=min,ide=inf)
        for i,j in enumerate(et):
            self.st.update(i,j)
        self.LCA_init_stat==True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            depth,et,vid=self.EulerTour(root)
            self.LCA_init(depth,et)
        return self.st.query(x,y+1)

## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

show_flg=False
show_flg=True

def func(y):
    global x
    #show('d',y)
    l,r=-2,10**9+1
    while r-l>1:
        mid=(l+r)//2
        #show((l,r),(mid+y,mid),(mid+y)**5-mid**5)
        if (mid+y)**5-mid**5==x:
            return mid+y,mid
        if (mid+y)**5-mid**5<x:
            l=mid
        else:
            r=mid
        
    return -1


x=I()
for i in range(1,int(x**0.5)+1):
    if x%i==0:
        k=func(i)
        if k==-1:
            0
        else:
            print(*k)
            exit()

        k=func(x//i)
        if k==-1:
            0#continue
        else:
            print(*k)
            exit()

Submission status: Wrong Answer

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

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

    for a in range(-100, 100):
        for b in range(-100, 100):
            if (a ** 5 - b ** 5) == X:
                print("{} {}".format(a, b))
                exit()

    logging.info("error")
        
            
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

lower = -1
upper = -1
for i in range(10000):
    pow5 = pow(i, 5)
    if lower == -1 and pow5 >= x:
        lower = i - 1

    if upper == -1 and pow5 - pow(i-1, 5) >= x:
        upper = i
        break

for a in range(lower, upper+1):
    a5 = pow(a, 5)
    for b in range(-a-1, a+1):
        if a5 - pow(b, 5) == x:
            print(a, b)
            exit(0)

# 0, 0
print(0, 0)

Submission status: Wrong Answer

Solution code:
x = int(input())

a = 0

while True:
    b5 = a**5 - x
    print(b5)
    
    if b5 >= 0:
        for b in range(b5+1):
            if b**5 == b5:
                print(a, b)
                exit()
            if b**5 > b5:
                break
    else:
        b5m = -b5
        for bm in range(b5m+1):
            if bm**5 == b5m:
                print(a, -bm)
                exit()
            if bm**5 > b5m:
                break
    
    a += 1

Submission status: Wrong Answer

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