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

for i in range(len(make_divisors(X))):
    A = make_divisors(X)[i]
    for j in range(-int(X**(1/5)),int(X**(1/5))+1):
        if (A+j)**5-j**5==X:
            a = j + A
            b = j
            break
        else:
            continue
        break
    else:
        continue
    break
print(a,b)

Submission status: Runtime Error

Solution code:
x=int(input())

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

a=prime_factorize(x)

a.append(1)
a=list(set(a))
len=len(a)
for i in range(len):
    if a[i]>11:
        a[i]=0
a=list(set(a))
if (0 in a)=1:
    a.remove(0)
    
t=-100
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break
    for i in range(len):
        if ((t+a[i])**5-t**5)-x==0:
            ansx=t+a[i]
            ansy=t
            break
        else:
            t+=1
print(ansx,ansy)

Submission status: Runtime Error

Solution code:
plus=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71, \
73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173, \
179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281, \
283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409, \
419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541, \
547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659, \
661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809, \
811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941, \
947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069, \
1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223, \
1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373, \
1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511, \
1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657, \
1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811, \
1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987, \
1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129, \
2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287, \
2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423, \
2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617, \
2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741, \
2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903, \
2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079, \
3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257, \
3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413, \
3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571]
int_02=int(x**0.2)
if int_02**5 = x:
  print("%d 0" % x)
  exit()
