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

#output
initial_num = 1

left = 1
right = 10**2
while left + 1 < right:
    mid = (left + right)//2
    if mid **5  > X:
        right = mid
    else:
        left = mid

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
A = left
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not is_integer(B):
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)

print(A, int(B))

Submission status: Time Limit Exceeded

Solution code:
import sys
def main():
    N=int(input())

    for i in range(-64,64):
        for j in range(-64,64):
            if i**5-j**5==N:
                print(i,j)
                sys.exit(0)

    a=65
    b=64
    for i in range(10000000):
        ass=a**5-b**5
        if ass==N:
            print(a,b)
            sys.exit(0)
        elif ass>N:
            b+=1
        else:
            a+=1

if __name__ =='__main__': 
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

x = int(input())
power = ""

for a in range(-500, 500):
    for b in range(-500, 500):
        if np.power(a, 5)^-np.power(b, 5) == x:
            power = f"{a} {b}"
            break
    if not power == "":
        break

print(power)

Submission status: Time Limit Exceeded

Solution code:
import collections
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

c = collections.Counter(prime_factorize(X))
cl = list(c.keys())
cl.append(1)
for insu in cl:
    for i in range(-1000000, 1000000):
        if i**5 - (i-insu)**5 == X:
            print(i, (i-insu))
            break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
Acount = 0
Bcount = 0
di= {}
def func(i):
    return i**5
for i in range(5000):
    di[str(func(i))] = str(i)
preA = int(X **(1/5))
while True:
    funcA = preA**5
    if funcA-X>=0 and str(funcA-X) in di.keys():
        print(str(preA)+" "+di[str(funcA-X)])
        break
    elif X-funcA>= 0 and str(X-funcA) in di.keys():
        print(str(preA)+" -"+di[str(X-funcA)])
        break
    preA += 1

Submission status: Time Limit Exceeded

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


for i in range(-64,64):
    for j in range(-64,64):
        if i**5-j**5==N:
            print(i,j)
            sys.exit(0)

a=65
b=64
for i in range(10000000):
    ass=a**5-b**5
    if ass==N:
        print(a,b)
        sys.exit(0)
    elif ass>N:
        b+=1
    else:
        a+=1

Submission status: Time Limit Exceeded

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


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

    B = 0
    while True:
        A = (X + B**5)**(1/5)
        if not isinstance(A, complex) and A.is_integer():
            A = int(A)
            break
        B *= -1
        A = (X + B**5)**(1/5)
        if not isinstance(A, complex) and A.is_integer():
            A = int(A)
            break
        B *= -1
        B += 1

    print(f"{A} {B}")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys, math
import bisect, heapq
import collections
 
sys.setrecursionlimit(10 ** 6)
 
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()
 
 
for b in range(0, 10 ** 9 + 1):
    b5 = b ** 5
    a5 = x + b5
    a = a5 ** (1 / 5)
    if a5 == a ** 5:
        print(int(a), b)
        exit()
    a5 = x - b5
    a = a5 ** (1 / 5)
    if a5 == a ** 5:
        print(int(a), -b)
        exit()

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

#約数列挙
def enum_divisors(N):
    f = []
    i = 1
    #sqrt不使用: 少数誤差が気にならない
    while i * i <= N:
        if N % i == 0:
            f.append(i)
            if N//i != i:
                #重複しないならば、iの相方であるN/iも追加
                f.append(N//i)
        i += 1
    f.sort()
    return f

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

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
a = 0
b = 0
for i in range (-10**3,10**3):
    for j in range (-10**3,10**3):
        if X == i**5 - j**5:
            a = i
            b = j
    
print('%d %d'%(a,b))

Submission status: Time Limit Exceeded

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=0
a=1
while True:
    try:
        f=(s+num**5)**(1/5)
        if f.is_integer():
            break
        f=(s-num**5)**(1/5)
        if f.is_integer():
            a=-1
            break
    except:
        pass
    num+=1

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
t = X**(0.2)
if t.is_integer():
    print(int(t),0)
else:
    b = 1
    while(True):
        k = b**5
        t = (X+k)**(0.2)
        if t.is_integer():
            print(int(t),b)
            break
        if X >= k:
            t = (X-k)**(0.2)
            if t.is_integer():
                print(int(t),-b)
                break
        b += 1

Submission status: Time Limit Exceeded

Solution code:
x=int(input())

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False
    
import math

for i in range(100000000000):

    
    if is_integer_num(((x+i**5)**(1/5))):
        print(int((x+i**5)**(1/5)),i)
        break
    if is_integer_num(((x-i**5)**(1/5))):
        print(int((x-i**5)**(1/5)),-i)
        break

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
for i in range(-x,x):
    for l in range(-x,x):
        g=i**5
        g-=l**5
        if g==x:
            print('{} {}'.format(i,l))
            exit()

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
for i in range(int(x**0.5)+1):
    for j in range(-(int(x**0.5)+1),int(x**0.5)+1):
        if i**5-j**5==x:
            print(str(i)+" "+str(j))
            break
    else:
        continue
    break

Submission status: Time Limit Exceeded

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

ds1 = 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

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

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
  if a!=0:
    break
print(a,b)

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())

