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: Runtime Error

Solution code:
b = 1
x = int(input())

while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b < 60:
    b += 1

if (x + b**5)**(1/5) != int((x + b**5)**(1/5)):
    b = -1
    while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b > -60:
        b -= 1

a = int((x + b**5)**(1/5))
print(a, b)

Submission status: Runtime Error

Solution code:
X=int(input())

def ok(B):
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return i**5==B

def get(B):
    f = B/abs(B)
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return int(i*f)



A_cand=[]
i=0
while i**5<=10**10:
    A_cand.append(i)
    i+=1

#print(A_cand)
for a in A_cand:
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
        break
for a in A_cand:
    a*=-1
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
print(0/0)

Submission status: Runtime Error

Solution code:
X = int(input())

for i in range(100000):
    A5 = X - i**5
    if (A5**(1/5)).is_integer():
        print(i, -int(A5**(1/5)))
        break

Submission status: Runtime Error

Solution code:
import sys
import numpy as np

s=int(sys.stdin.readline())
#n,k=map(int,sys.stdin.readline().split())
#a=np.array(sys.stdin.readline().split(),dtype='int64')
#a=np.array([sys.stdin.readline().split() for i in range(n)],dtype='int64')

num=1
a=-1
while True:
    f=(s-num**5)**(1/5)
    if int(f)==f:
        break
    num+=1

print(str(int(f))+' '+str(a*num))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

X = int(input())

for i in range(100):
    res = X + i**5
    p = res ** (1/5)
    if p.is_integer():
        print(int(p), i)
        exit()
    res = X + (-i**5)
    p = res ** (1/5)
    if p.is_integer():
        print(int(p), -i)
        exit()

Submission status: Runtime Error

Solution code:
import numpy as np
x = int(input())
b = 0
ans = []
while True:
    n = x - b**5
    a = int(np.power(n, 1/5))
    if a**5 == n:
       ans.append(a)
       ans.append(-b)
       break
    b += 1

print(*ans)

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():
    def make_divisors(n):
        divisors = []
        divisors2 = []
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                divisors2.append(n // i)
                if i != n // i:  # 平方数の場合n**0.5を1つだけにしてる
                    divisors.append(n // i)
                    divisors2.append(i)

        # divisors.sort() # ソートしたけりゃして
        return [divisors, divisors2]

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

        d, d2 = make_divisors(X)[0], make_divisors(X)[1]
        i = 0
        while True:
            b = 0
            if i >= len(d):
                break
            while True:
                a = d[i] + b
                val = a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4
                if val == d2[i]:
                    return [a, b]
                if val > d2[i]:
                    i += 1
                    b=0
                    if i >= len(d):
                        break
                else:
                    b += 1
        i = 0
        while True:
            b = -1
            if i >= len(d):
                break
            while True:
                a = d[i] + b
                val = a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4
                if val == d2[i]:
                    return [a, b]
                if val > d2[i]:
                    i += 1
                    b=-1
                    if i >= len(d):
                        break
                else:
                    b -= 1

    print(*main())


resolve()

Submission status: Runtime Error

Solution code:
x=int(input())
b=0
a_p=x

while a_p!=int(a_p**(1/5))**5:
  if b==0:
    b=1
  elif b>0:
    b*=-1
  else:
    b*=-1
    b+=1
  a_p=b**5+x

a=int(a_p**(1/5))
print(str(a)+" "+str(b))

Submission status: Runtime Error

Solution code:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
			


x=input1()
prime=prime_factorize(x)
for i in range(x):
	a=i
	b=a-prime[0]
	if x==a**5-b**5:
		print(a,b)
		break

Submission status: Runtime Error

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

while True:
    a = math.pow(x+pow(b, 5), 0.2)
    if a.is_integer():
        print(int(a), b)
        break
    a = math.pow(x+pow(-b, 5), 0.2)
    if a.is_integer():
        print(int(a), b)
        break
    b += 1

Submission status: Runtime Error

Solution code:
# coding: utf-8

#約数列挙
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

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

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

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(65):
  s = (x-i**5)**0.2
  t = (x+i**5)**0.2
  if s.is_integer():
    print(int(s),-i)
    break
  elif t.is_integer():
    print(int(t), i)
    break

Submission status: Runtime Error

Solution code:
X = int(input())
A = [0] * 200
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Submission status: Runtime Error

Solution code:
# coding: utf-8
from bisect import bisect_left


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

    P = [pow(i, 5) for i in range(64)]
    ret = None
    for b, b5 in enumerate(P):
        a5 = x+b5
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a, b)
                break

        a5 = abs(x-b5)
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a if b5 < x else -like_a, -b)
                break

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


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

