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: Accepted

Solution code:
X = int(input())
flag = True
a = 0
b = 0
for i in range(-118, 120):
    if flag == False:
        break
    for j in range(-119, 120):
        if i**5 - j**5 == X:
            a = i
            b = j
            flag = False
            break


print(str(a), str(b))

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import math
def factorial(x):
    max_num = int(2 * (10 ** 9) ** (1 / 5))
    for a in range(-1 * max_num, max_num):
        for b in range(-1 * max_num, max_num):
            check = math.pow(a, 5) - math.pow(b, 5)
            if check == x:
                return f'{a} {b}'


x = int(input())
print(factorial(x))

Submission status: Accepted

Solution code:
import math

x = int(input())

f = False
for a in range(-200,200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == x:
            print(a, b)
            f = True
            break
    if f == True:
        break

Submission status: Accepted

Solution code:
X = int(input())

for i in range(-118,119):
    for j in range(-119,118):
        if X == i**5 - j**5:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

def search(x: int) -> (int, int):
    for a in range(-1000, 1001):
        for b in range(-1000, 1001):
            if a ** 5 - b ** 5 == x:
                return (a, b)
    return (-2000, -2000)

a, b = search(x)
print(f"{a} {b}")

Submission status: Accepted

Solution code:
x = int(input())
n = 100000
 
def binp(arr, val):
    left,right = 0,len(arr)-1
    while left <= right:
        mid = (left+right)//2
        if val==arr[mid]: return mid
        elif val>=arr[mid]: left = mid+1
        else: right = mid-1
    return 0
 
def binn(arr, val):
    left,right = 0,len(arr)-1
    while left >= right:
        mid = (left+right)//2
        if val==arr[mid]: return mid
        elif val>=arr[mid]: right = mid+1
        else: left = 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):
    val = x + b**5
    a = max(binp(ap, val), binn(an,val))
    if a: print(a,b) ; break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

x = int(input())

for i in range(-200,200):
    for j in range(-200,200):
        buf = i**5 - j**5
        if buf == x:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

U = 10**9

