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:
if __name__ == '__main__':
    x = int(input())
    a = -1
    b = -1
    for i in range(0,1001,1):
        got = False
        for j in range(0,1001,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: Accepted

Solution code:
x=int(input())
i=j=0
while i**5-j**5-x:i=-~i%120;j=(j+99)%217-98
print(i,j)

Submission status: Accepted

Solution code:
X=int(input())

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

print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
eps = 1e-9
a = 1
while True:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(diff**0.2)
        if sign:
            b = -b
        break
    a += 1
print a,int(b)

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

pow5 = [i**5 for i in range(-120,120)]

for a in range(-120,120):
    for b in range(-120,120):
        if pow5[a+120] - pow5[b+120] == x:
            print(a , b)
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())

A = 200

f = True
while f:
    for B in range(-200,200,1):
        if A**5 - B**5 == x:
            print(A, B)
            f = False
    A -= 1

Submission status: Accepted

Solution code:
def calcurate(x):
  for a in range(1000):
    a5 = a**5
    for b in range(-1000, 1000):
      b5 = b**5
      if a5 - b5 == X:
        return a, b
      
if __name__ == "__main__":
  X = int(input())
  A, B = calcurate(X)
  print(A, B)

Submission status: Accepted

Solution code:
x = int(input())
flg = False
for a in range(150):
  for b in range(-150, a):
    if a**5 - b**5 == x:
      print("{} {}".format(a, b))
      flg = True
      break
  if flg: break

Submission status: Accepted

Solution code:
x = int(input())
LIMIT = 10 ** 9
lmt = 0

while lmt ** 5 - (lmt - 1) ** 5 <= LIMIT:
    lmt += 1


for a in range(-lmt, lmt + 1):
    for b in range(-lmt, a + 1):
        # print(a, b)
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

pow5 = [(i, i ** 5) for i in range(-1000, 1000)]

for a, a5 in pow5:
  for b, b5 in pow5:
    if a5 - b5 == x:
      print(f"{a} {b}")
      exit(0)

Submission status: Accepted

Solution code:
x = int(input())

pow5 = [i ** 5 for i in range(-1000, 1000)]

for a in range(-1000, 1000):
  for b in range(-1000, 1000):
    if pow5[a + 1000] - pow5[b + 1000] == x:
      print(f"{a} {b}")
      exit(0)

Submission status: Accepted

Solution code:
x = int(input())

for b in range(0, 1000):
    for a in range(b, 1000):
        if a**5 - b**5 == x:
            print(a, b, sep=" ")
            break
        if a**5 + b**5 == x:
            print(a, -b, sep=" ")
            break

Submission status: Accepted

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

def f(a, b):
    return a ** 5 - b ** 5
def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            # √nで無い数についてもう一個プラス
            if i != n // i:
                divisors.append(n // i)
    return divisors
division = sorted(make_divisors(x))
sele = math.floor(x ** (1/4))
for div in division:
    for j in range(-sele, sele + 1):
        a1 = j
        b1 = j - div
        if f(a1, b1) == x:
            print(a1, b1)
            break
    else:
        continue
    break

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

Submission status: Accepted

Solution code:
x = int(input())

def f():
    for a in range(1, 200):
        for b in range(-200, a):
            if a**5 - b**5 == x:
                print(a, b)
                return

f()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import count

def main():
    X = int(input())
    for i in count():
        for A in (-i, i):
            for B in range(-i, i+1):
                if A**5 - B**5 == X:
                    print(A, B)
                    return


main()

Submission status: Accepted

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

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

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)
      print(-j)
      exit()
    if i**5 - j**5 == x:
      print(i)
      print(j)
      exit()

Submission status: Accepted

Solution code:
import sys
X = int(input())
a = 1
b = 0
for a in range(1, 120):
  for b in range(-119, a):
    if pow(a, 5) - pow(b, 5) == X:
      print(a,b)
      sys.exit()

Submission status: Accepted

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