Submission status: Runtime Error

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


def main():
    X = int(input().rstrip())
    for b in range(64):
        if (X - b ** 5) ** (1 / 5) % 1 == 0:
            A = int((X - b ** 5) ** (1 / 5))
            B = b
            break

    print(A, B)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0]*n
ans = n
for i in range(m):
  b, c = map(int, input().split())
  b -= 1
  c -= 1
  a[b] += 1
  a[c] += 1
  if h[b] == h[c]:
    if a[b] == 1 and a[c] == 1:
      ans -= 2
    elif a[b] == 1 and a[c] != 1:
      ans -= 1
    elif a[b] != 1 and a[c] == 1:
      ans -= 1
  if h[b] > h[c]:
    a[b] -= 1
    if a[c] == 1:
      ans -= 1
  if h[b] < h[c]:
    a[c] -= 1
    if a[b] == 1:
      ans -= 1
print(ans)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X = I()

a = [0,1]
for i in range(2,70):
  a.append(i**5)
#print(a)

for i,j in itertools.combinations(a, 2):
  #print(i,j)
  for k in [-1,1]:
    if j - i*k == X:
      print(int(j**0.2), int(i**0.2)*k)
      exit()
print(error)

Submission status: Runtime Error

Solution code:
b = 1
x = int(input())

answerNotFound = True
while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b < 60:
    b += 1

if (x + b**5)**(1/5) != int((x + b**5)**(1/5)):
    b = -1
else:
    answerNotFound = False

if answerNotFound:
    while (x + b**5)**(1/5) != int((x + b**5)**(1/5)) and b > -60:
        b -= 1
        answerNotFound = True

if answerNotFound:
    print(int((x + b**5)**(1/5)), b)

Submission status: Runtime Error

Solution code:
import math

X=int(input())
i_p=0
i_m=0
while True:
    A_p=(X+i_p**5)**(1/5)
    A_m=(X+i_m**5)**(1/5)
    if A_p==int(A_p):
        A=int(A_p)
        i=i_p
        break
    elif A_m==int(A_m):
        A=int(A_m)
        i=i_m
        break
    i_p+=1
    i_m-=1

print(A,i)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 標準入力の取得
X = int(input())

# 求解処理
A = 0
while True:
    B = -1*(X-A**5)**(1/5)
    if B.is_integer():
        break
    A += 1

result = f"{int(A)} {int(B)}"

# 結果出力
print(result)

Submission status: Runtime Error

Solution code:
X = int(input())
ans = list()
min = float("inf")
r = range(-100,100)
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
      elif A**5-B**5==min:
        ans.append([A,B])
ans=ans[1]
A = ans[0]
B = ans[1]
print(A, B)

Submission status: Runtime Error

Solution code:
x=int(input())
div=make_divisors(x)
def depth_limited(x,div):
    depth=-50
    while True:
        depth+=50
        for t in div:
            for b in range(depth,depth+50):
                if x==t*(5*b**4+10*b**3*t+10*b**2*t**2+5*b*t**3+t**4):
                    return (b+t,b)
                b=-b
                if x==t*(5*b**4+10*b**3*t+10*b**2*t**2+5*b*t**3+t**4):
                    return (b+t,b)
ans=depth_limited(x,div)
print(str(ans[0])+' '+str(ans[1]))

Submission status: Runtime Error

Solution code:
import math
import sys
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
               n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor[0]
number=int(input())
a=trial_division(number)
for i in range(20):
    for j in range(20):
        if(j-i)==a:
            print(i,end=" ")
            print(j)
            sys.exit()

Submission status: Runtime Error

