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

	for a in range(0, 101, 1):
		for b in range(-101, a+1, 1):
			val = a**5 - b**5
			if(val == N):
				print(str(a) + " " + str(b))
				return

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
x = int(input())
ls = []
for i in range(41):
    ls.append(pow(i, 5))

print(ls)
a = 0
while True:
    b = pow(a, 5)-x
    if -b in ls:
        print(a, -ls.index(-b))
        break
    if b in ls:
        print(a, ls.index(b))
        break
    a += 1

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
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)

    # divisors.sort()
    return sorted(divisors)



X = ii()
'''
a = make_divisors(X)
ind = bisect.bisect_left(a, X**0.2)

for num in a[:ind+1]:
    for i in range(num):
        j = num - i
        if i**5 + j**5 == X:
            print(i, (-1)*j)
            exit()
'''
num = int(X**0.2)+1
for i in range(10**6):
    tmp = X - i**5
    b = tmp**0.2
    if type(b) == float:
        if math.floor(b) == b:
            print(i, (-1)*int(b))
            exit()
    b2 = ((-1)*tmp)**0.2
    if type(b2) == float:
        if math.floor(b2) == b2: 
            print(i, int(b2))
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())


lst = []

i = 0
v = 0
while v <= X:
    v = pow(i, 5)
    lst.append((v, i))
    lst.append((-v, -i))
    i += 1


for a, i in lst:
    for b, j in lst:
        if a - b == X or b - a == X:
            print(i, j)
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

found = False
for i in range(1, int(X**0.5)+1):
    if X % i == 0:
        a = 0
        b = a - i
        while 1 <= a**5 - b**5 <= 10**9:
            if a**5 - b**5 == X:
                print(a, b)
                found = True
                break
            a += 1
            b = a - i
        if found:
            break

Submission status: Wrong Answer

Solution code:
x = int(input())
A = 0
B = 0
for i in range(-100,101):
  if i**5+x >0 and float.is_integer((i**5 + x)**0.2) == True:
    A = (i**5 + x)**0.2
    B = i
    break

print(int(A),B)

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
        if(N-j >0):
            ans2 = N - j
            s = 1
            break
        else:
            ans2 = j - N
            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:
# D
x = int(input())
for b in range(-100, 101):
    a = x + b**5
    if a**5 - b**5 == x:
        print(a, b)

Submission status: Wrong Answer

Solution code:
import numpy as np


def solve(vec, is_complex=True):
    dim = len(vec)
    if is_complex:
        A = np.zeros((dim, dim), dtype=complex)
    else:
        A = np.zeros((dim, dim))
    A[np.arange(dim - 1), 1 + np.arange(dim - 1)] = 1
    A[-1, :] = -vec
    ans, vec = np.linalg.eig(A)
    return ans


def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d = n // i
            ans = np.array([((i ** 4) -d)/5, (i ** 3), (i ** 2) * 2, i * 2])
            for x in ans:
                try:
                    if x.is_integer():
                        if x**5-(i-x)**5 == d:
                            ans = [int(x), int(i-x)]
                            return ans
                except:
                    pass
            ans = np.array([((d ** 4) - i) / 5, (d ** 3), (d ** 2) * 2, d * 2])
            for x in ans:
                try:
                    if x.is_integer():
                        if x**5-(d-x)**5 == i:
                            ans = [int(x), int(d-x)]
                            return ans
                except:
                    pass
m=int(input())
try:
    print(*make_divisors(m))
except:
    print(1)

Submission status: Wrong Answer

Solution code:
a = int(input())
for i in range(-10,1000,1):
    for j in range(-10,1000,1):
        if a == ((i**5) - (j**5)):
            print(i, j)
            break;
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
def pow1(x, n):
    if n == 0: return 1
    value = pow1(x, int(n / 2))
    value *= value
    if n % 2 == 1: value *= x
    return value
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())
a=prime_factorize(X)
for j in range(len(a)):
    for i in range (5000):
        if pow1(i-2000,5)-pow1(i-2000-a[j],5)==X:
            ans1=i-2000
            ans2=i-2000-a[j]
            print(ans1,ans2)
            break

