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
def input(): return sys.stdin.readline().rstrip()
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def main():
    x=int(input())
    x_lis=make_divisors(x)
    q_lis=set()
    for xx in x_lis:#xの約数
        xx_lis=make_divisors(xx)
        for q in xx_lis:#xの約数の約数
            q_lis|={q}
    q_lis=list(q_lis)
    q_lis.sort()
    for q in q_lis:
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b+=1
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b-=1


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
x = int(stdin.readline().rstrip())

if x == 1:
    print(0,-1)

for i in range(1,x+1):
    if x%i==0:
        for a in range(i//2):
            b = a-i
            if int(a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4) * (a-b) == x:
                print(int(a), int(b))
                exit()

Submission status: Wrong Answer

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

#output
import math
left = 1
right = 10**2
while left + 1 < right:
    mid = (left + right)//2
    if mid **5  > X:
        right = mid
    else:
        left = mid

A = right
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

left2 = 1
right2 = A
while left2 + 1 < right2:
    mid2 = (left2 + right2)//2
    D = mid2**5 - X
    if D >= 0:
        E = pow(D, 1/5)
    else:
        E = -pow(-D, 1/5)
    if E.is_integer():
        right2 = mid2
    else:
        left2 = mid2
A = left2
C = A**5 - X
if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5) 
print(A, int(B))

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


x = int(input())
li = []
for i in range(-int(x**(1/5))-10,int(x**(1/5))+10):
    li.append(i)
for i in range(len(li)):
    for j in range(len(li)):
        if li[i]**5 - li[j]**5 == x:
            print(li[i],li[j])
            sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

kouho = make_divisors(x)

for i in kouho:
    for j in range(-i,i+1):
        if x % abs(j - (i-j))  == 0:
            if j**5-(i-j)**5 == x or (i-j)**5-j**5 == x:
                print(j,i-j)
                break

Submission status: Wrong Answer

Solution code:
x  = int(input())
a = 1
if x < 1:
    a += x
b = (-1) ** 4/5 * (a ** 5 - x) ** 1//5


print(a , int(b))

Submission status: Wrong Answer

Solution code:
x = int(input())

for a in range(1,int(x**(1/5))+1):
  b = (a ** 5 - x)
  if b < 0:
    b = -(abs(b)**(1/5))
  else:
    b = b**(1/5)
  if a**5-b**5==x:
     b = int(b)
     print(a,b,sep = ' ')
     break

Submission status: Wrong Answer

Solution code:
ans = int(input())
res = round(ans**0.2)

for i in range(-res, res+1):
    for j in range(-res, res+1):
        if j**5 - i**5 == ans:
            print(i,j)
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

CNT = 100

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

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def main():
    x=int(input())
    x_lis=make_divisors(x)
    q_lis=set()
    for xx in x_lis:#xの約数
        xx_lis=make_divisors(xx)
        for q in xx_lis:#xの約数の約数
            q_lis|={q}
    q_lis=list(q_lis)
    q_lis.sort()
    for q in q_lis:
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b+=1
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b-=1
            print(a,b)


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
x=int(input())

i=0
while True:
    sign=1
    b=(i**5-x)

    if b<0:
        sign=-1
    b=sign*((b*sign)**0.2)
    
    if b==int(b):
        print(i,int(b))
        break

    i+=1

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
if x % (2**5) == 0:
    print(2, 0)
else:
    if x < 2**5:
        b = int(x**(1/5))
        print(0, -b)
    else:
        a = math.floor(x**(1/5))
        print(a, -1)

Submission status: Wrong Answer

Solution code:
import itertools


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

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

Submission status: Wrong Answer

Solution code:
x = int(input())
i = x
a = (x -1)**0.2
b = (x +1)**0.2
if type(a) is float:
        if a == int(a):
            print(int(a),-1)
            exit()
if type(b) is float: 
        if b == int(b):
            print(int(b),1)

Submission status: Wrong Answer

