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())
for A in range(130):
  for B in range(130):
    if (A**5) - (B**5) == X:
      print("{} {}".format(A,B))
      exit()
    elif ((-1*A)**5) - (B**5) == X:
      print("{} {}".format(-1*A,B))
      exit()
    elif (A**5) - ((-1*B)**5) == X:
      print("{} {}".format(A,-1*B))
      exit()   
    elif ((-1*A)**5) - ((-1*B)**5) == X:
      print("{} {}".format(-1*A,-1*B))
      exit()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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()
    a += 1

Submission status: Accepted

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

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:
            ans_a,ans_b = a,b
            break


print(ans_a,ans_b)

Submission status: Accepted

Solution code:
"""
~~ author : dokueki
~~ created : 10~05~2020
"""

import sys
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    n = int(sys.stdin.readline())
    ans = []
    for i in range(-118, 120):
        for j in range(-119, 119):
            if i ** 5 - j ** 5 == n:
                ans.append([i, j])

                break
    print(*ans[0])


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem D - I hate Factorization

# input
X = int(input())

# initialization
ans_list = [0, 0]

# count
for a in range(-500, 501):
    for b in range(-500, 501):
        if a**5-b**5==X:
            ans_list[0] = a
            ans_list[1] = b
            break

# output
print(" ".join(map(str, ans_list)))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())
flag = 1
a = -1000
b = -1000
for i in range(-1000, 1000):
  for j in range(-1000, 1000):
    if i**5-j**5 ==X:
      a = i
      b = j
print(f"{a} {b}")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
Num = 1
Check = "NG"

while Check == "NG":
    A_list = [i for i in range(Num)]
    B_list = [i for i in range(Num)]
    for i in range(Num):
        for j in range(Num):
            A5 = A_list[i] ** 5
            B5 = B_list[j] ** 5
            if A5 + B5 == X or A5 - B5 == X or -A5 + B5 == X:
                Check = "OK"
                break
        if Check == "OK":
            break
    if Check == "OK":
        break
    Num += 1
if A5 + B5 == X:
    print("{} -{}".format(i, j))
elif A5 - B5 == X:
    print("{} {}".format(i, j))
elif -A5 + B5 == X:
    print("-{} -{}".format(i, j))

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

X = int(stdin.readline())

# tmp = (10 ** 9) ** (1/5)
# print(tmp)

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

Solution code:
Mod  = 10**9
i = 0
ans = 0
while ans<Mod:
    i+=1
    ans = i**5 - (i-1)**5
#print(i)->120

i = 0
ans = 0
while ans<Mod:
    i-=1
    ans = i**5-(i-1)**5
#print(i)->-119


x = int(input())
Kouho = [int(i) for i in range(-120,121,1)]
for i in Kouho:
    for j in Kouho:
        if i**5-j**5==x:
            print(i,j)
            exit()

Submission status: Accepted

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

for x in range(100000):
    if 2 * x ** 5 == X:
        print(x, -x)
        sys.exit()
    for y in range(x):
        if (x ** 5 - y ** 5) == X:
            print(x, y)
            sys.exit()
        if (-x ** 5 + y ** 5) == X:
            print(-y, -x)
            sys.exit()
    tmp = 0
    y = 0
    while tmp < X:
        tmp = x ** 5 + y ** 5
        if tmp == X:
            print(x, -y)
            sys.exit()
        y += 1

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

Submission status: Accepted

Solution code:
import itertools

X = int(input())

for a, b in itertools.product(range(128), range(-128, 128)):
  if(a ** 5 - b ** 5 == X):
    print(a, b)
    break

Submission status: Accepted

Solution code:
X = int(input())
rangee = 200

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import pow
X = int(input())
for A in range(-120, 120):
    for B in range(-120, 120):
        if int(pow(A, 5)) - int(pow(B, 5)) == X:
            print(A, B)
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
 
for a in range(-119 , 120 , 1):
  A = a**5
  for b in range(-119 , 120 , 1):
    B = b**5
    if(A-B==X):
      print(a, b)
      exit()
    else:
      continue

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

# 1 ✕ 1 (int)
X = int(input().rstrip())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            print(str(a) + " " + str(b))
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
 
flag = 0
A = 0
B = 0
 
for i in range(-120, 120):
  for j in range(-120, 120):
    if i**5 - j**5 == X:
      A = i
      B = j
      break
    elif i**5 + j**5 == X:
      A = i
      B = -j
      break
    elif -i**5 - j**5 == X:
      A = -i
      B = j
      break
