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 make_divisors(n):
    divisors = [0]
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
    return divisors

flag = 0
a_s = 0
if x == 1:
  print(1, 0)
else:
  l = make_divisors(x)
  print(l)
  for i in range(x+1):
    if 2*(i**5) >= x:
      a_s = i
      break
  for a in range(a_s, x+1):
    if flag == 1:
      break
    for b_a in l:
      if b_a <= a:
        b = a - b_a
        if a**5 - b**5 == x:
          print(a, b)
          flag += 1
          break
        elif a**5 + b**5 == x:
          print(a, -1*b)
          flag += 1
          break
      else:
        continue

Submission status: Wrong Answer

Solution code:
n = int(input())
 
a = [i**5 for i in range(119)]
for i in range(119):
    for j in range(i+1,119):
        if a[j]-a[i] == n:
            print(j,i)
            exit()
        if a[j]+a[i] == n:
            print(j,-i)
            exit()

Submission status: Wrong Answer

Solution code:
import math
import sys

X = int(input())

i = -1
while True:
    ans = math.pow(X-i, 0.2)
    if ans.is_integer():
        print(int(ans), -i)
        sys.exit()

    ans = math.pow(X+i, 0.2)
    if ans.is_integer():
        print(int(ans), i)
        sys.exit()

    i = i-1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A = 0
while True:
    for B in range(A+1):
        if A ** 5 + B ** 5 == X:
            print(A, B)
            sys.exit()
        if A ** 5 - B ** 5 == X:
            print(A, -B)
            sys.exit()
        if - A ** 5 + B ** 5  == X:
            print(-A, B)
            sys.exit()
    A += 1

Submission status: Wrong Answer

Solution code:
memorization_dict = dict()
max_number = 10 ** 9
i = 0
power_value = 0
while power_value <= max_number:
    power_value = i ** 5
    memorization_dict[power_value] = i
    i += 1

X = int(input())

solution_1 = 0
solution_2 = 0

for B in memorization_dict.keys():
    A = X + B
    if A in memorization_dict.keys():
        solution_1 = memorization_dict[A]
        solution_2 = memorization_dict[B]
        break
    A = X - B
    if A in memorization_dict.keys():
        solution_1 = memorization_dict[A]
        solution_2 = memorization_dict[B] * (-1)
        break

print(solution_1, solution_2)

Submission status: Wrong Answer

Solution code:
X = int(input())

for A in range(100):
    for B in range(-50, 50):
        if A**5-B**5 == X:
            print(A, B)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

for a in range(-118,120):
    if a**5 - (a-1)**5 == x:
        print(a, a-1)
        break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
uba = math.ceil(x**0.2) # ルート1/5

flag = False
for a in range(-uba-1, uba+1):
    for b in range(-uba-1, uba+1):
        s = a**5 - b**5
        if s == x:
            flag = True
            break
    if flag:
        break

print(a, b)

Submission status: Wrong Answer

Solution code:
def get_answer():
  x = int(input())
  
  is_get = False
  for a in range(1000000000):
    if is_get:
      break
    for b in range(-1*a, a, 1):
      if x == a**5 - b**5:
        is_get = True
        break
        
  print(f"{a-1} {b}")

Submission status: Wrong Answer

Solution code:
def get_answer():
  x = int(input())
  
  is_get = False
  for a in range(1000000000):
    if is_get:
      break
    for b in range(-1*a, a, 1):
      if x == a**5 - b**5:
        is_get = True
        break
        
  print(f"{a} {b}")

if __name__ == "__main__":
  get_answer()

Submission status: Wrong Answer

Solution code:
x = int(input())

#%%
import math
uba = math.ceil(x**0.2) # ルート1/5

flag = False
for a in range(uba+1):
    for b in range(-uba-1, uba+1):
        s = a**5 - b**5
        if s == x:
            flag = True
            break
    if flag:
        break

print(a, b)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
  x = int(input())
  
  is_get = False
  for a in range(1000000000):
    if is_get:
      break
    for b in range(-1*a, a, 1):
      if x == a**5 - b**5:
        is_get = True
        break
        
  print(f"{a} {b}")

Submission status: Wrong Answer

Solution code:
x = int(input())

#%%
import math
uba = math.ceil(x**0.2) # ルート1/5

flag = False
for a in range(uba+1):
    for b in range(-uba, uba):
        s = a**5 - b**5
        if s == x:
            flag = True
            break
    if flag:
        break

print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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

print(a, b)

