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:
import sys
X=int(input())
X2=int(X**0.5)
X5=int(X**0.2)

for i in range(1, X2+1):
    if X%i==0:
        for j in range(-i,X5):
            Xt=(j+i)**5-j**5
            if Xt>X and j>0:
                break
            if Xt==X:
                print(j+i,j)
                sys.exit()

Submission status: Wrong Answer

Solution code:
import math
import sys

x = int(input())

for i in range(1, int((10**9)/2)+1):
    if x-i**5 < 0.0:
        flag = 1
        b = math.pow(-(x - i ** 5), 1.0 / 5.0)
    else:
        b = math.pow((x-i**5), 1.0/5.0)
        flag = 0
    if b.is_integer():
        if flag == 1:
            print(i, int(b))
        else:
            print(i, -int(b))
        sys.exit()

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)
    q_lis=set()
    for xx in x_lis:#xの約数
        xx_lis=make_divisors(xx)
        for q in xx_lis:#xの約数の約数
            q_lis|={q}
    q_lis=list(q_lis)
    q_lis.sort()
    for q in q_lis:
        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=0
        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:
# -*- coding: utf-8 -*-
import itertools
import numpy as np
x = int(input())
# hani = int(pow(x, 1/5))
# for a in range(-hani-1, hani+1):
#     for b in range(-hani-1, hani+1):
#         if (pow(a, 5) - pow(b, 5) == x):
#             print(a, b)
#             exit()
max_x = pow(10, 10)
v = 0
v_lis = [0]
i = 1
while max_x > v:
    v = pow(i, 5)
    v_lis.append(v)
    v_lis.append(-v)
    i += 1

for a5, b5 in itertools.combinations_with_replacement(v_lis, 2):
    if (a5 - b5 == x):
        if (a5 < 0):
            a = int(pow(a5*-1, 1 / 5)) * -1
        else:
            a = int(pow(a5, 1 / 5))
        if (b5 < 0):
            b = int(pow(b5*-1, 1/5))*-1
        else:
            b = int(pow(b5, 1/5))
        print(a, b)
        exit()


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


# arr = factorization(x)
# fact = []
# for prime, idx in arr:
#     fact.extend([prime]*idx)

# print(fact)

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

d = make_divisors(X) 

ans =[0,0]

for i in d:

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

Submission status: Wrong Answer

Solution code:
X = int(input())
As = [0]*121
for i in range(1,121):
  As[i] = i**5

flag = 0
for i in range(1,121):
  a = As[i]
  for j in range(i+1):
    b = As[j]
    if a + b == X:
      print(i,j)
      flag = 1
      break
    elif a - b == X:
      print(i, -j)
      flag = 1
      break
  if flag == 1:
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(0, 100):
    ap = a
    am = -a
    for b in range(0, 100):
        bp = b
        bm = -b
        if X == ap**5 - bp**5:
            print(ap, bp)
            exit()
        elif X == ap**5 - bm**5:
            print(ap, bm)
            exit()
        elif X == am**5 - bp**5:
            print(am, bp)
            exit()
        elif X == am**5 - bm**5:
            print(am, bm)
            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 = 0
  f = False
  while True:
    b = ab
    if (b+d)**5 - b**5 == x:
      f = True
      break
    elif (b+d)**5 - b**5 > x:
      break
    b = -ab
    if (b+d)**5 - b**5 == x:
      f = True
      break
    elif (b+d)**5 - b**5 > x:
      break
    ab += 1
    
  if f:
    print(b+d, b)
    break

Submission status: Wrong Answer

Solution code:
X=int(input())
m = X
pf={}
if X == 1:
    pf[1] = 1
else:
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1

for p in pf.keys():
    i = 0
    while True:
        if pow(i,5) - pow(i-p,5) == X:
            print(i,i-p)
            exit()
        elif i-p > 0 and pow(i,5) - pow(i-p,5) > X:
            break;
        i+=1

Submission status: Wrong Answer

Solution code:
x=int(input())
ab=[]
for i in range(1000):
    ab.append(i**5)
