Problem:


Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

a = 0
a_list = []
b = 0
b_list = []
c = 0
c_list = []

while a ** 5 < 10 ** 10:
  a_list.append(a)
  a += 1
  b_list.append(b)
  b -= 1
  c_list.append(c)
  c += 1


for i in a_list:
  for j, k in zip(b_list, c_list):
    if(i ** 5 - j ** 5 == x):
      print(i, j)
      sys.exit()
    elif(i ** 5 - k ** 5 == x):
      print(i, k)
      sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

q = 0
while abs(x) > q**5:
  q += 1

deta = False
for A in range(-q, q+1):
  if deta:
    break
  for B in range(-q, q+1):
    if A**5 - B**5 == x:
      print(A,B)
      break

Submission status: Wrong Answer

Solution code:
#! python3
import sys
def main():
    x = int(input())
    xx = int(x ** (1/5))

    alist = list(range(-xx, xx+1))

    for i in alist:
        a = int(i)
        for u in alist:
            b = int(u)
            if a -b != 0:
                if x % (a - b) == 0:
                    if (a**5 - b**5) == x:
                        print(a, b)
                        sys.exit()


main()

Submission status: Wrong Answer

Solution code:
X = int(input())

num = [i ** 5 for i in range(100)]

for A in range(100):
    for B in range(100):
        if num[A] + num[B] == X:
           print(A, B*(-1))
           exit(0)