Submission status: Wrong Answer

Solution code:
X=int(input())
stp=0
for a in range(X):
    if stp==1:
        break
    else:
        for b in range(X):
            A=a**5
            B=b**5
            tmp1=A-B
            tmp2=-A+B
            tmp3=-A-B
            tmp4=A+B
            if tmp1==X:
                print(a,b)
                stp=1
                break
            elif tmp2==X:
                print(-a,-b)
                stp=1
                break
            elif tmp3==X:
                print(-a,b)
                stp=1
                break
            elif tmp4==X:
                print(a,-b)
                stp=1
                break

Submission status: Wrong Answer

Solution code:
X=int(input())
for a in range(10**5):
    for b in range(10**5):
        A=a**5
        B=b**5
        tmp1=A+B
        tmp2=-A-B
        tmp3=-A+B
        tmp4=A-B
        if tmp1==X:
            print(a,b)
            break
        elif tmp2==X:
            print(-a,-b)
            break
        elif tmp3==X:
            print(-a,b)
            break
        elif tmp4==X:
            print(a,-b)
            break
    break

Submission status: Wrong Answer

Solution code:
x=int(input())
a=1
for i in range(2,x):
  if x%i == 0:
    b1=a-i
    b2=a-x//i
    break
else:
  b1=0
  b2=0

if a**5-b1**5 == x:
  print(a,b1)
elif a**5-b2**5 == x:
  print(a,b2)

Submission status: Wrong Answer

Solution code:
x=int(input())
a=1
for i in range(2,x):
  if x%i == 0:
    b=a-i
    break
else:
  b=0

print(a,b)

Submission status: Wrong Answer

Solution code:
X = int(input())
#for a in range(-120,120):
#  b = a**5-X
#  if b < 0: b = -(-b)**0.2
#  else: b = b**0.2
#  if b.is_integer():
#    print(a,int(b))
#    break

isOK = False
for a in range(-120,120):
  for b in range(-120,120):
    if a*a-b*b == X:
      print(a,b)
      isOK = True
      break
  if isOK:break

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
#for a in range(-120,120):
#  b = a**5-X
#  if b < 0: b = -(-b)**0.2
#  else: b = b**0.2
#  if b.is_integer():
#    print(a,int(b))
#    break
    
for a in range(-120,120):
  for b in range(-120,120):
    if a*a-b*b == X:
      print(a,b)
      sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(-120,120):
  b = a**5-X
  if b < 0: b = -(-b)**0.2
  else: b = b**0.2
  if b.is_integer():
    print(a,int(b))
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(int(10e20)):
  b = a**5-X
  if b < 0: b = -(-b)**0.2
  else: b = b**0.2
  if b.is_integer():
    print(a,int(b))
    break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(100000000):
  b = a**5-X
  if b < 0: b = -(-b)**0.2
  else: b = b**0.2
  if b.is_integer():
    print(a,int(b))
    break

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

l = - 10 ** 5
r = 10 ** 5
for i in range(1, int(x ** 0.5) + 1):
    if x % i: continue
    while r - l > 1:
        a = (l + r) // 2
        b = a - i
        c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
        #print(i, a, b, c)
        if i * c <= x: l = a
        else: r = a
        #print(l, r)
    a = l
    b = l - i
    c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
    if i * c == x: 
        print(a, b)
        sys.exit()

    j = x // i
    if x % j: continue
    while r - l > 1:
        a = (l + r) // 2
        b = a - j
        c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
        #print(i, a, b, c)
        if j * c <= x: l = a
        else: r = a
        #print(l, r)
    a = l
    b = l - j
    c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
    if j * c == x: 
        print(a, b)
        sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(10000):
  b = a**5-X
  if b < 0: b = -(-b)**0.2
  else: b = b**0.2
  if b.is_integer():
    print(a,int(b))
    break

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

l = 0
r = 10 ** 5
for i in range(1, int(x ** 0.5) + 1):
    if x % i: continue
    while r - l > 1:
        a = (l + r) // 2
        b = a - i
        c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
        #print(i, a, b, c)
        if i * c <= x: l = a
        else: r = a
        #print(l, r)
    a = l
    b = l - i
    c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
    if i * c == x: 
        print(a, b)
        sys.exit()

    j = x // i
    if x % j: continue
    while r - l > 1:
        a = (l + r) // 2
        b = a - j
        c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
        #print(i, a, b, c)
        if j * c <= x: l = a
        else: r = a
        #print(l, r)
    a = l
    b = l - j
    c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
    if j * c == x: 
        print(a, b)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