Solution code:
import numpy as np
def main():
    l = 5000
    x = int(input())
    a = np.zeros([l], dtype=int)
    for i in range(l):
        a[i] = (i+1)**5
    b = np.array(a) - x
    
    pair = []
    for i in range(l):
        if np.abs(b)[i] in a:
            pair.append(i)

    aa = 0
    bb = 0
    for i in range(1, len(pair)):
        if a[pair[0]] - a[pair[i]] == x:
            aa = pair[0]+1
            bb = pair[i]+1
            break
        elif -a[pair[0]] - a[pair[i]] == x:
            aa = -(pair[0]+1)
            bb = pair[i]+1
            break
        elif a[pair[0]] + a[pair[i]] == x:
            aa = pair[0]+1
            bb = -(pair[i]+1)
            break
        elif -a[pair[0]] + a[pair[i]] == x:
            aa = -(pair[0]+1)
            bb = -(pair[i]+1)
            break
    
    print(aa, bb)

if __name__ == '__main__':
    main()

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==1:
            print(fifth_power.index(abs(x-fifth_power[i]))+1,i)
            break
        else:
            print(fifth_power.index(abs(x-fifth_power[i]))+1,-1)
            break

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    x = int(input())
    n = 0
    while x > (n+1)**5:
        n+=1
    for i in range(n):
        if n**5-i**5==x:
            print('{} {}'.format(n,i))
            break
        if (n-1)**5+i**5==x:
            print('{} {}'.format(n-1,-i))
            break

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

Solution code:
X=int(input())
A=1001
small=2
if X!=1:
    while True:
        if X%small==0:
            break
        small+=1
    for i in range(2010):
        B=A-small
        if (A**4+A**3*B+A**2*B**2+A*B**3+B**4 == X/(A-B)):
            break
        A-=1
    print(str(A)+" "+str(B))
elif X==1:
    print("0 -1")

Submission status: Wrong Answer

Solution code:
x=int(input())
fac = 0
mul = 0
for i in range(2,10**3):
    if x%i==0:
       fac = i
       break
if fac==0:
    fac=1
for a in range(1,10**5):
    b = a - fac 
    if a**5 - b**5 == x:
        ans=[a,b]
        print(*ans)
        exit()

Submission status: Wrong Answer

Solution code:
import sys, math


input = sys.stdin.readline

gets = lambda: input().rstrip()
getn = lambda: int(input())
getmul = lambda: (int(i) for i in input().split())
getlist = lambda: [int(i) for i in input().split()]

x = getn()

start = int(x ** (1 / 5))
solved = False

for b in range(start, start + 1000000):
    # print(b)
    b5 = b ** 5
    a5 = x + b5
    a = a5 ** (1 / 5)
    # print(b5, a5, a)

    try:
        a = int(a)
        if a5 == a ** 5:
            print(int(a), b)
            solved = True
    except:
        pass

    if solved:
        break
    a5 = x - b5
    a = a5 ** (1 / 5)
    try:
        a = int(a)
        if a5 == a ** 5:
            print(int(a), -b)
            solved = True
    except:
        pass

    if solved:
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

X = inputI()

def is_fiveroot(n):
  r = pow(abs(n),0.2) * n/abs(n)
  if pow(r,5) == n:
    return True,int(r)
  else:
    return False,int(r)
  
if is_fiveroot(X)[0]:
  print(is_fiveroot(X)[1],0)
  exit()
  
b = 0

while True:
  b += 1
  a = is_fiveroot(X+pow(b,5))
  if a[0]:
    print(a[1],b)
    exit()
  a = is_fiveroot(X-pow(b,5))
  if a[0]:
    print(a[1],-b)
    exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
A = int(X**(1/5)) + 3
while True:
    
    A -= 1
    B = (abs((A**5 - X) ** (5)) ** (1/5))
    if B.is_integer():
        print(A, int(-B))
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
for a in range(64):
  b=pow((pow(a,5)-x),0.2)
  if isinstance(b, complex):
    continue
  if int(b)==round(b,10):
    print(a,int(b))
    break

Submission status: Wrong Answer

Solution code:
import numpy
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

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

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

tmp = ans[0]**5 - ans[1]**5
if tmp != ans:
    ans[0], ans[1] = ans[1], ans[0]

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

Submission status: Wrong Answer

Solution code:
x = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors
    
div = make_divisors(x)

