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
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

x = load()
for b in range(1000, -10000, -1):
    b5 = b ** 5
    y = (x + b5)**(1/5)
    if type(y) == complex:
        continue
    if abs(y - math.floor(y)) < 0.000005:
        print(math.floor(y), b)
        exit()

Submission status: Wrong Answer

Solution code:
# D - I hate Factorization

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

div = make_divisors(X)

flg = False
for d in div:
    i = 1
    j = i-d
    while True:
        if pow(i,5)-pow(j,5)<X:
            i += 1
            j += 1
            continue
        if pow(i,5)-pow(j,5)==X:
            print(i,j)
            flg = True
            break
        elif pow(i,5)-pow(j,5)>X:
            break
    if flg:
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

flg = 0
for i in range(-100,100):
  if flg == 1:
    break

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

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)
ok = False

for i in range(2 ** len(cands)):
    y = 1
    for j in range(i):        
        if (i >> j) & 1 == 1:
            y *= cands[j]
    for a in range(1, y + 1):
        b = a - y
        if func(a, b) == x:
            print(a, b)
            ok = True
        break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(-1000,1000+1):
    for j in range(-1000,1001):
        if pow(i,5) + pow(j,5) == x:
            print("{} {}".format(i,j))
            exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
i=1
while (X+(i**5))**(1/5)-int((X+(i**5))**(1/5))>10**(-10):
    i+=1
    if X<i:
        i=-1
        while (X+(i**5))**(1/5)-int((X+(i**5))**(1/5))>10**(-10):
            i-=1
        break
print("{} {}".format(int((X+(i**5))**(1/5)), i))

Submission status: Wrong Answer

Solution code:
x = int(input())

a = int(x**(1/5))
b = -150

flag = 0
if flag == 0:
    for i in range(a,a+1200):
        for j in range(b,b+1200):
            if i**5 - j**5 == x:
                print(i,j)
                flag = 1
                break

if flag == 0:
    b = 0
    for i in range(a,a-1200):
        for j in range(b,b-1200):
            if i**5 - j**5 == x:
                print(i,j)
                break

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    X=int(sys.stdin.readline())
    for i in range(-100,100):
        for j in range(-100,100):
            if i**5-j**5==X:
                print("{} : {} {}".format(X,i,j))
                


main()

Submission status: Wrong Answer

Solution code:
#D
x = int(input())

l = [[]]
for i in range(0, 1000):
    for j in range(-1000, 0):
        if i ** 5 - j ** 5 == x:
            print(f'{i} {j}')
            exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
y = 0
while x**5 < n:
	y = (n - x**5);
	y = int(y)
	if (x**5 + y**5 == n):
		print(x, -1 * y, sep = " ");
		break
	x+=1
if (x**5 + y**5 != n):
	i = 1
	while(i <= 200):
		if (n % i == 0):
			j = 0;
			ok = False;
			while((i+j)**5 - j**5 <= n):
				if (i+j)**5 - j**5 == n:
					print(i+j,j, sep = ' ');
					ok = True;
					break;
				j+=1
		i+=1
		if (ok == True):
			break;

Submission status: Wrong Answer

Solution code:
X = int(input())

A = 0
while True:
    for B in range(A):
        if A ** 5 + B ** 5 == X:
            print(f"{A} {B}")
            exit()
        elif (-A) ** 5 + B ** 5 == X:
            print(f"{-A} {B}")
            exit()
        elif A ** 5 + (-B) ** 5 == X:
            print(f"{A} {-B}")
            exit()
        elif (-A) ** 5 + (-B) ** 5 == X:
            print(f"{-A} {-B}")
            exit()
    A += 1

Submission status: Wrong Answer

Solution code:
def solve():
  X = int(input())
  for a in range(-1000, 1000):
    for b in range(-1000, 1000):
      if a ** 5 - b ** 5 == X:
        print(a, b)
        break
  return 0
if __name__ == "__main__":
  solve()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x=II()
    s=set()
    etoa={}
    for a in range(1000000):
        s.add(a**5)
        etoa[a**5]=a
    for b in range(1000000):
        t=x+b**5
        if t in s:
            print(etoa[t],-b)
            break
        t=x-b**5
        if t<0:continue
        if t in s:
            print(etoa[t],b)
            break

