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


def f(a, b):
    return (a**5-b**5) == x


for z in range(1, 100):
    if f(a*z, b*z):
        print(a, b)
        break

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
for i in range(1,int(X**(0.5)+1)):
    if X % i ==0:
        a=0
        b=-i
        while a**5<2*X:
            a+=1
            b+=1
            if a**5-b**5==X:
                print(a,b)
                sys.exit()

Submission status: Wrong Answer

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

for i in range(-100, 101):
    # print(i)
    for j in range(-100, 101):
        # print(i**5 - j**5)
        if (i**5 - j**5) == X:
            print(str(i) + ' ' + str(j))
            sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(1, 101):
    if i ** 5 >= x and (i - 1) ** 5 < x:
        b = i ** 5 - x
        for j in range(101):
            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(-100, 1):
            if j ** 5 == b:
                print(i, j)
                exit()

Submission status: Wrong Answer

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    x = int(input())
    a = 0
    bl = -1000
    br = 1000
    b = False
    while not b:
        z = a**5
        bl = -1000
        br = 1000
        while abs(bl-br)!=1:
            if z-((bl+br)//2)**5<x:
                br = (bl+br)//2
            elif z-((bl+br)//2)**5>x:
                bl = (bl+br)//2
            if z-((bl+br)//2)**5==x:
                print(x,z-((bl+br)//2)**5)
                b = (bl+br)//2
                break
        if not b:
            a += 1
    print(a,b)
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
x=int(input())

# aが正
import sys
count = 0
for a_tmp in range(1, 1000000):
    b_tmp_5 = a_tmp**5 - x
    if b_tmp_5 > 0:
        b_tmp = pow(b_tmp_5, 1/5)
    else:
        b_tmp = (pow(-b_tmp_5, 1/5))*-1
    if b_tmp.is_integer():
        count += 1
        print(a_tmp, int(b_tmp))
        break

# aが負
if count == 0:
    for a_tmp_m in range(-1000, 0):
        b_tmp_5_m = a_tmp_m**5 - x
        b_tmp_m = (pow(-b_tmp_5_m, 1/5))*-1
        if b_tmp_m.is_integer():
            sys.exit
            count += 1
            print(a_tmp_m, int(b_tmp_m))
            break

# aが0
if count == 0:
    b_tmp_5_0 = -x
    b_tmp_0 = (pow(-b_tmp_5_0, 1/5))*-1
    if b_tmp_0.is_integer():
        print(0, int(b_tmp_0))

Submission status: Wrong Answer

Solution code:
from math import pow
from itertools import combinations
x = int(input())

def prime_factorize(n):
    a = [1]
    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

def func(a, b):
    return pow(a, 5) - pow(b,5)
    
cands = prime_factorize(x) + [1]
cands += [c*-1 for c in cands]
ok = False

for c in cands:
    for a in range(1, c + 1):
        b = a - c
        if func(a,b) == x:
            print(a, b)
            ok = True
            break
    if ok:
        break

Submission status: Wrong Answer

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

for i in range(1, int(X**0.5)+1):
	if X%i==0:
		divisors.append(i)
		if i!= X//i:
			divisors.append(X//i)
K=len(divisors)
A=-1
for y in range(0,K):
	KKK=0
	A=0
	while KKK<X:
		A=A+1
		KKK=A**5-(A-divisors[y])**5
	if KKK==X:
		print(A,A-divisors[y])
		break

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
x = int(input())
s = -(int(x**0.2)-1)
g = int(x**0.2)+1
for i in range(s,g):
    r = i**5 + x
    if (r**0.2)%1 == 0:
        print(-i,-int(r**0.2))
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
m = 100

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

Submission status: Wrong Answer

Solution code:
import sys
key = int(input())
for i in range(0,1000):
    for j in range(i,1000):
        if key == i ** 5 - j ** 5:
            print(i, j)
            sys.exit(1)
        elif key == i ** 5 - (-j) ** 5:
            print(i, -j)
            break
            sys.exit(1)

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):
        f = math.ceil(math.pow(factor, 1/5))
        for b in range(-boundary - f, boundary + f + 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:
#!/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(1, i+1):
			a = i + b
			log.print(a, b, a**5-b**5)
			if a**5 - b**5 == x:
				print(*[a, b])
				exit()
			a = i - b
			log.print(a, b, a**5 + b**5)
			if a**5 + b**5 == x:
				print(*[a, -b])
				exit()

	


main()

Submission status: Wrong Answer

Solution code:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def check(a,b,x):
    a=round(a)
    return a**5 - b**5 == x

def fifthroot(n):
    for i in range(int(n**(1/5)+1)) :
        if i**5==n:
            return i
    return -1

def main():
    x = int(input().strip())
    for b in range(1,10**2):
        if fifthroot(x + b**5)!=-1:
            eprint("b>=0")
            a=fifthroot(x + b**5)
            print(a,b)
        # #
        # a=(x + b**5)**(1/5)
        # eprint('a ',end=':\n')
        # eprint(a)
        # if check(a,b,x):
        #     eprint("b>=0")
        #     print(int(a),b)
        #     return            

        #
        # if a.is_integer():
        #     eprint("b>=0")
        #     print(a,b)
        #     return
    for a in range(1,10**2):
        if x - a**5 < 0:
            break
        # b=(x - a**5) ** (1/5)
        b=fifthroot(x - a**5)
        if b!=-1:
            eprint("b<0")
            print(a,-int(b))
            return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools
X=int(input())
li=[i**5 for i in range(64)]
for v in itertools.permutations(li, 2):
    v=list(v)
    v.sort()
    if v[0]-v[1]==X:#両方プラスの時
        A=v[0]**0.2
        B=v[1]**0.2
        print(str(int(A))+" "+str(int(B)))
        break
    elif v[0]+v[1]==X:#v[1]がマイナスの時
        A=v[0]**0.2
        B=-1*((v[1])**0.2)
        print(str(int(A))+" "+str(int(B)))
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

flag = 0

for i in range(100):
    for j in range(100):
        N = i**5 - j**5
        M = i**5 + j**5

        if N == X:
            print(i,j)
            flag = 1
            break

        elif M == X:
            print(i,-1*j)
            flag = 1
            break
    
    if flag == 1:
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
import math
#print(x)
for i in range(1000000):
    a = x + (i ** 5)
    a2 = x + (-i ** 5)

    if a > 0:
        v = math.pow(a, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            print(v, i)
            break
    else:
        v = math.pow(-a, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            print(-v, i)
            break

    if a2 > 0:
        v = math.pow(a2, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            print(v, -i)
            break
    else:
        v = math.pow(-a2, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            print(-v, -i)
            break

Submission status: Wrong Answer

Solution code:
X = int(input())
div = []
for i in range(1, int(X**0.5)+1):
    if X % i == 0:
        div.append(i)
        if i != X // i:
            div.append(X//i)
for p in div:
    i = 0
    print(p)
    while (i+p-p//2)**5 - (i-p//2) ** 5 <= X:
        if (i+p-p//2)**5 - (i-p//2) ** 5 == X:
            print(i+p-p//2, i-p//2)
            print(i)
            break
        i += 1
    else:
        continue
    break
    i = 0
    while (i+p)**5 - i ** 5 <= X:
        if (i+p)**5 - i ** 5 == X:
            print(i+p, i)
            break
        i += 1
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

for A in range(-100,100):
    for B in list(range(-100,100)):
        if A**5 - B**5 == X:
            print(f'{A} {B}')
            exit()

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
N = math.floor(X ** (1/5)) + 1

for a in range(-N,N):
  for b in range(-N,N):
    x = a**5
    y = b**5
    T = 0
    if x-y == X:
      print(a,b)
      T = 1
      break
  if T == 1:
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
start = int(pow(x,0.5))
for i in range(-start,start):
    k = pow(x + pow(i,5),0.2)
    if type(k) != type(1+1j) and k == int(k) and pow(int(k),5) - pow(i,5) == x:
        print(int(k),i)
        exit()

Submission status: Wrong Answer

Solution code:
X =int(input())
A =[i**5 for i in range(1,121)]
a =[i for i in range(1,120)]
B =[i**5 for i in range(-120,121)]
b =[i for i in range(-120,121)]

for i in range(len(A)):
    for j in range(len(B)):
        if A[i]  -  B[j]  == X:
            print("{} {}".format(a[i],b[j]))
            break

Submission status: Wrong Answer

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

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,25937424601, 
27027081632, 
28153056843, 
29316250624, 
30517578125, 
31757969376, 
33038369407, 
34359738368, 
35723051649, 
37129300000, 
38579489651, 
40074642432, 
41615795893, 
43204003424, 
44840334375, 
46525874176, 
48261724457, 
50049003168, 
51888844699, 
53782400000, 
55730836701, 
57735339232, 
59797108943, 
61917364224, 
64097340625, 
66338290976, 
68641485507, 
71008211968, 
73439775749]

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:
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, 1500):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)
        if an < 0:
            break

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
x=int(input())
c=0
for i in range(0,101):
    for j in range(0,101):
        if (i*i*i*i*i)+(j*j*j*j*j)==x:
            print(i,"-"+str(j))
            c+=1
            break
        elif (i*i*i*i*i)-(j*j*j*j*j)==x:
            print(i,j)
            c+=1
            break
    if c==1:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
s = -(int(x**0.2))
g = int(x**0.2)
for i in range(s,g):
    r = i**5 + x
    if (r**0.2)%1 == 0:
        print(-i,-int(r**0.2))
        exit()

Submission status: Wrong Answer

Solution code:
import bisect

X = int(input())

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

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
for B in range(100):
    for A in range(B,100):
        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            exit()
        elif A**5 + B**5 == X:
            print(str(A) + " " + str(-1*B))
            exit()

Submission status: Wrong Answer

Solution code:
import math, sys
X = int(input())
sX = math.floor(math.sqrt(X))
AandB = []
for x in range(-sX,sX+1):
    if x==0:
        continue
    if X%x == 0:
        AandB.append(x)
for a_b in AandB:
    b = a_b//2
    flag = True
    while flag:
        a = a_b - b
        if a**5-b**5==X:
            print(str(a)+" "+str(b))
            sys.exit()
        elif a**5-b**5>X:
            flag = False
        b-=1

Submission status: Wrong Answer

Solution code:
x = int(input())

memo = []
i = 1
while(pow(i, 5) < 10**9):
  memo.append(pow(i, 5))
  i+=1
  
  
for i in range(len(memo)):
  for j in range(len(memo)):
    if memo[i]-memo[j] == x:
      print(i+1, j+1)
      exit()
    if memo[i]+memo[j]  == x:
      print(i+1, -j-1)
      exit()

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(d[m].index(x),m)
        break
    elif x in e[m]:
        print(m,-e[m].index(x))
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(-100,100):
    for b in range(-100,100):
        if (a-b)!=0 and X%(a-b)==0:
            if a**5-b**5==X:
                print(a, b)
                exit()

Submission status: Wrong Answer

Solution code:
import math
import collections

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

    if X == 1:
        z = 0
    else:
        z = int(X ** 0.2)

    tmp = (z ** 5) - X

    print(int((X+tmp)**0.2), tmp)

    return 0

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

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

Submission status: Wrong Answer

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

div = make_divisors(X)

for item in div:
    for A in range(-1000,1000):
        B = A - item

        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))

Submission status: Wrong Answer

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

x = int(input())
if x == 1:
    print("0 -1")
    quit()
p_numbers = prime_factorize(x)
num = p_numbers[0]

for i in range(1000000):
    a = num - i
    b = -1 * i
    if x == num * (a ** 4 + (a ** 3) * b + (a ** 2) * (b ** 2) + a * (b ** 3) + b ** 4):
        print(str(a) + ' ' + str(b))
        quit()

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)
    return divisors
X = int(input())
data = make_divisors(X)
for i in data:
  b=0
  while (b+i)**4 +(b+i)**3*b+(2*b+i)**2+(b+i)*b**3 + b**4 <= X/i:
    if (b+i)**5 - b**5 == X:
      print(b+i,b)
      exit(0)
    else:
      b +=1
  b=-1
  while b+i > 0:
    if (b+i)**5 - b**5 == X:
      print(b+i,b)
      exit(0)
    else:
      b -=1

Submission status: Wrong Answer

Solution code:
from numba import jit
X = int(input())


@jit
def solver(X):
    i = 2
    while X % i != 0:
        i += 1
    return i


if X == 1:
    print(0, -1)
    exit()

sol = solver(X)
for i in range(-10, 10):
    j = i - sol
    if (i ** 5 - j ** 5) == X:
        print(i, j)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

for A in range(-65,65):
    for B in list(range(-65,65)):
        if A**5 - B**5 == X:
            print(f'{A} {B}')
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys

x=int(input())
for a in range(1,10**3):
    for b in range(1,10**3):
        if a**5 - b**5==x:
            print(a,b)
            sys.exit()
        if (-a)**5 - b**5==x:
            print(-a,b)
            sys.exit()
        if a**5 - (-b)**5==x:
            print(a,-b)
            sys.exit()
        if (-a)**5 - (-b)**5==x:
            print(-a,-b)
            sys.exit()

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(1)
	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(1, i+1):
			a = i + b
			log.print(a, b, a**5-b**5)
			if a**5 - b**5 == x:
				print(*[a, b])
				exit()
			a = i - b
			log.print(a, b, a**5 + b**5)
			if a**5 + b**5 == x:
				print(*[a, -b])
				exit()

	


main()

Submission status: Wrong Answer

Solution code:
from sys import exit
from math import sqrt

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

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

Submission status: Wrong Answer

Solution code:
import math
def factorial(x):
    for a in range(-1, 100):
        for b in range(-1, 100):
            check = math.pow(a, 5) - math.pow(b, 5)
            if check == x:
                return f'{a} {b}'
x = int(input())
print(factorial(x))

Submission status: Wrong Answer

Solution code:
import numpy as np
x=int(input())
#ａ⁵－ｂ⁵＝(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋ｂ⁴)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors
d=make_divisors(x)
for i in range(len(d)):
  d.append(-d[i])
flag=False
for i in d:
  if flag==True:
    break
  tui=x//i
  ans=np.roots([5,10*i,10*i**2,5*i**3,i**4-tui])
  for j in ans:
    a=j+i
    if a**5-j**5==x+0j:
      print(int(a.real),int(j.real))
      flag=True
      break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    X,=pin()


    #解が存在することが証明されているので、探索を行う
    for a in range(1000):
        cond=0        
        if a**5==X:print(a,0);break
        #search B for B**5==t
        A=a
        if A**5<X:#Bは負！
            t=X-A**5
            cond=1#後で負にする
            r=A+1 #rはBのかりの最大値
        elif A**5>X:
            t=X+(A**5)
            r=100+A+1
        #search B for B**5==t
        #print(t)
        for b in range(r):                
            #print(b**5,t)
            if b**5==t:
                #print("yeah")
                B=b
                if cond==1:B*=(-1)
                print(A,B)
                return
                
#%%submit!
resolve()

Submission status: Wrong Answer

Solution code:
x=int(input())
fifth_power=[0]*200
for i in range(200):
    fifth_power[i]=(i+1)**5
for i in range(200):
    if x==1:
        print(0,-1)
        break
    elif fifth_power.count(abs(x-fifth_power[i]))==1:
        if fifth_power[fifth_power.index(abs(x-fifth_power[i]))]-fifth_power[1]==x and i%2==0:
            print(fifth_power.index(abs(x-fifth_power[i]))+1,i+1)
            break
        else:
            print(fifth_power.index(abs(x-fifth_power[i]))+1,-i-1)
            break

Submission status: Wrong Answer

Solution code:
import math

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

def ihate(x):
    sq = int(math.sqrt(x)) + 1
    facts = []
    for i in range(1, sq):
        if x % i == 0:
            facts.append(i)

    for fa in facts:
        d = x // fa
        for a, b in zip(range(-fa, 0), range(0, fa)):
            if f(a, b) == d:
                return f'{a} {b}' if a > b else f'{b} {a}'
x = int(input())
print(ihate(x))

Submission status: Wrong Answer

Solution code:
import math
import sys

x = int(input())

for i in range(1, int((10**9))+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:
x = int(input())

def divisor(n):
    ass = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass  # sortされていない


x_li = divisor(x)
x_li.sort()
#print(x_li)
for i in range(len(x_li)//2+1):
    for j in range(x_li[i]+1):
        a = j
        b = a - x_li[i]
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Wrong Answer

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


def main():
    x = ii()

    if x == 1:
        print(0,-1)
        return
    xc = x
    ggg = []
    for i in range(10**9):

        for j in range(2,xc+1):
            if xc%j == 0:
                ggg.append(j)
                xc = xc//j
                break
            if j**2 > xc:
                ggg.append(xc)
                xc = 1
                break
        
        if xc == 1:
            break

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

        idx_list.append(idx)
    idx_list2 = list(set(idx_list))

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())
def judge(num):
    if num < 0:
        num *= -1
    ans = num**(1/5)
    if ans.is_integer():
        return True
    else:
        return False
if judge(x):
    if x < 0:
        print(-1*int(x**(1/5)), 0)
        exit()
    else:
        print(int(x**(1/5)), 0)
        exit()
b1 = 0
b2 = 0
while 1:
    b1 += 1
    b2 -= 1
    if judge(x+(b1**5)):
        print(int((x+(b1**5))**(1/5)), b1)
        exit()
    elif judge(x+(b2**5)):
        if x+(b2**5) < 0:
            print(-1*int(((x+(b2**5))*-1)**(1/5)), b2)
        else:
            print(int((x+(b2**5))**(1/5)), b2)
        exit()