div = []

i = 1
while i*i <= x:
    if x%i == 0:
        div.append(i)
        if i*i != x:
            div.append(x//i)
    i += 1

for d in div:

    minr = math.floor(math.sqrt(math.sqrt((x//d)/5)))
    if minr-d <= 0:
        minr = 0
    a = minr

    while (a-d)<=0 or 5*((a-d)**4) < x//d:
        a += 1
        b = a-d
        if a**5-b**5 == x:
            print(a, b)
            exit()
        if -a**5+b**5 == x:
            print(-a, -b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

def mkDivisors(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 = ni()
    div = mkDivisors(x)
    for i in div:
        for n in [i,-1*i]:
            for b in range(-n-125, n+125):
                a = b + n
                if pow(a,5) - pow(b,5) == x:
                    print(a,b)
                    return
    print("Erorr")
    return


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
C = 0
for i in range(-10000,10000):
	if C == 1:
		break
	for j in range(-10000,10000):
		if i**5-j**5 == X:
			print(i,j)
			C += 1
			break

Submission status: Time Limit Exceeded

Solution code:
def pow_r(x, n):
    if n == 0: 
        return 1
    if n % 2 == 0: 
        return pow_r(x ** 2, n // 2)
    else: 
        return x * pow_r(x ** 2, (n - 1) // 2)


x = int(input())
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if x == (pow_r(a, 5)) - (pow_r(b, 5)):
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = 1
b = 1
for i in range(-1000, 1000):
  for j in range(-1000, 1000):
    if ((i ** 5) - (j ** 5) == n):
      a = i
      b = j

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

Submission status: Time Limit Exceeded

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

#output
import math
initial_num = 1
while initial_num**5 < X:
    initial_num += 1
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
A = initial_num
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not is_integer(B):
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)

print(A, int(B))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for i in range(10**3):
    for j in range(-10**6,10**6):
        if i**5 - j**5 ==X:
            print(i,j)
            break

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
A=[]
C=[]
for i in range(100000):
    A.append((i)**5)
    C.append((-(i))**5)
for i in range(len(A)):
    for j in range(len(A)):
        if x==A[i]-A[j]:
            print(i,j)
            #print(A[i],A[j])
            #print(A)
            exit()
        elif x==A[i]-C[j]:
            print(i,-(j))
            #print(A[i],C[j])
            #print(C)
            exit()

Submission status: Time Limit Exceeded

Solution code:
def pow_r(x, n):
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)
    else:  # standard case ② n is odd
        return x * pow_r(x ** 2, (n - 1) // 2)


x = int(input())
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if x == (pow_r(a, 5)) - (pow_r(b, 5)):
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
def main():
    x = int(input())
    n = int(x ** (1 / 5))
    a = n
    b = n
    while True:
        if a**5 - b**5 == x:
            print(a,b)
            break
        b -= 1

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
b = 0.0
c = True

while c:
    if ((X + b**5)**0.2).is_integer():
        c = False
        a = int(((X + b**5)**0.2))
    elif b >= 0:
        b = -1*b
    else:
        b = -1*b + 1
        
print(a, int(b))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
for a in range(0, X + 1):
    for b in range(0, X + 1):
        if (a**5 - b**5) or (a**5 + b**5) <= X:
            if (a**5 - b**5) == X:
                print(a, b)
                exit()
            if (a**5 + b**5) == X:
                print(a, -b)
                exit()
        else:
            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)

	divisors.sort()
	return divisors

x = int(input())

l = make_divisors(x)

for i in range(max(len(l)//2,1)):
	a = -10**4+l[i]
	b = -10**4
	#print(a,b)
	while True:
		num = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
		if num == l[-i-1]:
			print(a,b)
			#print('Yes!')
			break
		if a == 10**6:
			break
		#print(l[-i-1],num)
		a += 1
		b += 1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

if X == 1:
    print(0, -1)
    exit()

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

    # divisors.sort()
    return divisors

def solve(num, X):
    a = 1
    while a < X:
        if (a) ** 5 - (a -num) ** 5 == X:
            return True, a, a-+ num
        a += 1
    return False, 0, 0

arr = make_divisors(abs(X))
for num in arr:
    flag, a, b = solve(num , X)
    if flag:
        print(a, b)
        exit()
    flag, a, b = solve(-num , X)
    if flag:
        print(a, b)
        exit()

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())
for a in range(1000000000):
    b = (x - (a**5))**0.2
    if isinstance(b, float) and b.is_integer():
        print(a, int(b) * -1)
        break

Submission status: Time Limit Exceeded

Solution code:
#coding: utf-8
from math import ceil, floor
X = int(input())
a = floor(X**(1/5))
a2 = -a
while True:
    a2 = -a
    b = (a**5 - X)
    b2 = (a2**5 - X)
    if a**5 - b**5 == X:
        print(a,b)
        exit()
    elif a2**5 - b2**5 == X:
        print(a2, b2)
    a += 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)
			if i != n // i:
				divisors.append(n//i)

	divisors.sort()
	return divisors

x = int(input())

l = make_divisors(x)

for i in range(max(len(l)//2,1)):
	a = -10**4+l[i]
	b = -10**4
	#print(a,b)
	while True:
		num = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
		if num == l[-i-1]:
			print(a,b)
			#print('Yes!')
			break
		if a == 10**5:
			break
		#print(l[-i-1],num)
		a += 1
		b += 1

Submission status: Time Limit Exceeded

Solution code:
def main():
    x = int(input())
    
    if x ==1:
        print(1,0)
        return
    for i in range(-int(x**0.2),10**7,1):
        t = pow(i**5+x,1/5)
        if t.is_integer():
            print(int(t),i)
            break
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for i in range(10**4):
    for j in range(-10**3,10**3):
        if i**5 - j**5 ==X:
            print(i,j)
            break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

div = []

i = 1
while i*i <= x:
    if x%i == 0:
        div.append(i)
        if i*i != x:
            div.append(x//i)
    i += 1

for d in div:
    a = 0
    while (a-d)<=0 or 5*((a-d)**4) < x//d:
        a += 1
        b = a-d
        if a**5-b**5 == x:
            print(a, b)
            exit()
        if -a**5+b**5 == x:
            print(-a, -b)
            exit()

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)
a = 0
n = 0
while n==0:
  for i in range(len(divisors)):
    gap = divisors[i]
    other = X // gap
    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
    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
    a = a*(-1)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main(X=None):
    if X is None:
        X = ii()
    for a in range(-100000000, 100000000):
        b5 = a**5 - X
        b = meg(lambda v: v**5<=b5, -100000000, 100000000)
        if a**5 - X == b**5:
            print(a, b)
            return

main()

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)

	divisors.sort()
	return divisors

x = int(input())

l = make_divisors(x)

for i in range(max(len(l)//2,1)):
	a = -10**4+l[i]
	b = -10**4
	#print(a,b)
	while True:
		num = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
		if num == l[-i-1]:
			print(a,b)
			#print('Yes!')
			break
		if a == 10**3:
			break
		#print(l[-i-1],num)
		a += 1
		b += 1

Submission status: Time Limit Exceeded

Solution code:
X = input()


for a_i in range(100000000):
	for b_i in range(a_i):
		if a_i**5 - b_i**5 == X:
			print ("%d %d"%(a_i, b_i))
			break
		if a_i**5 + b_i**5 == X:
			print ("%d %d"%(a_i, -1 * b_i))			
			break
	else:
		continue
	break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
B = -100
while True:
  A = (X + (B ** 5)) ** (1 / 5)
  if type(A) != complex:
    if A.is_integer():
      print(int(A), B)
      exit()
    else:
      B += 1
  else:
    B += 1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
for b in range(10000000):
    tmp=x+b**5
    if tmp>=0:
        if tmp**0.2==int(tmp**0.2):
            print(int(tmp**0.2),b)
            exit()
    tmp=x-b**5
    if tmp>=0:
        if tmp**0.2==int(tmp**0.2):
            print(int(tmp**0.2),-b)
            exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

B = 1
while True:
    B_5 = B**5

    diff = X - B_5
    A = diff**(1 / 5)
    if A % 1 == 0:
        B = -B
        A = int(A)
        break

    diff = X + B_5
    A = diff**(1 / 5)
    if A % 1 == 0:
        A = int(A)
        break

print(A, B)

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)

	divisors.sort()
	return divisors

x = int(input())

l = make_divisors(x)

for i in range(max(len(l)//2,1)):
	a = -10**4+l[i]
	b = -10**4
	#print(a,b)
	while True:
		num = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
		if num == l[-i-1]:
			print(a,b)
			#print('Yes!')
			break
		if a == 10**4:
			break
		#print(l[-i-1],num)
		a += 1
		b += 1

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
bekilis =[]

for i in range(1,65):
    bekilis.append(i**5)

for i in range(10000000):
    tmp_p = X + (i ** 5)
    tmp_m = X - (i ** 5)

    if tmp_p in bekilis:
        print((bekilis.index(tmp_p)+1),i)
        break

    elif tmp_m in bekilis:
        print((bekilis.index(tmp_m)+1),-i)
        break

Submission status: Time Limit Exceeded

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  a=int(n**(1/5))
  # print(a)
  b=n-a**5
  c=0
  while True:
    if c**5==b:
      return str(a)+' '+str(-c)
    c+=1

# main()
print(main())

Submission status: Time Limit Exceeded

Solution code:
#coding: utf-8
from math import ceil, floor
X = int(input())
a = floor(X**(1/5))
while True:
    b = (a**5 - X)
    if a**5 - b**5 == X:
        print(a,b)
        exit()
    # if (a**5 - X) < 0:
    #     pass
    # elif int((a**5 - X)**(1/5)) == (a**5 - X)**(1/5):
    #     print(a, int((a**5 - X)**(1/5)))
    #     exit()
    a += 1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())


def divisors(num):
    array = []
    limit = int(num ** 0.5) + 1
    for i in range(1, limit):
        if num % i == 0:
            div1 = i
            div2 = num//i
            array.append(div1)
            if div1 != div2:
                array.append(div2)
    array.sort()
    return array


divs = divisors(x)

for div in divs:
    for a in range(div+1):
        b = a - div
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
# python3

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

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


def solve(X):
    B = 0
    while True:
        x1 = X + (B) ** 5
        A = int(x1 ** (1/5.0))
        if A ** 5 == x1:
            return str(A) + " " + str(B)
        x2 = X + (-B) ** 5
        A = int(x1 ** (1/5.0))
        if A ** 5 == x2:
            return str(A) + " " + str(-B)
        B += 1


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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
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 SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 

X=II()

for i in range(0, 1000000):
    for j in range(-1000000, 1000000):
        if i**5-j**5==X:
            print(i,j)
            exit()

Submission status: Time Limit Exceeded

Solution code:
# ａ⁵－ｂ⁵＝(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋ｂ⁴)
import sys
X = int(input())
a = 1
for i in range(1, 10**9):
    a = i**5
    if a-X > 0:
        b = 1
        while True:
            if a-X == b**5:
                print(i, b)
                sys.exit()
            elif a-X > b:
                b += 1
            else:
                break
    elif a-X < 0:
        b = -1
        while True:
            if a-X == b**5:
                print(i, b)
                sys.exit()
            elif a-X < b:
                b -= 1
            else:
                break
    else:
        print(i, 0)
        break

Submission status: Time Limit Exceeded

Solution code:
def main():
    x = int(input())
    a = int(x**(1/5))
    while True:
        b = a**5 - x
        if b < 0:
            b = abs(b-0)**(1/5)
            b = b * (-1)
        else:
            b = b**(1/5)
        b = int(b)
        if a**5 - b**5 == x:
            print(a,b)
            return 0
        else:
            a+=1
    
if __name__ == '__main__':
    main()

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:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
make_divisors(10**9)
for i in range(0,200):
  for j in range(0,200):
    if i**5+j**5 == x:
      print(i,-j)
      quit()
l = make_divisors(x)
b = 0
for i in l:
  b = 0
  while True:
    a = b+i
    if a**5-b**5 < x:
      b += 1
    elif a**5-b**5 > x:
      break
    else:
      print(a,b)

Submission status: Time Limit Exceeded

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

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())
div = make_divisors(x)
ans = 0
for yakusu in div:
    a = 0
    b = -yakusu
    while (a-b) * calc(a, b) <= x or b < 0:
        if abs((a-b) * calc(a, b)) == x:
            ans = (a, b)
            break
        else:
            a += 1
            b += 1
    if ans != 0: break

if ans[0]**5 - ans[1]**5 > 0:
    print(ans[0], ans[1])
else:
    print(ans[1], ans[0])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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



A=0
while True:
    B_5=A**5-X
    r = ok(B_5)
    if r==abs(B_5):
        print(A,r*(-1 if B_5<0 else 1))
        break
    A+=1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
i = 0
while True:
    tres = x + i ** 5
    a = tres ** (1.0 / float(5))
    if a ** 5 == tres:
        print(int(a), i)
        exit()
    tres = x + (i * -1) ** 5
    a = tres ** (1.0 / float(5))
    if a ** 5 == tres:
        print(int(a), i * -1)
        exit()
    i += 1