Problem:


Score : 400 points

Problem Statement

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

Constraints

1 \leq X \leq 10^9

X is an integer.

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

Input

Input is given from Standard Input in the following format:

X

Output

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

A B

Sample Input 1

33

Sample Output 1

2 -1

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

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Wrong Answer

Solution code:
X = int(input())

def factorization(n):
    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)

    if temp!=1:
        arr.append(temp)

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

    return arr
    
fact_ls = factorization(X)

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

Submission status: Wrong Answer

Solution code:
x = int(input())

import math
def trial_division(n):
    #素因数を格納するリスト
    num_list = []
    factor = set(num_list)
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.add(num)
    #リストが空ならそれは素数
    if not factor:
        return [1]
    else:
        factor.add(n)
        return factor


for number in trial_division(x):
  for a in range(round(x/number)):
    b = a - number
    if a**5 - b**5 == x:
      print(a,b)
      break
    elif a**5 - (-b)**5==x:
      print(a,-b)
      break

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table
def main():
  sFlag=False
  X= int(input())
  X_table=prime_decomposition(X)
  X_table.append(1)
  for i in range(X//2):
    A=i
    for j in range(len(X_table)):
      B=A-X_table[j]
      X_n=A**5-B**5
      if(X_n==X):
        print(A,B)
        sFlag=True
        break
    if(sFlag==True):
      break

if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(100001):
    val1=i**5
    if val1>x:
        num1=val1-x
    else:
        num1=x-val1
    g1=num1**(1/5)
    if g1==int(g1):
        if val1>x:
            print(i,end=" ")
            print(int(g1))
        else:
            print(i,end=" ")
            print(int(0-g1))
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
top = int(x**0.5)+1
A = 0
B = 0
flag = False

divs = []
for i in range(1, top):
    if x % i == 0:
        divs.append(i)

for d in divs:
    if flag:
        break
    for i in range(-d, d+1):
        a = i
        b = a - divs[-1]
        if a**5 - b**5 == x:
            A = a
            B = b
            flag = True
            break

print(A, B)

Submission status: Wrong Answer

Solution code:
import math

X = int(input())

for i in range(int(math.sqrt(X))+1):
  if X % (i + 1) == 0:
    A_B = i + 1
    for A in range(i+1):
      B = A - A_B
      C = (A ** 4) + (A ** 3) * B + (A ** 2) * (B ** 2) + A * (B ** 3) + (B ** 4)
      if A_B * C == X:
        print("{} {}".format(A,B))
        break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
X=int(input())

N=int((X*2)**(0.2))+1
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:
import bisect
from itertools import combinations

X = int(input())

gojou_list = [i ** 5 for i in range(80)]
X_index = bisect.bisect(gojou_list, X)

start = 0 if X_index < 5 else X_index - 5
end = 80 if X_index + 5 > 80 else X_index + 5

for i, v in combinations(gojou_list, 2):
    i_base = gojou_list.index(i)
    v_base = gojou_list.index(v)
    if i + v != X:
        continue
    if (i * -1) - v == X:
        print(i_base * -1, v_base)

    elif i - (v * -1) == X:
        print(i_base, v_base * -1)

    elif (i * -1) - (v * -1) == X:
        print(i_base * -1, v_base * -1)

    elif i - v == X:
        print(i_base, v_base)

    elif (v * -1) - i == X:
        print(v_base * -1, i_base)

    elif v - (i * -1) == X:
        print(v_base, i_base * -1)

    elif (v * -1) - (i * -1) == X:
        print(v_base * -1, i_base * -1)

    elif v - i == X:
        print(v_base, i_base)

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)

    divisors.sort()
    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:
        ans.sort(reverse=True)
        tmp = ans[0]**5 - ans[1]**5
        if tmp == X: break

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

Submission status: Wrong Answer

Solution code:
import bisect

D = 2000

X = int(input())

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

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

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

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

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

Submission status: Wrong Answer

Solution code:

import math


def fact(x):
    for cand in range(2, math.ceil(math.sqrt(x)) + 1):
        q, r = divmod(x, cand)
        if r == 0:
            return min(q, cand), max(q, cand)
    return 1, x


