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:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

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

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


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

# from fractions import gcd
# from math import gcd

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


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


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


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


def main():
    x = int(input().strip())
    for a in range(0,2000):
        for b in range(-100,2000):
            if a**5 - b**5 == x:
                print(a,b)
                return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
def check(v):
    l = int(-1e18)
    r = int(1e18)
    while r - l > 1:
        m = int((r + l) / 2)
        if m ** 5 > v:
            r = m
        else:
            l = m
    return l

x = int(input())
for b in range(-10000, 10000):
    v = int(b ** 5 + x)
    k = check(v)
    if k ** 5 == v:
        print(k, b)
        break

Submission status: Accepted

Solution code:
#! /usr/bin python3

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

Submission status: Accepted

Solution code:
def resolve():
    import math
    x = int(input())
    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__':
    resolve()

Submission status: Accepted

Solution code:
import sys
s = int(input())
for i in range(-120,120):
  for j in range(-120,120):
    if i**5 - j**5 == s:
      print(i,j)
      sys.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(str(A)+" "+str(B))
      exit()

Submission status: Accepted

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

Submission status: Accepted

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

for A in range(-10**3,10**3):
    for B in range(-10**3,10**3):
        if A ** 5 - B ** 5 == x:
            print(A,B)
            quit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

X= int(input())

#添字の最大値を算出

a = 1
b = 0
dif = 0
while dif < 10**9:
    a += 1
    b += 1

    dif = a ** 5 - b ** 5

loop_sequence = a - 1

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

Submission status: Accepted

Solution code:
x = int(input())
import math
f = 1
for A in range(-10**5,10**5):
    A5 = A ** 5
    if x - A5 > 0:
        f = -1
        B = round(math.pow(x - A5,1/5),0)
    else:
        B = round(math.pow(-(x - A5),1/5),0)
    if  A5 == x + int(B*f) ** 5:
        print(A,int(B)*f)
        quit()

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

a = 0
while True:
    b = a
    target = (a**5) - X
    while (b**5) > target:
        b-=1
    if(b**5) == target:
        print("%d %d"%(a,b))
        break
    a+=1

Submission status: Accepted

Solution code:
import sys

if __name__ == "__main__":
    line1 = sys.stdin.readline().strip()
    X = int(line1)

    A = 120
    while A >= -120:
        A -= 1

        B = 120

        isEnd = False
        while B >= -120:
            B -= 1

            if A ** 5 - B ** 5 == X:
                print("{0} {1}".format(A, B))
                isEnd = True
                break

        if isEnd:
            break

Submission status: Accepted

Solution code:
import sys