main()

Submission status: Wrong Answer

Solution code:
x=int(input())
p=False
q=[]
for i in range(101):
  q.append(i**5)
r=100

l=0
while (r-l>=1):
  j=(l+r)//2
  if q[j]-x in q:
    print(int(q[j]**(1/5)),int((q[j]-x)**(1/5)))

  elif q[j]-x >= 50**5:
    r=i
  else:
    l=i+1

Submission status: Wrong Answer

Solution code:
n = int(input())
nn = int(pow(n,1/5)) + 1
p = sorted(range(nn),reverse = True)
for i in p:
    b = pow(n - i ** 5, 1/5)
    if float.is_integer(b):
        break

print(i,int(b))

Submission status: Wrong Answer

Solution code:
X = int(input())

AA = 0
BB = 0

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

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

print(AA,BB)

Submission status: Wrong Answer

Solution code:
#D
x = int(input())

l = [[]]
for i in range(0, 100):
    for j in range(-100, 0):
        if i ** 5 - j ** 5 == x:
            print(f'{i} {j}')
            exit()

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

Submission status: Wrong Answer

Solution code:
X = int(input())

for A in range(100):
  for B in range(100):
    if A**5 - B**5 == X:
      print(str(A) + " " + str(B))
    break
    if A**5 + B**5 == X:
      print(str(A) + " -" + str(B))
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

A=[]
B=[]

for i in range(65):
    A.append(X+(i)**5)
    B.append(X-(i)**5)

ans1=0
ans2=0

for i in range(65):
    if i**5 in A:
        ans1=i
        ans2=A.index(i**5)
        break
    elif i**5 in B:
        ans1=i
        ans2=-B.index(i**5)
        break

print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
X = int(input())
y = 1
z = X
for i in range(2,int((X**(1/2)))+1):
  if X%i==0:
    y = i
    z = X//i
    break
    
for a in range(10**5):
  b = a-y
  if a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4==z:
    print(a,b)
    exit()

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)
ok = False

for i in range(1, 2 ** len(cands)):
    y = 1
    for j in range(i):        
        if (i >> j) & 1 == 1:
            y *= cands[j]
    for a in range(1, y + 1):
        b = a - y
        if func(a, b) == x:
            print(a, b)
            ok = True
        break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x=II()
    s=set()
    etoa={}
    for a in range(1000000):
        s.add(a**5)
        etoa[a**5]=a
    for b in range(1000000):
        t=x+b**5
        if t in s:
            print(etoa[t],-b)
            break
        t=x-b**5
        if t<0:continue
        if t in s:
            print(etoa[t],-b)
            break

main()

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
rX = math.floor(X ** (1/5))
for i in range(0 - rX, rX):
        A5 = 0
        A5 = X + (i ** 5)
        A = A5 ** (1/5)
        # print(type(A))
        if type(A) is float:
                if A.is_integer() is True:
                        A = int(A)
                        print(i, A)
                        break

Submission status: Wrong Answer

Solution code:
X = int(input())
i=0
while(True):
  B =  i**5 - X
  if B<0:
    powB = pow(-B,0.2)
    if(float.is_integer(powB)):
      print(i,int(-powB))
      break
  else:
    powB = pow(B,0.2)
    if(float.is_integer(powB)):
      print(i,int(powB))
      break
  B =  (-i)**5 - X
  if B<0:
    powB = pow(-B,0.2)
    if(float.is_integer(powB)):
      print(-i,int(-powB))
      break
  else:
    powB = pow(B,0.2)
    if(float.is_integer(powB)):
      print(-i,int(powB))
      break
  i+=1

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)
    divisors.sort()
    return divisors
d = make_divisors(X)
for i in range(len(d)):
    m = d[i]
    n = d[-i-1]
    r = np.roots([5,10*m,10*(m**2),5*(m**3),(m**4-n)])
    for j in range(len(r)):
        a = np.round(np.roots([5,-10*m,10*(m**2),-5*(m**3),(m**4-n)])[j].real,decimals=8)
        if a.is_integer():
            b = a - m
            print(int(a),int(b))
            break

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
M = 100

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())
lst = []
for i in range(101):
    lst.append(i**5)
    lst.append(-i ** 5)