# def check(a, b):
#     a2 = a * a
#     a3 = a2 * a
#     a4 = a3 * a
#     b2 = b * b
#     b3 = b2 * b
#     b4 = b3 * b
#     return a4 + a3*b + a2*b2 + a*b3 + b4

def pow5(x):
    return x ** 5


def func(a, b):
    return pow5(a) - pow5(b)


def submit():
    x = int(input())

    if x == 1:
        print("0 -1")
        return

    q1, q2 = fact(x)
    # パターン2 a > 0, b < 0
    a = q1
    b = 0
    f = func(a, b)
    while a > 0 and f > x:
        a -= 1
        b -= 1
        f = func(a, b)
    if f == x:
        print("{} {}".format(a, b))
        return

    # パターン1, a, b > 0
    a = q1
    b = 0
    f = func(a, b)
    while f < x:
        a += 1
        b += 1
        f = func(a, b)
    if f == x:
        print("{} {}".format(a, b))
        return


        
submit()

Submission status: Wrong Answer

Solution code:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys
from math import ceil


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    sq = [i**5 for i in range(120)]
    for i in range(1, 120):
        i5 = sq[i]
        for j in range(-i, i+1):
            j5 = sq[j] if j >= 0 else -sq[-j]
            if i5-j5 == x:
                return f"{i} {j}"
        if i == 3:
            break


if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
X = int(input())

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

nums = [0]
n = 0
while (((n + 1)**5) - (n**5)) <= 10 ** 10:
    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:
X=int(input())
for i in range(0,1000):
    for j in range(-100,101):
        if i**5-j**5==X:
            print(str(i)+" "+str(j))
            break
    else:
        continue
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())

a=0
b=0
for i in range(100):
    a=i
    for j in range(-50,50):
        b=j
        if (a**5)-(b**5)==x:
            break
    else:
        continue
    break

print(a,b)

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(1, 121):
  for b in range(-1000, 120):
    if b**5 == a**5-X:
      print(a, b)
      break

Submission status: Wrong Answer

Solution code:
x=int(input())
a=0
b=0
t=0
while a**5<x:
    while b**5<x:
        if a**+b**5==x:
            print(a,-b)
            t=1
            break
        if -a**5-b**5==x:
            print(-a,b)
            t=1
            break
        b+=1
    if t==0:
        break
    a+=1

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(1,10**9):
    b = pow(n - i, 1/5)
    if float.is_integer(b):
        break

print(i,int(-b))

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
i=0
s=2
ans1 =0
ans2 =0
while (i**5<=10**10):
    t.append(i**5)
    i+=1
print(t)
for j in t:
    if(N + j) in t:
        ans1 = j
        ans2 = N + j
        s = 0
        break
    elif(N-j) in t:
        ans1 = -j
        ans2 = N - j
        s = 1
        break
if(s==0):
    ans3 = t.index(j) 
    ans4 = t.index(ans2)
else:
    ans3 = (t.index(j))*(-1)
    ans4 = t.index(ans2)
print(ans4,ans3)

Submission status: Wrong Answer

Solution code:
X=int(input())

for a in range(-100,100,1):
  for b in range(-100, 100,1):
    if a**5==b**5+X:
      print(a,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)

for i in range(A):
    if B.is_integer():
        break
    else:
        A -= 1
        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 numpy as np

x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 100):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = int(J**(0.2))*(np.sign(j))
            break
        k += 1
print(str(A) + ' ' + str(B))

Submission status: Wrong Answer

Solution code:
x = int(input())

lower = -1
upper = -1
for i in range(10000):
    pow5 = pow(i, 5)
    if lower == -1 and pow5 >= x:
        lower = i - 1

    if upper == -1 and pow5 - pow(i-1, 5) >= x:
        upper = i
        break

for a in range(lower, upper+1):
    a5 = pow(a, 5)
    for b in range(-a-1, a+1):
        if a5 - pow(b, 5) == x:
            print(a, b)
            exit(0)

    a5n = -a5
    for b in range(upper):
        if a5n - pow(-b, 5) == x:
            print(-a, -b)
            exit(0)

# 0, 0
print(0, 0)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

A = []

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

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

Submission status: Wrong Answer