l = 0
r = 10 ** 5
for i in range(1, int(x ** 0.5) + 1):
    if x % i: continue
    while r - l > 1:
        a = (l + r) // 2
        b = a - i
        c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
        #print(i, a, b, c)
        if i * c <= x: l = a
        else: r = a
        #print(l, r)
    a = l
    b = l - i
    c = a**4 + a**3 * b + a*a*b*b + a * b ** 3 + b ** 4
    if i * c == x: 
        print(a, b)
        sys.exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
X_0 = int(X**0.5)
X_list = []
for i in range(1, X_0 + 1):
    if X%i == 0:
        X_list.append(i)

flag = False
ans = 0
for x in X_list:
    y = X/x
    y1 = y**0.5
    y2 = int(y**0.5)
    for A in range(x, y2+1):
        if A**5 - (A-x)**5 == X:
            flag = True
            ans = (A, A-x)
            break
if flag:
    print(ans)
else:
    for x in X_list:
        for B in range(1, x+1):
            if (x-B)**5 + B**5 == X:
                flag = True
                ans = (x-B, -B)
    if flag:
        print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
x=input()
x=int(x,base=10)

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

Submission status: Wrong Answer

Solution code:
X = int(input())
INF = 100
A = [i ** 5 for i in range(INF)]
B = [i ** 5 for i in range(INF)]