def fif_root(arg):
    def root(x):
        return math.floor(math.pow(x,1/5)*pow(10,10))/pow(10,10)
    return list(map(lambda x: root(x), 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: Accepted

Solution code:
import bisect
x = int(input())
aa = [a**5 for a in range(-1000, 1001)]
aset = set(aa)
for a in aa:
    if x+a in aset:
        ans = (x+a, a)
        break
ans1, ans2 = float('inf'), float('inf')
for i in range(-1000, 1001):
    if i**5==ans[0]: ans1 = i
    if i**5==ans[1]: ans2 = i
    if ans1==float('inf') or ans2==float('inf'): continue
    break
print(ans1, ans2, sep=' ')

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
for a in range(-200,201):
    for b in range(-200,201):
        if a**5 - b**5 == x:
            print("{} {}".format(a,b))
            exit()

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def main():
 x = int(input())
 for i in range(-200, 200):
   for j in range(-200, 200):
     if i**5-j**5 ==x:
       print(i,j)
       sys.exit()
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
def main():
 x = int(input())
 for i in range(-200, 200):
   for j in range(-200, 200):
     if i**5-j**5 ==x:
       print(i,j)
       sys.exit()
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def run():
  X = int(input())
  flag = 0
  
  for a in range(-118, 120):
    for b in range(-119, 119):
      if a**5-b**5==X:
        A = a
        B = b
        flag = 1
        break
    if flag==1:
      break
  
  print("{} {}".format(A, B))
  
if __name__ == "__main__":
  run()

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    ans = [i**5 for i in range(-125, 126)]
    for i, v1 in enumerate(ans, -125):
        for j, v2 in enumerate(ans, -125):
            if (v1-v2==x):
                print(i, j)
                return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

x = int(input())

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
x=int(input())
for A in range(120):
    k=A**5-x
    if k>=0:
        l=int(k**0.2)
        if l**5==k:
            print(A,l)
            break
    else:
        k=-k
        l=int(k**0.2)
        if l**5==k:
            print(A,-l)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

X, = map(int, input().split())

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

Submission status: Accepted

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

solve()

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:
x=int(input())
for A in range(10**3):
    k=A**5-x
    if k>=0:
        l=int(k**0.2)
        if l**5==k:
            print(A,l)
            break
    else:
        k=-k
        l=int(k**0.2)
        if l**5==k:
            print(A,-l)
            break

Submission status: Accepted

Solution code:
'''
A = 500 とする。
このとき、X = 10^9 となるのは、 B = 499.9968... のとき。
→ AまたはB (の絶対値) が大きすぎると、Xが10^9に収まらない。

A, Bの探索範囲は -120~120で十分。
'''

from itertools import product

def main():
    X = int(input())
    for A, B in product(range(-150, 150), range(-150, 150)):
        if A**5 - B**5 == X:
            print(A, B)
            return

main()

Submission status: Accepted

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

if X == 0:
    print("0 0")
elif X > 0: # a > b
    for i in range(-1000,1000):
        for j in range(-1000,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(-1000,1000):
        for j in range(i+1,1000):
            if X == i**5-j**5:
                print(i,j)
                break_flag = True
                break
        if break_flag == True:
            break

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    facts = [i ** 5 for i in range(120)]
    for a, a5 in enumerate(facts):
        for b, b5 in enumerate(facts):
            if a5 + b5 == N:
                print(a, -b)
                break
            if a5 - b5 == N:
                print(a, b)
                break
        else:
            continue
        break


resolve()

Submission status: Accepted

Solution code:
N=int(input())
def math(N):
  for i in range(-600,600):
    for j in range(-600,600):
      if i**5-j**5==N:
        return [i, j]
        break
print(*math(N))

Submission status: Accepted

Solution code:
x = int(input())
flag = False

for i in range(-1000, 1001):
    for j in range(-1000, 1001):
        if i**5-j**5 == x:
            flag=True
            print(i,j)
            
        if flag: break
    if flag: break

Submission status: Accepted

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

Submission status: Accepted

Solution code:

x = int(input())
achieve = 0

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

Submission status: Accepted

Solution code:
X = int(input())
#A**5 - B**5 = X
def return_AB(X):
    for i in range(-300,300,1):
        #print ("i=",i)
        for j in range(-300,300,1):
            #print ("j=",j)
            Y = i**5 - j**5
            
            if X == Y:
                return i,j
    else:
        return None, None

A,B = return_AB(X=X)
print("{} {}".format(A,B))

Submission status: Accepted

Solution code:
X = int(input())

a = 0
b = 0

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




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

Submission status: Accepted

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(R):
            if go[i] - go[j] == X:
                return i, j
        for j in range(i, R):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


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

Submission status: Accepted

Solution code:
X = int(input())
# X = 1
stopFlag = 0
for i in range (-201, 201):
    a = i
    for j in range(-201, 201):
        if a**5 - j**5 == X:
            print (a, j)
            stopFlag = 1            
        if stopFlag:
            break
    if stopFlag:
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def main():
    # a^5-b^5=xのx(x:自然数, a,b:整数)
    x = int(input())

    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(str(a)+" "+str(b))

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
lst = []
for i in range(-118, 120):
    for j in range(-119, 119):
        y = i ** 5 - j ** 5
        if y == x:
            lst_1 =[]
            lst_1.append(i)
            lst_1.append(j)
            lst.append(lst_1)
print(lst[0][0], lst[0][1])

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())
f={}
for a in range(200):
    for b in range(-200,200):
        f[a**5-b**5]=[a,b]
A,B=f[X]
print(A,B)

Submission status: Accepted

Solution code:
X = int(input())
a = []
for i in range(4000):
  a.append(i**5)
for i in range(4000):
  if X + a[i] in a:
    A = int((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: 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:
X = int(input())

def f():
    for A in range(-118, 120):
        for B in range(-119, 119):
            if pow(A, 5) - pow(B, 5) == X:
                print(f"{A} {B}")
                return

f()

Submission status: Accepted

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(i,j)
      exit(0)

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:
X = int(input())

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()
    for a in range(1,1000):
        a5 = a**5
        for b in range(a+1):
            b5 = b**5
            if a5 + b5 == x:
                return JA([a,-b], " ")
            if a5 - b5 == x:
                return JA([a,b], " ")

    return -1


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    x = int(input())
    for a in range(-120, 120):
        for b in range(-120, 120):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                break
        else:
            continue
        break


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

for A in range(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(120):
  for j in range(-119,120):
    if i**5-j**5==x:
      print(i,j)
      exit()

Submission status: Accepted

Solution code:
N = int(input())
array = [_**5 for _ in range(0,120)]

for x in array[:]:
    for y in array[:]:
        if x - y == N:
            print(array.index(x),array.index(y))
            exit()
        elif x + y == N:
            print(array.index(x),-array.index(y))
            exit()

Submission status: Accepted

Solution code:
a = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

b = -1
while True:
    b+=1
    amin = (x + b**5)**0.2
    apls = (x - b**5)**0.2

    if isinstance(amin, float):
        amin = round(amin,10)
        if amin.is_integer():
            print(int(amin),b)
            break
    
    if isinstance(apls,float):
        apls = round(apls,10)
        if apls.is_integer():
            print(int(apls),-1*b)
            break

Submission status: Accepted

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

# D - I hate Factorization
def meet_condition(i, j):
	pi = pows[i]
	pj = pows[j]
	
	if pi - pj == x:
		return i, j
	elif pi + pj == x:
		return i, -j


pows = []

for i in range(200):
	pows.append(pow(i, 5))

x = int(input())

for i in range(len(pows)):
	for j in range(len(pows)):
		if meet_condition(i, j) != None:
			a, b = meet_condition(i, j)
			print(a, b)
			exit()

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().strip()

def main():
    X = int(input())
    for diff in range(-200,200):
        for a in range(-200,200):
            b = a-diff
            if (a**5 - b**5) == X:
                break
        else:
            continue
        break
    print(a,b)

main()

Submission status: Accepted

Solution code:
N = 200

x = int(input())
A, B = 0, 0
for a in range(N):
    for b in range(-N, N):
        if a**5 - b**5 == x:
            A, B = a, b

print(A, B)

Submission status: Accepted

Solution code:
def Main(X):
    for i in range(-178, 178):
        for j in range(-178, 178):
            if i**5-j**5 == X:
                return i,j

def main():
    X = int(input())
    i, j = Main(X)
    print("{0} {1}".format(i, j))

if __name__ == '__main__':
    main()

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:
c=5**6
exec(c*2*f'i,j=c%120,c//120;c-=i**5-j**5!={input()}or exit(print(i,j));')

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(str(i) + " " + str(j))
            exit()

Submission status: Accepted

Solution code:
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

X = int(input())
for a in range(10**3):
    for b in range(10**3):
        aa = a ** 5
        bb = b ** 5
        if aa - bb == X:
            print(a, b)
            sys.exit()
        if aa + bb == X:
            print(a, -b)
            sys.exit()
        if -aa - bb == X:
            print(-a, b)
            sys.exit()
        if -aa + bb == X:
            print(-a, -b)
            sys.exit()

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    X = read_int()
    A = 0
    B = 0
    # A > B
    while True:
        if A**5-B**5 == X:
            return '%s %s'%(A, B)
        if A**5+B**5 == X:
            return '%s %s'%(A, -B)
        if A == B:
            A += 1
            B = 0
        else:
            B += 1


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
x = int(input())
a0, a1 = -118, 119
b0, b1 = -119, 118
flag = False
for a in range(a0, a1+1):
    for b in range(b0, b1+1):
        if a**5 - b**5 == x:
            a_ , b_ = a, b
            flag = True
            break
    if flag is True:
        break
print(a_, b_)

Submission status: Accepted

Solution code:
x = int(input())

flag = False
for a in range(-118, 120):
    if(flag): break
    for b in range(-118, 119):
        if(flag): break
        if pow(a, 5) - pow(b, 5) == x:
            print(a,b)
            flag = True
            break

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
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()
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

Solution code:
def power(x,y):
	res=1
	while y>0:
		if y%2==1:
			res=(res*x)
		y=y//2
		x=x*x
	return res

x=int(input())
for i in range(-1000,1001,1):
	rr=power(i,5)
	for j in range(-1000,1001,1):
		temp=rr-power(j,5)
		if temp==x:
			print(i,j)
			exit()

Submission status: Accepted

Solution code:
x=int(input())
import math
import sys
A=[math.pow(i,5) for i in range(-1000,1000,1)]
B=[math.pow(i,5) for i in range(-1000,1000,1)]
for n in A:
  for m in B:
    if n-m==x:
      print(-1000+A.index(n),-1000+B.index(m))
      sys.exit()

Submission status: Accepted

Solution code:
def calc(n):
    x = 1 << (n.bit_length() + 4) // 5
    y = (4 * x + n // (x ** 4)) // 5
    while y < x:
        x = y
        y = (4 * x + n // (x ** 4)) // 5
    return x
def f(n):
    return calc(n) if n > 0 and calc(n) ** 5 == n else 0

X = int(input())
for i in range(1 << 10):
    a = f(X + i ** 5)
    if a:
        print(a, i)
        break
    a = f(X - i ** 5)
    if a:
        print(a, -i)
        break

Submission status: Accepted

Solution code:
X = int(input())


#すぐ発散するからプラスマイナス200で十分な値になる。



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

Submission status: Accepted

Solution code:
M=120
c=M*M
exec(c*2*f'i,j=c%M,c//M;c-=i**5-j**5!={input()}or exit(print(i,j));')

Submission status: Accepted

Solution code:
X = int(input())

for A in range(-118, 120):
    Ap = A * A * A * A * A
    for B in range(-119, 119):
        Bp = B * B * B * B * B
        if Ap - Bp == X:
            break
        elif Ap - Bp == -X:
            A, B = B, A
            break
    else:
        continue
    break
print(A, B)

Submission status: Accepted

Solution code:
import numpy as np
X = int(input())
x = np.arange(-300,300,dtype= np.int64)
diff = np.subtract.outer(x**5,x**5)

i = np.where(diff == X)

A,B = i[0][0]-300,i[1][0]-300
print(A,B)

Submission status: Accepted

Solution code:
c=24000
exec(c*2*f'i,j=c%200,c//200;i**5-j**5-{input()}or exit(print(i,j));c-=1;')

Submission status: Accepted

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

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

Submission status: Accepted

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


def sqrt5(n):
    negative = True if n < 0 else False
    for i in range(1000):
        if i ** 5 == abs(n):
            if negative:
                return -i
            return i


def solve(X: int):
    pos = {x ** 5 for x in range(1000) if x ** 5 <= int(1e15)}
    neg = {-x for x in pos}
    nums = pos.union(neg)
    for a in nums:
        # b = a - x
        if a - X in nums:
            b = a - X
            print(sqrt5(a), sqrt5(b))
            return
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

ans = 1
for i in range(-5000, 5000):
    if ans == 0:
        break
    for j in range(-5000, 5000):
        if i**5 - j**5 == x:
            print(i, j)
            ans = 0
            break