def divisors(n):
  res = set()
  for i in range(1, int(n ** 0.5) + 1):
    if n % i: continue
    res.add(i)
    res.add(n // i)
  return res

x = int(sys.stdin.readline().rstrip())

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

def ternary_search(d):
    lo, hi = -1, 10 ** 18
    while lo + 1 < hi:
        a = (lo + hi) // 2 
        b = a - d 
        bl = a >= abs(b)
        bl2 = f(a, b) >= x
        if bl ^ bl2: lo = a
        else: hi = a
    return hi, hi - d

def main():
    diffs = divisors(x)
    for d in diffs:
        a, b = ternary_search(d)
        if f(a, b) == x:
            print(a, b)
            return 

if __name__ == '__main__':
    main()

Submission status: Accepted

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


def solve(X: int):
    def func(A):
        return pow(X+A**5, 1/5)

    for A in range(-1000, 1000):
        for B in range(-1000, 1000):
            if X == A**5-B**5:
                print(A, B)
                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:
n = int(input())
flag = False
for i in range(10**8):
    for j in range(-10**4,10**4):
        if i**5 - j **5 == n :
            print(i,j)
            flag = True
            break
    if flag == True :
        break

Submission status: Accepted

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


def solve(X: int):
    def func(A):
        return pow(X+A**5, 1/5)

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

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 1010
while B==1010:
    l = -1000
    r = 1000
    while abs(l-r)!=1:
        if A**5-((l+r)//2)**5<X:
            r = (l+r)//2
        elif A**5-((l+r)//2)**5>X:
            l = (l+r)//2
        else:
            B = (l+r)//2
            break
    if B==1010:
        A += 1
print(A,B)

Submission status: Accepted

Solution code:
import sys

def divisors(n):
  res = set()
  for i in range(1, int(n ** 0.5) + 1):
    if n % i: continue
    res.add(i)
    res.add(n // i)
  return res

x = int(sys.stdin.readline().rstrip())

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

def binary(d):
    lo, hi = -1, 10 ** 18
    while lo + 1 < hi:
        a = (lo + hi) // 2 
        b = a - d 
        bl = a >= abs(b)
        bl2 = f(a, b) >= x
        if bl ^ bl2: lo = a
        else: hi = a

        # if f(a, b) >= x:
        #     hi = a 
        # else:
        #     lo = a
    return hi, hi - d

def main():
    diffs = divisors(x)
    for d in diffs:
        a, b = binary(d)
        if f(a, b) == x:
            print(a, b)
            return 

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

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

    return arr


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


p = factorization(x)
p = make_divisors(x)
# print(p)
Bas = 0
Aas = 0

flg = False
# p.append([1, 1])
# print(p)
for i in range(len(p)):
    if flg:
        break
    _p = p[i]
    # print(_p)
    B = int(-_p/2)

    while True:

        xnew = (B + _p)**5 - B ** 5
        # print(B, xnew)
        if xnew == x:
            Bas = B
            Aas = B + _p
            flg = True
            break

        if xnew > x:
            break

        B += 1


print(f'{Aas} {Bas}')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt
import fractions
import collections
import itertools
from collections import deque
X=int(input())
"""
l=[]
for i in range(1,ceil(sqrt(X))+1):
    if X%i==0:
        l.append(i)
        l.append(X//i)
l=list(set(l))
l2=l
for i in range(len(l)):
    l2.append(-l[i])
#print(l2)
l2.sort()
if len(l)!=0:
    for i in l2:
        x=X//i
        #print(i,x)
        n=(x-pow(i,4))/(pow(i,2)+1)
        #print(n)
        if (5*pow(i,4)+20*x)>=0:
            if sqrt((5*pow(i,4)+20*x)).is_integer()==True:
                #print(x,i)
                m=int(sqrt((5*pow(i,4)+20*x)))
                if (-5*i*i+m)%10==0:
                    y=(-5*i*i+m)//10
                    #print(i,y)
                    if pow(i,2)+4*y>=0:
                        if sqrt(pow(i,2)+4*y).is_integer()==True:
                            z=int(sqrt(pow(i,2)+4*y))
                            if (-i+z)%2==0:
                                b=(-i+z)//2
                                a=i+b
                                print(a,b)
                                break
                            elif (-i - z) % 2 == 0:
                                b = (-i - z) // 2
                                a = i + b
                                print(a, b)
                                break
                elif (-5*i*i-m)%10==0:
                    y=(-5*i*i+m)//10
                    #print(i,y)
                    if pow(i,2)+4*y>=0:
                        if sqrt(pow(i,2)+4*y).is_integer()==True:
                            z=int(sqrt(pow(i,2)+4*y))
                            if (-i+z)%2==0:
                                b=(-i+z)//2
                                a=i+b
                                print(a,b)
                                break
                            elif (-i - z) % 2 == 0:
                                b = (-i - z) // 2
                                a = i + b
                                print(a, b)
                                break
"""
flag=0
#こんなことしなくても全探査で通る!
#A>0にて
#A=iの時A^5-B^5の最小は
#i^5-(i-1)^5
#i^5-(i-1)^5が10^9を超えていれば、その範囲の中で全探査すれば、必ず入力の解を持つものに出会えるはず(このiをmaxとする)
#A<=0にて
#A=iの時、A^5ーB^5の最小は
#i^5-(i+1)^5
#i^5-(i+1)^5が10^9を超えていれば、その範囲の中で全探査すれば、必ず入力の解を持つものに出会えるはず(このiをminとする)
i=0
while pow(i+1,5)-pow(i,5)<10**9:        #A>0にて、pow(i+1,5)-pow(i,5)が10^9を超える点を探す
    #print(pow(i+1,5)-pow(i,5))
    i=i+1
ma=i
#print(ma)
i=0
#input()
while pow(i,5)-pow(i-1,5)<10**9:        #A<=0にて、pow(i,5)-pow(i-1,5)が10^9を超える点を探す
    #print(pow(i, 5) - pow(i-1, 5))
    i=i-1
mi=i
#print(ma,mi)
for i in range(mi-2,ma+2):          #余裕を持って、mi-2からma+2の間を
    for j in range(mi-2,ma+2):      #全探査すれば余裕で通るはず
        if pow(i,5)-pow(j,5)==X:
            print(i,j)
            flag=1
            break
    if flag==1:
        break

Submission status: Accepted

Solution code:
from sys import stdin


def get_result(data):
    N = data[0]
    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if (a**5 - b**5) == N:
                return '{} {}'.format(a, b)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)

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:
# -*- coding: utf-8 -*-

N=input()

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

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

L=make_divisors(N)
for yakusu in L:
    for a in range(10**3):
        b=a-yakusu
        if func(a,b)==N:
            print a,b
            quit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import itertools

X = int(input())


def solve(x):
    for i in range(-200, 200):
        for j in range(-200, 200):
            if i ** 5 - j ** 5 == x:
                return i, j


A, B = solve(X)
print(A, B)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N=input()

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

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

L=make_divisors(N)
for yakusu in L:
    for a in range(1,10**3):
        b=a-yakusu
        if func(a,b)==N:
            print a,b
            quit()

Submission status: Accepted

Solution code:
def main():
    r = 0
    x = 0
    while x <= 1e9:
        r += 1
        x = pow(r, 5) - pow(r-1, 5)
    x = 0
    l = 1
    while x <= 1e9:
        l -= 1
        x = pow(l, 5) - pow(l-1, 5)
    for a in range(l,r):
        for b in range(l,r):
            if pow(a,5) - pow(b, 5) == X:
                print(a, b)
                return

X = int(input())
main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N=input()

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

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

L=make_divisors(N)
for yakusu in L:
    for a in range(1,10**3):
        b=a-yakusu
        ret=func(a,b)
        if ret==N:
            print a,b
            quit()

Submission status: Accepted

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


def solve(X: int):
    f = lambda x, y: x**5 - y**5
    for i in range(-200, 200):
        for j in range(-200, 200):
            if f(i, j) == X:
                print(str(i) + ' ' + str(j))
                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:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x = int(input())
    a = 0

    while True:
        a += 1
        for b in range(a):
            if a ** 5 + b ** 5 == x:
                print(a, -b)
                sys.exit()
            if a ** 5 - b ** 5 == x:
                print(a, b)
                sys.exit()


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

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()
    save = -1
    for i in range(len(divisors)):
        if divisors[i] >= 130:
            save = i
            break
    if save > 0:
        divisors = divisors[:save]
    return divisors

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

divs = make_divisors(X)
ans = 0
for div in divs:
  a = -120+div
  b = -120
  while f(a, b) > X and b < 2:
    a += 1
    b += 1
  if f(a, b) == X:
    ans = (a, b)
    
print(ans[0], ans[1])

Submission status: Accepted

Solution code:
#x**5-y**5 - int(input()) = 0


X = int(input()) #X <= 10**9

#x**5-y**5 <= 10**9



count = 0
for l in range(-1000,1000):
  for i in range(-1000,1000):
    if(l**5 -i**5 == X):
      print(l,i)
      count += 1
      break
  if(count == 1):
    break

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:
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()

X = int(input())
for A in range(-10 ** 3, 10 ** 3):
    A5 = A ** 5
    for B in range(-10 ** 3, 10 ** 3):
        if A5 - B ** 5 == X:
            print(A, B)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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()
    save = -1
    for i in range(len(divisors)):
        if divisors[i] >= 130:
            save = i
            break
    if save > 0:
        divisors = divisors[:save]
    return divisors

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

divs = make_divisors(X)
ans = 0
for div in divs:
  a = -120
  b = -120+div
  while f(a, b) < X and a < 2:
    a += 1
    b += 1
  if f(a, b) == X:
    ans = (a, b)
  a = -120+div
  b = -120
  while f(a, b) > X and b < 2:
    a += 1
    b += 1
  if f(a, b) == X:
    ans = (a, b)
    
print(ans[0], ans[1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N=input()

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

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

L=make_divisors(N)
for yakusu in L:
    for a in range(10**3):
        b=a-yakusu
        if func(a,b)==N:
            print a,b
            quit()

Submission status: Accepted

Solution code:
import sys

X = int(sys.stdin.readline().strip())

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

Submission status: Accepted

Solution code:
import sys

X = int(input())
for i in range(-500,500):
    for j in range(-500,500):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            sys.exit()

Submission status: Accepted

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

for i in range(-1000,1000):
  for j in range(-1000,1000):
    num= i**5 -j **5
    if num == X:
      print(i,j)
      flg=True
      break
     
  if flg:
    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)
            exit(0)

Submission status: Accepted

Solution code:
# coding: utf-8
X = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

for a in range(120):
    for b in range(120):
        A=a**5
        B=b**5
        if X==A+B:
            print(a,-b)
            exit()
        elif X==A-B:
            print(a,b)
            exit()

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:
import numpy as np
x = int(input())

i = 0
while True:
    a = i
    b = (np.abs(a**5 - x))**(1/5)
    #print(b)
    if (a**5-x) < 0 :
        b = -b
    if a**5 - int(b)**5 == x:
        print(a,int(b))
        break
    
    a = -i
    b = (np.abs(a**5 - x))**(1/5)
    if (a**5-x) < 0 :
        b = -b
    if a**5 - int(b)**5 == x:
        print(a,int(b))
        break
    i += 1

Submission status: Accepted

Solution code:
X = int(input())

for a in range(0,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())
found = False
for i in range(-200, 200):
    for j in range(-200, 200):
        if (i ** 5 - j ** 5) == X:
            print(i, j)
            found = True
            break
    if found:break

Submission status: Accepted

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

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 100000):
    tmp = math.pow(X + b ** 5, 0.2)
    if math.floor(math.floor(tmp+1.0e-6) - tmp + 1.0e-6) == 0:
        break
        
tmp = math.floor(tmp + 1.0e-6)
print(tmp, b)

Submission status: Accepted

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

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

print(a,b)

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:

    

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


    def isOK(A, B):
        eq = A**5 - B**5
        if eq <= X:
            return True
        else:
            False
    
    def bin_search(B):
        # search A
        # A**5 - B **5 <= X となる最大のAを求める
        left = B
        right = 10 ** 4 * 2

        while right - left > 1:
            mid = left + (right - left) // 2
            if isOK(mid, B):
                left = mid
            else:
                right = mid

        return left
    

    for B in range(-10**4, 10**4 + 1):
        A = bin_search(B)
        if A**5 - B**5 == X:
            print(A, B)
            exit()
            
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# AC: 33 msec(Python3)
from itertools import combinations_with_replacement
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    x = int(readline())

    ab = [i**5 for i in range(200)]

    C = combinations_with_replacement(ab, 2)
    for a, b in C:
        if a + b == x:
            print(int(pow(b, 0.2)), -int(pow(a, 0.2)))
            break
        
        if b - a == x:
            print(int(pow(b, 0.2)), int(pow(a, 0.2)))
            break


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
#  N,M=map(int,input().split())
x=int(input())

def main():
    for i in range(-130,130):
        for j in range(-130,130):
            if i**5-j**5==x:
                print(i,j)
                return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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:
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])

    ret = None
    for b in range(120):
        for a in range(b, 120):
            a5, b5 = pow(a, 5), pow(b, 5)
            if a5-b5 == x:
                ret = (a, b)
                break
            elif a5+b5 == x:
                ret = (a, -b)
                break

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import *

def get(n):
	return n * n * n * n * n

X = int(stdin.readline())
for a in range(0, 10001):
	A = get(a)
	B = abs(A - X)
	lo = 0
	hi = 10000
	b = -1
	ok = False
	while lo <= hi:
		mid = (lo + hi) // 2
		sum = get(mid)
		if sum is B:
			b = mid
			ok = True
			break
		if sum < B:
			lo = mid + 1
		else:
			hi = mid - 1
	if ok is True:
		if A < X:
			b = -b
		print("{} {}".format(a, b))
		exit()

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])

    ret = None
    for b in range(120):
        for a in range(b, 120):
            a5, b5 = pow(a, 5), pow(b, 5)
            if a5-b5 == x:
                ret = (a, b)
            elif a5+b5 == x:
                ret = (a, -b)

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