found=0
for a in ab:
    for b in ab:
        if found==1:
            break
        if a-b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        elif a+b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        else:
            continue

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(20):
  a=i**5
  if a==x:
    print(i,0)
    exit()
  elif a==x+1:
    print(i,1)
    exit()
  elif a==x-1:
    print(i,-1)
    exit()
  else:
    for j in range(20):
      b=j**5
      if a-b==x:
        print(i,j)
        exit()

Submission status: Wrong Answer

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X = int(input())

i = -64
val = i**5
vals = defaultdict(int)
while val <= 10**9:
    vals[val] = i
    i += 1
    val = i**5

d = defaultdict(int)
for a, akon in vals.items():
    for b, bkon in vals.items():
        val = a-b
        if d[val] == 0:
            d[val] = (akon, bkon)

if X in d.keys():
    a, b = d[X]
    print(a, b)

Submission status: Wrong Answer

Solution code:
x = int(input())

n = 32768
a = [i for i in range(n)]
a5 = [pow(i, 5) for i in range(n)]
for i in range(n):
    for j in range(n):
        if a5[i] - a5[j] == x:
            print(f"{a[i]} {a[j]}")
            exit()
        if a5[i] + a5[j] == x:
            print(f"{a[i]} {-a[j]}")
            exit()
        if a5[j] - a5[i] == x:
            print(f"{-a[i]} {a[j]}")
            exit()
        if a5[j] + a5[i] == x:
            print(f"{-a[i]} {-a[j]}")
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(10**2):
    for j in list(range(-i, i)):
        if i**5 - j**5 == x:
            print(i, j)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    x = int(input())
    n = int(x ** (1/5))

    for i in range(n+1,0,-1):
        a = i ** 5
        c = abs(a - x)
        d = int(c ** (1/5)) - c ** (1/5)
        if d == 0:
            b = -1 * int(c ** (1/5))
            print(i,b)
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

x=int(input())
value=0
index=0
hashmap=dict()
while value<int(1e9)+1:
    value=pow(index,5)
    hashmap[value]=index
    index+=1
#print(hashmap)    

for i in range(1,1000000):
    b1=x+int(pow(i,5))
    b2=x+int(pow(-i,5))
#    print(i,b1,b2)
    if hashmap.get(b1)!=None:
        print(hashmap[b1],i)
        break
    if hashmap.get(b2)!=None:
        print(hashmap[b2],-i)
        break

Submission status: Wrong Answer

Solution code:
a = 0
x = int(input())
for a in range(x):
    b = (x - a**5)**.2
    if type(b) in (int,float) and float.is_integer(float(b)):
        print(a, -int(b))
        exit()

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 j**2 > xc:
                ggg.append(xc)
                xc = 1
                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:
hoge = {}
for i in range(100):
    hoge[i] = i**5
for i in range(100):
    hoge[-i] = -i**5
x = int(input())
for i in hoge.items():
    for j in hoge.items():
        if i[1] - j[1] == x:
            print(i[0], j[0])
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    x = int(input())
    a = [0, 1]
    b = [0, -1]
    i = 2
    while a[-1] <= x:
        a.append(pow(i, 5))
        b.append(-pow(i, 5))
        i += 1

    a_ = set(a)
    b_ = set(b)
    for n in a:
        if x - n in b_:
            print(int(pow(x - n, 1 / 5)), int(pow(n, 1 / 5)))
            return

        if x - n in a_:
            print(int(pow(x - n, 1 / 5)), int(-pow(n, 1 / 5)))
            return


main()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

for i in range(-10000, 10**6):
    a = (x+i**5)**(1/5)
    if is_integer_num(a):
        print(int(a),i)
        break

Submission status: Wrong Answer

Solution code:
import itertools

z = []
for i in range(100):
    a =i**5
    # print(a)
    z.append(a)
    if len(str(a)) > 9:
        break

X = int(input())

z_p = list(itertools.permutations(z, 2))
for i in range(len(z_p)):
    if z_p[i][0] - z_p[i][1] ==  X:
        print(z.index(z_p[i][0]),z.index(z_p[i][1]))
        exit()
    elif z_p[i][0] + z_p[i][1] ==  X:
        print(z.index(z_p[i][0]),-(z.index(z_p[i][1])))
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(x):
    for j in range(x):
        if (j-i)!=0 and(j-i)!=1and x%(j-i)==0:
            print(j,end=" ")
            print(i)
            break
    break