print(str(A) + ' ' + str(B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x=INT()

for i in range(-500,501):
    for j in range(-500,501):
        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())
flag = False
for i in range(-119,119,1):
    for j in range(-119,119,1):
        if i**5 - j**5 == x:
            print('{} {}'.format(i, j))
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools

# 標準入力の取得
X = int(input())


def get_value(A: int, B: int) -> int:
    """関数

    Arguments:
        A {int} -- 整数
        B {int} -- 整数

    Returns:
        int -- 整数
    """
    return A**5 - B**5


def main() -> None:
    """Entry point
    """
    # 求解処理
    """
    "X = A^5 - B^5"について増加スピードが最も遅い"A - B = 1"の場合について考える。
    このとき、数列"a_n = n^5 - (n-1)^5"はn=-119, 120のときにXの最大値10^9を超えるため、
    -118 <= A <= 119の場合についてのみ考える。
    この不等式とA - B = 1より、-119 <= B <= 118であるため、これらの範囲内のA, Bについて全探索を行う。
    """
    A_min, A_max = -118, 119
    B_min, B_max = -119, 118
    result = ""
    for A, B in itertools.product(range(A_min, A_max+1), range(B_min, B_max+1)):
        value = get_value(A, B)
        if value == X:
            result = f"{A} {B}"
            break

    # 結果出力
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools

# 標準入力の取得
X = int(input())

# 求解処理


def get_value(A: int, B: int) -> int:
    return A**5 - B**5


A_min, A_max = -118, 119
B_min, B_max = -119, 118
result = ""
for A, B in itertools.product(range(A_min, A_max+1), range(B_min, B_max+1)):
    value = get_value(A, B)
    if value == X:
        result = f"{A} {B}"
        break

# 結果出力
print(result)

Submission status: Accepted

Solution code:
import math

X = int(input())
flag = 0

for i in range(119,-119,-1):
  for j in range(119,-119,-1):
    if (pow(i,5) - pow(j,5)) == X:
      flag = 1
      break
  if flag == 1:
    break
print(i,j)

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

Submission status: Accepted

Solution code:
"""
A^5 - B^5
= (A - B)(A^4 + A^3*B + A^2*B^2 + A*B^3 + B^4)
= (A - B){(A + B) * (A^3 + B^3) + A^2*B^2}
= (A - B){(A + B)^2 * (A^2 - AB + B^2) + A^2*B^2}

(A + B)^2 > 0, (A^2 - AB + B^2) > 0, A^2*B^2 > 0
-> (A - B) > 0
"""


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


def solve():
    X = int(input())
    N = 10 ** 9 + 7

    step = 2 if X % 2 else 1  # if X is odd number, (A - B) also must be odd.

    for x in range(1, N, step):  # x means (A - B)
        if X % x:  # X must be divided by (A - B)
            continue

        for a in range(N):
            b = a - x

            diff = X - (a ** 5 - b ** 5)
            if diff == 0:
                return a, b

            if diff < 0 < b:
                break


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

from collections import deque

X = int(input())
s = {}
q = deque()
q.append((1, 0))
done = {(1, 0)}

while True:
	ab = q.popleft()
	tx = ab[0] ** 5 - ab[1] ** 5
	#print(ab)
	if (tx == X):
		print(ab[0], ab[1])
		quit()
	elif (tx > X):
		if ((ab[0] - 1, ab[1]) not in done):
			q.append((ab[0] - 1, ab[1]))
			done.add((ab[0] - 1, ab[1]))
		if (ab[1] > 0 or (ab[0], ab[1] + 1) not in done):
			q.append((ab[0], ab[1] + 1))
			done.add((ab[0], ab[1] + 1))
		if (ab[1] <= 0 or (ab[0], ab[1] - 1) not in done):
			q.append((ab[0], ab[1] - 1))
			done.add((ab[0], ab[1] - 1))
	else:
		if ((ab[0] + 1, ab[1]) not in done):
			q.append((ab[0] + 1, ab[1]))
			done.add((ab[0] + 1, ab[1]))
		if (ab[1] <= 0 or (ab[0], ab[1] - 1) not in done):
			q.append((ab[0], ab[1] - 1))
			done.add((ab[0], ab[1] - 1))

Submission status: Accepted

Solution code:
"""
A^5 - B^5
= (A - B)(A^4 + A^3*B + A^2*B^2 + A*B^3 + B^4)
= (A - B){(A + B) * (A^3 + B^3) + A^2*B^2}
= (A - B){(A + B)^2 * (A^2 - AB + B^2) + A^2*B^2}

-> (A + B)^2 > 1, (A^2 - AB + B^2) > 1, A^2*B^2 > 1.
"""


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


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
a = 0

while True:
    b = 0
    b2 = 0
    while a**5 - b**5 > 0 or a**5 - b2**5 < 10**9:
        if a**5 - b**5  == x:
            print(a ,b)
            break
        b += 1
        if a**5 - b2**5 == x:
            print(a ,b2)
            break
        b2 -= 1
    else:
        a += 1
        continue
    break

Submission status: Accepted

Solution code:
n=int(input())
x=0
while True:
    if (x+1)**5-x**5>10**9:
        x+=1
        break
    x+=1
for i in range(-x,x):
    for j in range(-x,x):
        if i**5-j**5==n:
            print(i,j)
            exit()

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

Submission status: Accepted

Solution code:
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1

Submission status: Accepted

Solution code:
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache   #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------
x = int(input())
def power(x,y):
    res = 1
    #print(x,y)
    while y>0:
        if y%2:
            res*=x
        x*=x
        y//=2
        #print(x,y)
    return res
def bs(n):
    l = -250
    r = 250
    while r-l>=0:
        mid = (l+r)//2
        tmp = power(mid,5)
        if tmp==n:
            return True, mid
        elif tmp<n:
            #print(mid,tmp,n)
            l = mid+1
        else:
            r = mid-1
    if power(l,5)==n:
        return True,l
    elif power(r,5)==n:
        return True,r
    return False,0
for i in range(-250,250):
    key = power(i,5)-x
    f,b = bs(key)
    if f:
        print(i,b)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
L = []
for i in range(120):
	L.append(i ** 5)
x = 0
for a in L:
	if a < X:
		b = X - a
		if b in L:
			B = -L.index(b)
			break
	else:
		b = a - X
		if b in L:
			B = L.index(b)
			break
A = L.index(a)
print(A, B)

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())
for a in range(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())
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:
x = int(input())
for i in range(-118,119):
  for j in range(-119,118):
    if i**5 - j**5 == x:
      print(i,j)
      quit()