Solution code:
import itertools
x = int(input())
num = [i**5 for i in range(5000)]
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())
start = int(pow(x,0.2))
for i in range(-start,start):
    k = pow(x + pow(i,5),0.2)
    k = round(k,6)
    if type(k) != type(1+1j) and pow(int(k),5) - pow(i,5) == x:
        print(int(k),i)
        exit()

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 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)
if ans == 1:
  a.append(1)

for i in range(10**3):
  x = i
  y = x-a[0]
  if x**5 - y**5 == ans:
    print(x,y)
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
for A in range(-65, 65):
    for B in range(-65, 65):
        if (A**5-B**5) == X:
            print("%d %d"%(A,B))
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
from collections import deque
from math import *

def main():
    X=int(input())
    for i in range(X):
        if (pow(i,5)==X-1):
            print(str(i)+" "+str(-1))
            exit()
        
   
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
X = int(input())
if X == 0:
    print(0,0)
    exit()
for i in range(0,10000):
    for j in range(0,10000):
        if i!=j and X % abs(i-j) == 0:
            if i**5 - j**5 ==X:
                print(i,j)
                exit()
            if i**5 + j**5 ==X:
                print(i,-j)
                exit()
            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())

for a in range(x,0,-1):
    b=(a**5-x)
    if b<0:
        b=-(round(abs(b)**(1/5),7))
        if b.is_integer():
            b=int(b)
            print("{} {}".format(a,b))
            exit()

    else:
        b=(round(abs(b)**(1/5),7))
        if b.is_integer():
            b=int(b)
            print("{} {}".format(a,b))
            exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
ab=[]
for i in range(1000):
    ab.append(i**5)
found=0
for a in ab:
    for b in ab:
        if found==1:
            break
        if a-b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        elif a+b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        elif -a-b==x:
            print(int(-(a**0.2)),int((b**0.2)))
        elif -a+b==x:
            print(int(-(a**0.2)),int(-(b**0.2)))
        else:
            continue

Submission status: Wrong Answer

Solution code:
x = int(input())

break_loop = False
for a in list(map(lambda x: x-64, list(range(129)))):
    for b in list(map(lambda x: x-64, list(range(129)))):
        ans = (a-b)*(a**4 + (a**3)*b + a*a*b*b + a*(b**3) + b**4)
        if x == ans:
            break_loop = True
            print(a,b)
            break
    if break_loop:
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

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


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

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
X = int(input())
A = []
for i in factorization(X):
  for j in range(1,i[1]+1):
    a = i[0]**j
    b = X//a
    if(a<b):
      A.append([a,b])
    else:
      A.append([b,a])
 
A = list(map(list, set(map(tuple, A))))
flag = 0
for i in A:
  r = list(range(0,1000+1))
  for a in r:
    b = a - i[0]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[1]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break
  r = list(range(0,1000+1))
  for a in r:
    b = a - i[1]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[0]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
X = int(input())
if X == 0:
  print(0,-1)
  exit()
if X%2 != 0:
  c = Counter(prime_factorize(X+1))
  for a,b in c.items():
    if b == 5:
      if a**5-1 == X:
        print(a,1)
        exit()
  c = Counter(prime_factorize(X-1))
  for a,b in c.items():
    if b == 5:
      if a**5+1 == X:
        print(a,-1)
        exit()
else:
  c = Counter(prime_factorize(X))
  for a,b in c.items():
    if b == 5:
      if a**5 == X:
        print(a,0)
        exit()

Submission status: Wrong Answer

Solution code:
import bisect
from itertools import combinations

X = int(input())

gojou_list = [i ** 5 for i in range(80)]
X_index = bisect.bisect(gojou_list, X)

start = 0 if X_index < 5 else X_index - 5
end = 80 if X_index + 5 > 80 else X_index + 5

for i, v in combinations(gojou_list[start:end], 2):
    i_base = gojou_list.index(i)
    v_base = gojou_list.index(v)
    if i + v != X:
        continue
    if (i * -1) - v == X:
        print(i_base * -1, v_base)

    elif i - (v * -1) == X:
        print(i_base, v_base * -1)

    elif (i * -1) - (v * -1) == X:
        print(i_base * -1, v_base * -1)

    elif i - v == X:
        print(i_base, v_base)

    elif (v * -1) - i == X:
        print(v_base * -1, i_base)

    elif v - (i * -1) == X:
        print(v_base, i_base * -1)

    elif (v * -1) - (i * -1) == X:
        print(v_base * -1, i_base * -1)

    elif v - i == X:
        print(v_base, i_base)