Submission status: Wrong Answer

Solution code:
import collections
import sys

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 == 0:
  print("0 0")
  sys.exit()

x = abs(X)
c = prime_factorize(x)
c.append(1)
c = sorted(c)
#print(c)


for i in range(len(c)):
  B = (c[i] // 2) * -1
  A = B + c[i]
  while True:
    Z = A**5 - B**5
    #print(A,B,c[i],Z)
    if Z == x:
      if X < 0:
        print(B,A)
      else:
        print(A,B)
      sys.exit()

    if Z > x:
      break    
    A += 1
    B += 1

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    N = int( X ** (1/5) ) + 1

    isFound = False

    res = [N-1,0]

    for i in range(N):
        A = N - i
        temp1 = X - A ** 5
        if temp1 >= 0:
            temp1 = int( temp1 ** (1/5) )
        else:
            temp1 *= -1
            temp1 = int( temp1 ** (1/5) )
            temp1 *= -1
        # print(A,temp1)
        for B in range(temp1-2,temp1+3):
            temp2 = A ** 5 - B ** 5
            if temp2 == X:
                res = [A,B]
                isFound = True
                break
        if isFound:
            break

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



main()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

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:
        _b = x - a ** 5
        if _b**0.2 == int(_b**0.2):
            print(a, int(-1*_b**0.2))
            break

Submission status: Wrong Answer

Solution code:
def main():
  x=int(input())
  for i in range(10**9):
    y=x-i**5
    if y>0:
      s=1
    else:
      s=-1
    if(abs(y)**0.2).is_integer():
      return (i,-s*int(abs(y)**0.2))
    if(abs(x+i**5)**0.2).is_integer():
      return (-i,-s*int(abs(y)**0.2))
print(*main())

Submission status: Wrong Answer

Solution code:
num = int(input())
a = 0
b = 0
for i in range(1, 100):
        for j in range(-i, i):
            if i**5 - j**5 == num:
                a = i
                b = j
print(str(a) + " " + str(b))

Submission status: Wrong Answer

Solution code:
x = int(input())
n = 70
posi = [pow(i, 5) for i in range(n)]
nega = [pow(i, 5) for i in range(0, -n, -1)]
flag = False
for i in range(n):
    for j in range(n):
        if posi[i] - nega[j] == x:
            print(i, -j)
            flag = True
            if flag:
                break
    if flag:
        break

Submission status: Wrong Answer

Solution code:

x=int(input())
value=0
index=0
hashmap=dict()
while value<int(1e9)+1:
    value=pow(index,5)
    hashmap[value]=index
    index+=1
#print(hashmap)    

for i in range(1,1000):
    b1=x+int(pow(i,5))
    b2=x+int(pow(-i,5))
#    print(i,b1,b2)
    if hashmap.get(b1)!=None:
        print(hashmap[b1],i)
        break
    if hashmap.get(b2)!=None:
        print(hashmap[b2],-i)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
a=int(x**(0.2))
f=0
while True:
    b=((f**5)-x)
    if b<0:
        b=-b
        e=b**(0.2)
        if e%1==0:
            print(f,int(-e))
            break
    else:
        e=b**(0.2)
        if e%1==0:
            print(f,int(e))
            break
    f+=1

Submission status: Wrong Answer

Solution code:
A = list()
B = list()
i=0
X = int(input())
while(True):
    tmp = i**5
    A.append(tmp)
    B.append(i)
    if i%2 ==1:
        A.append(tmp*-1)
        B.append(i)
    if tmp >= 10**15:
        break
    i +=1
result = [0,0]
for i in range(len(A)):
    for j in range(len(A)):
        if A[i] -A[j] ==X:
            result[0] = B[i]
            result[1] = B[j]
            break

print(*result)

Submission status: Wrong Answer

Solution code:
X = int(input())

for a in range(-3, 3):
  for b in range(-3, 3):
    #print(a,b)
    if a**5 - b**5 == X:
      print(a, b)
      exit()

Submission status: Wrong Answer

Solution code:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
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=input1()
if x>1:
	prime=prime_factorize(x)
else:
	prime=[1,1]

for i in range(max(prime)):
	a=i
	b=a-prime[0]
	if x==a**5-b**5:
		print(a,b)
		break

Submission status: Wrong Answer

Solution code:
x = int(input())
d = [[0 for i in range(110)] for j in range(110)]
e = [[0 for i in range(110)] for j in range(110)]
for i in range(110):
    d[0][i] = i**5
    d[i][0] = i**5
for i in range(1,110):
    for j in range(1,110):
        d[i][j] = d[0][j]+d[i][0]
        e[i][j] = d[0][j]-d[i][0]
for m in range(110):
    if x in d[m]:
        print(m,-d[m].index(x))
        break
    elif x in e[m]:
        print(m,e[m].index(x))
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import itertools
import numpy as np
x = int(input())
# hani = int(pow(x, 1/5))
# for a in range(-hani-1, hani+1):
#     for b in range(-hani-1, hani+1):
#         if (pow(a, 5) - pow(b, 5) == x):
#             print(a, b)
#             exit()
max_x = pow(10, 9)
v = 0
v_lis = [0]
i = 1
while max_x > v:
    v = pow(i, 5)
    v_lis.append(v)
    v_lis.append(-v)
    i += 1

for a5, b5 in itertools.combinations_with_replacement(v_lis, 2):
    if (a5 - b5 == x):
        if (a5 < 0):
            a = int(pow(a5*-1, 1 / 5)) * -1
        else:
            a = int(pow(a5, 1 / 5))
        if (b5 < 0):
            b = int(pow(b5*-1, 1/5))*-1
        else:
            b = int(pow(b5, 1/5))
        print(a, b)
        exit()


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


# arr = factorization(x)
# fact = []
# for prime, idx in arr:
#     fact.extend([prime]*idx)

# print(fact)

Submission status: Wrong Answer

Solution code:
X = int(input())
for A in range(-10 ** 2, 10 ** 2):
    for B in range(-10 ** 2, 10 ** 2):
        if A ** 5 - B ** 5 == X:
            print(A, B)
            exit()

Submission status: Wrong Answer

Solution code:
from itertools import combinations
x = int(input())
n = 100
c = []
for i in range(n):
    c.append(i**5)
for (i, j) in combinations(range(n), 2):
    if c[j] - c[i] == x:
        print(j, i)
        break
    if c[j] + c[i] == x:
        print(j, -i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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

def gen_candidates(limit, divisor):
    for a in range(limit):
        yield (a, a - divisor)


for divisor in gen_divisor(x):
    for a, b in gen_candidates(x + 1, divisor):
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

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:
        break

print('{} {}'.format(ans[0], ans[1]))

Submission status: Wrong Answer

Solution code:
def bsa(X, A):
    l, r = 0, A
    A5 = A ** 5
    while l <= r:
        mid = (l + r) // 2
        key = X + mid ** 5
        if key == A5:
            return mid
        elif key < A5:
            l = mid + 1
        else:
            r = mid - 1
    return -1

def bss(X, A):
    l, r = 0, A
    A5 = A ** 5
    while l <= r:
        mid = (l + r) // 2
        key = X - mid ** 5
        if key == A5:
            return mid
        elif key < A5:
            l = mid + 1
        else:
            r = mid - 1
    return -1

X = int(input())
for i in range(X + 1):
    a, s = bsa(X, i), bss(X, i)
    if a != -1:
        print(i, a)
    if s != -1:
        print(i, -s)

Submission status: Wrong Answer

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

for i in range(-100, 100):
    for j in range(-100, 100):
        cand = i ** 5 - j ** 5
        if X == cand:
            print(i, j)
            sys.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=1000
    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
            break
        if z2 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j
            break
    if a!=0 or b!=0:
        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:
#coding: utf-8

import sys

X = int(input())

powers = {}
num = 100
for i in range(num):
    powered = pow(i, 5)
    powers[i] = powered
for a in range(num-1, 0, -1):
    for b in range(0, num):
        poweredA = powers[a]
        poweredB = powers[b]
        if poweredA - poweredB == X:
            print(a, b)
            sys.exit()
        elif poweredA + poweredB == X:
            print(a, -b)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
X = INT()

# #nを素因数分解したリストを返す
# def prime_decomposition(n):
#   i = 2
#   table = []
#   while i * i <= n:
#     while n % i == 0:
#       n /= i
#       table.append(i)
#     i += 1
#   if n > 1:
#     table.append(n)
#   return table
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

D = divisor(X)

for d1 in D:
    for a in range(10**4):
        b = d1 - a
        d2 = X // d1
        if a**5-b**5 == X:
            print(a, b)
            exit()









# for d in D:
#     ab = d
#     Z = ab // d
#     print(ab, Z)
#     # print((X ** (1/5)))
#     for b in range(int(sqrt(X)) + 1):
#         a = ab - b
#         if a**5-b**5 == X:
#             print("a, b:", a, b)



# for d in divisor(X):
#     ab = d
#     z = X // d
#     for a in range(10 ** 9):
#         b = a - d
#         dot = 
    # for b in range():

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(100000):
    A5 = X - i**5
    if A5 < 0:
        continue
    if float(A5**(1/5)).is_integer():
        print(i, -int(A5**(1/5)))
        break

Submission status: Wrong Answer

Solution code:
x=int(input())

if x==1:
    print(0,-1)
else:
    for i in range(x-1):
        if x%(i+2)==0:
            n=i+2
            break

    for i in range(200):
        a=105-i
        b=105-i-n
        c=a**5-b**5
        if c==x:
            print(a,b)
            break

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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())
    for A in range(-100,100):
        for B in range(-100,100):
            if A**5-B**5==X:
                print(A, B)
                sys.exit()


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
  x=int(input())
  for i in range(10**9):
    y=x-i**5
    if y>0:
      s=1
    else:
      s=-1
    if(abs(y)**0.2).is_integer():
      return (i,-s*int(abs(y)**0.2))
    if(abs(x+i**5)**0.2).is_integer():
      return (-i,-s*int(abs(y)**0.2))
print(main())

Submission status: Wrong Answer

Solution code:
import bisect
x = int(input())
T = [0] * (10 ** 4)
for i in range(1, (10 ** 4)+1):
    T[i - 1] = i ** 5

for i in range(len(T)):
    index = bisect.bisect_left(T, x + T[i])
    if index == len(T):
        break
    if T[index] == x + T[i]:
        print(' '.join(map(str,[index + 1, i + 1])))
        exit(0)


for i in range(len(T)):
    index = bisect.bisect_left(T, x - T[i])
    if index == len(T):
        break
    if T[index] == x - T[i]:
        print(' '.join(map(str,[index + 1, -(i + 1)])))
        exit(0)

Submission status: Wrong Answer

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

import sys
import math

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return

def enumerate_factor(x):
    i = 1
    factors = []
    while i * i <= x:
        if x % i == 0:
            factors.append(i)
            if x // i != i:
                factors.append(x // i)
        i += 1
    return factors

def main():
    x = read(int)
    
    boundary = math.ceil(math.pow(x, 1/5))
    for factor in enumerate_factor(x):
        for b in range(-boundary, boundary + 1):
            a = b + factor
            if a**5 - b**5 == x:
                print(f"{a} {b}")
                return

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    N = int( X ** (1/5) ) + 1

    isFound = False

    res = [N-1,0]

    for i in range(N):
        A = N - i
        temp1 = X - A ** 5
        if temp1 >= 0:
            temp1 = int( temp1 ** (1/5) )
        else:
            temp1 *= -1
            temp1 = int( temp1 ** (1/5) )
            temp1 *= -1
        print(A,temp1)
        for B in range(temp1-2,temp1+3):
            temp2 = A ** 5 - B ** 5
            if temp2 == X:
                res = [A,B]
                isFound = True
                break
        if isFound:
            break

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



main()

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,]

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:
X = int(input())

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