Solution code:

    

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


    def isOK(A, B):
        eq = A**5 - B**5
        if X >= eq:
            return True
        else:
            False
    
    def bin_search(B):
        # search A
        left = B + 1
        right = 10 ** 4 * 2

        while right - left > 1:
            mid = left + (right - left) // 2
            if isOK(mid, B):
                left = mid
            else:
                right = mid

        return left
    

    for B in range(-10**4, 10**4 + 1):
        A = bin_search(B)
        if A**5 - B**5 == X:
            print(A, B)
            exit()


if __name__ == "__main__":
    main()

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(a, b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())


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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])

    ret = None
    for a in range(120):
        for b in range(120):
            a5, b5 = pow(a, 5), pow(b, 5)
            if a5-b5 == x:
                ret = (a, b)
            elif a5+b5 == x:
                ret = (a, -b)

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
found = False
a = 0
b = 0

for i in range(-200, 201):
  for j in range(-200, 201):
    if i**5-j**5==x:
      found = True
      a = i
      b = j
  if found:
    break
    
print(a, b)

Submission status: Accepted

Solution code:
X = int(input())
ans = list()
min = float("inf")
r = range(-200,200)
for A in r:
  for B in r:
    if A**5-B**5==X:
      if A**5-B**5< min:
        if len(ans)!=0: ans.pop()      
        ans.append([A,B])
        min = A**5-B**5
        break
      elif A**5-B**5==min:
        ans.append([A,B])
        break
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = 0
B = 0
if X == 0:
    print(0,0)
while(True):
    B = 0
    A5 = A ** 5
    if A5 <= X:
        while(B<A):
            B5 = B ** 5
            if A5 + B5 == X:
                print(A,-B)
                exit(0)
            B += 1
    else:
        while(B<A):
            B5 = B ** 5
            if A5 - B5 == X:
                print(A,B)
                exit(0)
            B += 1
    A += 1

Submission status: Accepted

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