Submission status: Accepted

Solution code:
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())
LISt=(make_divisors(x))
maX=max(LISt)
n=len(LISt)
flag = False

for i in range(1000):
  for j in range(n):
    b=-LISt[j]+i
    if i**5-b**5==x:
      flag=True
      print(i,b)
      break
  if flag:
    break

Submission status: Accepted

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

l = [i for i in range(-1000, 1000)]
c = itertools.permutations(l, 2)
for a, b in c:
    if a**5 - b**5 == X:
        print(a, b)
        break

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    x = int(input())
    for i in range(-1000, 1000):
        for j in range(-1000, 1000):
            if x == i**5 - j**5:
                print(i, j)
                break
        else:
            continue
        break

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
k = 1
while True:
    if k ** 5 - (k-1) ** 5 > x:
        break
    k += 1
for a in range(k):
    amari = x - a ** 5
    for b in range(a+1):
        if amari == b ** 5:
            print(a, -b)
            break
        if amari == (-b) ** 5:
            print(a, b)
            break

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

Submission status: Accepted

Solution code:
n, = map(int, input().strip().split())

# a5 - b5 = (a-b)(a4 + a3b + a2b2 + ab3 + b4)

def check(x):
  for a in range(200):
    b = a - x
    c = a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
    d = x * c
    if d == n:
      return [a, b]
  return None

for i in range(1, n+1):
  res = check(i)
  if res:
    break