for a in lst:
    b = X + a
    if b in lst:
        if a > 0 and b > 0:
            print(int(a**(1/5)), int(b**(1/5)))
        elif a < 0:
            print(-1 * (int(abs(a)**(1/5))), int(b**(1/5)))
        elif b < 0:
            print(int(a**(1/5)), -1 * int(abs(b)**(1/5)))
        exit()

Submission status: Wrong Answer

Solution code:
import sys
import math

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

if x == 1:
    print(0, -1)
    sys.exit()
    
#factorization(x)

a = 0
b = -1
while a < x ** 2:
    if a**5 - b**5 == x:
        break
    a += 1
    b += 1
print(a, b)

Submission status: Wrong Answer

Solution code:
def main():
    X=int(input())
    for x in range(-1000,-1000):
        for y in range(-1000,1000):
            if x**5 - y**5 == X:
                print(x,y)
                exit()

main()

Submission status: Wrong Answer

Solution code:
N = int(input())
i = int(N ** 0.2)
for j in range(i):
	if N - j**5 == j**5:
		print(str(i) + " " + str(j))
		break
	else:
		j = j * -1
		if N - j**5 == j**5:
			print(str(i) + " " + str(j))
			break
print(str(i) + " " + str(j))

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

facts = factorization(x)

for fact in facts:
    c = fact[0]
    for i in range(1, c+1):
        if i**5 + (c-i)**5 == x:
            print(i, i-c)
            break

Submission status: Wrong Answer

Solution code:
import sys

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

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

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

def main():
    X = int(input())
    if X == 1:
        print(1,0)
        exit()
    soinsu = trial_division(X)
    soinsu = list(set(soinsu))
    A = 0
    for s in soinsu:
        while True:
            A += 1
            B = A - s
            if keisan(A,B) > X //s:
                break
            if A**5 - B**5 == X:
                print(A,B)
                exit()

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

x = int(readline())
for i in range(-1000, 1000):
    i **= 5
    for j in range(-1000, 1000):
        if i == j ** 5 + x:
            print(i, j)
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

AA = 0
BB = 0

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

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

print(AA,BB)

Submission status: Wrong Answer

Solution code:
X = int(input())
A = 0
B = 0

for a in range(int(X ** 0.25 - 1), X + 1):
    b = - (X - a ** 5) ** 0.2

    if b.imag == 0.0 and b == int(b):
        A = a
        B = b
        break

print(str(A) + " " + str(int(B)))

Submission status: Wrong Answer

Solution code:


def sovle_odd(X):
    max = 3000
    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 = 3000
    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())
for i in range(-math.ceil(x**0.5), math.ceil(x**0.5), 1):
    b = (x+i**5)**0.2
    try:
        if b % 1 == 0:
            print(int(b), i)
            break
    except:
        pass

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 1
y = 0
while x**5 < n:
	y = (n - x**5);
	y = int(y)
	if (x**5 + y**5 == n):
		print(x, -1 * y, sep = " ");
		break
	x+=1
if (x**5 + y**5 != n):
	i = 1
	while(i <= 200):
		if (n % i == 0):
			j = 0;
			ok = False;
			while((i+j)**5 - j**5 <= n):
				if (i+j)**5 - j**5 == n:
					print(i+j,j, sep = ' ');
					ok = True;
					break;
				j+=1
		i+=1
		if (ok == True):
			break;

Submission status: Wrong Answer

Solution code:
# coding: utf-8

X = int(input())
flg = 0
for A in range(-100, 100):
    for B in range(-80, 80):
        if A ** 5 - B ** 5 == X:
            print(f"{A} {B}")
            flg = 1
            break
    if flg:
        break

Submission status: Wrong Answer

Solution code:
# D - I hate Factorization

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

div = make_divisors(X)