def solve():

    for i in range(INF):
        for j in range(INF):
            if X == A[i] - B[j]:
                print(i, j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == A[i] + B[j]:
                print(i, -j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == -A[i] - B[j]:
                print(-i, j)
                return

    for i in range(INF):
        for j in range(INF):
            if X == -A[i] + B[j]:
                print(-i, -j)
                return
            
solve()

Submission status: Wrong Answer

Solution code:
X = int(input())
A = [i ** 5 for i in range(65)]
B = [i ** 5 for i in range(65)]

def solve():

    for i in range(65):
        for j in range(65):
            if X == A[i] - B[j]:
                print(i, j)
                return

    for i in range(65):
        for j in range(65):
            if X == A[i] + B[j]:
                print(i, -j)
                return

    for i in range(65):
        for j in range(65):
            if X == -A[i] + B[j]:
                print(-i, j)
                return

    for i in range(65):
        for j in range(65):
            if X == -A[i] - B[j]:
                print(-i, -j)
                return
            
solve()

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(0,1000):
    for j in range(-1000,1000):
        if i**5-j**5==x:
            print("{} {}".format(i,j))
            break

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(0,1000):
    for j in range(0,1000):
        if i**5-j**5==x:
            print("{} {}".format(i,j))
            break

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(0,100):
    for j in range(0,100):
        if i**5-j**5==x:
            print("{} {}".format(i,j))
            break

Submission status: Wrong Answer

Solution code:
x=int(input())
for i in range(-100,100):
    for j in range(-100,100):
        if i**5-j**5==x:
            print("{} {}".format(i,j))
            break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())


def check(x):
    xx = math.ceil(x ** 0.2)
    for i in range(xx + 1):
        for j in range(xx + 1):
            if (i == j):
                continue
            elif (x % (i - j) == 0) and (x == ((i ** 5) - (j ** 5))):
                print(i, j)
                return
            elif (x % (i + j) == 0) and ( x == ((i ** 5) + (j ** 5))):
                print(i, -j)
                return

check(x)

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

xx = math.ceil(x ** 0.2)

for i in range(xx + 1):
    for j in range(xx + 1):
        if (i == j):
            continue
        elif (x % (i - j) == 0) and (x == ((i ** 5) - (j ** 5))):
            print(i, j)
            break
        elif (x % (i + j) == 0) and ( x == ((i ** 5) + (j ** 5))):
            print(i, -j)
            break

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    X = int(input())
    for a in range(200, 200):
        a5 = a**5
        b5 = a5-X
        for b in range(200, 200):
            if b**5 == b5:
                print(a, b)
                exit()


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    X = int(input())
    for a in range(-64, 64):
        a5 = a**5
        b5 = a5-X
        for b in range(-64, 64):
            if b**5 == b5:
                print(a, b)
                exit()


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    x = int(input())
    a = -1
    b = -1
    for i in range(0,101,1):
        got = False
        for j in range(0,101,1):
            # print(str(i)+" "+str(j))
            if (i**5 - j**5) == x:
                a = i
                b = j
                got = True
                break
            if (i**5 + j**5) == x:
                a = i
                b = -1*j
                got = True
                break
        if got:
            break
    print(*[a,b])

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    x = int(input())
    a = -1
    b = -1
    for i in range(0,101,1):
        got = False
        for j in range(0,101,1):
            if (i**5 - j**5) is x:
                a = i
                b = j
                got = True
                break
            if (i**5 + j**5) is x:
                a = i
                b = -1*j
                got = True
                break
        if got:
            break
    print(*[a,b])

Submission status: Wrong Answer

Solution code:
X=int(input())

ans=[0,0]
i=0
while i<=100:
    j=-100
    while j<=100:
        if i**5-j**5==X:
            ans=[i,j]
        j+=1
    i+=1 

print(*ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(-100, 100):
    for b in range(-100, 100):
        if a**5 - b**5 == X:
            print(str(a)+" "+str(b))
            break
    if a**5 - b**5 == X:
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for a in range(10**2):
    B = a**5 - X
    b = B**-5
    if b % 1 == 0:
        print(str(int(a))+" "+str(int(b)))
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
for i in range(237):
  for k in range(237):
    A = i - 118
    B = k - 118
    if A**5 - B**5 == X:
      print(A,B)
      break
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
X = int(input())
pow5 = [i**5 for i in range(-150,150)]
for a in range(-150,150):
  for b in range(-150,150):
    if pow5[a+150]-pow5[b+150] ==X:
      print(a,b)
      break

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(-1000,1001):
    b = int(pow(a,5))-x
    # c = int(pow(a,5))+x
    # print(b)
    if b>=0:
        b = pow(b,0.2)
        if b==int(b):
            print(int(a),int(b))
            break
    else:
        b*=-1
        b = pow(b,0.2)
        if b==int(b):
            print(int(a),int(-b))
            break
# print(1/5)

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(-1000,1001):
    b = int(pow(a,5))-x
    # c = int(pow(a,5))+x
    # print(b)
    if b>0:
        b = pow(b,0.2)
        if b==int(b):
            print(int(a),int(b))
            break
    else:
        b*=-1
        b = pow(b,0.2)
        if b==int(b):
            print(int(a),int(-b))
            break
# print(1/5)

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(-1000,1001):
    b = int(pow(a,5))-x
    c = int(pow(a,5))+x
    if b>0:
        b = pow(b,0.2)
        if b==int(b):
            print(int(a),int(b))
            break
    if c>0:
        c = pow(c,0.2)
        if c==int(c):
            print(int(c),int(a))
            break
# print(1/5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
e=0
for a in range(-1000,1000):
    for b in range(a-70,a+70):
        if (a**5)-(b**5)==x:
            print(a,b)
            e=1
            break
    if e==1:
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
e=0
for a in range(-1000,1000):
    for b in range(a,a+65):
        if a**5-b**5==x:
            print(a,b)
            e=1
            break
    if e==1:
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
e=0
for a in range(-1000,1000):
    for b in range(a-65,a+65):
        if a**5-b**5==x:
            print(a,b)
            e=1
            break
        elif b**5-a**5==x:
            print(b,a)
            e=1
            break
    if e==1:
        break

Submission status: Wrong Answer

Solution code:
x=int(input())
e=0
for a in range(-1000,1000):
    for b in range(a-65,a+65):
        if a**5-b**5==x:
            print(a,b)
            e=1
            break
    if e==1:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(150):
    for j in range(-50, i):
        if i ** 5 - j ** 5 == n:
            print(i, j)
            exit(0)

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(150):
    for j in range(-20, i):
        if i ** 5 - j ** 5 == n:
            print(i, j)
            exit(0)

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(150):
    for j in range(-20, i - 1):
        if i ** 5 - j ** 5 == n:
            print(i, j)
            exit(0)

Submission status: Wrong Answer

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


def fif_root(arg):
    return list(map(lambda x: math.floor(math.pow(x, 1/5)*1000)/1000, arg))

def check_integer(arg):
    return list(map(lambda x: x.is_integer(), arg))

a = 0
while (A:= math.pow(a, 5))-math.pow(a-1, 5) <= X:
    #a,-aの時それぞれの5乗根を計算する。
    root = fif_root([abs(X-A), X+A])
    if True in (c := check_integer(root)):
        idx = c.index(True)
        b = int(root[idx])
        if idx == 1:
            a, b = -a, -b
        else:
            if X - A >= 0:
                b = -b
        print(a, b)
        break
    a += 1

Submission status: Wrong Answer

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


def fif_root(arg):
    return list(map(lambda x: math.pow(x, 1/5), arg))

def check_integer(arg):
    return list(map(lambda x: x.is_integer(), arg))

a = 0
while (A:= math.pow(a, 5))-math.pow(a-1, 5) <= X:
    #a,-aの時それぞれの5乗根を計算する。
    root = fif_root([abs(X-A), X+A])
    if True in (c := check_integer(root)):
        idx = c.index(True)
        b = root[idx]
        if idx == 1:
            a, b = -a, -int(b)
        else:
            if X - A >= 0:
                b = -int(b)
            else:
                b = int(b)
        print(a, b)
        break
    a += 1

Submission status: Wrong Answer

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


def fif_root(n):
    return math.pow(n, 1/5)


a = 0
while (A:= math.pow(a,5))-math.pow(a-1, 5) <= X:
    b = list(map(lambda x: fif_root(x), [abs(X-A), X+A]))
    if True in (c := list(map(lambda x: x.is_integer(), b))):
        idx = c.index(True)
        b = b[idx]
        if idx == 1:
            a, b = -a, -int(b)
        else:
            if X - A > 0:
                b = -int(b)
            else:
                b = int(b)
        break
    a += 1
print(a, b)

Submission status: Wrong Answer

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


def fif_root(n):
    return math.pow(n, 1/5)


a = 0
while True:
    A = math.pow(a, 5)
    b = list(map(lambda x: fif_root(x), [abs(X-A), X+A]))
    if True in (c := list(map(lambda x: x.is_integer(), b))):
        idx = c.index(True)
        b = b[idx]
        if idx == 1:
            a, b = -a, -int(b)
        else:
            if X - A > 0:
                b = -int(b)
            else:
                b = int(b)
        break
    a += 1
print(a, b)

Submission status: Wrong Answer

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


def fif_root(n):
    return math.pow(n, 1/5)


a = 0
while (A:=math.pow(a, 5)) <= X:
    b = list(map(lambda x: fif_root(x), [X-A, X+A]))
    if True in (c := list(map(lambda x: x.is_integer(), b))):
        ind = c.index(True)
        if ind == 1:
            a, b = -a, -int(b[ind])
        else:
            a, b = a, -int(b[ind])
        break
    a += 1
print(a, b)

Submission status: Wrong Answer

Solution code:

x = int(input())

def ans():
    for a in range(-100, 100):
        for b in range(-100, 100):
            if a**5 - b**5 == x:
                return print(a, b)
            
ans()

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
a = 0
A = 0
while A < X:
    A = a**5
    red = X - A
    b = math.pow(abs(red), 1/5)
    if b.is_integer():
        if red >= 0:
            b = -1*int(b)
        else:
            b = int(b)
        break
    a += 1
print(a, b)

Submission status: Wrong Answer

Solution code:
import math
X = int(input())
a = 0
A = 0
while A < (1/2)*X:
    A = a**5
    red = X - A
    b = math.pow(abs(red), 1/5)
    if b.is_integer():
        if red >= 0:
            b = -1*int(b)
        else:
            b = int(b)
        break
    a += 1
print(a, b)

Submission status: Wrong Answer

Solution code:
X = int(input())
a = 0
A = 0
while A < (1/2)*X:
    A = a**5
    if (b:=(X - A)**(1/5)).is_integer():
        print(a,-int(b))
        break
    a += 1

Submission status: Wrong Answer

Solution code:
X = int(input())

def solve():
  for A in range(-118, 120):
    for B in range(-119, 119):
      if A*A*A*A*A - B*B*B*B*B == X or A*A*A*A*A + B*B*B*B*B == X:
        print(A, B)
        break
        
solve()

Submission status: Wrong Answer

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

if X == 0:
    print("0 0")
elif X > 0: # a > b
    for i in range(-100,100):
        for j in range(-100,i):
            if X == i**5-j**5:
                print(i,j)
                break_flag = True
                break
        if break_flag == True:
            break        

elif X < 0: #a < b
    for i in range(-100,100):
        for j in range(i+1,100):
            if X == i**5-j**5:
                print(i,j)
                break_flag = True
                break
        if break_flag == True:
            break

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in reversed(range(101)):
    for j in range(101):
        a, b = i**5, j**5
        if a-b==x:
            print(i, j)
            exit()
        if a+b==x:
            print(i, -j)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

x = int(input())
achieve = 0

for a in range(100):
    for b in range(-100,100):
        if(a**5 - b**5) == x:
            print(a, b)
            achieve = 1
    if achieve == 1:
        break

Submission status: Wrong Answer

Solution code:
m=5**6;exec(f'i,j=m&63,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));'*2*m)

Submission status: Wrong Answer

Solution code:
X = int(input())

a = 0
b = 0

for i in range(-100, 100):
    for j in range(-100,100):
        if(i * i * i * i * i - j * j * j * j * j == X):
            a = i
            b = j
            break




print("{} {}".format(a, b))

Submission status: Wrong Answer

Solution code:

x = int(input())
a = 0
b = 0

for i in range(100):
    if(i**5) >= x:
        if(i**5)-x > x-((i-1)**5):
            a = i-1
        elif(i**5)-x <= x-((i-1)**5):
            a = i
        break

B = (a**5) - x
b = B//5
print(a, b)

Submission status: Wrong Answer

Solution code:

x = int(input())
a = 0
b = 0

for i in range(100):
    if(i**5) >= x:
        if(i**5)-x > x-((i-1)**5):
            a = i-1
        elif(i**5)-x <= x-((i-1)**5):
            a = i
        break

print(a)

B = (a**5) - x
b = B//5
print(a, b)

Submission status: Wrong Answer

Solution code:

x = int(input())
a = 0
b = 0

for i in range(100):
    if(i**5) >= x:
        if(i**5)-x > x-((i-1)**5):
            a = i-1
        elif(i**5)-x <= x-((i-1)**5):
            a = i
        break

print(a)

B = (a**5) - x
b = B//5
print(a,b, sep=" ")

Submission status: Wrong Answer

Solution code:
X = int(input())

R = 3000
go = [i**5 for i in range(R)]


def foo():
    for i in range(R):
        for j in range(i, R):
            if go[i] - go[j] == X:
                return i, j
        for j in range(R):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


A, B = foo()
print(A, B)

Submission status: Wrong Answer

Solution code:
X = int(input())

go = [i**5 for i in range(1000)]


def foo():
    for i in range(1000):
        for j in range(i, 1000):
            if go[i] - go[j] == X:
                return i, j
        for j in range(1000):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


A, B = foo()
print(A, B)

Submission status: Wrong Answer

Solution code:
import sys
X=int(input())
for j in range(119):
    for i in range(119):
        if abs(pow(i,5)-X) == pow(j,5):
            if pow(i,5)-pow(j,5)==X:
                print(i,j)
                sys.exit()
            else:
                print(i,-j)
                sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
X=int(input())
for j in range(100):
    for i in range(100):
        if abs(pow(i,5)-X) == pow(j,5):
            if pow(i,5)-pow(j,5)==X:
                print(i,j)
                sys.exit()
            else:
                print(i,-j)
                sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    # a^5-b^5=xのx(x:自然数, a,b:整数)
    x = int(input())
    # b^5>=0と仮定するとa^5はa^5>1に絞れる
    flag = 0
    for a in range(-118, 120, 1):
        for b in range(-119, 119, 1):
            if pow(a,5)-pow(b,5)==x:
                flag = 1
                break
        if flag==1: break

    print([a, b])

main()

Submission status: Wrong Answer

Solution code:
X = int(input())
a = []
for i in range(1000):
  a.append(i**5)
for i in range(1000):
  if X + a[i] in a:
    A = (X + a[i])**0.2
    B = i
  elif X - a[i] in a:
    A = int((X - a[i])**0.2)
    B = -i
print(A,B)

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(-500,500):
  for j in range(-500,500):
    a = pow(i,5)
    b = pow(j,5)
    if(x == a - b):
      print(a,b)
      exit(0)

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(-500,500):
  for j in range(-500,500):
    a = pow(i,5)
    b = pow(j,5)
    if(x == a - b):
      print(a,b)
      exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
for i in range(200):
  for j in range(-200,200):
    if(i**5+j**5==x):
      print(i,j)
      break

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
    x = int(input())
    a = 1
    while True:
        b = - pow(abs(x - a ** 5), 1/5) * np.sign(x - a ** 5)
        if b == int(b):
            print(a, int(b))
            break
        a += 1

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a = int(input())

flg = False
ans = 0
for b in range(-50,50):
    for c in range(-50,50):
        if (b**5) - (c**5) == a:
            print(b,c)
            flg = True
    if flg:
        break