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: Time Limit Exceeded

Solution code:
import math
num = int(input())
a = - num
b = 0
result = 0
check = True

while a < num and check:
    for i in range(- num, num):
        result = math.pow(a, 5) - math.pow(i, 5)
        if int(result) == num:
            check = False
            b = i +1
            break
    a += 1
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

a = 10**10

for i in range(a):
    if i**5 + 1 == x:
        print(i, -1)
        exit()
    elif i**5 -1 == x:
        print(i, 1)
        exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
def modpow(a, n, mod):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % mod
        a *= a
        a = a % mod
    return ret
i = 0
L = list()
while True:
    num = modpow(i,5,X)
    if num in L:
        j = L.index(num)
        ret = '{} {}'.format(i,j)
        print(ret)
        break
    else:
        L.append(num)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
s={0}
n=1
stop=0
while(1):
    N=n**5
    for i in s:
        if N-i==x:
            if i>0:
                sig=int(i//abs(i))
            else:
                sig=1
            print(n,sig*int(pow(abs(i),1/5)))
            stop=1
        elif N-i==-x:
            if i>0:
                sig=int(i//abs(i))
            else:
                sig=1
            print(n,sig*int(pow(abs(i),1/5)))
            stop=1
    if stop==1:
        break
    s|={N,-N}

Submission status: Time Limit Exceeded

Solution code:
import itertools


max_num = 10000
num_list = [i for i in range(-max_num,  max_num+1)]
num_list_5 = [i ** 5 for i in num_list]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = num_list_5[a]
    b5 = num_list_5[b]
    if a5 - b5 == x:
        print(num_list[a], num_list[b])
        break

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())
s = math.floor(x ** (1/5)) 
a = 0
b = 0
for i in range(-x, x+1):
    for j in range(-x, x+1):
        if (i**5 - j**5) == x:
            a = i
            b = j

print(a,b)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
for i in range(1,x+1):
    if x%i: continue
    j = x//i
    # i & j have the same sign
    for a in range(1, x+1):
        b = a - i
        if j == (a**4 + b*a**3 + b**2*a**2 + b**3*a + b**4):
            print(a,b)
            break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
i = 0
while True:
  tmp1 = pow(X + pow(i, 5), 1/5)
  if tmp1.is_integer():
    print(int(tmp1), i)
    break
  tmp2 = pow(X - pow(i, 5), 1/5)
  if tmp2 != complex:
    if tmp2.is_integer():
      print(int(tmp2), -i)
      break
  else:
    i += 1

Submission status: Time Limit Exceeded

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

for i in range(X+1):
    for j in range(X):
        k = -j
        if (i - j) * (i ** 4 + i ** 3 * j + i ** 2 * j ** 2 + i * j ** 3 + j ** 4) == X:
            print(i,j)
            sys.exit()
        elif (i - k) * (i ** 4 + i ** 3 * k + i ** 2 * k ** 2 + i * k ** 3 + k ** 4) == X:
            print(i,k)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ansa = 1
ansb = 1
for i in range(-10**8,10**8):
    a = (X + i**5)**(1/5)
    if isinstance(a, complex):
        pass
    else:
        a = float(a)
        if a.is_integer() == True:
            ansa = int(a)
            ansb = i
        break
print(str(-1*ansb) + ' ' + str(-1*ansa))

Submission status: Time Limit Exceeded

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

for a in range(1, 1500):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1, 1500):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)

        if an == X:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
import sys
a=int(input())
i=0
j=1
t=True
while i**5<=a:
  if a-i**5>=0:
    if int((a-i**5)**0.2)==(a-i**5)**0.2:
      print(i,int((-1)*(a-i**5)**0.2))
      sys.exit()
  else:
    if int((-a+i**5)**0.2)==(-a+i**5)**0.2:
      print(i,int((-a+i**5)**0.2))
      sys.exit()
  i+=1
while t:
  if i**5-j**5>a:
    j+=1
  elif i**5-j**5<a:
    i+=1
  else:
    print(i,j)
    sys.exit()

Submission status: Time Limit Exceeded

Solution code:
import math
kai = int(input())
for x in range(-1000,kai):
    for y in range(-1,kai):
        if x**5 - y**5 == kai:
            print(x,y)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
if x**0.2==int(x**0.2):
  print(int(x**0.2),0)
  exit()