for d in div:
    i = 1
    j = i-d
    while True:
        if pow(i,5)-pow(j,5)<X:
            i += 1
            j += 1
            continue
        if pow(i,5)-pow(j,5)==X:
            print(i,j)
            break
        elif pow(i,5)-pow(j,5)>X:
            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
    ggg = []
    for i in range(2,int(x**(1/2)+10)):
        if x%i==0:
            ggg.append(i)

    ggg.append(x)

    # 両方＋
    for i in ggg:
        for j in range(10**9):
            b = j
            a = b+i
            clc = a**5 - b**5
            # print(a,b,clc)
            if clc == x:
                print(a,b)
                return
            if clc > x:
                break
    # b-
    for i in ggg:
        for j in range(i):
            b = -i+j
            a = b+i
            clc = a**5 - b**5
            # print(a,b,clc)
            if clc == x:
                print(a,b)
                return
            if b**2 > x:
                break

if __name__ == "__main__":
    main()

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)
    divisors.sort()
    return divisors
d = make_divisors(X)
for i in range(len(d)):
    m = d[i]
    n = d[-i-1]
    r = np.roots([5,10*m,10*(m**2),5*(m**3),(m**4-n)])
    for j in range(len(r)):
        a = np.round(np.roots([5,-10*m,10*(m**2),-5*(m**3),(m**4-n)])[j].real,decimals=3)
        if a.is_integer():
            b = a - m
            print(int(a),int(b))
            break

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append((i, n//i))
    if sort:
        d.sort()
    return d


X = I()
for p, q in divisors(X):
    for a in range(p + 1):
        b = a - p
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit(0)
        elif b ** 5 - a ** 5 == X:
            print(b, a)
            exit(0)

Submission status: Wrong Answer

Solution code:
import sys
import math

X = int(input())

# X = 33

# 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 a**5 - b**5 == X:
            print(a, b)
            sys.exit(0)

Submission status: Wrong Answer

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


@jit
def solver(X):
    sol = []
    i = 2
    while i <= math.sqrt(X)+1:
        if X % i == 0:
            sol.append(i)
        i += 1
    return sol


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


for j in sol:
    s = 0
    t = 0
    while (s ** 5 - t ** 5) <= X:
        if (s ** 5 - t ** 5) == X:
            print(s, t)
            break
        else:
            s += 1
            t = s-j

Submission status: Wrong Answer

Solution code:
import math

X = int(input())
K = []

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
    
K = make_divisors(X)


for p in K:
    k = p

    ans = make_divisors(X//k)
    
    
    for i in range(len(ans)):
        A = ans[i]
        
        if A ** 5 - (A - k) ** 5 == X:
            print (A,A-k,sep = " ")
            exit()

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
for i in range(1,int(math.sqrt(x)+1)):
    if x % i==0:
        t=i
        w=x//i
        a=1
        while a<=t:
            b=t-a
            if a**5-b**5==x:
                print(a,b)
                exit()
            b=a-t
            if a**5-b**5==x:
                print(a,b)
                exit()
            a+=1

Submission status: Wrong Answer

Solution code:
x=int(input())
p=False
q=[]
for i in range(101):
  q.append(i**5)
r=100
a=0
b=0
l=0
while (r-l>=1):
  j=(l+r)//2
  if q[j]-x in q:
    a=int(q[j]**(1/5))
    b=int((q[j]-x)**(1/5))
  elif q[j]-x >= 50**5:
    r=i
  else:
    l=i+1
print(a,b)

Submission status: Wrong Answer

Solution code:


def sovle_odd(X):
    max = 1500
    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 = 3000
    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:
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)
ok = False

for i in range(1, 2 ** len(cands)):
    ls = 1
    for j in range(len(cands)):        
        if (i >> j) &1 == 1:
            ls *= cands[j]
    for a in range(1, ls + 1):
        b = a - ls
        if func(a, b) == x:
            print(a, b)
            ok = True
        break
    if ok:
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(-1000,1001):
    b = int(pow(a,5))+x
    if b<0:
        continue
    b = pow(b,1/5)
    if b==int(b):
        if int(pow(a,5) - int(pow(b,5))) == x:
            print(a,int(b))
            break
        elif int(pow(b,5) - int(pow(a,5))) == x:
            print(int(b),int(a))
            break

Submission status: Wrong Answer

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

a=0
b=0
for a in range(64):
	b=((a**5)-X)**0.2
	if type(b)==int:
		break
	else:
		a=a+1
		
print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
key = x % 5
x = 0
y = 0
is_true = False
for a in range(-key, key+1):
    for b in range(-key, key+1):
        A = a ** 5
        B = b ** 5
        # print([A, B])
        # print([a, b])
        if a != b and A - B == x:
            print(A, B)
            is_true = True
            break
        # elif a != b and A + B == x:
        #     x, y = A, -(B)
        #     is_true = True
        #     break
        # elif a != b and -(A + B) == x:
        #     x, y = -(A), B
        #     is_true = True
        #     break
    if is_true:
        break

# print(x, y)

Submission status: Wrong Answer

Solution code:
x = int(input())

[a,b] = [0,0]
for i in range(-500,501):
    for j in range(-500,501):
        if i**5 - j**5 == x:
            a = i
            b = j
            break

print([a,b])

Submission status: Wrong Answer

Solution code:
import os

def main():
	x = int(input())
	b = 0 
	a = 0
	while(x + b**5 != a):
		b -= 1
		if b == 100:
			a += 1
			b = 0
	print(1,b)
			


if __name__ == "__main__":
	main()

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

yakusuu = make_divisors(x)

for i in yakusuu[:len(yakusuu)//2+1]:
    y = int(x/i)
    if (y-i)%2 == 0:
        print(i+(y-i)//2,(y-i)//2)

Submission status: Wrong Answer

Solution code:
x=int(input())
tmp=0
if x >= 0:
  a=round(pow(x, 0.2))
  while x>a**5:
    if pow(x-a**5, 0.2).is_integer():
      tmp=1
      b=-1*int(pow(x-a**5, 0.2))
      break
    a+=1
  if tmp==0:
    b=int(pow(a**5-x, 0.2))
else:
  b=round(pow(-x, 0.2))
  while -x>b**5:
    if pow(-x-b**5, 0.2).is_integer():
      tmp=1
      a=-1*int(pow(-x-b**5, 0.2))
      break
    b+=1
  if tmp==0:
    a=int(pow(b**5+x, 0.2))
print(a, b)

Submission status: Wrong Answer

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

y = ceil(10 ** 1.8)
s = -ceil(10 ** 1.8)
t = -ceil(10 ** 1.8)

a = 0
b = 0

while s < y:
    t = -y
    while t < y:
        if s ** 5 - t ** 5 == x:
            a = int(s)
            b = int(t)
        t += 1
    s += 1

print(a, b)

Submission status: Wrong Answer

Solution code:
X = int(input())
C = 0
for i in range (10**9):
  if i**5 > X:
    C = i-1
    break
  else:
    continue

for i in range(C+1):
  B = round((X-(C-i)**5)**(1/5))
  if (C-i)**5 + B**5 ==X:
    A = C-i
    B = -B
    print(A, B)
    break
  else:
    continue
    
for i in range(10**9):
  if (i+1)**5-i**5 >X:
    C  = i
    exit()
  else:
    continue

    
for i in range(C+1):
  B = round(((C-i)**5-X)**(1/5))
  if (C-i)**5 - B**5 ==X:
    A = C-i
    B = B
    print(A, B)
    break
  else:
    continue

Submission status: Wrong Answer

Solution code:
from math import pow, floor
X = int(input())
print(floor(pow(X-1, 1.0/5.0)), -1)

Submission status: Wrong Answer

Solution code:
import itertools


X = int(input())
ans_A = 0
ans_B = 0
for i, j in itertools.combinations(range(0, 1000), 2):
    j *= -1
    if i**5 - j**5 == X:
        ans_A = i
        ans_B = j
        break
if ans_A == 0 and ans_B == 0:
    for i, j in itertools.combinations(range(0, 1000), 2):
        if i**5 - j**5 == X:
            ans_A = i
            ans_B = j
            break
print(ans_A, ans_B)