for c in div:
    if (c-1)**5 + 1 == x or 1 - (c-1)**5 == x:
        print(c-1, -1)
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
ok=0
for i in range(70):
    I=i**5
    for j in range(70):
        J=j**5
        if I-J==x:
            print(i,j)
            ok+=1
            break
        elif I+J==x:
            print(i,-j)
            ok+=1
            break
    if ok==1:
        break

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

# Aの数は10**4個ある
# そして二分探索する

nums = [0]
n = 0
while (((n + 1)**5) - (n**5)) <= X * 2:
    nums.append((n + 1)**5)
    n += 1
# print(nums)
ans = None
for num in nums:
    if X - num in nums:
        ans = (num, -(X - num))
        break
    elif X + num in nums:
        ans = (num, X + num)
        break
if ans:
    print(*ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
n=int(x**(1/5))
gojou=[0]*(n+1)
for i in range(n+1):
    gojou[i]=i**5

for i in range(n+1):
    for j in range(n+1):
        if gojou[i]-gojou[j]==x:
            print(i,j)
            break
        elif gojou[i]+gojou[j]==x:
            if i**5 - (-j)**5 == x:
                print(i,-j)
                break
        elif -gojou[i]-gojou[j]==x:
            print(-i,j)
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
import math

x_str = input()
x = int(x_str)

power_five_list = []

a = None
b = None

x_digit_num = len(x_str)

five_power_nums = []

i = 0
while True:
    i_power_five = int(math.pow(i, 5))

    # if (len(str(i_power_five)) == x_digit_num):
    #     five_power_nums_of_x_digit_num.append((i, i_power_five))
    # if (len(str(i_power_five)) == x_digit_num + 1):
    #     five_power_nums_of_x_digit_num_plus_one.append((i, i_power_five))
    if (len(str(i_power_five)) >= x_digit_num + 2):
        break
    else:
        five_power_nums.append((i, i_power_five))

    i += 1

for a, a_power_five in reversed(five_power_nums):
    for b, b_power_five in five_power_nums:
        if a_power_five - b_power_five == x:
            print("{0} {1}".format(a, b))
            exit(0)
        if a_power_five + b_power_five == x:
            print("{0} {1}".format(a, -1*b))
            exit(0)
        if - a_power_five - b_power_five == x:
            print("{0} {1}".format(-1*a, b))
            exit(0)
        if - a_power_five - b_power_five == x:
            print("{0} {1}".format(-1*a, -1*b))
            exit(0)

Submission status: Wrong Answer

Solution code:
# D

x = int(input())

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

if a**5 - b**5 != x and a**5 - (-b)**5 != x:
    a = int(x**(1/5))+1
    b = int(abs(x-a**5)**(1/5))
    if a**5 - b**5 == x:
        print(a,b)
    else:
        print(a,-b)
        
elif a**5 - b**5 == x:
    print(a,b)

else:
    print(a,-b)

Submission status: Wrong Answer

Solution code:
x = int(input())
A=[]
i=1
while i*i<=x:
  if x%i==0:
    A += [i, x//i]
  i += 1
for j in A:
  c= int((x/j*0.2)**(0.25))
  a = c
  while a**5-(a-j)**5 < x:
    a +=1
  else:
    if a**5-(a-j)**5 == x:
      print(a, a-j)
      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(A, B*(-1))
           exit(0)

Submission status: Wrong Answer

Solution code:
X = int(input())

b = -1
i = 0

while 1:
    a = i
    tmp = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
    ans = (a - b) * tmp
    if ans == X:
        break
    i += 1
    if ans > X:
        break
print(a, b)

Submission status: Wrong Answer

Solution code:
x=int(input())

b=0
while True:
    p,m=b, -b
    xp, xm = x+p**5, x+m**5
    if (xp**(0.2)).is_integer():
        if xp>=0:
            ansx=int(abs(xp)**(1/5))
        else:
            ansx=-1*int(abs(xp)**(1/5))
        ans=[ansx,p]
        break
    if (abs(xm)**(0.2)).is_integer():
        if xp>=0:
            ansx=int(abs(xm)**(1/5))
        else:
            ansx=-1*int(abs(xm)**(1/5))
        ans=[ansx,m]
        break
    b+=1

print(" ".join(list(map(str,ans))))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

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

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

Submission status: Wrong Answer

Solution code:
x = int(input())
a = 1
b = (x-a)**0.2
while b - int(b) != 0:
    a += 1
    b = (x-a)**0.2
print(a, int(b))

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:
from math import floor
x = int(input())
k = 1
for i in range(2,x+1):
    if x % i == 0:
        k = i
        break

for a in range(floor(x ** (1/5)),x):
    b = a - k
    if a**5 - b**5 == x:
        print(a, b)
        break

Submission status: Wrong Answer

Solution code:
X = abs(int(input()))
size = 100
L = [i**5 for i in range(size)]
if X == 0:
    print(0, 0)
for l in range(size):
    for m in range(l+1):
        if L[l] + L[m] == X:
            print(l, -m)
            exit(0)
        if L[l] - L[m] == X:
            print(l, m)
            exit(0)

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

def search():
    for b in range(10**10):
        #B^5 = A^5-X
        #A^5 = B^5+X
        for sign in [1,-1]:
            a_5 = (sign*b)**5 + X
            #print(a_5, sign*b, a_5 - b**5, X)
            candidate = factorization(abs(a_5))
            if len(candidate) == 1 and candidate[0][1]%5 == 0:
                #print(a_5 ** 0.2, b)
                print(candidate[0][0]**(candidate[0][1]//5), b)
                return
            

            

search()

Submission status: Wrong Answer

Solution code:
# Problem D - I hate Factorization

# 素因数分解
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

# input
X = int(input())

# initialization
f_list = factorization(X)
f_list = sorted(f_list, key=lambda x: x[0])

# count
ans = [0, 0]
is_ok = False
for f in f_list:
    tmp_num = f[0] ** f[1]
    tmp_num_2 = X // tmp_num


    for a in range(tmp_num, -1, -1):
        b = a - tmp_num
        if (a**4 + (a**3) * b + (a**2) * (b**2) + a*(b**3) + b**4)==tmp_num_2:
            ans[0] = a
            ans[1] = b
            is_ok = True
            break
    if is_ok:
        break

# output
print(" ".join(list(map(str, ans))))

Submission status: Wrong Answer

Solution code:
import math
def factorial(x):
    for a in range(-1, 9+1):
        for b in range(-1, 9+1):
            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:
x=int(input())
fac = 0
mul = 0
for i in range(2,10**3):
    if x%i==0:
       fac = i
       break
if fac==0:
    fac=1
print(fac)
for a in range(1,10**5):
    b = a - fac 
    if a**5 - b**5 == x:
        ans=[a,b]
        print(*ans)
        exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
ansa = 1
ansb = 1
for i in range(-10**6,10**6):
    a = (X + i**5)**(1/5)
    if isinstance(a, complex):
        pass
    else:
        a = float(a)
        if a.is_integer() == True:
            ansa = int(a)
            ansb = i
        break
print(str(-1*ansb) + ' ' + str(-1*ansa))

Submission status: Wrong Answer

Solution code:
def main():
    x=int(input())
    for i in range(-90, 90):
        for j in range(-90,90):
            if  i*i*i*i*i-j*j*j*j*j==x:
                print(i, j)
                return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
try:
    x=int(input())
    for i in range(x):
        temp1=(x+i**5)**0.2
        temp2=(x+-1*(i**5))**0.2
        if(int(temp1)==temp1):
            print(int(temp1),i)
            break
        if(int(temp2)==temp2):
            print(int(temp2),-1*i)
            break
except Exception:
    pass

Submission status: Wrong Answer

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

X = int(input())

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

Submission status: Wrong Answer

Solution code:
x=int(input())

if x==1:
    print(0,-1)
elif x<100:
    n=[]
    for i in range(x-1):
        if x%(i+2)==0:
            n.append(i+2)

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

else:
    n=[]
    for i in range(100):
        if x%(i+2)==0:
            n.append(i+2)

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

Submission status: Wrong Answer

Solution code:
x = int(input())

ichi = str(x)
ichi = int(ichi[-1])

for i in range(100000):
  test = -(ichi - i)
#  print(test**5 - i**5)
  if test**5 - i**5 == x:
    print(test, i)
    break
  elif (-1*test)**5 - (-1*i)**5 == x:
    print(-1*test, -1*i)
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
a=[]
for i in range(0,1000):
  a.append(i**5)
for i in range(0,len(a)):
  for j in range(i,len(a)):
    if((a[i]**5+x)==a[j]):
      print(j,i)
      i=len(a)-1
    elif((x-a[i]**5)==a[j]):
      print(j,-i)
      i=len(a)-1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor, pow

X = int(input())
A = floor(pow(X, 0.2))
B5 = A**5 - X
for B in range(-A, A):
    if B**5 == B5:
        print(A, B)
        break

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import queue
# import heapq


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


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


def main():
    print(*solve())


def solve():
    X = int(input())
    facts = factorization(X)

    f0 = facts[0][0]
    f1 = X // f0

    for a in range(10**7):
        b = f0 + a
        if r(a, b) == f1:
            return a, b

        a = -a
        b = f0 + a

        if a < b:
            a,b = b,a

        if r(a, b) == f1:
            return a, b


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def main():
    x=int(input())
    x_lis=make_divisors(x)
    q_lis=set()
    for xx in x_lis:#xの約数
        xx_lis=make_divisors(xx)
        for q in xx_lis:#xの約数の約数
            q_lis|={q}
    q_lis=list(q_lis)
    q_lis.sort()
    for q in q_lis:
        a=0
        b=a-q
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b+=1
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b-=1


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

a = 0
b = 0
while a ** 5 < x:
    a += 1
a -= 1

b = -(x - a ** 5)

f = False
if b < 0:
    b = -b
    f = True
    
for i in range(5):
    b = math.sqrt(b)

if f == True:
    b = -int(b)
print(a , int(b))

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

def search():
    for b in range(10**3):
        #B^5 = A^5-X
        #A^5 = B^5+X
        for sign in [1,-1]:
            a_5 = (sign*b)**5 + X
            #print(a_5, sign*b, a_5 - b**5, X)
            candidate = factorization(abs(a_5))
            if len(candidate) == 1 and candidate[0][1]%5 == 0:
                #print(a_5 ** 0.2, b)
                print(candidate[0][0]**(candidate[0][1]//5), b)
                return
            

            

search()

Submission status: Wrong Answer

Solution code:
#coding: utf-8
from math import ceil, floor
X = int(input())
a = 0
a2 = -a
def sign(v):
    if v < 0:
        return -1
    else:
        return 1
def counter(a):
    v = a * sign(a)
    for i in range(1, int(v**0.5)+1):
        if v % i == 0:
            if v == i**5:
                return True
    return False
while True:
    a2 = -a
    b = (a**5 - X)
    b2 = (a2**5 - X)
    if counter(b):
        if a**5 - b == X:
            print(a, int(abs(b)**(1/5))*sign(b))
            quit()
    if counter(b2):
        if a2 ** 5 - b2 == X:
            print(a2, int(abs(b)**(1/5))*sign(b2))
            quit()
    # if abs(b)**(1/5) == int(abs(b)**(1/5)):
    #     if a**5 - b == X:
    #         print(a,int(abs(b)**(1/5)) * sign(b))
    #         exit()
    # if abs(b2)**(1/5) == int(abs(b2)**(1/5)):
    #     if a2**5 - b2 == X:
    #         print(a2, int(abs(b2)**(1/5)) * sign(b2))
    #         exit()
    a += 1

Submission status: Wrong Answer

Solution code:
import itertools


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

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

Submission status: Wrong Answer

Solution code:
X=int(input())

arr=[]
arr3=[]
for i in range(0,640):
    arr.append(i**5)
    arr3.append(i)
    arr.append(-i**5)
    arr3.append(-i)

arr2=[]
import itertools
l=itertools.combinations_with_replacement(arr,2)
for i in l:
    arr2.append(i[0]-i[1])
arr2=arr2[1:]

A=arr2.index(X)//len(arr)
B=arr2.index(X)%len(arr)
print(arr3[A],arr3[B])

Submission status: Wrong Answer

Solution code:
x=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n // i:
                divisors.append([i,n//i])
            else:
                divisors.append([i,i])
    return divisors
l=make_divisors(x)
for x,y in l:
    for i in range(10**2):
        p=i-x
        if i**4+(i**3)*p+(i**2)*(p**2)+i*(p**3)+p**4==y:
            print(i,p)
            break