Solution code:
from sys import stdin
import math

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


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    X = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    X_fac = factorization(X)
    X_fac = list(set(sum(X_fac,[])))
    flag = False
    for fac in X_fac:
        A = math.ceil(fac/2)
        while True:
            B = A-fac
            if X == A**5-B**5:
                s = f'{A} {B}'
                flag == True
                break
            else:
                if A**5-B**5>X:
                    break
            A += 1
        if flag:
            break
    if flag==False:
        for fac in X_fac:
            A = math.ceil(fac/2)
            while True:
                B = A-fac
                if X == A**5-B**5:
                    s = f'{A} {B}'
                    flag == True
                    break
                else:
                    if A**5-B**5>X:
                        break
                A -= 1
            if flag:
                break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(s)

Submission status: Runtime Error

Solution code:
input = raw_input

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: # choufuku
                divisors.append(n//i)
    # divisors.sort()
    return divisors

def f(x, d):
    out = (x+d) ** 5 - x ** 5
    return out

ds = make_divisors(x)
#ds = ds1 + [-d for d in ds1]
#print("ds", ds)

found = False
for d in ds:
    if found:
        break

    b = 0
    while True:
        aa = b+d
        bb = b
        ret = f(b, d)
        #print(aa, bb, d, ret)
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret > x:
            break
        b += 1

    if found:
        break

    b = -1
    while True:
        aa = b+d
        bb = b

        ret = f(b, d)
        #print(aa, bb, d, ret)
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret > x:
            break
        b -= 1

    if found:
        break

    d0 = d
    d = -d
    
    if d0 % 2 == 0:
        b = d0 // 2
    else:
        b = d0 // 2 + 1

    while True:
        aa = b+d
        bb = b
        ret = f(b, d)
        #print(aa, bb, d, ret)
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret < x:
            break
        b += 1

    if found:
        break

    if d0 % 2 == 0:
        b = d0 // 2
    else:
        b = d0 // 2 - 1
    while True:
        aa = b+d
        bb = b

        ret = f(b, d)
        #print(aa, bb, d, ret)
        
        if x == ret:
            found = True
            a = b+d
            b = b
            break
        elif ret < x:
            break
        b -= 1


assert found
print("%d %d" % (a, b))

Submission status: Runtime Error

Solution code:
X = int(input())

l = range(-10**3:10**3)

for i in l:
  for j in l:
    if i**5 - j**5 == X:
      print("i" + " " + "j")
      exit()

Submission status: Runtime Error

Solution code:
x = int(input())
det = 1001001001
for i in range(1000000):
    if abs(i**5 - x) < abs(det):
        det = i**5 - x
        a = i
    else:
        break

if det < 0:
    for i in range(-1, -1000000, -1):
        if i**5 == det:
            b = i
            break
elif det == 0:
    b = 0
else:
    for i in range(1000000):
        if i**5 == det:
            b = i
            break


print(a, b)

Submission status: Runtime Error

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

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

    for b in range(10**9):
        y = ((x + (-1*b)**5)**(1/5)).is_integer()
        if y:
            print(int((x + (-1*b)**5)**(1/5)), -1*b)
            break


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
X = int(input())

t = np.arange(-1000000, 1000000, 1)
t = t**5
S = set(t)

for B in range(-1000000, 1000001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break

Submission status: Runtime Error

Solution code:
res = {}
for i in range(-100, 100):
    for j in range(-100, 100):
        ans = i ** 5 - j ** 5
        res[ans] = (i, j)
n = int(input())
print(res[n][0], res[n][1])

Submission status: Runtime Error

Solution code:
# input
X = int(input())

# process
a, b = 0, 0

nl = []
i = 0
np = 0
n = i**5
while n - np <= 10**9:
    nl.append(n)
    i += 1
    np = n
    n = i**5

for i in range(len(nl)):
    t = X-nl[i]
    if t in nl:
        a = i
        b = -(nl.index(X-nl[i]))
        break

    if -t in nl:
        a = i
        b = nl.index(X-nl[i])
        break

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

Submission status: Runtime Error

Solution code:
x=int(input())
for a in range(64):
  b=pow(-(pow(a,5)-x),0.2)
  if int(b)==b:
    print(a,-int(b))
    break

Submission status: Runtime Error

Solution code:
X= int(input())

for b in range(-100, 100):
    for a in range(100):
        if a**5 == X + b**5:
            ans =(a, b)
            break
print(*ans)

Submission status: Runtime Error

Solution code:
import numpy as np
X = int(input())

t = np.arange(-600000, 600000, 1)
t = t**5
S = set(t)

for B in range(-600000, 600001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break

Submission status: Runtime Error

Solution code:
import itertools
x = int(input())
digits = len(str(x))
dic = {}
keta = []
for i in range(10000):
    num = i ** 5    
    if (num > (10**9)) or (num > 10**(digits+1)):
        break
    if num > 10**(digits-2):
        dic[i] = num
    elif num < 10**(digits+1):
        dic[i] = num
        
for num1,num2 in itertools.combinations(dic.keys(), 2):
    a, b = dic[num1], dic[num2]
    if x == (a+b):
        ans = (num1,num2)
        break
    if x == (a-b):
        ans = (num1,-num2)
        break
    if x == (-a+b):
        ans = (-num1,num2)
        break
    if x == (-a-b):
        ans = (-num1,-num2)
        break
print(f"{ans[0]} {ans[1]}")

Submission status: Runtime Error

Solution code:
X = int(input())
A, B = int()
X = (A**5) - (B**5)
print(A,B)

Submission status: Runtime Error

Solution code:
x = int(input())
num = x

flag = 0
n_x = []
if x!=1:
    for _ in [0]*num:
        for i in range(2,x//2+1):
            tmp = x % i
            if tmp == 0:
                n_x.append(i)
                x = x//i
                break
        n_x.append(x)
        break
    n_x.sort()

    d = 1
    for i in n_x[:-1]:
        d = d*i

    u = n_x[-1]

    for a in range(-u,u):
        b = a + d
        if u==(a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4):
            ans = [a,b]
            break

    print('{} {}'.format(ans[1],ans[0]))
else :
    print('0 -1')

Submission status: Runtime Error

Solution code:
X = int(input())

y = int((X**0.2)//1 + 1)

def array(y):
    a = [0]
    for i in range(1,y+1):
        a.append(i**5)
        a.append(-i**5)
    a.sort()
    return a

a = array(y)

N = len(a)
for i in range(N-1):
    for j in range(i+1,N):
        if a[j] - a[i] == X:
            A,B = -y+j, -y+i

print(A,B)

Submission status: Runtime Error

Solution code:
import numpy as np
X = int(input())

t = np.arange(-100000, 100000, 1)
t = t**5
S = set(t)

for B in range(-100000, 100001, 1):
    if X+B**5 in S:
        print("%d %d"%((X+B**5)**0.2, B))
        break

Submission status: Runtime Error

Solution code:
X = int(input())
# X = 1

B = 0
while(True):
    B5 = B**5
    C5 = (-B)**5
    A5 = (X + B5)**0.2
    A5r = (X + C5)**0.2
    if A5 == round(A5,0):
        print (int(A5), int(B5))
        break
    if A5r ==  round(A5r,0):
        print (int(A5r), int(C5))
        break
    B += 1

Submission status: Runtime Error

Solution code:
x = int(input())

flag = 0
n_x = []
if x!=1:
    for _ in [0]*x:
        for i in range(2,x//2+1):
            tmp = x % i
            if tmp == 0:
                n_x.append(i)
                x = x//i
                break
        n_x.append(x)
        break
    n_x.sort()

    d = 1
    for i in n_x[:-1]:
        d = d*i

    u = n_x[-1]

    for a in range(-u,u):
        b = a + d
        if u==(a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4):
            ans = [a,b]
            break

    print('{} {}'.format(ans[1],ans[0]))
else :
    print('0 -1')

Submission status: Runtime Error

Solution code:
# coding: utf-8
from bisect import bisect_left


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

    P = [pow(i, 5) for i in range(64)]
    ret = None
    for b, b5 in enumerate(P):
        a5 = x+b5
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a, b)
                break

        a5 = abs(x-b5)
        like_a = bisect_left(P, like_a)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a if b5 < x else -like_a, -b)
                break

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


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

Submission status: Runtime Error

Solution code:
x = int(input())
b_p = 0
b_m = 0

def div(n):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs
    divs += list(map(lambda x: x*(-1), divs))
    return divs

divs = div(x)
while True:  
    for i in divs:
        a_p = i + b_p
        a_m = i + b_m
        if a_p ** 5 == x + b_p ** 5:
            print(a_p, b_p)
            exit(1)
        if a_m ** 5 == x + b_m ** 5:
            print(a_m, b_m)
            exit(1)
    b_p += 1
    b_m -= 1

Submission status: Runtime Error

Solution code:
for a in range(-int(math.pow(x,1./3.)),int(math.pow(x,1./3.))+1):
    for b in range(-int(math.pow(x,1./3.))+1,int(math.pow(x,1./3.))+1):
        if a!=b:
            if x/(a-b) == a*a*a*a+a*a*a*b+a*a*b*b+a*b*b*b+b*b*b*b:
                print(a,b)
                break
    else:
        continue
    break

Submission status: Runtime Error

Solution code:
def abc166_d():
  x = int(input())
  for k in range(1, 56):
    cand = (x + k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), k)
      return
    cand = (x - k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), -k)
      return

abc166_d()

Submission status: Runtime Error

Solution code:
X = int(input())
A = 1
K = 1
while K < X:
    A += 1
    K = A ** 5
w = 0
while w != 1:
    P = S ** 5
    Q = P - X
    B = 0
    while (Q < B**5):
        B += 1
    if (Q == B**5):
        w += 1
    else:
        S += 1

        
print(S,B)

Submission status: Runtime Error

Solution code:
import math
X=int(input())
Cout=3
B=0
while Fend!=1:
    A=pow(X+B**5,1/5)
    if A==math.floor(A):
        print(str(int(A))+" "+str(int(B)))
        Fend=1
    Cout=Cout+1
    if Cout%2==0:
        B=-B
    else:
        B=B+1

Submission status: Runtime Error

Solution code:
def main():
    from builtins import int, map, list, print, len
    import sys
    sys.setrecursionlimit(10 ** 6)

    X = int(input())
    t = []
    i = 0
    while True:
        x = i ** 5
        t.append(x)
        if x > 10 ** 9:
            break
        i += 1
    d = {}
    for i in range(len(t)):
        for j in range(len(t)):
            d[t[i] - t[j]] = [i, j]
            d[t[i] + t[j]] = [i, -j]
            d[-t[i] - t[j]] = [-i, j]
            d[-t[i] + t[j]] = [-i, -j]
    print(d[X][0], d[X][1])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    X = int(input())
    n_5,a = [(0,0)],1
    while a**5 <= X:
        n_5.append((a,a**5))
        n_5.append((-a,-a**5))
        a += 1
    n_5.sort()

    for a in range(len(n_5)):
        for b in range(len(n_5)):
            if n_5[a][1] - n_5[b][1] == X:
                a_ans,b_ans = n_5[a][0],n_5[b][0]
                break

    print(a_ans,b_ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
X = int(input())

cand = int(pow(X, 0.2))
diff = - (X - pow(cand, 5))

for i in range(-cand, cand + 1):
    if pow(cand, 5) - pow(i, 5) == X:
        other = i

print(cand, other)

Submission status: Runtime Error

Solution code:
# coding: utf-8
from bisect import bisect_left


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

    P = [pow(i, 5) for i in range(64)]
    ret = None
    for b, b5 in enumerate(P):
        a5 = x+b5
        like_a = bisect_left(P, a5)
        if P[like_a] == a5:
            ret = (like_a, b)
            break

        a5 = abs(x-b5)
        like_a = bisect_left(P, like_a)
        if P[like_a] == a5:
            ret = (like_a if b5 < x else -like_a, -b)
            break

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


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

Submission status: Runtime Error

Solution code:
x = int(input())
def judge(num):
    ans = num**(1/5)
    if ans.is_integer():
        return True
    else:
        return False
if judge(x):
    print(int(x**(1/5)), 0)
    exit()
b1 = 0
b2 = 0
while 1:
    b1 += 1
    b2 -= 1
    if judge(x+(b1**5)):
        print(int((x+(b1**5))**(1/5)), b1)
        exit()
    elif judge(x+(b2**5)):
        print(int((x+(b2**5))**(1/5)), b2)
        exit()

Submission status: Runtime Error

Solution code:
mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))

x = II()
import sympy
div = sympy.divisors(x)
tmp = []
for l in div:
	print(l)
	tmp.append(-1*l)
div += tmp
p = 0
a = None
b = None
while(1):
	for l in div:
		s = p**5 - (p-l)**5
		# print(s)
		if s ==x:
			a=p
			b=p-l
		elif s==(-x):
			a=l-p
			b=-p
	if a is not None:
		break
	p += 1
print(a,b)

Submission status: Runtime Error

Solution code:
def abc166_d():
  x = int(input())
  for k in range(1, 33):
    cand = (x + k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), k)
      return
    cand = (x - k**5) ** 0.2
    if cand.is_integer():
      print(int(cand), -k)
      return

