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:
import sys

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


def chk(x, a, b):
    if a * a * a * a * a - b * b * b * b * b == x:
        print(a, b)
        sys.exit()


def r(x, n, a, b):
    for _ in range(n):
        a = a + 1
        # print(a, b)
        chk(x, a, b)
    return a, b


def u(x, n, a, b):
    for _ in range(n):
        b = b + 1
        # print(a, b)
        chk(x, a, b)
    return a, b


def l(x, n, a, b):
    for _ in range(n):
        a = a - 1
        # print(a, b)
        chk(x, a, b)
    return a, b


def d(x, n, a, b):
    for _ in range(n):
        b = b - 1
        # print(a, b)
        chk(x, a, b)
    return a, b


while n < 100000000:
    a, b = r(x, n, a, b)
    a, b = u(x, n, a, b)
    n = n + 1
    a, b = l(x, n, a, b)
    a, b = d(x, n, a, b)
    n = n + 1


# r1 u1 l2 d2 r3 u3 l4 d4

#    x x x x x
#      x x x x
#      x x x x
#      x x x x

Submission status: Accepted

Solution code:
x = int(input())
a = 10
f = False
for i in range(-1000, 1001):
  for j in range(-1000,1001):
    if pow(i, 5) - pow(j,5) == x:
      print(i, j)
      f = True
      break
  if f:
    break

Submission status: Accepted

Solution code:
x = int(input())

lower_limit, upper_limit = -10**3, 10**3

for a in range(lower_limit, upper_limit):
    for b in range(lower_limit, upper_limit):
        d = a ** 5 - x
        if d == b ** 5:
            print("{} {}".format(a, b))
            exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
i=1
a=0
b=0
while(a==0 and b==0):
  for j in range(-i,i):
    if i**5-j**5==x:
      a=i
      b=j
  i+=1
    
print(a,b)

Submission status: Accepted

Solution code:
x = int(input())

for a in range(10**3):
  for b in range(10**3):
    frag = False
    if a ** 5 - b ** 5 == x:
      print(a,b)
      frag = True
      break
    elif (-a) ** 5 - b ** 5 == x:
      print(-a,b)
      frag = True
      break
      
    elif a ** 5 - (-b) ** 5 == x:
      print(a,-b)
      frag = True
      break
      
    elif (-a) ** 5 - (-b) ** 5 == x:
      print(-a,-b)
      frag = True
      break
  if frag == True:
      break

Submission status: Accepted

Solution code:
x=int(input())
if x==1:
    print(0,-1)
    exit()
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
li=sorted(make_divisors(x))
for i in range(len(li)):
    j=li[i]
    k=j//2
    while pow(k,5)-pow(k-j,5)<=x:
        if pow(k,5)-pow(k-j,5)==x:
            print(k,k-j)
            exit()
        else:
            k+=1
    continue

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-500, 500):
    for j in range(-500, 500):
        if i**5 - j**5 == X:            
            ans = [str(i), str(j)]
            break
print(" ".join(ans))

Submission status: Accepted

Solution code:
X = int(input())
Ans = []
for A in range(201):
  for B in range(A):
    if A ** 5 - B ** 5 == X:
      Ans = [A, B]
    if A ** 5 + B ** 5 == X:
      Ans = [A, B * (-1)]
      break
      
print(Ans[0], Ans[1])

Submission status: Accepted

Solution code:
X = int(input())
a = 1
b = 0
while True:
    tmp = a**5-b**5
    if tmp < X:
        b -= 1
    elif tmp == X:
        print(a,b)
        break
    else:
        b = a
        a += 1

Submission status: Accepted

Solution code:
def f(a, b):
    return a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4