r1, r2 = res
print(r1, r2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

from typing import Iterable


def calc(a: int, b: int) -> int:
    return a ** 5 - b ** 5


def fifthroot(i: int) -> int:
    return int(pow(i, 1 / 5))


def search_b(x, a) -> (bool, int):
    b = int(pow(abs(a ** 5 - x), 1 / 5))
    if x == a ** 5 - b ** 5:
        return True, b
    elif x == a ** 5 + b ** 5:
        return True, -b
    else:
        return False, 0


def main() -> None:
    X = ri()
    predict = fifthroot(X)
    for a in range(predict - 100, predict + 100):
        success, b = search_b(X, a)
        if success:
            break
    wm((a, b))


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> int:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(data: Iterable) -> None:
    print(' '.join(list(map(str, data))))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
import sys
for a in range(1000):
  for b in range(1000):
    if (a ** 5 - b ** 5) == x:
      print(str(a)+" "+str(b))
      sys.exit()
    elif(a ** 5 - (-b) ** 5) == x:
      print(str(a)+" "+str(-b))
      sys.exit()
    elif((-a) ** 5 - b ** 5) == x:
      print(str(-a)+" "+str(b))
      sys.exit()
    elif((-a) ** 5 - (-b) ** 5) == x:
      print(str(-a)+" "+str(-b))
      sys.exit()

Submission status: Accepted

Solution code:
def main():
    fac = 2**11
    l_a=[]
    for i in range(-fac,fac+1):
        l_a.append(i**5)
    l_b = l_a
    ans = int(input())
    #print(l_a)
    A=0
    B=0
    for num_a, i in enumerate(l_a):
        for num_b, j in enumerate(l_b):
            if i - j == ans:
                A = num_a - fac
                B = num_b - fac
    print(A,B)
main()

Submission status: Accepted

Solution code:
import itertools

X=int(input())
for A,B in itertools.product(range(150),range(-150,150)):
    if (A**5-B**5==X):
        print(A, B)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(X):
    for i in range(-119, 120):
        for j in range(-119, 120):
            if i ** 5 - j ** 5 == X:
                print(i, j)
                return
solve(int(input()))

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys
X = int(input())
for i in range(-118, 119):
	for j in range(-119, 118):
		res = i**5 - j**5
		if res == X:
			print("{} {}".format(i, j))
			sys.exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

X = int(input())


def explor_B(A):
    tmp = X - A**5

    def hantei(add_val):
        B = 0
        while True:
            if abs(B**5) == abs(tmp):
                return True, B
            elif abs(B**5) > abs(tmp):
                return False, 0
            else:
                B += add_val  

    if tmp < 0:
        return hantei(1)
         
    else:
        return hantei(-1)


A = 0

while True:
    flag, B = explor_B(A)
    if flag:
        break
    else:
        A += 1

print("{} {}".format(A, B))

Submission status: Accepted

Solution code:
import math

X = int(input())


def explor_B(A):
    tmp = X - A**5
    if tmp < 0:
        B = 0
        while True:
            if abs(B**5) == abs(tmp):
                return True, B
            elif abs(B**5) > abs(tmp):
                return False, 0
            else:
                B += 1  
    else:
        B = -1
        while True:
            if abs(B**5) == abs(tmp):
                return True, B
            elif abs(B**5) > abs(tmp):
                return False, 0
            else:
                B -= 1  

A = 0

while True:
    flag, B = explor_B(A)
    if flag:
        break
    else:
        A += 1

print("{} {}".format(A, B))

Submission status: Accepted

Solution code:
import numpy as np


x = int(input())
cands = np.arange(-120,120)
for a in cands:
    for b in cands:
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
X = int(input())
flag = 1
for c in range(1, np.power(10, 9)):
    x = X
    if x % c == 0:
        x = x // c
        for a in range(np.power(10, 3)):
            b = a-c
            y = 0
            for i in range(5):
                y += np.power(a, 4 - i) * np.power(b, i)
            if y == x:
                print(a, a - c)
                flag = 0
                break
    if flag == 0:
        break

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)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

a = 0
b = -1

while True:
    a5 = pow(a, 5)
    b5 = pow(b, 5)
    if(a5-b5 == x):
        print("{} {}".format(a, b))
        break
    if(a5+b5 == x):
        print("{} {}".format(a, -b))
        break
    if(-a5-b5 == x):
        print("{} {}".format(-a, b))
        break
    if(-a5+b5 == x):
        print("{} {}".format(-a, -b))
        break

    b += 1
    if(a==b-1):
        a +=1
        b =0

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
x = int(input())
foo = 0;
for i in range(-120 , 120):
  if foo == 1:
      break;
  for j in range(-120 , 120):
    if(math.pow(i , 5) - math.pow(j , 5) == x):
      print(i , " " , j)
      foo = 1;
      break;

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

x = int( input() )

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

Submission status: Accepted

Solution code:
def q4():
    X = int(input())
    for A in range(-255, 255):
        for B in range(-255, 255):
            if A**5 - B**5 == X:
                print(A, B)
                return


if __name__ == '__main__':
    q4()

Submission status: Accepted

Solution code:
x = int(input())
for diff in range(1, 250):
  a = 1
  while True:
    b = a-diff
    val = a**5 - b**5
    if val == x:
      print(a,b)
      exit(0)
    if b > 0 and  val > x:
      break
    a += 1
print(-1)

Submission status: Accepted

Solution code:
X=int(input())
I=J=0
for i in range(-300,300):
  for j in range(-300,300):
    if i**5-j**5==X:
      I=i
      J=j
      break
print(I,J)

Submission status: Accepted

Solution code:
import bisect
# 計算量を大体で見積もってぶん投げればおｋ
# この問題だとO(a**0.25)
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
k=breaknum=1
while(True):
    for n in range(-118,120):
        x=n**5-(n-k)**5
        if X==x:
            print("{0} {1}".format(n,n-k))
            breaknum=-1
            break
    k+=1
    if breaknum==-1:
        break