divisors = set()
for i in range(1, int(U**.5)+1):
    if x % i == 0:
        divisors |= {i, x//i}

def f(a, b):
    return a**5-b**5

for b in range(-1000, 1000):
    for div in divisors:
        a = div+b
        if f(a, b) == x:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x=int(input())
if x==1:
    print(0,-1)
    exit()
else:
    n5=[0]
    i=1
    for i in range(1,120):
        i5=i*(i*i)**2
        n5.append(i5)
        if abs(x-i5) in n5:
            print(n5.index(i5),-(x-i5)//abs(x-i5)*(n5.index(abs(x-i5))))
            break

Submission status: Accepted

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

for A in range(-200,200):
    for B in range(-200,200):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys

X = int(input())

# X = 33

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5 - b**5 == X:
            print(a, b)
            sys.exit(0)

Submission status: Accepted

Solution code:
import sys
X = int(input())
# for i in range(1000):
#     for j in range(1000):
#         a = i ** 2
#         b = j ** 2
#         c = i * j
#         if (i - j) * (a * (a ** 2 + c + b) + b * (c + b)) == X:
#             print(i,j)
#             sys.exit()
#         elif (i + j) * (a * (a ** 2 - c + b) + b * (-c + b)) == X:
#             print(i,-j)
#             sys.exit()

for i in range(-118,120):
    for j in range(-118,120):
        if i ** 5 - j ** 5 == X:
            print(i,j)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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)
            exit()

Submission status: Accepted

Solution code:
X=int(input())
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5-j**5==X:
            print(i,j)
            exit()
print('No')

Submission status: Accepted

Solution code:
# D - I hate Factorization

X = int(input())
fact = []
for i in range(300):
    fact.append(pow(i,5))

for i in range(300):
    for j in range(300):
        if fact[i]-fact[j]==X:
            print(i, j)
            break
        elif fact[i]+fact[j]==X:
            print(i, -j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
# coding: utf-8

#約数列挙
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

#main
X = int(input())
F = make_divisors(X)
#intのみのlistは、直接.join()できない
S = [int(x) for x in F]

for i in range(len(S)):
    tmp = S[i]
    for A in range(-1000, 1001):
        B = A - tmp
        if A**5 - B**5 == X:
            print(str(A) + ' ' + str(B))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
# coding:utf-8

X = int(input())
for i in range(-120, 120 + 1):
    for j in range(-120, 120 + 1):
        if i ** 5 - j ** 5 == X:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
N = int(input())
t = []
i=0
s=2
ans1 =0
ans2 =0
while (i**5<10**11):
    t.append(i**5)
    i+=1
for j in t:
    if(N + j) in t:
        ans1 = j
        ans2 = N + j
        s = 0
        break
    elif(N-j) in t:
        ans1 = -j
        if(N-j >0):
            ans2 = N - j
            s = 1
            break
        else:
            ans2 = j - N
            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: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X = int(input())
c = 0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==X:
            a = i
            b = j
            print(a, b)    
            c = 1
            break
    if c != 0:
        break

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

def func():
    for a in range(-10**2 - 200, 10**2 + 200):
        for b in range(-10**2 - 200, 10**2 + 200):
            if a**5 - b**5 == x:
                k = [a, b]
                return k
    

k = func()
for i in range(2):
    print(k[i], end=" ")

Submission status: Accepted

Solution code:
x = int(input())
f = False
for a in range(-119, 120):
    if f:
        break
    for b in range(-119, 120):
        if int(pow(a, 5) - pow(b, 5)) == x:
            f = True
            print(a, b)
            break

Submission status: Accepted

Solution code:
X = int(input())
#print(X)
n = X
div = []
for i in range(1, int(n**0.5)+1):
  if n % i == 0:
    div.append(i)
    if i != n // i:
      div.append(n//i)
#print(div)

for i in div:
  for a in range(0, 10001): 
    b = a - i
    #print(a, b)
    if a**5 - b**5 == X:
      print(a, b)
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
X = int(input())

A = 0
B = 0
for a in range(10**3):
    for b in range(-10**3, 10**3):
        if X == a ** 5 - b ** 5:
            A = a
            B = b
            break
print(A, B)

Submission status: Accepted

Solution code:
X = int(input())
a = []
b = 0
flag = True
num = 120
if(X <= 120):
  num = X
for i in range(1,num+1):
  if(X%i== 0):
    a.append(i)
while(flag):
  for i in range(len(a)): 
    if(pow(b+a[i],5)-pow(b,5) == X):
      print("%d %d"%(b+a[i],b))
      flag = False
      break
  b -= 1
  if(b < -119):
    b = 119

Submission status: Accepted

Solution code:
# 2020/05/03
# AtCoder Beginner Contest 166 - D

# Input
x = int(input())

# Calc
eflg = False
for a in range(200):
    wk_a = a ** 5
    for b in range(200):
        if wk_a - (b ** 5) == x:
            ans1 = a
            ans2 = b
            eflg = True
            break

        if wk_a - (-b ** 5) == x:
            ans1 = a
            ans2 = -b
            eflg = True
            break

    if eflg == True:
        break

# Output
print(ans1, ans2)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    for a in range(-200, 201):
        for b in range(-200, 201):
            if a**5 - b**5 == X:
                return print(a, b)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())

for b in range(-1000,1000):
    for a in range(-1000,1000):
        if((a**5-b**5)==x):
            print(a,b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(raw_input())

def solve():
    for A in range(-1000, 1000):
        for B in range(-1000, 1000):
            if A**5 - B**5 == X:
                print A, B
                return
solve()

Submission status: Accepted

Solution code:
import sys
import bisect
import numpy as np

x = int(input())
bs = [i for i in range(-100, 200)]
bspow = list(map(lambda x: x**5, bs))
# print(bspow)

for a in range(200):
    b_calc = a**5 - x
    index = bisect.bisect_left(bspow, b_calc)
    if(bspow[index] == b_calc):
        print(a, bs[index])
        sys.exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input1 = int(input())

for A in range(-130,130):
    for B in range(-130,130):
        if A ** 5 - B ** 5 == input1:
            print(A,B)
            exit()

Submission status: Accepted

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(-119,119):
        for j in range(-119,119):
            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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
#n, k = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
#a = 0
#b = 0
for a in range(0, 1000):
    for b in range(0, 1000):
        if pow(a, 5)-pow(b, 5) == x:
            print(a, end=" ")
            print(b)
            exit()
        elif pow(a, 5)-pow(b*-1, 5) == x:
            print(a, end=" ")
            print(b*-1)
            exit()
        elif pow(-1*a, 5)-pow(b, 5) == x:
            print(-1*a, end=" ")
            print(b*-1)
            exit()
        elif pow(-1*a, 5)-pow(b*-1, 5) == x:
            print(-1*a, end=" ")
            print(b*-1)
            exit()

Submission status: Accepted

Solution code:
import sys

x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      sys.exit()

Submission status: Accepted

Solution code:
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

x = I()
t = 0
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 -j**5 == x:
            print(i,j)
            t = 1
            break
    if t==1:
        break

Submission status: Accepted

Solution code:
X = int(input())
for A in range(-1000,1001):
  for B in range(-1000,1001):
    if A**5-B**5==X:
      print(A,B)
      exit()

Submission status: Accepted

Solution code:
x = int(input())
if x == 1:
  print(0,-1)
  exit()
  
def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

c = []
fct = factorize(x)
for div in divisorize(fct):
    c.append(num(div))
    
chk = False
for s in c:
  if chk:
    break
  for i in range(1000):
    if (i+s)**5-i**5 > x:
      break
    if (i+s)**5-i**5 == x:
      ans = (i+s,i)
      chk = True
      break
  if s <1000:    
    for p in range(s,1000):
      j = -1*p
      #print(s,(j+s)**5-j**5)
      if (j+s)**5-j**5 > x:
        break 
      if (j+s)**5-j**5 == x:
        ans = (j+s,j)
        chk = True
        break 
  for ww in range(1,(s+1)//2)[::-1]:
    jj = -1*ww
    if (jj+s)**5-jj**5 > x:
      break    
    if (jj+s)**5-jj**5 == x:
      ans = (jj+s,jj)
      chk = True
      break 
print(*ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
x = int(input())
for i in range(-500, 500):
    for j in range(-500, 500):
        if i**5 - j**5 == x:
            print(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-500, 501):
  for b in range(-500, 501):
    if a*a*a*a*a - b*b*b*b*b == X:
      ans_a = a
      ans_b = b
      break
      
print(ans_a, ans_b)

Submission status: Accepted

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)
      exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import sys

X = int(input())


def f(a, b):
    return a ** 5 - b ** 5 == X


for a in range(-200, 200):
    for b in range(-200, 200):
        if f(a, b):
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
x  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

for a in range(-500, 500):
    for b in range(-500, 500):
        if (a ** 5) - (b **5) == x:
            print(a, b)
            exit()
"""
for a in range(1, 10**9):
    b = abs((a**5 - x)**(1/5))
    #print(a, b, (b.is_integer()))

    if b.is_integer():
        b = int(b)
        if (a ** 5) - (-b ** 5) == x:
            print(a, -b)
        else:
            print(-a, b)

        break
"""

Submission status: Accepted

Solution code:
#coding: utf-8
X = int(input())
for a in range(-118, 120, 1):
    for b in range(-118, 120, 1):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    for a in range(1,120):
        for b in range(-120,120):
            if a**5-b**5==x:
                print(a,b)
                return
        

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())
# 1 <= x <= 10^9
a, b = 0, 0

def make_divisors(n):
    '''約数のリストを返す
    '''
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

d = make_divisors(x)
d.sort()

for i in d:
    #print("div:",i)
    a, b = i, 0
    while(b != -1000):
        #print("sw:",a, b)
        if x == pow(a,5) - pow(b,5):
            print(a, b)
            exit()
        else:
            a -= 1
            b -= 1

Submission status: Accepted

Solution code:
X = int(input())

numbers = dict()

for i in range(-200, 200):
    numbers.setdefault(i, i**5)

for i in range(-200, 200):
    for j in range(-200, 200):
        if numbers[i] - numbers[j] == X:
            output = [i, j]
            break

print(output[0], output[1])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
 
def main():
    X = int(input().rstrip())
    f = 0
    for a in range(-150, 150):
        for b in range(-150, 150):
            i = a ** 5 - b ** 5
            if i == X:
                print(a, b)
                f = 1
                break
 
        if f:
            break
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())
def f(a,b):
  return a**5-b**5

for a in range(-200,200):
  for b in range(-200,200):
    if f(a,b)==X:
      print(a,b)
      exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
List = [(A,B) for A in range(-120,120) for B in range(-120,120) if A**5 - B**5 == X]

print(*List[0])

Submission status: Accepted

Solution code:
X = int(input())
x = 1
while ((x-1)**4)*5 < X:
    x += 1
for i in range(x):
    for j in range(-x, i):
        if i**5-j**5 == X:
            a = [i,j]
            break 
print(*a)

Submission status: Accepted

Solution code:
X = int(input())

ans = []

for i in range(-118,120):
  for j in range(-119,119):
    if i ** 5 - j ** 5 == X:
      ans = [i,j]
      break

print(*ans)

Submission status: Accepted

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)
      exit()

Submission status: Accepted

Solution code:
import itertools
import numpy as np
X=int(input())
t=0
for i in range(0,1000):
    if t==-1:
        break
    for j in range(-1000,1000):
        #print(i,end=" ")
        #print(j)
        if i**5-j**5==X:
            print(i,end=" ")
            print(j)
            t=-1
            break

Submission status: Accepted

Solution code:
import itertools

x = int(input())
n = 200
table = [pow(i, 5) for i in range(-n, n+1)]
# choices = list(itertools.product([i for i in range(len(table))], repeat=2))
choices = list(itertools.permutations([i for i in range(len(table))], 2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
A = list(range(-200, 200))
B = list(range(-200, 200))
for a in A:
  for b in B:
    if a**5 - b**5 == X:
      print(a, b)
      exit()

Submission status: Accepted

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

for A in range(-200,200):
  for B in range(-200,200):
    if A*A*A*A*A - B*B*B*B*B == X:
      print(A, B)
      sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
a = []
b = []
ansa = 0
ansb = 0
for i in range(10**3):
    a.append(i**5)
    b.append(i**5)
for i in a:
    for j in b:
        if i - j == x:
            ansa = i**(1/5)
            ansb = j**(1/5)
        elif i + j == x:
            ansa = i**(1/5)
            ansb = -(j**(1/5))
        elif -i + j == x:
            ansa = -(i**(1/5))
            ansb = -(j**(1/5))
        elif -i -j == x:
            ansa = -(i**(1/5))
            ansb = j**(1/5)
print(int(ansa), int(ansb))

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

    for B in range(-200, 201):
        for A in range(-200, 201):
            if A**5 - B**5 == X:
                print(A, B)
                exit()
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A=[]
B=[]

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

ans1=0
ans2=0

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

print(ans1,ans2)

Submission status: Accepted

Solution code:
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(read())

for a in range(-118, 120):
    for b in range(-119, 119):
        if pow(a, 5) - pow(b, 5) == X:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
import math
X = int(input())
N = math.floor(X ** (2/5)) + 1

for a in range(N):
  for b in range(-N,N):
    x = a**5
    y = b**5
    T = 0
    if x-y == X:
      print(a,b)
      T = 1
      break
  if T == 1:
    break

Submission status: Accepted

Solution code:
x = int(input())

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

print(a,b)

Submission status: Accepted

Solution code:
import itertools


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

Submission status: Accepted

Solution code:
x=int(input())
fifth_power=[0]*200
for i in range(200):
    fifth_power[i]=(i+1)**5
for i in range(200):
    t=abs(x-fifth_power[i])
    if x==1:
        print(0,-1)
        break
    elif fifth_power.count(t)==1:
        if fifth_power[i]-t==x:
            print(i+1,fifth_power.index(t)+1)
            break
        else:
            print(i+1,-fifth_power.index(t)-1)
            break

Submission status: Accepted

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

if X == 1:
    print(1,0)
    exit()

def repeat_any_square( a,n ):
    if n == 1:
        return a
    x = repeat_any_square( a,n//2 )
    x *= x
    if n % 2 == 1:
        x *= a
    return x

ans = []
for i in range(-1000,1000):
    ans.append(repeat_any_square(i,5))

#print(ans)
for i in range(2000):
    if ((ans[i] - X) in ans) == True:
        flag_A = 1
        flag_B = 1
        if ans[i] < 0:
            flag_A = -1
        if ans[i] - X < 0:
            flag_B = -1
        print(flag_A*int(math.pow(flag_A*ans[i],1/5)),flag_B*int(math.pow(flag_B*(ans[i]-X),1/5)))

        exit()

Submission status: Accepted

Solution code:
import itertools

x = int(input())
n = 200
table = [pow(i, 5) for i in range(-n, n+1)]
choices = list(itertools.product([i for i in range(len(table))], repeat=2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

	for a in range(0, 131, 1):
		for b in range(-131, a+1, 1):
			val = a**5 - b**5
			if(val == N):
				print(str(a) + " " + str(b))
				return

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
X=int(input())
for i in range(-200,201):
    for j in range(-200,201):
        if i**5-j**5==X:
            print(str(i)+" "+str(j))
            break
    else:
        continue
    break

Submission status: Accepted

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

main()

Submission status: Accepted

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

for i in range(-200,200):
    for j in range(-200,200):
        if (i**5-j**5==x):
            A=i
            B=j
print(A,B)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import numpy as np

X = int(input())
maxs = int(X**(1/5))

l = np.arange(-126, 127)

comb = np.array(list(itertools.combinations_with_replacement(l, 2)))

sum1 = comb[:, 0]**5 - comb[:, 1]**5
sum2 = comb[:, 1]**5 - comb[:, 0]**5

if len(np.where(sum1==X)[0]) != 0:
    result1 = np.where(sum1==X)[0][0]
    print(comb[result1][0], comb[result1][1])
else:
    result2 = np.where(sum2==X)[0][0]
    print(comb[result2][1], comb[result2][0])

Submission status: Accepted

Solution code:
import math

X = int(input())
M = 500

def culc():
  for a in range(-M, M):
    a5 = pow(a, 5)

    for b in range(-M, M):
      b5 = pow(b, 5)

      if(a5 - b5 == X):
        print(" ".join(map(str, [a, b])))
        return

culc()