Submission status: Wrong Answer

Solution code:
x = int(input())

lim = 10000000000
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())

def gen_divisor(x):
    for i in range(x, 0, -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:
if __name__=='__main__':
    x = int(input())
    n = 0
    a,b = 0,0
    while x > n**5:
        n+=1
    for i in range(n):
        if n**5-i**5==x:
            a,b=n,i
        if (n-1)**5+i**5==x:
            a,b = n-1,-i
    print('{} {}'.format(a,b))

Submission status: Wrong Answer

Solution code:
x=int(input())
for a in range(99):
  for b in range(-99,99):
    if a**5-b**5==x: print(a,b); exit()

Submission status: Wrong Answer

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

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(y):
        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())
power5 = [i ** 5 for i in range(100)]
for i in power5:
  for j in power5:
    if i - j == x:
      print(i, j)
      exit()
for i in power5:
  for j in power5:
    if i + j == x:
      print(i, -j)
      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)
      deta = True
      break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
print(int(((X-1)**0.5)//2), -1)

Submission status: Wrong Answer

Solution code:
X = int(input())
if X == 1:
    print(0, -1)
    exit()
for i in range(1, 10**9):
    if pow(i, 5, X-1) == 0:
        a = i
        break

print(a, -1)

Submission status: Wrong Answer

Solution code:
X = int(input())

B = 0
while True:
    # print(f"----- B : {B}")
    # print(f"----- B**5 : {B**5}")
    # +B
    if X - B ** 5 >= 0:
        tmp = pow(X - B ** 5, 1/5)
        # print(f"tmp: {tmp}")
        if tmp.is_integer():
            A = int(tmp)
            print(A, B)
            exit()
    
    # -Bについても判定
    if X - (-B) ** 5 >= 0:
        tmp = pow(X - (-B) ** 5, 1/5)
        # print(f"tmp: {tmp}")
        if tmp.is_integer():
            A = int(tmp)
            print(A, -B)
            exit()

    B += 1

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(-100, 120):
    if b**5 == a**5-X:
      print(a, b)
      break

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000001, 1)
t = t**5
S = set(t)

for B in t:
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break

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**3,10**4 + 10**3,2):
        for j in range(10**4 + 1 + 10**3,-10**4 - 10**3,-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:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

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

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


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

# from fractions import gcd
# from math import gcd

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


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


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


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

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

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

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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(thisB)) + ' ' + str(int(thisA)))
		break

Submission status: Wrong Answer

Solution code:
x = int(input())

flag1 = False
flag2 = False

for i in range(int(pow(x, 1/5))+1):
    a1 = x - i**5
    a2 = x + i**5
    for j in range(int(pow(a1, 1/5))+1):
        if j**5 == a1:
            flag1 = True
            break
    for k in range(int(pow(a2, 1/5))+1):
        if k**5 == a2:
            flag2 = True
            break
    if flag1:
        print(j, -i)
        break
    if flag2:
        print(j, i)
        break

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
x = int(input())
h = x

for i in range(2,10**5):
    if x%i == 0:
        h = i
        break


for i in range(1, h+10**5):
    a = i
    b = h-i
    if a**5-b**5 == x:
        print(a,b)
        exit(0)
    b = i-h
    if a**5-b**5 == x:
        print(a, b)
        exit(0)

Submission status: Wrong Answer

Solution code:
X = int(input())

for i in range(X**5):
    B = i ** 5 -X
    if B < 0:
        C = (-B) ** (1/5)
        flg = 1
    else:
        C = B ** (1/5)
    if C.is_integer():
        if flg == 0:
            print(i,int(C))
            exit()
        else:
            print(i,-int(C))
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())

for A in range(100):
    for B in range(-100, 100):
        if A**5 - B**5 == X:
            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(4000)]
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:
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)
    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)
        print(B[0], -A)
        break