x = int(input())
pair = [(1, x)]
i = 2
while i*i <= x:
    if x % i == 0:
        pair.append((i, x//i))
    i += 1

for i, j in pair:
    # print(f"pair:{i} {j}")
    a = 0
    b = -i
    while b <= 0 or f(a, b) <= j:
        # print(f(a, b))
        a += 1
        b += 1
        if f(a, b) == j:
            print(f"{a} {b}")
            exit(0)

Submission status: Accepted

Solution code:
X = int(input())

x = int(pow(X, 0.2) // 1)
y1 = x - pow(10, 6)
y2 = x + pow(10, 6)
#print(y1, y2)

for B in range(y1, y2 + 1):
  A = pow(X + pow(B, 5), 0.2) 
  #print(A)
  if type(A) != complex:
    if abs(int(A) - A) < pow(10, -6):
      print(int(A), B)
      quit()

Submission status: Accepted

Solution code:
from math import floor
from copy import deepcopy

def calc(a,b):
  ret=a**4+b**4+a*b*(a**2+a*b+b**2)
  return ret

X=int(input())
p=floor(X**0.5)

q=[]
for i in range(1,p+1):
  if X%i==0:
    q.append([i,X//i])
    
for kumi in q:
  s=kumi[0]
  t=kumi[1]
  #print(s,t)
  for A in range(p):
    B=A-s
    if calc(A,B)==t:
      print(A,B)
      break

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    n5 = {i:i**5 for i in range(-130, 131)}
    for i, v1 in n5.items():
        for j, v2 in n5.items():
            if v1 - v2 == x:
                print(i, j)
                return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
X=int(input())
for i in range(500):
  for j in range(500):
    if (i-100)**5-(j-100)**5==X:
      A=[]
      A.append(i-100)
      A.append(j-100)
      A=[str(n) for n in A]
      print(' '.join(A))
      sys.exit()

Submission status: Accepted

Solution code:
X = int(input())
s = [0] * 200
for i in range(200):
    s[i] = i**5
k = 0
for i in range(200):
    if k == 1:
        break
    else:
        for j in range(200):
            if k == 1:
                break
            else:
                if s[i] - s[j] == X:
                    print(i,j)
                    k = 1
                elif s[j] - s[i] == X:
                    print(j,i)
                    k = 1
                elif s[i] + s[j] == X:
                    print(i,-j)
                    k = 1
                elif s[i] + s[j] == -X:
                    print(-i,j)
                    k = 1

Submission status: Accepted

Solution code:
x=int(input())
m=10**3
for i in range(0,m):
    for j in range(-m,i):
        if i**5-j**5 == x:
            ans1=i
            ans2=j

print(ans1,ans2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
t=0
n=int(input())
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5-j**5==n:
            print(i,j,sep=' ')
            t=1
            break
    if t==1:
        break

Submission status: Accepted

Solution code:
X = int(input())

for a in range(0, 1000):
    for b in range(-1000, 1001):
        if (a**5) - (b**5) == X:
            print(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:
            print(a,b)
            exit(0)

Submission status: Accepted

Solution code:
X = int(input())

lis = set([])
lis.add(0)
for i in range(1, 250):
    lis.add(i**5)

for x in lis:
    if abs(X-x) in lis:
        if x-X<0:
            print(int(x**0.2), -int(abs(x-X)**0.2))
        else:
            print(int(x**0.2), int(abs(x-X)**0.2))
        break

Submission status: Accepted

Solution code:
x = int(input())

pos_array = []
neg_array = []

idx = 0
num = 0
while num < 10**15:
    num = pow(idx, 5)
    pos_array.append(num)
    idx += 1

idx = 0
num = 0
while num > -10**15 - 1:
    num = pow(idx, 5)
    neg_array.append(num)
    idx -= 1

for i in range(len(pos_array)):
    for j in range(len(pos_array)):
        if pos_array[i] - pos_array[j] == x:
            print("%d %d" % (i, j))
            exit(0)

for i in range(len(pos_array)):
    for j in range(len(neg_array) - 1, -1, -1):
        if pos_array[i] - neg_array[j] == x:
            print("%d %d" % (i, -j))
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())
a = 1
true = True
while true:
    if a**5-x < 0:
        b = -1*int((-1*(a**5-x))**(1/5))
    else:
        b = int((a**5-x)**(1/5))
    if a**5 -b**5 == x:
        true = False
        break
    a += 1
    
print(a ,b)

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)
      #else:
      #  divisors.append([i, i])
  return divisors


def solve(a, b, c):
  D = (b**2 - 4*a*c) ** (1/2)
  x_1 = (-b + D) / (2 * a)
  x_2 = (-b - D) / (2 * a)
  return x_1, x_2

for pattern in make_divisors(X):
  diff = pattern
  A = 5
  B = 5 * (diff ** 2)
  C = diff ** 4 - X//diff
  sekiss = solve(A, B, C)
  for sekis in sekiss:
    if sekis == int(sekis):
      #print(int(sekis), diff)
      kouhos = solve(1, -diff, -int(sekis))
      if kouhos[0].imag == 0.0:
        print(int(kouhos[0]), int(kouhos[0] - diff))
      break

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
#input = sys.stdin.readline
X = I()
five_l = [-1]*200
f=0
for a in range(200):
    five_l[a]=pow(a,5)
    now = five_l[a]
    for i in range(a+1):
        search = five_l[i]
        if search+now==X:
            f = 1
            print(a,-i)
            break
        elif now-search == X:
            print(a,i)
            f = 1
            break
    if f==1:
        break

Submission status: Accepted

Solution code:
N = int(input())
s = 0
a = 0
import math

while s== 0:
  
  if a**5 > N:
    b = math.floor( (a**5 - N)**(1/5) )
    c = 1
  else:
    b = math.floor( (N - a**5)**(1/5) )
    c = 2
  
  if c == 1 and a**5 - b**5 == N:
    s = 1
  elif  c == 2 and a**5 + b**5 == N:
    b = -b	
    s = 1
  else:
    a += 1  
  
print(a,b)

Submission status: Accepted

Solution code:
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
import math
import itertools
from collections import defaultdict
from collections import Counter
import numpy as np

import heapq


#n,k=list(map(int,input().split()))
n=int(input())
a=[i**5 for i in range(1000)]
ans=set()
for i in a:
    for j in a:
        ans.add(i+j)
        ans.add(i-j)
        if i+j==n:
            print(int(i**(1/5)),int((j**(1/5))*(-1)))
            exit()
        if i-j==n:
            print(int(i**(1/5)),int(j**(1/5)))
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
SIZE = 200
def main():
    X = int(input())
    for A in range(-SIZE, SIZE):
        for B in range(-SIZE, SIZE):
            if A ** 5 - B ** 5 == X:
                print(A, B)
                break
        else: continue
        break
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
if x>=0:
	a=0
	while True:
		b5=a**5-x
		if b5>=0:
			b=int(b5**(1/5))
		else:
			b=int((-1)*((-1)*b5)**(1/5))
		if a**5-b**5==x:
			print(a,b)
			break
		elif a**5-(b+1)**5==x:
			print(a,b+1)
			break
		elif a**5-(b-1)**5==x:
			print(a,b-1)
			break
		a+=1
else:
	a=0
	while True:
		b5=a**5-x
		if b5>=0:
			b=int(b5**(1/5))
		else:
			b=int((-1)*((-1)*b5)**(1/5))
		if a**5-b**5==x:
			print(a,b)
			break
		elif a**5-(b+1)**5==x:
			print(a,b+1)
			break
		elif a**5-(b-1)**5==x:
			print(a,b-1)
			break
		a-=1

Submission status: Accepted

Solution code:
lim = int(1e5 + 1)
x = int(input())
d = {}
for i in range(-lim, lim):
    d[pow(i, 5)] = i
for i in range(-lim, lim):
    res = pow(i, 5) + x
    if res in d:
        print(d[res], i)
        break

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

X = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]


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 -*-
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

number = 1000

minus = False
end = False

a = 0
b = 0

for i in range(number):
    a = i + 1
    a5 = pow(a, 5)
    if a5 < x:
        minus = True
        surplus = x - a5
    else:
        minus = False
        surplus = a5 - x
    if surplus == 0:
        b = 0
        break
    elif a == 1:
        continue
    for j in range(i):
        b = j + 1
        b5 = pow(b, 5)
        if b5 == surplus:
            if minus:
                b = -b
            end = True
            break
    if end:
        break

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
x=int(input())
for a in range(101):
    for b in range(101):
        if a**5+b**5==x:
            print(a,-b)
            sys.exit()
for a in range(150):
    for b in range(150):
        if a**5-b**5==x:
            print(a,b)
            sys.exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def f():
    N = 1000
    X = int(input())
    pow5_list = [pow(i, 5) for i in range(N)]
    A, B = 0, 0
    for i in range(N):
        for j in range(i-1, 0, -1):
            if pow5_list[i] - pow5_list[j] == X:
                A, B = i, j
                return A, B
        for k in range(i+1):
            if pow5_list[i] + pow5_list[k] == X:
                A, B = i, -k
                return A, B

def main():
    A, B = f()
    print("{} {}".format(A, B))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
import sys

X = int(input())
X_soinsu = []
for i in range(1, int(math.sqrt(X))+1):
    if X % i == 0:
        X_soinsu.append(i)
        X_soinsu.append(X//i)

for abs_b in range(0, 10000):
    for b in [abs_b, -abs_b]:
        for soinsu in X_soinsu:
            a = b + soinsu
            if a**5 - b**5 == X:
                print(a, b)
                sys.exit(0)

Submission status: Accepted

Solution code:
X = int(input())
size=2*10**2
kumi={}
for i in range(-size,size):
    for j in range(-size,size):
        tmp=i**5 - j**5
        if tmp not in kumi:
            kumi[tmp]=[i,j]

print(kumi[X][0],kumi[X][1])

Submission status: Accepted

Solution code:
X = int(input())

a = -int(X**(1/4))
b = int(X**(1/4))
for x in range(a, b):
  for y in range(a, b):
    if x**5 - y**5 == X:
      print(x, y)
      break
  else:
    continue
  break

Submission status: Accepted

Solution code:
import sys
from itertools import combinations_with_replacement

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X = int(rl())
    
    five_pow = [0]
    i = 1
    while five_pow[-1] < 10 ** 18:
        five_pow.append(i ** 5)
        i += 1
    
    for a, b in combinations_with_replacement(range(len(five_pow)), 2):
        p_of_a, p_of_b = five_pow[a], five_pow[b]
        if p_of_a - p_of_b == X:
            print(a, b)
            exit()
        if p_of_a + p_of_b == X:
            print(a, -b)
            exit()
        if p_of_b - p_of_a == X:
            print(b, a)
            exit()
        if p_of_b + p_of_a == X:
            print(b, -a)
            exit()


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import sys
x = int(input())
pow5s = [i ** 5 for i in range(-200, 201)]
for ap200, a5 in enumerate(pow5s):
    for bp200, b5 in enumerate(pow5s):
        if a5 - b5 == x:
            print(int(ap200 - 200), int(bp200 - 200))
            sys.exit()

Submission status: Accepted

Solution code:
import math
X=int(input())
t=int(math.sqrt(X))
L=[]
for i in range(1,t+1):
	if X%i==0:
		L.append([i,X//i])
for i in range(10010):
	for x,y in L:
		j=i-x
		tmp=pow(i,4)+pow(i,3)*j+pow(i,2)*pow(j,2)+i*pow(j,3)+pow(j,4)
		if tmp==y:
			print(i,j)
			exit()
		j=i-y
		tmp=pow(i,4)+pow(i,3)*j+pow(i,2)*pow(j,2)+i*pow(j,3)+pow(j,4)
		if tmp==x:
			print(i,j)
			exit()

Submission status: Accepted

Solution code:
I=lambda : list(map(int,input().split()))
a,=I();f=0
r=[pow(j,5) for j in range(-1000,1001)]
for i in range(len(r)):
    for j in range(len(r)):
        if r[i]-r[j]==a:
            print(i-1000,j-1000);f=1;break
    if f:
        break

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

dt = {}
x = []
for i in range(300):
    dt[i**5] = i
    x.append(i**5)
num = inp()
if num in dt:
    print(dt[num],0)
    exit()
n = len(x)
for i in range(n-1):
    for j in range(i+1,n):
        if x[i] + x[j] == num:
            print(dt[x[i]],-dt[x[j]])
            exit()
        elif x[j] - x[i] == num:
            print(dt[x[j]],dt[x[i]])

Submission status: Accepted

Solution code:
x = int(input())
A=[a**5 for a in range(500)]
for b in range(10000):
    tmp=x+b**5
    if tmp in A:
        print(A.index(tmp),b)
        exit()
    tmp=x-b**5
    if tmp in A:
        print(A.index(tmp),-b)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

def calc(x):
    for i in range(-1000, 1001):
        for j in range(i+1, 1001):
            if ((j**5) - (i**5)) == x:
                print(j, i)
                return
calc(x)

Submission status: Accepted

Solution code:
#import itertools
#K = int(input())
#N,K = map(int,input().split())
X = int(input())
n=[i**5 for i in range(121)]
m=[i**5 for i in range(121)]
#A = list(map(int,input().split()))
for i in n:
    for j in m:
        if i-j==X:
            print(n.index(i),m.index(j))
            exit()
        elif i+j==X:
            print(n.index(i),-m.index(j))
            exit()

Submission status: Accepted

Solution code:
import sys


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


def main():
    X = int(input())
    check = [i ** 5 for i in range(-5 * (10 ** 2), 5 * (10 ** 2))]
    for i in range(len(check) - 1):
        for j in range(i + 1, len(check)):
            if check[j] - check[i] == X:
                print(j - 500, i - 500)
                return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())

anses = set()
i = 0
while True:
    anses.add(i)
    anses.add(-i)
    if i**5 > 10**18:
        break
    i += 1

for a in list(anses):
    for b in list(anses):
        if a**5 - b**5 == x:
            print(a,b)
            exit(0)

Submission status: Accepted

Solution code:
import sys
inf = 10**15
mod = 10**9+7
x = int(input())
for i in range(-10**5, 10**5+1):
    tmp = i**5-x
    b = int(abs(tmp)**(1/5))
    if b**5 == abs(tmp):
        if tmp > 0:
            print('{} {}'.format(i, b))
        else:
            print('{} {}'.format(i, -b))
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = 0

while True:
    temp = X - A ** 5
    if temp >= 0:
        B = int(pow(temp, 1/5))
    else:
        B = -int(pow(-temp, 1/5))
    if A ** 5 + B ** 5 == X:
        print(A, -B)
        break
    A += 1

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    aa = [i**5 for i in range(1000)]

    for i in range(len(aa)):
        a = aa[i]
        for j in range(len(aa)):
            b = aa[j]
            if a - b == x:
                print(i,j)
                break
            elif a + b == x:
                print(i,-j)
                break
            elif -a - b == x:
                print(-i, j)
                break
            elif -a + b == x:
                print(-i, -j)
                break
        else:
            continue
        break

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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


def solve(X: int):
    # b が負
    for a in range(0, 101):
        for b in range(0, -101, -1):
            if a**5 - b**5 == X:
                print(a, b)
                exit()

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

    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:
def main():
    D = int(input())
    flag = False
    for a in range(-128, 128):
        for b in range(-128, 128):
            if a ** 5 - b ** 5 == D:
                print(a, b)
                return
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
a = []
b = []
for i in range(-200,200):
    a.append([i, i**5])
    b.append([i, i**5])

n = len(a)

for i in range(n):
    for j in range(n):
        if a[i][1] - b[j][1] == x:
            print(str(a[i][0]) + " " + str(b[j][0]))
            exit()
        if b[j][1] - a[i][1] == x:
            print(str(b[j][0]) + " " + str(a[i][0]))
            exit()
        if a[j][1] - b[i][1] == x:
            print(str(a[j][0]) + " " + str(b[i][0]))
            exit()
        if b[i][1] - a[j][1] == x:
            print(str(b[i][0]) + " " + str(a[j][0]))
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for a in range(10**4):
    for b in range(-10**4,10**4):
        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(10**7):
        tmp = pow(A,5) - X
        if tmp == 0:
            print(A,0)
            exit()
        elif tmp < 0:
            for i in range(-1,-(10**7),-1):
                if tmp == pow(i,5) and pow(A,5) - pow(i,5) == X:
                    print(A,i)
                    exit()
                elif tmp > pow(i,5):
                    break
        else:
            for i in range(1,10**7):
                if tmp == pow(i,5) and pow(A,5) - pow(i,5) == X:
                    print(A,i)
                    exit()
                elif tmp < pow(i,5):
                    break



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# python3

#===============================================================================
from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()
##==============================================================================


def solve(X):
    c = {}
    for i in range(1000):
        c[i] = i ** 5
        c[-i] = -c[i]
    for i in c:
        for j in c:
            if c[i] - c[j] == X:
                return str(i) + " " + str(j)


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

Submission status: Accepted

Solution code:
X = int(input())

for A in range(10**4):
    for B in range(-10**4,10**4):
        if A**5-B**5==X:
            print('{} {}'.format(A,B))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
x,=I()
ar=[]
i=1
fl=1

t=bi.bisect_left(ar,x)
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            fl=0
            break
    if not fl:
        break

Submission status: Accepted

Solution code:
import sys
from bisect import bisect_left


sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


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


def main():
    X = int(input())
    d = set()
    for i in range(100000):
        d.add(i ** 5)
    D = sorted(d)
    idx = {v: i for i, v in enumerate(D)}
    for i in d:
        if X - i in d:
            print(idx[i], -idx[X - i])
            break
        elif i - X in d:
            print(idx[i], idx[i - X])
            break


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

l = [i**5 for i in range(10**3)]

ans_a = 0
ans_b = 0

finish = 0

for b in range(10**3):
    for a in range(b, 10**3):
        sa = l[a] - l[b]
        wa = l[a] + l[b]
        if sa > X:
            continue
        if sa == X:
            ans_a = a
            ans_b = b
            finish = 1
            break
        if wa == X:
            ans_a = a
            ans_b = -b
            finish = 1
            break
    if finish:
        break

print(ans_a, ans_b)

Submission status: Accepted

Solution code:
X = int(input())

N = 10**3

f = False
for i in range(N+1):
    for j in range(N+1):
        if i**5-j**5 == X:
            print(i, j)
            f = True
            break
        if i**5+j**5 == X:
            print(i, -j)
            f = True
            break
    if f:
        break

Submission status: Accepted

Solution code:
x = int(input())
def ans(x):
    for a in range(0, 1000)[::-1]:
        for b in range(-1000, 1000)[::-1]:
            if a**5 - b**5 == x:
                return a, b
a,b = ans(x)
print(a,b)

Submission status: Accepted

Solution code:
X = int(input())
for A in range(10000):
    if abs((abs(A**5-X))**0.2 - int(abs(A**5-X)**0.2)) < 0.0000001:
        B = int(abs(A**5-X)**0.2)
        if A**5 - B**5 == X:
            print(A, " ", B)
            break
        else:
            print(A, " ", -1*B)
            break

Submission status: Accepted

Solution code:
x = int(input())

lim = int(x**0.25)

for a in range(0,lim+1):
    b5 = (pow(a,5)-x)
    if b5 <0:
        fugou=-1
    else:
        fugou=+1
    b5 = abs(b5)
    if pow(int(b5 ** 0.2),5)==b5:
        break

print(a, fugou*int(b5**0.2))

Submission status: Accepted

Solution code:
n=int(input())
x= list(range(-1000, 1000, 1))
#print(x)
a = 100
b = 100
for i in x:
    for j in x:
        if i**5-j**5 == n:
            print(i, end=" ")
            print(j)
            exit()

Submission status: Accepted

Solution code:
x=int(input())

for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            c=a
            d=b
        if a**5 + b**5 ==x:
          c=a
          d=-1*b
print(str(c)+" "+str(d)+"\n")

Submission status: Accepted

Solution code:
X = int(input())
flag = 0
for i in range(1,int(X**0.5)+1):
    if X%i==0:
        x = i
        y = X//i
        for b in range(-int(10**(9/5))-1,int(10**(9/4))+1):
            a = b+x
            if a**4+a**3*b+a**2*b**2+a*b**3+b**4==y:
                A = a
                B = b
                flag = 1
                break
        if flag==1:break
print(A,B)

Submission status: Accepted

Solution code:
x=int(input())
f=False
for a in range(10000+1):
    for b in range(-10000,10000+1):
        v=a**5-b**5
        if v==x:
            f=True
            break
    if f:
        break
print(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
x = int(input())

def solve(x):
	for first in range(-150, 150):
		for sec in range(-150, 150):
			if first**5 - sec**5 == x:
				print(first, sec)
				return

solve(x)


# print(150**5 - 149**5)

Submission status: Accepted

Solution code:
x = int(input())


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

Submission status: Accepted

Solution code:
X=int(input())
for a in range(3*10**2):
  for b in range(6*10**2):
    if(a**5-(b-300)**5==X):
      print(a,b-300)
      exit()