#plus=list(map(int,plus.split()))
def factorization(num):
  if num == 1:
    return [1]
  factor = []
  while num > 1:
    for i in range(500):
      k = plus[i]
      if num % k == 0:
        factor.append(k)
        num = int(num//k)
        break
  return factor
  
x=int(input())
a=0
b=0
a_b=0
y=factorization(x)
len_y=len(y)
z=set(y)


z=list(z)
#print(z)
for j in range(len(z)):
  a_b=z[j]
  for k in range(a_b):
    a=a_b+k
    b=k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
    a=a_b-k
    b=0-k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
      
if len_y > 2:
  z=set([])
  for l in range(0,len_y-1):
    for m in range(l,len_y):
      z=z|set([y[l]*y[m]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
    
if len_y > 3:
  z=set([])
  for l in range(0,len_y-2):
    for m in range(l,len_y-1):
      for n in range(m,len_y):
        z=z|set([y[l]*y[m]*y[n]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 4:
  z=set([])
  for l in range(0,len_y-3):
    for m in range(l,len_y-2):
      for n in range(m,len_y-1):
        for p in range(n,len_y):
          z=z|set([y[l]*y[m]*y[p]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 5:
  z=set([])
  for l in range(0,len_y-4):
    for m in range(l,len_y-3):
      for n in range(m,len_y-2):
        for p in range(n,len_y-1):
          for q in range(p,len_y):
            z=z|set([y[l]*y[m]*y[p]*y[q]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

Submission status: Runtime Error

Solution code:
x=int(input())
p=False
q=[]
for i in range(101):
  q.append(i**5)
r=100

l=0
while (r-l>=1):
  j=(l+r)//2
  if q[j]-x in q:
    a=q[j]
    b=q[j]-x
  elif q[j]-x >= 50**5:
    r=i
  else:
    l=i+1
print(a,b)

Submission status: Runtime Error

Solution code:
i = 0
while i**5 < x and (i + 1)**5 < x:
    i += 1
flag = 0
for j in range(x):
    if flag:
        break
    tmp1 = j ** 5
    if tmp1 < x:
        start, end = 0, x - tmp1
        while start <= end:
            middle = (start + end)//2
            if tmp1 + middle ** 5 > x:
                end = middle - 1
            elif tmp1 + middle ** 5 == x:
                flag = 1
                print(j, -middle)
                break
            else:
                start = middle + 1
    elif tmp1 == x:
        print(j, 0)
        break
    else:
        start, end = 0, tmp1 - x
        while start <= end:
            middle = (start + end) // 2
            if tmp1 - middle ** 5 > x:
                start = middle + 1
            elif tmp1 - middle ** 5 == x:
                flag = 1
                print(j, middle)
                break
            else:
                end = middle -1

Submission status: Runtime Error

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

ans = None
d_ls = make_divisors(x)
for d in d_ls:
    for a in range(0, 100):
        b = a-d
        c = a**5-b**5
        if c==x:
          ans = (a, b)
          break
    if ans is not None:
      break
print(ans[0], ans[1])

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
H = list(map(int,input().split()))
AB = [0]*M
for i in range(M):
    AB[i] = list(map(int,input().split()))

GD = [0]*N

for A ,B in AB:
    HA = H[A-1]
    HB = H[B-1]
    if HA < HB:
        GD[A-1] -= 1
    elif HA > HB:
        GD[B-1] -= 1
    else:
        GD[A-1] -= 1
        GD[B-1] -= 1

ans = 0
for i in GD:
    if i == 0:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
from scipy import optimize, exp

def main():
    X = int(input())
    def f(x):
        expr = x**5 - y**5 - X
        return expr
    
    ans = optimize.fsolve(f, 0)

    out = str(ans[0]) + '' + str(ans[1])
    print(out)
main()

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

x = int(input())

yakusuu = make_divisors(x)

for i in yakusuu[:len(x)//2+1]:
    y = int(x/i)
    if (y-i)%2 == 0:
        print(i+(y-i)//2,i)

Submission status: Runtime Error

Solution code:

n = int(input())

l = []
for _ in range(0, 100):
    x = _**5
    if x > 10**9:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)
#print(l)
#print(len(l))

from itertools import combinations
y = (list(combinations(l, 2)))
#print(y)

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j
#print(y[z])

if y[z][0] > 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] > 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))


print(a, b)

Submission status: Runtime Error

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

x = load()
for b in range(-1, -1000000000, -1):
    b5 = b ** 5
    y = (x + b5)**(1/5)
    if abs(y - math.floor(y)) < 0.000005:
        print(math.floor(y), b)
        exit()

Submission status: Runtime Error

Solution code:
x = int(input())
i = 0
while x-i % i != 0:
  i+= 1
a += i
b += x - i
print(a,b)

Submission status: Runtime Error

Solution code:
from sys import stdin
X = map(int, stdin.readline().rstrip().split())

for a in range(X):
    for b in range(X):
        if (pow(a,5) - pow(b,5)) == X:
            print(f'{a} {b}')

Submission status: Runtime Error

Solution code:
X = int(input())

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

Submission status: Runtime Error

Solution code:
X = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

for i in range(100000):
    C = X + (i**5)
    if C**(1/5)%1 ==0:
        print(int(C**(1/5)), i)
        break
    C = X - (i**5)
    if C**(1/5)%1 ==0:
        print(int(C**(1/5)), -i)
        break

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

x = int(input())

yakusuu = make_divisors(x)

for i in yakusuu[:len(x)//2+1]:
    y = int(x/i)
    if (y-i)%2 == 0:
        print(i+(y-i)//2,(y-i)//2)

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(x // 2):
    if pow(x - pow(i, 5), 1 / 5).is_integer():
        print(i, int(-pow(x - pow(i, 5), 1 / 5)))
        exit()

Submission status: Runtime Error

Solution code:
# 2020/05/03
# AtCoder Beginner Contest 166 - D

# Input
x = int(input())

# Calc
eflg = False
for a in range(10**6):
    wk_a = a ** 5
    b = 0
    sav = 10 ** 10
    for b in range(10**6):
        val_1 = wk_a - (b ** 5)
        val_2 = wk_a - (-b ** 5)

        if val_1 == x:
            ans1 = a
            ans2 = b
            eflg = True
            break

        if val_2 == x:
            ans1 = a
            ans2 = -b
            eflg = True
            break
        
        sav = abs(val_2) - x

        if sav > x:
            break

    if eflg == True:
        break

# Output
print(ans1, ans2)

Submission status: Runtime Error

Solution code:

n = int(input())

l = []
for _ in range(0, 100):
    x = _**5
    if x > 10**9:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)
#print(l)
#print(len(l))

from itertools import combinations
y = (list(combinations(l, 2)))
#print(y)

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j
#print(y[z])

if y[z][0] >= 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] >= 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))


print(a, b)

Submission status: Runtime Error

Solution code:
X = int(input())
B=-1
tmp = X
while True:
    tmp = tmp + B**5
    A = int(tmp**.2)
    if A**5==tmp:
        break
    B -= 1
    tmp = X     
print(A, B)

Submission status: Runtime Error

Solution code:
import numpy as np


def solve(vec, is_complex=False):
    dim = len(vec)
    if is_complex:
        A = np.zeros((dim, dim), dtype=complex)
    else:
        A = np.zeros((dim, dim))
    A[np.arange(dim - 1), 1 + np.arange(dim - 1)] = 1
    A[-1, :] = -vec
    ans, vec = np.linalg.eig(A)
    return ans


def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d = n // i
            ans = np.array([((i ** 4) -d)/5, (i ** 3), (i ** 2) * 2, i * 2])
            for x in ans:
                try:
                    if x.is_integer():
                        if x**5-(i-x)**5 == d:
                            ans = [int(x), int(i-x)]
                            return ans
                except:
                    pass
            ans = np.array([((d ** 4) - i) / 5, (d ** 3), (d ** 2) * 2, d * 2])
            for x in ans:
                try:
                    if x.is_integer():
                        if x**5-(d-x)**5 == i:
                            ans = [int(x), int(d-x)]
                            return ans
                except:
                    pass
m=int(input())
print(*make_divisors(m))

Submission status: Runtime Error

Solution code:
from sys import stdin
X = map(int, stdin.readline().rstrip().split())

for a in range(X):
    for b in range(X):
        if (pow(a,5) - pow(b,5)) == x:
            print(f'{a} {b}')

Submission status: Runtime Error

Solution code:
for A in range(1000):
    for B in range(1000):        
        if A**5 - B**5 == X:
            print(A, B)

Submission status: Runtime Error

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)

    return divisors

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

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

Submission status: Runtime Error

Solution code:
import math

X = int(input())

def decompose(n):
	result = []
	half = math.floor(math.sqrt(n))
	i = 2
	while i <= half:
		if n % i == 0:
			result.append(i)
			n //= i
			half = math.floor(math.sqrt(n))
		else:
			i += 1
	if n > 1:
		result.append(n)
	return result

facts = decompose(X)

fact_table = {}
for f in facts:
	if f not in fact_table:
		fact_table[f] = 1
	else:
		fact_table[f] += 1

facts = list(fact_table.items())
facts.sort()

def bisearch_smallest(f, s, e = None):
	if e == None:
		e = s - 1
		s = 0
	else:
		e -= 1
	
	while s < e:
		m = (s + e) // 2
		if f(m):
			e = m
		else:
			s = m + 1
	
	if s == e and f(s):
		return s
	else:
		return -1

def find(num, n):
	if n >= len(facts):
		m = bisearch_smallest(lambda A: 5 * A ** 4 - (A - num) ** 4 >= 0, 0, 10 ** 9)
		i = bisearch_smallest(lambda A: A ** 5 - (A - num) ** 5 <= X, 0, m + 1)
		j = bisearch_smallest(lambda A: A ** 5 - (A - num) ** 5 >= X, m - 1, 10 ** 9)
		
		if i ** 5 - (i - num) ** 5 == X:
			return i, i - num
		if j ** 5 - (j - num) ** 5 == X:
			return j, j - num
	else:
		f, c = facts[n]
		for i in range(c + 1):
			ret = find(num, n + 1)
			if ret != None:
				return ret
			num *= f
	return None

A, B = find(1, 0)


print(A, B)

Submission status: Runtime Error

Solution code:
import numpy as np

n=100
X = int(input())

a = np.array(range(n))
ex = np.full(n, 5)

m = a*n+a.reshape(n,1)

b = np.power(a, ex)

plus = b + b.reshape(n,1)
minus = b - b.reshape(n,1)

plus = plus==X
minus = minus==X

if np.count_nonzero(plus):
  c = m[plus][0]
  ans = int(c/n), -int(c%n)
else:
  c = m[minus][0]
  ans = int(c/n), int(c%n)
  
print(ans[0], ans[1], sep=' ')

Submission status: Runtime Error

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

def main():
    x = int(input())
    for i in range(100):
        for j in range(0, i+1):
            y = i ** 5 - j ** 5
            z = i ** 5 + j ** 5
            if x == y:
                a = i
                b = j
                break
            elif x == z:
                a = i
                b = -j
                break
    print(a, b)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
from sympy import *
n=int(input())
x,y = sympy.symbols("x y")   # 申明未知数"x"和"y"
a = sympy.solve([x**5-y**5-n],[x,y])   # 写入需要解的方程组
print(a[x],end='')
print(' ',end='')
print(a[y])

Submission status: Runtime Error

Solution code:
x = int(input())
import math
for i in range(10**9):
    if math.pow(i**5 + x, 1.0/5.0).is_integer():
        print(int(math.pow(i**5 + x, 1.0/5.0)), i)
        break
    elif math.pow(-i**5 + x, 1.0/5.0).is_integer():
        print(int(math.pow(-i**5 + x, 1.0/5.0)), -i)
        break

Submission status: Runtime Error

Solution code:
x = int(input())
N = int(x**0.25 / 5) + 2
r = next((i, j) for i in range(-N, N) for j in range(i + 1, N) if j**5 - i**5 == x)
print(*r)

Submission status: Runtime Error

Solution code:
X = int(input())
a = 0
b = 0
while a == 0 and b == 0:
    for i in range(1, 100000):
        A = i**5
        B = (A-X)**(1/5)
        if B.is_integer():
            a = int(A)
            b = int(B)
        break
print(f"{a} {b}")

Submission status: Runtime Error

Solution code:
X = int(input())

for B in range(10 ** 7):
    num = X + (B ** 5)
    num = num ** 0.2
    if num.is_integer():
        num = int(num)
        print(max(num, B), min(num, B))
        exit()
    num = X - (B ** 5)
    num = num ** 0.2
    if num.is_integer():
        num = int(num)
        print(max(num, -B), min(num, -B))
        exit()
    
print(1,2)

Submission status: Runtime Error

Solution code:
def main():
  from itertools import combinations
  x = int(input())
  ls = [0]
  if x == 1:
    print(0, -1)
    exit()
  for i in range(1, 100):
    ls.append(i**5)
    ls.append(-i**5)
  ls.sort()
  for b in ls:
    if x + b in ls:
      a = x + b  
      break
  if a < 0:
    print(-1*int(pow(-a, 0.2)), end=' ')
  else:
    print(int(pow(a, 0.2)), end=' ')
  if b < 0:
    print(-1*int(pow(-b, 0.2)), end=' ')
  else:
    print(int(pow(b, 0.2)), end=' ')
  


if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
x = int(input())
n = 10*7

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while l <= r:
        mid = (l+r)//2
        if num == dp[mid]:return mid
        elif num >= dp[mid]:l = mid+1
        else:r = mid-1
    return 0

def bln(dp,num):
    l = 0
    r = -len(dp)-1
    while l>=r:
        mid = (l+r)//2
        if num == dp[mid]:return mid
        elif num >= dp[mid]:r = mid+1
        else:l = mid-1
    return 0
            
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]

for b in range(-n,n):
    num = x + b**5
    a = max(blp(ap,num),bln(an,num))
    if a:print(a,b) ; break

Submission status: Runtime Error

Solution code:
x = int(input())
a = 0
b = 0
i = 0
flag = 0
while i < 100 :
  c = i**5
  d = (x-c)**0.2
  e = d.is_integer()
  if e == True:
    flag = 1
    b = int(d)
    a = int(i)
    break
  else:
    pass
  i = i + 1
if flag == 0:
  print("impossible")
elif flag == 1:
  print(a,b)

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np

X = int(input())
#maxs = int(X**(1/5))

l = np.arange(-63, 64)

comb = np.array(list(itertools.combinations_with_replacement(l, 2)))

sum1 = comb[:, 0]**5 - comb[:, 1]**5
sum2 = comb[:, 1]**5 - comb[:, 0]**5

try:
    result1 = np.where(sum1==X)[0][0]
    print(comb[result1][0], comb[result1][1])
except:
    result2 = np.where(sum2==X)[0][0]
    print(comb[result2][1], comb[result2][0])

Submission status: Runtime Error

Solution code:
x = int(input())

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

Submission status: Runtime Error

Solution code:
x = int(input())
N = int(x**0.25 / 5) + 2
r = next((i, j) for i in range(2, N) for j in range(1, i) if j**5 - i**5 == x)
print(*r)

Submission status: Runtime Error

Solution code:
x=int(input())
l=[]
for i in range(1,int(x**0.5)+1):
  if x%i==0:
    l.append(i)
    l.append(x//i)
for i in l:
  for j in range(x**0.2+10*2,0,-1):
    A=j
    B=j-i
    if A<B:
      break
    if A**5-B**5==x:
      print(A,B,sep=' ')
      exit()

Submission status: Runtime Error

Solution code:
x=int(input())
a=[]
for i in range(220):
  a.append[i**5]
for i in range(220):
  y=x-a[i]
  if y in a:
    print(i,a.index(y))
    break
  elif -y in a:
    print(i,-a.index(y))

Submission status: Runtime Error

Solution code:
X=int(input())
Y=int(X**(0.2))
for i in range(Y,0,-1):
    for t in (-Y//2,Y,1):
        if (i**5)-(t**5)==X:
            S=i
            Z=t
            break
        else:
            continue
print(S,Z)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): 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 dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
import math

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



X = ii()
'''
a = make_divisors(X)
ind = bisect.bisect_left(a, X**0.2)

for num in a[:ind+1]:
    for i in range(num):
        j = num - i
        if i**5 + j**5 == X:
            print(i, (-1)*j)
            exit()
'''
num = int(X**0.2)+1
for i in range(10**6):
    tmp = X - i**5
    b = tmp**0.2
    if math.floor(b) == b:
        print(i, (-1)*int(b))
        exit()
    b2 = ((-1)*tmp)**0.2
    if type(b2) == float:
        if math.floor(b2) == b2: 
            print(i, int(b2))
            exit()

Submission status: Runtime Error

Solution code:
import math
x=long(input())
end=0
for i in range(1,63):
    check1=long(math.pow( i+1, 5 )*100000)/100000
    check2=long(math.pow(i-1,5)*100000)/100000
    if check2<x<check1:
        m=x
        m=m-pow(i,5)
        if m<0:
            m=-m
            end=1
        b=long(math.pow(m,1/5)*100000)/100000
        out=long(b)
        if out<b<out+1:
            end=0
        if out==b:
            break
if x>pow(i,5):
    out=-out
print(i,end=' ')
print(out)

Submission status: Runtime Error

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

ans = None
d_ls = make_divisors(x)
for d in d_ls:
    for a in range(2, 100):
        b = 2-d
        c = a**5-b**5
        if c==x:
          ans = (a, b)
          break
    if ans is not None:
      break
print(ans[0], ans[1])

Submission status: Runtime Error

Solution code:
def main():
  from itertools import combinations
  x = int(input())
  ls = [0]
  if x == 1:
    print(0, -1)
  for i in range(1, 100):
    ls.append(i**5)
    ls.append(-i**5)
  ls.sort()
  for b in ls:
    if x + b in ls:
      a = x + b  
      break
  if a < 0:
    print(-1*int(pow(-a, 0.2)), end=' ')
  else:
    print(int(pow(a, 0.2)), end=' ')
  if b < 0:
    print(-1*int(pow(-b, 0.2)), end=' ')
  else:
    print(int(pow(b, 0.2)), end=' ')
  


if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/python3

import math
import collections
#標準出力からの読み込み
x = int(input())

#判定ロジック
#Xを素因数分解
#5乗の素因数をのぞいたらあとはBが1になるはず、そこでAを仮定して調べる

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
    
prime = prime_factorize(x)
c = collections.Counter(prime)
prime_list = []

for key, values in c.items():
    if values >= 5:
        prime_list.append(key)

if prime_list != []:
    for i in prime_list:
        x = x/(i**5)

if pow(x+1,0.2).is_integer():
    a = pow(x+1,0.2)
    b = 1
if pow(x-1,0.2).is_integer():
    a = pow(x-1,0.2)
    b = -1
if prime_list != []:
    for i in prime_list:
        a = a*i
        b = b*i

print(int(a), b)

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(30):
    if i ** 5 >= x and (i - 1) ** 5 =< x:
        b = i ** 5 - x
        for j in range(30):
            if j ** 5 == b:
                print(i, j)
                exit()
    if i ** 5 <= x and (i + 1) ** 5 >= x:
        b = i ** 5 - x
        for j in range(-30, 1):
            if j ** 5 == b:
                print(i, j)
                exit()

Submission status: Runtime Error

Solution code:
import itertools

x = int(input())
n = 100
table = [pow(i, 5) for i in range(-n, n+1)]
choices = list(itertools.permutations([i for i in range(len(table))], 2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)

Submission status: Runtime Error

Solution code:
x=int(input())

import math
import sys

def sq(x):
    """"
    if x<=0:
        return False
    """
    tmp=math.pow(x,1/5)
    if tmp-int(tmp)==0:
        return True
    else:return False

b=0
bb=0
while(True):
    if sq(x+b**5):
        print(int(math.pow(x+b**5,1/5)),b)
        sys.exit()
    b+=1
    if sq(x+bb**5):
        print(int(math.pow(x+bb**5,1/5)),bb)
        sys.exit()
    bb-=1

Submission status: Runtime Error

Solution code:
import numpy as np
x = int(input())
tmp_list=[]
c=0
tmp_2=0
while(1):
    tmp_1=c**5
    if (tmp_1 - tmp_2)<x:
        tmp_list+=[tmp_1]
    else:
        break
    tmp_2=tmp_1
    c+=1

def せいがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i+j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))*-1]
            if tmp>x:
                break
    return 0

def ふがわ(target:list,x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp=i-j
            if tmp==x:
                return [int(i**(1/5)),int(j**(1/5))]
            if tmp<x:
                break
    return 0
  
ans=ふがわ(tmp_list,x)
if ans==0:
    ans=せいがわ(tmp_list,x)
print(ans[0],ans[1])

Submission status: Runtime Error

Solution code:
X = int(input())
if pow(-10, 10) <= A < 10 ** 10 and pow(-10, 10) <= B < 10 ** 10 and pow(A, 5) - pow(B, 5) == X:
  print(str('A'), str('B'))

Submission status: Runtime Error

Solution code:
X = int(input())

for B in range(10 ** 7):
    num = X + (B ** 5)
    num = num ** 0.2
    if num.is_integer():
        num = int(num)
        print(max(num, B), min(num, B))
        exit()
    num = X - (B ** 5)
    num = num ** 0.2
    if num.is_integer():
        num = int(num)
        print(max(num, -B), min(num, -B))
        exit()