abc166_d()

Submission status: Runtime Error

Solution code:
x=int(input())
for i in range(-100,100):
    a=i
    for j in range(-100,100):
        b=j
        if a**5-b**5==x:
            am=a
            bm=b
        else:
            c=0
print(am,bm)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
b = 0
ans = []
while True:
    n = x - b**5
    a = int(math.pow(n, 1/5))
    if a**5 == n:
       ans.append(a)
       ans.append(-b)
       break
    b += 1

print(*ans)

Submission status: Runtime Error

Solution code:
d = {}
for i in range(1, 100):
    for j in range(i-1, -i-1, -1):
        if i ** 5 - j ** 5 > 10 ** 9:
            print(*d[int(input())])
            exit()
        d[i ** 5 - j ** 5] = (i, j)
    else:
        continue

Submission status: Runtime Error

Solution code:
import math


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

    MAX = int(math.pow(10 ** 10, 1 / 5))

    for b in range(0, MAX + 1):
        # b = 1,2,3...
        a = math.pow(abs(b ** 5 + X), 1 / 5)
        # print(f'b={b} a={a}')
        if a == int(a):
            if b ** 5 + X > 0:
                print(int(a), b)
            else:
                print(-int(a), b)
            return

        # b = -1, -2, -3
        a = math.pow(abs(- b ** 5 + X), 1 / 5)
        # print(f'b={-b} a={a}')
        if a == int(a):
            if - b ** 5 + X > 0:
                print(int(a), b)
            else:
                print(-int(a), b)
            return

    raise ValueError()


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
X=int(input())
i=0
while True:
    x1=(X+i**5)**(1/5)
    x2=(X-i**5)**(1/5)
    if x1==int(x1):
        print(int(x1),i)
        exit()
    elif x2==int(x2):
        print(int(x2),-i)
        exit()
    i+=1