i=int(-(x**0.2))
while True:
  h=(x+(i**5))**0.2
  if h==int(h):
    print(int(h),i)
    exit()
  i+=1

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
a=int(x**(1/5))+1
l=list(range(a+1))
s=[]
m=0
n=0
w=0
e=1
r=1
for i in l:
  k=i**5
  l[i]=k
for i in l:
  s.append(i*-1)
p=l+s
for i in p:
  if m==1:
    break
  for q in p:
    if x==i-q:
      print(int(i**(1/5)),end=" ")
      m+=1
      if p.index(q)<=a+1:
        print(p.index(q))
      else:
        print((p.index(q)-a-1)*-1)
      break
if m==0:
  while  n==0:
    u=e**5-w**5
    if u>x:
      w==0
      r+=1
      e=r
    if x==u:
      print(e,end=" ")
      print(w)
      n+=1
    else:
      e+=1
      w+=1

Submission status: Time Limit Exceeded

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

# coding: utf-8
# Your code here!
#N, K = map(int, input().split())
X = int(input())

div = make_divisors(X)

for diff in div:
    for a in range(X):
        if (a**5 - (a-diff)**5) == X:
            print(a, a-diff)
            break

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
X = int(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

divisors = make_divisors(X)
n = 0
a = 0
while n==0:
  for i in range(len(divisors)):
    gap = divisors[i]
    other = X // gap
    b = a - gap
    if (a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4)==other:
      print(a, b)
      n = -1
      break
    else:
      a = a*(-1)
      b = a - gap
      if (a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4)==other:
        print(a, b)
        n = -1
        break
      else:
        a = a * (-1)
        a += 1

Submission status: Time Limit Exceeded

Solution code:

x=int(input())

def enum_div(n):
    ir=int(n**(0.5))+1
#    ret=[]
    ret=set()
    for i in range(1,ir):
        if n%i == 0:
            ret.add(i)
#            ret.append(i)
            if (i!= 1) & (i*i != n):
#                ret.append(n//i)
                ret.add(n//i)
    return ret

ret=enum_div(x)

y=70000
for ai in range(-y,y):
    yn=""
    for r in ret:
        bi=ai-r
        if ai**5-bi**5==x:
            yn="YES"
            break
        bi=ai+r
        if ai**5-bi**5==x:
            yn="YES"
            break
    if yn=="YES":
        break

if yn=="YES":
    print(ai,bi)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
a = int(x**0.2)
b = 0
while a**5 - b**5 != x:
    b -= 1
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
import math
X = int(input())
a = math.ceil(X**(1/5))
c = 0
N = int(1e10)
while c <= N:
    c += 1
    b = math.floor((a**5-X)**(1/5))
    if a**5 - b**5 == X:
        print(a, b)
        break
    a += 1

Submission status: Time Limit Exceeded

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

import math

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

    for b in range(10**9):
        y = (x + (-1*b)**5)**(1/5)
        if type(y) == float:
            y = math.floor(y * 10 ** 6) / (10 ** 6)
            if y % 1 == 0:
                print(int((x + (-1*b)**5)**(1/5)), -1*b)
                break


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

N=input()

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

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

L=make_divisors(N)
for yakusu in L:
    for a in range(N):
        b=a-yakusu
        ret=func(a,b)
        if ret==N:
            print a,b
            quit()
        elif N<ret:
            continue

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

def func():
    for a in range(-10**2, 10**2):
        for b in range(-10**2, 10**2):
            if a**5 - b**5 == x:
                k = [a, b]
                return k
    for a in range(10**5, 10**2, -1):
        for b in range(10**5, 10**2, -1):
            if a**5 - b**5 == x:
                k = [a, b]
                return k
    

k = func()
for i in range(2):
    print(k[i], end=" ")

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

def divisor(n):
    ass = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass  # sortされていない


x_li = divisor(x)
x_li.sort()
#print(x_li)
for i in range(len(x_li)):
    for j in range(x_li[i]+1):
        a = j
        b = a - x_li[i]
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Time Limit Exceeded

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)
    return divisors
n = int(input())
a_b = sorted(make_divisors(n))
flag = False
for i in a_b:
  if i ** 5 == n:
    print(i, 0)
    break
  else:
    for b in range(-1*i-1, i + 1):
      if (i+b)**5-b**5 == n:
        print(i + b, b)
        flag = True
        break
  if flag:
    break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

B = [i for i in range(-1000000,10000001)]

ans = []

for b in B:
    a = (X+(b**5))**(1/5)
    if type(a) == float or type(a) == int:
        if a.is_integer():
            ans.append(a)
            ans.append(b)
            break;

for i in range(2):
    ans[i] = int(ans[i])
    ans[i] = str(ans[i])

print('\t'.join(ans))

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n // i:
                divisors.append([i,n//i])
            else:
                divisors.append([i,i])
    return divisors
l=make_divisors(x)
for x,y in l:
    for i in range(10**5):
        p=i-x
        if i**4+(i**3)*p+(i**2)*(p**2)+i*(p**3)+p**4==y:
            print(i,p)
            break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
A = 0
while True:
    diff = X - A**5
    if diff < 0:
        minus_flg = False
        diff = abs(diff)
    else:
        minus_flg = True
    B = pow(diff, 0.2)
    if (isinstance(B, float)) and B.is_integer():
        break
        A += 1
if minus_flg:
    B = int(B)*-1
print(A, int(B))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for a in range(X):
    flag = True
    for b in range(X):
        if b ** 5 > X:
            flag = False
            break
        if a ** 5 - b ** 5 == X:
            A, B = a, b
            break
        elif a ** 5 + b ** 5 == X:
            A, B = a, -b
            break
    if flag:
        break

if X == 1:
    print(1, 0)
else:
    print(A, B)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-



import sys
############
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())
    divs = make_divisors(X)
    for d in divs:
        if (X-pow(d,5))%5 !=0:
            continue
        for i in range(-d,X):
            Y=pow(i+d,5)-pow(i,5)
            if Y==X:
                print(i+d,i)
                sys.exit()
            elif Y>X and i>0:
                break

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
x_mod = x % 5
i = 0
while True:
    if i - (i - x_mod) == x_mod:
        if i ** 5 - (i-x_mod)**5 == x:
            print(i, i-x_mod)
            break
    i += 1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
for i in range(10**8):
    if i**5 == x:
        print(i,0)
        break
    elif i**5 == x-1:
        print(i,-1)
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
import math,sys
p = int(math.sqrt(X))+1
for i in range(p):
    for j in range(-p,p):
        if i**5 - j**5 ==X:
            print(i,j)
            sys.exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys, math


input = sys.stdin.readline

gets = lambda: input().rstrip()
getn = lambda: int(input())
getmul = lambda: (int(i) for i in input().split())
getlist = lambda: [int(i) for i in input().split()]

x = getn()

start = int(x ** (1 / 5))
solved = False

for b in range(start, 10000000):
    # print(b)
    b5 = b ** 5
    a5 = x + b5
    a = a5 ** (1 / 5)
    # print(b5, a5, a)

    try:
        a = int(a)
        if a5 == a ** 5:
            print(int(a), b)
            solved = True
    except:
        pass

    if solved:
        break
    a5 = x - b5
    a = a5 ** (1 / 5)
    try:
        a = int(a)
        if a5 == a ** 5:
            print(int(a), -b)
            solved = True
    except:
        pass

    if solved:
        break

Submission status: Time Limit Exceeded

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

for a in range(1, 2000):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1, 2000):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)

        if an == X:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 21:48:14 2020