Submission status: Wrong Answer

Solution code:
X = int(input())

B = [n**5 for n in range(150)]

A = []

for i in range(150):
    a = i**5- X if i**5 >= X else X-i**5
    A.append(a)

for j in range(150):
    if A[j] in B:
        if j**5 >= X:
            print(j,B.index(A[j]))
            break
        else:
            print(-j,B.index(A[j]))
            break

Submission status: Wrong Answer

Solution code:
def factorization(n):
    from collections import Counter
    arr = Counter()
    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[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(arr.keys()) == 0 and n != 1:
        arr[n] = 1

    return arr


X = int(input())
arr = factorization(X)
INF = 10 ** 15
if X == 1:
    print(0, -1)
    exit()

for p in arr:
    a = 0
    A = pow(a, 5)
    b = a - p
    B = pow(b, 5)
    while A < INF:
        if A - B == X:
            print(a, b)
            exit()
        a += 1
        A = pow(a, 5)
        b = a - p
        B = pow(b, 5)

Submission status: Wrong Answer

Solution code:
X = int(input())
A = 1
while True:
    if X > A ** 5:
        S = X - A ** 5
        B = S ** (1 / 5) * (-1)
    else:
        S = A ** 5 - X
        B = S ** (1 / 5)
    if A ** 5 - B ** 5 == X:
        break
    A += 1
print(A, int(B))

Submission status: Wrong Answer

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

for a_ in range(3):
    _ = a_**5 - x
    b_ = _**0.2
    if a_**5 - _ ==x:
        a = a_
        b = b_**5
        
print(a, int(b.real))

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
M = int(10 ** (9 * 0.2) + 10)

def culc():
  for a in range(-M, M):
    a5 = pow(a, 5)
    for b in range(-M, M):
      b5 = pow(b, 5)

      if(a5 - b5 == X):
        print(" ".join(map(str, [a, b])))
        return

culc()

Submission status: Wrong Answer

Solution code:
X = int(input())
B=-1
tmp = X
i=0
flg=0
while True:
    tmp = tmp + B**5
    A = int(tmp**.2)
    if A**5==tmp:
        break
    B -= 1
    tmp = X
    i+=1
    if i>40:
        break       
print(A, B)

Submission status: Wrong Answer

Solution code:
X = int(input())
j = 1
for i in range(1,X//2+2):
  if X%i == 0:
    if i != 1:
      j = i
      break


a_b=j
tmp = X//i
for k in range(-100000,100000):
  b = -k
  a = a_b + b
  if a**5 - b**5 == X:
    print(a,b)
    exit()
  elif -a**5 + b**5 == X:
    print(a,b)
    exit()
for k in range(-100000,100000):
  b = -k
  a = tmp + b
  if a**5 - b**5 == X:
    print(a,b)
    exit()
  elif -a**5 + b**5 == X:
    print(a,b)
    exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
ans_i = 0
ans_j = 0
for i in range(-100, 100):
    j = -100
    while x > j ** 5:
        print(i, j)
        print(i ** 5, j ** 5)
        if i ** 5 - j ** 5 == x:
            ans_i = i
            ans_j = j
            j = x + 1
            break
        else:
            j += 1
print(ans_i, ans_j)

Submission status: Wrong Answer

Solution code:
x = input()
for i in range(100):
  for j in range(100):
    if(i**5-j**5 == int(x)):
      print(str(i)+" "+str(j))

Submission status: Wrong Answer

Solution code:


def sovle_odd(X):
    max = 500
    for A in range(1,max, 2):
        for B in range(max):
            AX = A*A*A*A*A
            BX = B*B*B*B*B

            C = AX-BX
            #if AX-BX == X:
            if C == X:
                print(A, B)
                return
            #if BX-AX == X:
            if -C == X:
                print(B, A)
                return
            C = -AX - BX
            #if -AX - BX:
            if C == X:
                print(-A, B)
                return
            #if AX + BX:
            if -C == X:
                print(A, -B)
                return

def solve_even(X):
    max = 1000
    for A in range(0,max, 2):
        for B in range(0, max, 2):
            AX = A*A*A*A*A
            BX = B*B*B*B*B

            C = AX-BX
            if C == X:
                print(A,B)
                return
            elif -C == X:
                print(B,A)
                return
            
            C = -AX - BX
            if C==X:
                print(-A,B)
                return
            elif -C==X:
                print(A, -B)
                return

def solve():
    X = int(input())
    
    if X%2==1: # X odd case
        sovle_odd(X)
    else: # X even case
        solve_even(X)

solve()

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

factor1 = math.pow(X, 1.0/5.0)
factor2 = math.pow(X-1, 1.0/5.0)
factor3 = math.pow(X+1, 1.0/5.0)

if factor1.is_integer():
    print(int(factor1), 0)
elif factor2.is_integer():
    print(int(factor2), -1)
else:
    print(int(factor3), 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(0,10000+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(0,10000+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:
X = int(input())

def factorization(n):
    arr = [1]
    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
    
fact_ls = factorization(X)

flg = False
for f in fact_ls:
    for b in range(-9999, 10000):
        a = b + f
        if (a ** 5 - b ** 5) == X:
            A = a
            B = b
            flg = True
            break
    if flg:
        break
else:
    A = 0
    B = 0

print(A, B)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
A=[]
B=[]
number = []
flag = 0
for i in range(math.ceil(math.sqrt(X)) * -1, math.ceil(math.sqrt(X)) + 1):
    number.append(i)
    A.append(i ** 5)
    B.append(i ** 5)
    
print(A)

for i in range(len(A)):
    for j in range(len(B)):
        if(A[i] - B[j] == X and flag == 0):
            print(number[i],number[j])
            flag += 1

Submission status: Wrong Answer

Solution code:
#input
X = int(input())

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

Submission status: Wrong Answer

Solution code:
X = int(input())

AA = 0
BB = 0

for A in range(121):
    for B in range(121):
        if X == (A ** 5) - (B ** 5):
            AA = A
            BB = B

if AA == 0 and BB == 0:
    for A in range(101):
        if X == (A ** 5) + 1:
            AA = A
            BB = -1

print(AA,BB)

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
    if a**5 - b**5 > X:
        a -= 1
        continue
    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:
X=int(input())

def judgef(n):
    if n>0:
        a=n**(0.2)
        b=int(n**(0.2))
    else:
        n=0-n
        a=n**(0.2)
        b=int(a**(0.2))
    if abs(a-b)<0.000001:
        return True
    else:
        return False

B=0

while True:
    C=X+B**5
    D=X-B**5
    if judgef(C):
        A=C**(0.2)
        break
    elif judgef(D):
        A=C**(0.2)
        B=0-B
        break
    B+=1

print(int(A),'',B)

Submission status: Wrong Answer

Solution code:
X = int(input())
x = 1
while ((x-1)**4)*5 < X:
  x += 1
for i in range(x):
  for j in range(-x, i):
    if i**5-j**5 == X:
      a = [i,j]
      print(*a)

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=0,10**18+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:
            r=mid
        else:
            l=mid
    
    l,r=-10**18,0
    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(int(x**0.2)-3,int(x**0.2)+3):
    if i**5==x:
        print(i)
        exit()

for i in range(1,int(x**0.5)+1+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 queue
n = int(input())

a = 0
aa = 0
ab = 0
q =[0]

while(aa<=10**9):
    a += 1
    aa = a ** 5
    q.append(aa)

b = 0
for i in range(1,a+1):
    if q[i] == n:
        print(str(q[i]) + " 0")
        exit()

for i in range(1,a+1):
    for k in range(1, a + 1):
        if q[i] - q[k] == n:
            print(str(i) + " " + str(k))
            exit()
        if q[i] + q[k] == n:
            print(str(i) + " " + str(-k))
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

    if temp!=1:
        arr.append([temp, 1])

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

    return arr


for number in factorization(x):
  for a in range(number[0]):
    b = a - number[0]
    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:
x = int(input())

for i in range(185):
    for j in range(187):
        if ((i-118)**5)-((j-67)**5) == x:
            print(i-118,j-67)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
import math

X = int(input())


# Aが正、Bが負
for A in range(math.ceil(X**(1 / 5))):
    # A = 1
    B_5 = X - A**5
    B = B_5**(1 / 5)
    if math.floor(B) == B:
        print(A, -int(B))
        sys.exit(0)

# Aが正、Bが正
for a in range(math.ceil(X**(1 / 4))):
    for b in range(math.ceil(X**(1 / 4))):
        eq = a**4 + (a**3) * b + (a**2) * (b**2) + a * (b**3) + b**4
        if eq == 33 or a - b == X:
            print(a, b)
            sys.exit(0)

Submission status: Wrong Answer

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

    i = 0
    while True:
        j = i ** 5
        a1, a2 = x + j, x - j

        p = a1 ** (1 / 5)
        if int(p) == p:
            p = int(p)
            print(p, i)
            break
        if a2 >= 0:
            p = a2 ** (1 / 5)
            if int(p) == p:
                p = int(p)
                print(p, -1 * i)
                break
        else:
            p = abs(a2) ** (1 / 5) * -1
            if int(p) == p:
                p = int(p)
                print(p, -1 * i)
                break
        i += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
X=int(input())
ans1=0
ans2=0
for a in range(-10,10):
    for b in range(-10,a):
        if a**5-b**5==X:
            ans1=a
            ans2=b
            break
print(ans1,ans2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(30):
    if i ** 5 >= x and (i - 1) ** 5 <= x:
        b = i ** 5 - x
        for j in range(30):
            if j ** 5 == b:
                print(i, j)
                exit()
    if i ** 5 <= x and (i + 1) ** 5 >= x:
        b = i ** 5 - x
        for j in range(-30, 1):
            if j ** 5 == b:
                print(i, j)
                exit()

Submission status: Wrong Answer

Solution code:
import sys
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)
for j in divisors:
  for a in range(100):
    b = a - j
    if a * a * a * a * a - b * b * b * b * b == x:
      print(a, b)
      sys.exit(0)

Submission status: Wrong Answer

Solution code:
import sys


X = int(sys.stdin.readline().rstrip())
Y = [i ** 5 for i in range(X + 1)]

def check(d):
    for a in range(1, d // 2 + 1):
        b = a - d
        a5 = Y[a]
        b5 = Y[b] if b >= 0 else -Y[-b]
        if a5 == b5 + X:
            print(a, b)
            sys.exit()


for i in range(1, int(X**0.5)+1):
    if X % i == 0:
        check(i)
        if i != X // i:
            check(X//i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

def bin_s(l, r, a):
    print(a)
    while l <= r:
        mid = l + r // 2
        print(l, r)
        if a ** 5 - mid ** 5 == x:
            return (mid, True)
        elif a ** 5 - mid ** 5 > x:
            l = mid + 1
        else:
            r = mid - 1
    return (-1, False)

def search(x: int) -> (int, int):
    a = 1
    while True:
        if a ** 5 - (a - 1)** 5 <= x <= a ** 5 + (a - 1)** 5:
            b, j = bin_s(-a + 1, a - 1, a)
            if j:
                return (a, b)
        a += 1

a, b = search(x)
print(f"{a} {b}")

Submission status: Wrong Answer

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

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while l <= r:
        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:
        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:
x = int(input())
a = 0
b = 0

for a_ in range(3):
    _ = a_**5 - x
    b_ = _**0.2
    if a_**5 - b_**5 ==x:
        a = a_
        b = b_**5
        
print(a, int(b.real))

Submission status: Wrong Answer

Solution code:
print(2,-1)

Submission status: Wrong Answer

Solution code:
x=int(input())
ans=0
for A in range(100):
    for B in range(-100,10):
        ans=(A**5)-(B**5)
        if ans==x:
            print(A,B)
            break
    if ans==x:
        break

Submission status: Wrong Answer

Solution code:
X=int(input())
x=1
while 1:
  while 1:
    if X%x==0:
      break
    x+=1
  a=X-pow(x,5)
  if a==0:
    print(0,-1)
    exit(0)
  if a%(5*x)==0:
    a=a//(5*x)
    if a>0:
      for b in range(1,a):
        if a==(b+x)*b*(pow(x,2)+(b+x)*b):
          print(b,b+x)
          exit(0)
    else:
      for b in range(-x,0):
        if a==(b+x)*b*(pow(x,2)+(b+x)*b):
          print(b,b+x)
          exit(0)
  x+=1

Submission status: Wrong Answer

Solution code:
import math

l = []
ans = []
x = int(input())

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

for i in range(a - 5, a + 5):
    l.append(i)

for i in range(1,len(l)):
    for j in range(len(l)):
        tmp = math.pow(l[j],5) - math.pow(l[i],5)
        if tmp == x:
            print(l[j],l[i])
            break
    else:
        continue
    break

Submission status: Wrong Answer

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)
def prime_fact(n):
	p = {}
	for i in range(2, int(-(-n**0.5//1))+1):
		if n % i == 0:
			while n % i == 0:
				n //= i
				p[i] = p.get(i, 0) + 1
	if n != 1:
		p[n] = p.get(n, 0) + 1
	return p


def main():
	log = Logger(0)
	x = int(sys.stdin.readline())
	p = prime_fact(x)
	p[1] = 1
	if x == 1:
		print(*[0, -1])
		exit()
	log.print(p)
	for i in p.keys():
		for b in range(0, i):
			a = i + b
			# log.print(a, b, a**5-b**5)
			if pow(a, 5) - pow(b, 5) == x:
				print(*[a, b])
				exit()
			a = i - b
			# log.print(a, b, a**5 + b**5)
			if pow(a, 5) + pow(b, 5) == x:
				print(*[a, -b])
				exit()

	


main()

Submission status: Wrong Answer

Solution code:
X = int(input())
L = list()
i = 0
while True:
    if i ** 5 > 10 ** 11:
        break
    L.append(i ** 5)
    i += 1
flag = False
ret = ''
for i in range(len(L)):
    if flag:
        break
    for j in range(i, len(L)):
        if L[i] - L[j] == X :
            ret ='{} {}'.format(i,j)
            flag = True
            break
        if L[i] + L[j] == X :
            ret ='{} {}'.format(i,-j)
            flag = True
            break
print(ret)

Submission status: Wrong Answer

Solution code:
x=int(input())

max=int(pow(x,0.2))
a=0
b=0
for i in range(0,max*max+1):
    if x-i**5>=0:
        tmp_b=-1*pow(x-i**5,0.2)
    else:
        tmp_b=pow(i**5-x,0.2)
    if int(tmp_b)==tmp_b:
        a=i
        b=int(tmp_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)
        flg = 0
    if C.is_integer():
        if flg == 0:
            print(i,int(C))
            exit()
        else:
            print(i,-int(C))
            exit()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

a = 0
a5 = 0
while a5 <= x:
    a += 1
    a5 = a**5

a -= 1

#print(a**5 - x)

if a**5 - x < 0:
    b = -1 * math.pow(abs(a**5 - x), 1/5)
else:
    b = math.pow(abs(a**5 - x), 1/5)

print(a,int(b))