Submission status: Runtime Error

Solution code:
x = int(input())

flag = 0
n_x = []
if x!=1:
    while x!=1:
        for i in range(2,x//2+1):
            tmp = x % i
            if tmp == 0:
                n_x.append(i)
                x = x//i
                break
        n_x.append(x)
        x = 1
    n_x.sort()

    d = 1
    for i in n_x[:-1]:
        d = d*i

    u = n_x[-1]

    for a in range(-u,u):
        b = a + d
        if u==(a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4):
            ans = [a,b]
            break

    print('{} {}'.format(ans[1],ans[0]))
else :
    print('0 -1')

Submission status: Runtime Error

Solution code:
from functools import reduce
import math
def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors.keys())
x = int(input())
if (x==-1):
    print(0, -1, sep = ' ')
else:
    fac = list(prime_factors(x))
    a = min(fac)
    b = 0
    a2 = a
    b2 = b
    while(a**5 - b**5 != x and a2**5 - b2**5 !=x):
        a += 1
        b += 1
        a2 -= 1
        b2 -= 1
    if (a**5 - b**5 == x):
        print(a,b,sep= ' ')
    else:
        print(a2,b2,sep= ' ')

Submission status: Runtime Error

Solution code:
#D
import math ,sys
x = int(input())
for a in range(math.ceil(math.log10(x))):
    for b in range(-10 ** 9//2, 10 ** 9//2):
        if s ** 5 - b ** 5 == x:
            print(a, b)
            sys.exit()