@author: Kei
"""

X = int(input())

i = 0
j = 0


while(1):
    A_5 = pow(i,5) + X
    jud = pow(A_5,0.2)
    if jud.is_integer() == True:
        A = int(jud)
        B = i
        break
    if abs(pow(j,5))< X:
        A_5 = pow(j,5) + X
        jud = pow(A_5,0.2)
        if jud.is_integer() == True:
            A = int(jud)
            B = j
            break
    
    i += 1
    j -= 1


print(A,B)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
t = 1
for t in range(1, 10**9):
    if X % t == 0:
        for a in range(64):
            b = a - t
            if a**5 - b**5 == X:
                print(a, b)
                exit()

Submission status: Time Limit Exceeded

Solution code:
#coding: utf-8

import sys

X = int(input())

powers = {}
def powered(i):
    if i in powers:
        return powers[i]
    powered = pow(i, 5)
    powers[i] = powered
    return powered

for a in range(100000, 0, -1):
    for b in range(0, 100000):
        poweredA = powered(a)
        poweredB = powered(b)
        if poweredA - poweredB == X:
            print(a, b)
            sys.exit()
        elif poweredA + poweredB == X:
            print(a, -b)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

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

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

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

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X*0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Submission status: Time Limit Exceeded

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

def calc():
    A = 0
    while True:
        for i in [-1, 1]:
            A_ = A * i
            # B^5 = A^5 - X
            right = A_**5 - X
            if right >= 0:
                p = right**(-0.2)
            else:
                p = (-right)**(-0.2)
            if right >= 0:
                array = range(math.floor(p), math.ceil(p) + 1)
            else:
                array = range(-math.ceil(p), -math.floor(p) + 1)
            #print(A_, p, array)
            for B in array:
                left = B**5
                if left == right:
                    print(A_, B)
                    return
        A += 1

calc()

Submission status: Time Limit Exceeded

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 find(num, n):
	if n >= len(facts):
		A = 0
		while True:
			B = A - num
			x = A ** 5 - B ** 5
			if x == X:
				return A, B
			elif B > 0 and x > X:
				break
			A += 1
	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: Time Limit Exceeded

Solution code:
X = int(input())
ansa = 1
ansb = 1
for i in range(-10**9,10**9):
    a = (X + i**5)**(1/5)
    if isinstance(a, complex):
        pass
    else:
        a = float(a)
        if a.is_integer() == True:
            ansa = int(a)
            ansb = i
        break
print(str(-1*ansb) + ' ' + str(-1*ansa))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
import math,sys
p = int(math.sqrt(X))+1
for j in range(-p,p):
    for i in range(p):
        if i**5 - j**5 ==X:
            print(i,j)
            sys.exit()

Submission status: Time Limit Exceeded

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

for a in range(1, 5000):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1, 5000):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)

        if an == X:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
import sys


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(sys.stdin.readline().rstrip())
divs = make_divisors(X)
for d in divs:
    for a in range(1, d + 1):
        b = a - d
        if a ** 5 - b ** 5 == X:
            print(a, b)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
a = 0
b = 0
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if (i ** 5) - (j ** 5) == x:
            a = i
            b = j
            break
print("{} {}".format(a, b))

Submission status: Time Limit Exceeded

Solution code:
import sys

X = int(input())

for i in range(X+1):
    if i == 0:
        continue
    tmp = X / i
    if tmp.is_integer():
        p = []
        if int(tmp) < i:
            p.append(int(tmp))
            p.append(i)
        else:
            p.append(i)
            p.append(int(tmp))

        for k in p:
            for j in range(0,k):
                a = j
                b = i - a
                if a**5 - b**5 == X:
                    print("{} {}".format(a,b))
                    sys.exit()
                if b**5 - a**5 == X:
                    print("{} {}".format(b,a))
                    sys.exit()

Submission status: Time Limit Exceeded

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

def calc():
    A = 0
    while True:
        for i in [-1, 1]:
            A_ = A * i
            # B^5 = A^5 - X
            right = A_**5 - X
            if right >= 0:
                p = right**(-0.2)
            else:
                p = (-right)**(-0.2)
            if right >= 0:
                array = range(math.floor(p) - 5, math.ceil(p) + 6)
            else:
                array = range(-math.ceil(p) - 5, -math.floor(p) + 6)
            #print(A_, p, array)
            for B in array:
                left = B**5
                if left == right:
                    print(A_, B)
                    return
        A += 1

calc()

Submission status: Time Limit Exceeded

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(10**10):
    res = X + i**5
    p = res ** (1/5)
    if isinstance(p, float):
        if p.is_integer():
            print(int(p), i)
            exit()
    res = X + (-i**5)
    p = res ** (1/5)
    if isinstance(p, float):
        if p.is_integer():
            print(int(p), -i)
            exit()

Submission status: Time Limit Exceeded

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)
    return divisors
n = int(input())
a_b = make_divisors(n)
flag = False
for i in a_b:
  if i ** 5 == n:
    print(i, 0)
    break
  else:
    for b in range(-1*i-1, i + 1):
      if (i+b)**5-b**5 == n:
        print(i + b, b)
        flag = True
        break
  if flag:
    break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
# A>B
for i in range(1,int(x**(1))+1):
  if x%i==0:
    for j in range(i):
      a=j
      b=j-i
      if a**5-b**5==x:
        print(a,b)
        break

Submission status: Time Limit Exceeded

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

N=input()

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

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

L=make_divisors(N)

for yakusu in L:
    for a in range(N):
        b=a-yakusu
        ret=func(a,b)
        if ret==N:
            print a,b
            quit()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
t = 1
for t in range(1, 10**9):
    if X % t:
        for a in range(64):
            b = a - t
            if a**5 - b**5 == X:
                print(a, b)
                exit()

Submission status: Time Limit Exceeded

Solution code:
import sys


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(sys.stdin.readline().rstrip())
divs = make_divisors(X)
for d in divs:
    for a in range(1, d + 1):
        b = a - d
        if a ** 5 - b ** 5 == X:
            print(a, b)
            sys.exit()

Submission status: Time Limit Exceeded

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

for a in range(1, 10000):
    a4 = a**4
    a3 = a**3
    a2 = a**2
    for b in range(-1, 10000):
        an = (a-b)*(a4 + (a3)*b + (a2)*(b**2) + a*(b**3) + b**4)

        if an == X:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
import sys

x=int(input())
a=1
b=0
s=0
while(1):
    while(1):
        if(a==b):
            break
        if x%(a-b)==0:
            A=a**5
            B=b**5
            k=x-A
            if(-B==k):
                print(a,b)
                sys.exit()
            elif (B==k):
                print(a,-b)
                sys.exit()
        b+=1
    a+=1

Submission status: Time Limit Exceeded

Solution code:
x=int(input())

if x==1:
    print(0,-1)
else:
    n=[]
    for i in range(x-1):
        if x%(i+2)==0:
            n.append(i+2)
    
    for j in range(len(n)):
        for i in range(200):
            a=105-i
            b=105-i-n[j]
            c=a**5-b**5
            if c==x:
                print(a,b)
                break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

# x^5−y^5=(x−y)(x^4+x3^y+x^2y^2+xy^3+y^4)
# x-yをみつける x-y = d[i]
# と思ったができない
# ひょっとして総当りで間に合うのでは

for i in range(x):
    tmpx = i
    tmpy = i**5 - x
    if isinstance(tmpy, int) and tmpx**5 - tmpy**5 == x:
        print(tmpx, tmpy)
        exit()
print(0 / 0)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
x = -200
while True:
	y = (n - x**5);
	if (y < 0):
		y = -1 * ((-1 * y) ** 0.5) 
	y = int(y)
	if (x**5 + y**5 == n):
		print(x, -1 * y, sep = " ");
		break
	x+=1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for i in range(1, int(x**0.5)+1):
  if x%i==0:
    y = i
    z = x//i
    
    a = int(x**(1/5))
    ans = False
    
    while True:
      if a**5-(a-y)**5==x:
        ans = True
        b = a-y
        break
      if a**5-(a-z)**5==x:
        ans = True
        b = a-z
        break
      if a^5-(a-z)^5>x and a^5-(a-z)^5>x:
        break
      a += 1
    
    if ans:
      break
      
print(a, b)

Submission status: Time Limit Exceeded

Solution code:

def factorization(num):
  if num == 1:
    return [1]
  factor = []
  while num > 1:
    for i in range(num - 1):
      k = i + 2
      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: Time Limit Exceeded

Solution code:
X = int(input())
t = 1
for t in range(1, 10**9):
    for a in range(64):
        b = a - t
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
import sys

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

def trial_division(n):
    prime_factors = list()
    while n % 2 == 0:
        prime_factors.append(2)
        n //= 2
    p = 3
    while p * p <= n:
        if n % p == 0:
            prime_factors.append(p)
            n //= p
        else:
            p += 2
    if n != 1:
        prime_factors.append(n)
    return prime_factors

def keisan(A,B):
    return A**4 + A**3 * B + A**2 * B**2 + A * B ** 3 + B**4

def main():
    X = int(input())
    if X == 1:
        print(1,0)
        exit()
    soinsu = trial_division(X)
    A = 0
    while True:
        A += 1
        B = A - soinsu[0]
        if A**5 - B**5 == X:
            print(A,B)
            exit()


if __name__ == "__main__":
    main()