print("end")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(80,-80,-1):
  for j in range(-80,80):
    if pow(i,5)-pow(j,5)==N:
      print(i,j)
      break
  else:
    continue
  break

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の約数
        q_lis|={xx}
    for q in list(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
        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:
X = int(input())
A = [i for i in range(0, 1000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(A)):
    b = -A[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      print(a, b)
      exit()

Submission status: Wrong Answer

Solution code:
import itertools
X=int(input())
#li=[i**5 for i in range(int(X**0.2+1))]
#li=[i**5 for i in range(64)]#
li=[i**5 for i in range(128)]#
print(li)
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
#ans=(i-j)*(i**4+(i**3)*j+(i**2)*(j**2)+i*(j**3)+j**4)
#(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋小さい

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(-1*int(1E5),int(1E5)):
  a = i**5
  y = abs(a-x)
  flg,num = trial_division(y)
  if flg:
    if a-x>=0:
      print(str(i)+' '+str(num))
    else:
      print(str(i)+' '+str(-1*num))
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

base = 0

count = 1
aa = [0,]
while X > base:
  base = count ** 5
  aa.append(base)
  count += 1

# print(aa)

answer = []

next = aa.pop()
# print(next)

A = len(aa) - 1
A5 = aa[len(aa) - 1]
# print(A, A5)
for i in range(0, A+1):
  if A5 + aa[i] == X:
    answer.append("{} {}".format(A, -i))

if answer:
  print(answer[0])
else:
  A += 1
  aa.append(next)
  for i in range(0, A+1):
    if next - aa[i] == X:
      print(A, i)

Submission status: Wrong Answer

Solution code:
X = int(input())

N = []
for i in range(66):
    N.append(i**5)

for i in reversed(range(40)):
    for j in reversed(range(i)):
        if X == N[i] - N[j]:
            print(i, j)
            break
        if X == N[i] + N[j]:
            print(i, j * -1)
            break

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())
A, B = 0, 0
p = prime_factorize(X)
if(X == 1):
    print(0, -1)
    exit(0)
for i in range(len(p)):
    for j in range(-100000, 100000):
        B = j
        A = p[i] + B
        R = A**4 + (A**3) * B + (A**2) * (B**2) + A * (B**3) + B**4
        if((A - B) * R == X):
            print(A, B)
            exit(0)

Submission status: Wrong Answer

Solution code:
X = int(input())

#x^5-y^5=(x-y)(x^4+x^3y+x^2y^2+xy^3+y^4)

#for x in range(1, 121):
#  if ((x**5) - ((x-1)**5)) >= 1000000000:
#    print(x)

for a in range(-121, 121):
  for b in range(-10, 120):
    if b**5 == a**5-X:
      print(a, b)
      break

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = [i**5 for i in range(100)]
for i in ans:
    for j in ans:
        if i - j == x:
            print(ans.index(i), ans.index(j))
            exit()
        if i + j == x:
            print(ans.index(i), -ans.index(j))
            exit()

Submission status: Wrong Answer

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

factor = factorization(X)
if X == 1:
    print(0, -1)
else:
    for i in factor:
        for j in range(i[1]):
            A = i[0] ** (j+1)
            b = A * -1
            for k in range(A*2):
                a = A + b
                try:
                    if X % (a + b) == 0 and X % (a - b) == 0 and a != 0 and b != 0:
                        if a ** 5 - b ** 5 == X:
                            print(a, b)
                            end = True
                            break
                except:
                    pass
                b += 1
            if end :
                break
        if end :
            break

Submission status: Wrong Answer

Solution code:
x = int(input())

def fun(x):

    res = []

    for a in range(-100, 100):
        for b in range(-100, 100):
            mult = a**5 - b**5
            if mult == x:
                res = a, b
                break
    print(str(res)[1:-1])

fun(x)

Submission status: Wrong Answer

Solution code:
import sys
import math
input = sys.stdin.readline
X=int(input())
for i in range(10):
    B=5-i
    M=B**5+X
    if M>=0:
        A=math.pow(M,1/5)
        if A%1==0:
            print(int(A),end=" ")
            print(int(B))
            sys.exit()

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  
  a=int(n**(1/5))
  sa=0
  while True:
    b=abs(n-a**5)
    b1=b-sa
    b2=b+sa
    if b1==(b1**(1/5))**5:
      return str(a)+' '+str(-b1)
    if b2==(b2**(1/5))**5:
      return str(a)+' '+str(-b2)
    sa+=1

# main()
print(main())

Submission status: Wrong Answer

Solution code:
kai = int(input())
for x in range(-10,kai):
    for y in range(-10,kai):
        if x**5 - y**5 == kai:
            print(x,y)

Submission status: Wrong Answer

Solution code:
import math
x=int(input())
end=0
for i in range(1,63):
    check1=int(math.pow( i+1, 5 )*100000)/100000
    check2=int(math.pow(i-1,5)*100000)/100000
    if check2<x<check1:
        m=x
        m=m-pow(i,5)
        if m<0:
            m=-m
            end=1
        b=int(math.pow(m,1/5)*100000)/100000
        out=int(b)
        if out<b<out+1:
            end=0
        if out==b:
            break
print(i,end=' ')
print(out)

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(-100, 100):
    A = pow(i, 5)
    for j in range(-100, 100):
        B = pow(j, 5)
        if A-B == X:
            print(i, j)
            exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

# for b in range(65, -64, -1):
for b in range(1000000, -1000000, -1):
    a = (X + b**5)**0.2
    # print('b a', b, a)
    if type(a) == complex:
        if a.imag != 0:
            continue
        print(int(a.real), b)
    elif a.is_integer():
        print(int(a), b)

Submission status: Wrong Answer

Solution code:
X=int(input())
N=10**3
L=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(i):
    L[i][j]=i**5-j**5
C=[]
M=[[0 for i in range(N)] for i in range(N)]
for i in range(N):
  for j in range(N):
    M[i][j]=i**5+j**5
for i in range(N):
  for j in range(i):
    if L[i][j]==X:
      C.append([i,j])
for i in range(N):
  for j in range(N):
    if M[i][j]==X:
      C.append([i,-j])
print(C[0])

Submission status: Wrong Answer

Solution code:
X = int(input())

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

def gen_candidates(divisor):
    a = 0
    while True:
        a = a + 1
        b = a - divisor
        tmp = a**5 - b**5
        if  tmp == X:
            yield (a, b)
        elif tmp > X:
            break


for divisor in gen_divisor(X):
    for a, b in gen_candidates(divisor):
        print(a,b)
        break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
import itertools
x = int(input())
num = [i**5 for i in range(3000)]
ans= list(itertools.combinations_with_replacement(num, 2))
for i in ans:
    if abs(i[0]-i[1]) == x:
        if i[0] < i[1]:
            print(int(i[0]**0.2),int(i[1]**0.2)*-1)
        else:
            print(int(i[0]**0.2),int(i[1]**0.2))
        break
    elif i[0]+i[1] == x:
        print(int(i[0]**0.2),int(i[1]**0.2)*-1)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
ans = [i**5 for i in range(66)]
for i in ans:
    for j in ans:
        if i - j == x:
            print(ans.index(i), ans.index(j))
            exit()
        if i + j == x:
            print(ans.index(i), -ans.index(j))
            exit()

Submission status: Wrong Answer

Solution code:
import sys
from math import ceil, sqrt
def input(): return sys.stdin.readline().strip()


def main():
    X = int(input())
    x = int(X ** (1/5))
    if x == X ** (1/5):
        print("{} {}".format(x, 0))
        return
    
    for B in range(1, x + 1):
        A = (X - B**5) ** (1/5)
        if A < B: break
        if int(A) == A:
            print("{} {}".format(int(A), -B))
            return
    
    for d in range(1, ceil(sqrt(X))):
        if X % d == 0:
            B = 1
            while (B + d) ** 5  < B ** 5 + X:
                B += 1
            if (B + d) ** 5 == B ** 5 + X:
                print("{} {}".format(B + d, B))
                return



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def ff(n):
    if(n==0): return [0]
    if(n==1): return [1]
    ans=set([])
    i=2
    while(i*i<=n):
        if(n%i==0):
            ans.add(n//i)
            ans.add(i)
        i+=1
    return ans

x=int(input())
fx=ff(abs(x))
A=-1000000
B=-1000000
for f in fx:
    if(A!=-1000000 and B!=1000000): break
    for i in range(-100000,100000):
        b,a=i,i+f
        z=a**5-b**5
        if(z==abs(x)):
            A=a
            B=b
            break
if(x<0): A,B=B,A
print(A,B)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys


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


def check(d):
    for a in range(1, d + 1):
        b = a - d
        if Y[a] == Y[b] + X:
            print(a, b)
            sys.exit()


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

Submission status: Wrong Answer

Solution code:
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().rstrip())
for A in range(100):
    A_val = A ** 5
    val = A_val - X
    l = prime_factorize(val)
    minus_flg = False
    if -1 in l:
        l.remove(-1)
        minus_flg = True
    if (len(l) == 1 and l[0] in [-1, 1]) or (len(l) == 5 and len(set(l)) == 1):
        B = prime_factorize(val)
        val_B = B[0]
        if minus_flg:
            val_B = - val_B
        print(A, val_B)
        break

    val = - A_val - X
    l = prime_factorize(val)
    if (len(l) == 1 and l[0] in [-1, 1]) or (len(l) == 5 and len(set(l)) == 1):
        B = prime_factorize(val)
        print(B[0], -A)
        break

Submission status: Wrong Answer

Solution code:
thisNum = int(input())

for index in range(int(pow(thisNum, 1/5)) + 1) :

	thisA = pow(index, 5)
	thisB = pow(thisNum - thisA, 1/5).real

	thisBInt = int(thisB)
	if thisB == float(thisBInt) :
		print(str(int(thisA)) + ' ' + str(int(thisB)))
		break

Submission status: Wrong Answer

Solution code:
X = int(input())
b = 0
flag = True
while(flag):
  for i in range(1,X+1): 
    if(X % i == 0):
      print(i)
      if(pow(b+i,5)-pow(b,5) == X):
        print("%d %d"%(b+i,b))
        flag = False
        break
  b -= 1
  if(-pow(b,5) > X):
    b = int(X**(1/5))

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

a = 0
a_list = []
b = 0
b_list = []
c = 0
c_list = []

while a ** 5 < 10 ** 9:
  a_list.append(a)
  a += 1
  b_list.append(b)
  b -= 1
  c_list.append(c)
  c += 1


for i in a_list:
  for j, k in zip(b_list, c_list):
    if(i ** 5 - j ** 5 == x):
      print(i, j)
      sys.exit()
    elif(i ** 5 - k ** 5 == x):
      print(i, k)
      sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
def f(a,b):
    return pow(a,4) + b*pow(a,3) + pow(a*b,2) + a*pow(b,3) + pow(b,4)

def divisor(n):
    tank = []
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            tank.append(i)
    tank.append(n//tank[-1])
    return tank

lst = divisor(x)
for y in lst:
    for a in range(1, 10000):
        div = x//y
        
        b = a - y
        if f(a,b) == div:
            print(a, b)
            exit()
            
        b = a + y
        if f(a, b) == div:
            print(a,b)
            exit()

Submission status: Wrong Answer

Solution code:
X=int(input())

N=int(X**(0.5))
for i in range(N):
  for j in range(N):
    if i**5-j**5==X:
      print(i,j)
      break
    elif -i**5-j**5==X:
      print(-i,j)   
      break 
    elif i**5+j**5==X:
      print(i,-j)
      break
    elif -i**5+j**5==X:
      print(-i,j)
      break 
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
X = int(input())

#x^5-y^5=(x-y)(x^4+x^3y+x^2y^2+xy^3+y^4)

#for x in range(1, 121):
#  if ((x**5) - ((x-1)**5)) >= 1000000000:
#    print(x)

for a in range(0, 121):
  for b in range(-10, 120):
    if b**5 == a**5-X:
      print(a, b)
      break

Submission status: Wrong Answer

Solution code:
X=int(input())

for i in range(0,X):
  if (X+i)**0.2==int((X+i)**0.2) and i**0.2==int(i**0.2):
    print(int((X+i)**0.2),int(i**0.2),sep=" ")
    break
for i in range(1,X):
  if (X-i)**0.2==int((X-i)**0.2) and -i**0.2==int(-i**0.2):
    print(int((X-i)**0.2),int(-i**0.2),sep=" ")
    break

Submission status: Wrong Answer

Solution code:
X = int(input())

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
    X = int(input())
    for A in range(100):
        for B in range(100):
            if X == A**5 - B**5:
                print(A, B)
                return
            elif X == A**5 + B**5:
                print(A, -B)
                return

resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

# for b in range(65, -64, -1):
for b in range(1000000, -1000000, -1):
    a = (X + b**5)**0.2
    # print('b a', b, a)
    if type(a) == complex:
        if a.imag != 0:
            continue
        print(int(a.real), b)
        exit()
    elif a.is_integer():
        print(int(a), b)
        exit()

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
x = int(input())
l = 6201
for i in range(l):
    for j in range(l):
        if x == i ** 5 - (-j) ** 5:
            print(i, -j)
            exit()

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    for i in range(-10**4,10**4,2):
        for j in range(10**4 + 1,-10**4,-2):
            if i == j:
                continue
            if X % (i - j) == 0:
                if (i-j) * (pow(i,4) + pow(i,3)*j + pow(i,2)*pow(j,2) + i*pow(j,3) + pow(j,4)) == X:
                    print(i,j)
                    exit()
if __name__ == '__main__':
  main()

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())
A, B = 0, 0
p = prime_factorize(X)
if(X == 1):
    print(0, -1)
    exit(0)
for i in range(len(p)):
    for j in range(-1000, 1000):
        B = j
        A = p[i] + B
        R = A**4 + (A**3) * B + (A**2) * (B**2) + A * (B**3) + B**4
        if((A - B) * R == X):
            print(A, B)
            exit(0)

Submission status: Wrong Answer

Solution code:
x = int(input())

q = 0
while abs(x) > q**5:
  q += 1

for A in range(-q, q+1):
  for B in range(-q, q+1):
    if A**5 - B**5 == x:
      print(A,B)
      break

Submission status: Wrong Answer

Solution code:
x = int(input())

lim = 1000000000
d = dict()
i = 0
cand = 0
while(cand <= lim):
    cand = i ** 5
    d[cand] = i
    i += 1

for k, v in d.items():
    if (x-k) in d:
        print(d[x-k], -k)
        break
    elif (x+k) in d:
        print(d[x+k], k)
        break

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, int(x**0.5)+2):
  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:
import math

X = int(input())

N = math.ceil(pow(abs(X), 0.2))
M = math.floor(pow(abs(X), 0.2))

a = pow(abs(pow(N, 5) - abs(X)), 0.2)

if a - math.floor(a) < 1e-6:
  a = float(math.floor(a))
if pow(N, 5) - abs(X) < 0:
  a = -a
  
b = pow(abs(pow(M, 5) - abs(X)), 0.2)
if b - math.floor(b) < 1e-10:
  b = float(math.floor(b))

if pow(N, 5) - abs(X) < 0:
  b = -b
  
if a.is_integer() == True and b.is_integer() == True:
  if X < 0:
    print(int(-N))
    print(int(-a))
  else:
    print(int(N))
    print(int(a))
elif a.is_integer():
  if X < 0:
    print(int(-N))
    print(int(-a))
  else:
    print(int(N))
    print(int(a))
    
elif b.is_integer():
  if X < 0:
    print(int(-M))
    print(int(b))
  else:
    print(int(M))
    print(int(-b))

Submission status: Wrong Answer

Solution code:
x = int(input())
def f(a,b):
    return pow(a,4) + b*pow(a,3) + pow(a*b,2) + a*pow(b,3) + pow(b,4)

def divisor(n):
    tank = []
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            tank.append(i)
    tank.append(n//tank[-1])
    return tank

lst = divisor(x)
for y in lst:
    for a in range(1, 500):
        div = x//y
        
        b = a - y
        if f(a,b) == div:
            print(a, b)
            exit()
            
        b = a + y
        if f(a, b) == div:
            print(a,b)
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(X):
    B = i**5
    B_ = (-1*i)**5
    A_pow = pow(X + B,1/5)
    A_minus_pow = pow(X + B_,1/5)
    if type(A_pow) is complex or type(A_minus_pow) is complex:
        continue
    if A_pow.is_integer():
        print(int(A_pow),int(B))
        break
    elif A_minus_pow.is_integer():
        print(int(A_minus_pow),int(B_))
        break

Submission status: Wrong Answer

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

num_list=[]
num=0
while num**5 <= x:
    num_list.append(num)
    num_list.append(num-num*2)
    num+=1

a=list(itertools.combinations(num_list,2))     
b=[]
for i in range(len(a)):
    if a[i][0]-a[i][1]!=0 and x % abs(a[i][0]-a[i][1]) ==0:
        b.append([a[i][0], a[i][1]])
        
for  i in range(len(b)):
    if b[i][0]**5 - b[i][1]**5==x:
        print(b[i][0], b[i][1], sep=' ')
        break
    elif b[i][1]**5 - b[i][0]**5==x:
        print(b[i][1], b[i][0], sep=' ')
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
import itertools


max_num = 70
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.permutations(num_list, 2))

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

Submission status: Wrong Answer

Solution code:
if __name__=='__main__':
    x = int(input())
    n = 0
    while x > n**5:
        n+=1
    for i in range(n+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:
N=int(input())

for i in range(-40,40):
  for j in range(-40,40):
    if pow(i,5)-pow(j,5)==N:
      print(i,j)
      break
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
X = int(input())
flag = 0
minB = -1*int(X**0.2)
for B in range(minB,10**6+1):
    Y = (X+B**5)**0.2
    if Y==int(Y):
        print(int(Y),B)
        break

Submission status: Wrong Answer

Solution code:
import sys
from math import ceil, sqrt
def input(): return sys.stdin.readline().strip()


def main():
    X = int(input())
    x = int(X ** (1/5))
    if x == X ** (1/5):
        print("{} {}".format(x, 0))
        return
    
    for B in range(1, x + 1):
        #print("B={}".format(B))
        A = (X - B**5) ** (1/5)
        if A < B: break
        if int(A) == A:
            #print("{} {}".format(int(A), -B))
            return
    
    for d in range(1, ceil(sqrt(X))):
        #print("d={}".format(d))
        if X % d == 0:
            B = 1
            while (B + d) ** 5  < B ** 5 + X:
                B += 1
            if (B + d) ** 5 == B ** 5 + X:
                print("{} {}".format(B + d, B))
                return



if __name__ == "__main__":
    main()

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(1E5)):
  a = i**5
  y = abs(a-x)
  flg,num = trial_division(y)
  if flg:
    if a-x>=0:
      print(str(i)+' '+str(num))
    else:
      print(str(i)+' '+str(-1*num))
    break

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
mylist= []
for i in range(65):
    mylist += [i**5]
    #print(i**5)
#print(mylist)


for m in mylist:
    for mm in mylist:
        #print(m,mm)
        if m - mm == X:
            print(mylist.index(m), mylist.index(mm))
            sys.exit()

        elif m + mm == X:
            print(mylist.index(m), -1*mylist.index(mm))
            sys.exit()
print('No')

Submission status: Wrong Answer

Solution code:
import numpy 
x = int(input())
max = 10**9+1
flag = False
for i in range(1,max):
    if x%i == 0:
        for j in range(0,i+1): 
            if (numpy.power(i-j,5,dtype=numpy.int64) - numpy.power(j,5,dtype=numpy.int64)) == x:
                print(str(i-j)+" "+str(j))
                flag = True
                break
            if (numpy.power(i+j,5,dtype=numpy.int64) - numpy.power(-j,5,dtype=numpy.int64)) == x:
                print(str(i-j)+" "+str(j))
                flag = True
                break
    if flag:
        break

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    f = [i**5 for i in range(-100,101)]
    ans = 0
    for i in range(-100,101):
        if ans:
            break
        for j in range(-101,100):
            if i**5 - j**5 == n:
                print(i,j)
                ans = 1
                break

if __name__ == '__main__':
    main()

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())
A, B = 0, 0
p = prime_factorize(X)
if(X == 1):
    print(0, -1)
    exit(0)
print(p)
for i in range(len(p)):
    for j in range(-1000, 1000):
        B = j
        A = p[i] + B
        R = A**4 + (A**3) * B + (A**2) * (B**2) + A * (B**3) + B**4
        if((A - B) * R == X):
            print(A, B)
            exit(0)

Submission status: Wrong Answer

Solution code:
x = int(input())

for a in range(0,x):
  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:
X = int(input())
for i in range(-30, 30):
    A = pow(i, 5)
    for j in range(-30, 30):
        B = pow(j, 5)
        if A-B == X:
            print(i, j)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
 
for a in range(1, 10**9):
    tmp = a**5 - x
    if (tmp <= 0):
        tmp *= -1
        b = (-1) * (tmp**(1/5))
    else:
        b = (tmp**(1/5))
    if(b == int(b)):
        print(a, int(b))
        break