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

divisors = make_divisors(x)

for divisor in divisors:
  for a in range(100000):
    b = a - divisor
    if (a**5 - b**5 == x):
      print(a, b)
      break

Submission status: Time Limit Exceeded

Solution code:
import sys
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 make_divisors(x):
  a=0
  b=-i
  ab=0
  while b<=0 or i*ab<=x:
    ab=a**4+a**3*b+a**2*b**2+a*b**3+b**4
    if i*ab==x:
      print(a,b)
      sys.exit()
    a+=1
    b+=1

Submission status: Time Limit Exceeded

Solution code:
n=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
l=make_divisors(n)


aa=0
bb=0
for i in range(len(l)):

    t=0
    a=0
    while t==0:
        if a**5-(a-l[i])**5==n:
            t=2
            aa=a
            bb=a-l[i]

        elif a>l[i] and a**5-(a-l[i])**5>n:
            t=1

        a+=1

print(str(aa)+" "+str(bb))

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

a = 1
b = 0
while True:
    A = pow(a, 5)
    B = pow(b, 5)
    if A-B == x:
        print(a, b)
        break
    if A+B == x:
        print(a, -b)
        break
    a += 1
    b += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    for i in range(0,100000,1):
        for j in range(0,-100000,-1):
            if i == j:
                 continue
            if X % (i - j) == 0:
                if (i-j) * (pow(i,4) + pow(i,3)*j + pow(i,2)*pow(j,2) + i*pow(j,3) + pow(j,4)) == X:
                    print(i,j)
                    exit()
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
import sys
x=int(input())
a=0
while True:
  for i in range(-64,64):
    if a**5-i**5==x:
      print(a,i)
      sys.exit()
  a+=1

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

def search(x):
    for div in make_divisors(x):
        for a in range(div):
            b = -(div-a)
            if x == (a**5-(b**5)):
                print(a, b)
                return

search(x)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

root = int(X**(1/5))

if root**5 < X:
    rest = X - root**5
    another = -int(rest**(1/5))
else:
    rest = root**5 - X
    another = int(rest**(1/5))

tmp = 1
while root**5 - another**5 != X:
    another_plus = another + tmp
    another_minus = another - tmp
    if root**5 - another_plus**5 == X:
        another = another_plus
        break
    if root**5 - another_minus**5 == X:
        another = another_minus
        break
    tmp += 1


print(root, another)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import math
x = int(input())
ys = []
i = 1
while i**2 < x:
    if x%i == 0:
        ys.append(i)
        ys.append(x//i)
    i += 1
if i**2 == x:
    ys.append(i)

f = False

for j in ys:
    for i in range(10**100):
        if i**5-(i-j)**5 == x:
            print(i,i-j)
            break
        elif i**5-(i-j)**5 > x and i-j > 0:
            break
    if f:
        break

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
x = 1
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(-1000,1000):
    a=i
    for j in range(-1000,1000):
        b=j
        if a**5-b**5==x:
            am=a
            bm=b
        else:
            c=0
print(am,bm)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = 0
aa = 0
ab = 0

while(1):
    a += 1
    aa = a ** 5
    if aa >= n:
        ab = (a-1)**5
        break

b = 0
if aa == n:
    print(str(a) + " 0")
    exit()

while (1):
    b += 1
    if aa - b ** 5 == n:
        print(str(a) + " " + str(b))
        exit()
    if ab + b ** 5 == n:
        print(str(a - 1) + " " + str(-b))
        exit()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
A = [i for i in range(0, 10000)]
B = [-i for i in range(0, 10000)]
res = []
for i in range(len(A)):
  a = A[i]
  for j in range(len(B)):
    b = B[j]
    cal = a ** 5 - b ** 5
    if cal == X:
      print(a, b)
      exit()

Submission status: Time Limit Exceeded

Solution code:
import sys
from io import StringIO
import unittest
import math

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

    a = math.floor(x ** 0.2)

    b5 = a ** 5 - x # マイナスになる

    b = 0

    right = 0
    left = b5 - 10
    if x == 1:
        a = 0
        b = -1
    else:
        while 1:
            mid = (right + left) // 2

            if mid ** 5 > b5:
                right = mid - 1
            elif mid ** 5 < b5:
                left = mid + 1
            else:
                b = mid
                break

    print(a, b, sep=' ')


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """33"""
        output = """2 -1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1"""
        output = """0 -1"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
if X==1:
    print(0,-1) 
else:
    d = 2
    while(X%d!=0):
        d+=1
    b = -(10**2)
    a = b+d
    while(X!=((a**5)-(b**5))):
        b+=1
        a=b+d
    print(a,b)

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    for i in range(0,100001,2):
        for j in range(-100000,1,1):
            if i == j:
                 continue
            if X % (i - j) == 0:
                if (i-j) * (pow(i,4) + pow(i,3)*j + pow(i,2)*pow(j,2) + i*pow(j,3) + pow(j,4)) == X:
                    print(i,j)
                    exit()
if __name__ == '__main__':
  main()

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

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

Submission status: Time Limit Exceeded

Solution code:
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
            if(A-B==x):
                print(a,b)
                s=1
                break
            elif (-A-B==x):
                print(-a,b)
                s=1
                break
            elif (A+B==x):
                print(a,-b)
                s=1
                break
        b+=1
    if(s==1):
        break
    a+=1

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
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 lef(a, b):
    return a*a*a*a + a*a*a*b + a*a*b*b + a*b*b*b + b*b*b*b

def solve(X: int):
    divs = make_divisors(X)
    for d in divs:
        base = 0
        upper = X // d
        while(lef(base+d,base) < upper):
            base+=1
        if lef(base+d,base) == upper:
            print(base+d,base)
            return
        base = -1
        while(lef(base+d,base) < upper) or (base+d >-1 ):
            base -= 1
            if lef(base+d, base) == upper:
                print(base+d, base)
                return
    raise
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
i = x
while True:
    a = (x + (-i)**5)**(1/5)
    b = (x + (i)**5)**(1/5)
    if type(a) is float:
        if a == int(a):
            print(int(a),-i)
            break
    if type(b) is float: 
        if b == int(b):
            print(int(b),i)
            break
    i -= 1

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
    check = (float(X)/float(x) - x**4)**0.25 
    if (float(X)/float(x) - x**4)<=0:
        check=-1
    flag=0
    while(True):
        if fn(a,x) == X/x - x**4:
            flag=1
            print(a, a-x)
            break
        if (a**3 > x**3*2) and check < a:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for a in range(0, 10 ** 9):
    for b in range(0, 10 ** 9):
        ans = a ** 5 - (-b) ** 5
        if ans == x:
            print(a, -b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

root = int(X**(1/5))

if root**5 < X:
    rest = X - root**5
    another = -int(rest**(1/5))
else:
    rest = root**5 - X
    another = int(rest**(1/5))

while root**5 - another**5 != X:
    another_plus = another + 1
    another_minus = another - 1
    if root**5 - another_plus**5 == X:
        another = another_plus
        break
    if root**5 - another_minus**5 == X:
        another = another_minus
        break


print(root, another)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
A = 0
B = 0

while True:
    s = A**5
    t = X+B**5
#    print(A,B,s-t)
    if s<t:
        c = (A+1)**5-t
        d = s-(X+(B-1)**5)
        if abs(c)>=abs(d):
            B -= 1
        else:
            A += 1
    elif s>t:
        c = (A-1)**5-t
        d = s-(X+(B+1)**5)
        if abs(c)>=abs(d):
            B += 1
        else:
            A -= 1
    else:
        print(A,B)
        exit()

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
break_loop=False
for i in range(1-X,X):
  for j in range(-X,X-1):
    if (i-j)*(i**4+(i**3)*j+(i**2)*(j**2)+i*(j**3)+j**4)==X:
      print(i,j)
      break_loop=True
      break
  if break_loop:
    break

Submission status: Time Limit Exceeded

Solution code:
X=int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

X = ri()

def get_divisors(X):
	if X == 1:
		return [1]
	i = 2
	div = []
	while i*i <= X:
		if X % i == 0:
			X //= i
			div.append(i)
		else:
			i += 1
	if X > 1:
		div.append(X)
	return div

#for i in range(1, 10):
#	print(i, get_divisors(i))

def f(x, y):
	# x**4+y**4+x**2*y**2 + x**3*y+x*y**3
	return (y**4+x*y**3+x**2*y**2+x**3*y+x**4) * (x-y)

def search(d):
	y = 0
	while True:
		x = y+d
		v = f(x, y)
		#print(v)
		#print(x, y, v)
		if v == X:
			print(x, y)
			exit()
		if v > X:
			break
		y += 1
	y = -1
	while True:
		x = y+d
		if x <= 0:
			break
		v = f(x, y)
		#print(x, y, v)
		if v == X:
			print(x, y)
			exit()
		if v <= 0:
			break
		y -= 1

import itertools
def comb(divs):
	for i in range(1, len(divs)+1):
		for c in itertools.combinations(divs, i):
			m = 1
			for n in c:
				m *= n
			yield m

divs = get_divisors(X)
#print(divs)
visited = {}
for d in comb(divs):
#for d in set(divs):
	if d in visited: continue
	search(d)
	visited[d] = 1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
a = 1
b = 0
A = []

while True:
    if a ** 5 - x > 0:
        A.append(a ** 5 - x)
        break
    A.append(a ** 5 - x)
    a = a + 1

while True:
    if b ** 5 in A:
        break
    elif -b ** 5 in A:
        b = -b
        break
    b = b + 1

a = int((x + b ** 5) ** 0.2)

print(a, b)

Submission status: Time Limit Exceeded

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    import math
    for i in range(0,100001,2):
        for j in range(-100000,1,1):
            # if i == j:
            #     continue
            if (i-j) * (pow(i,4) + pow(i,3)*j + pow(i,2)*pow(j,2) + i*pow(j,3) + pow(j,4)) == X:
                print(i,j)
                exit()
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np#not for pypy

def main():
    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")
    #second_input = input().split(" ")

    X = first_input[0]
    B = 0
    while True:
        #positive
        A_principle = (X+B**5)**(1/5)
        if (A_principle-(A_principle//1))==0:
            print(str(int(A_principle))+" "+str(B))
            break
        #negative
        if X+(-B)**5>=0:
            A_principle = (X+(-B)**5)**(1/5)
            if (A_principle-(A_principle//1))==0:
                print(str(int(A_principle))+" "+str(-B))
                break
        B = B+1

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X=int(input())

def f(p, q):
    s=(q-p**4)/5
    if s%1>0:
        return False, None
    
    t=yakusu(s)
    for A in t:
        if A*(A**3-2*p*(A**2)+2*A*(p**2)-p**3)==s:
            if A>=0:
                A=int(A)
            else:
                A=-int(-A)
            B=A-p
            if B>=0:
                B=int(B)
            else:
                B=-int(-B)
            return True, [A, B]
    return False, None

def yakusu(x):
    if x<0:
        x*=-1
    tmp=int(pow(x, 1/2))+1
    out=set()
    for i in range(1, tmp):
        if x%i==0:
            out.add(i)
            out.add(x//i)
    if pow(x, 1/2)%1==0:
        out.add(pow(x, 1/2))
    out=list(out)
    out=out+[-i for i in out]
    out.sort()
    return out

tmp=yakusu(X)
for p in tmp:
    q=X//p
    hantei, ans=f(p, q)
    if hantei==True:
        print(ans[0], ans[1])
        exit()
        
    hantei, ans=f(-p, -q)
    if hantei==True:
        print(ans[0], ans[1])
        exit()

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

def LII_split():
    return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

X = input_int()

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

A_B = prime_factorize(X)
A = 1
while True:
    B = A - A_B
    if A**5 == B**5 + X:
        print(A, B)
        exit()
    A += 1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
flag = 0
A = 0
B = 0
for a in range(100000):
    for b in range(100000):
        if (a-10)**5 - (b-10)**5 == X:
            flag = 1
            A = a-10
            B = b-10
            break
        else:
            pass
    if flag == 1:
        break

print(A,B)

Submission status: Time Limit Exceeded

Solution code:
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    x = _i()
    i = 0
    while True:
        i5 = i ** 5
        if x > 2 * i5:
            i += 1
            continue
        for j in range(-i+1, i+1):
            j5 = j ** 5
            ij = i5 - j5
            if ij == x:
                return f"{i} {j}"
            if ij > x:
                break
        i += 1


if __name__ == "__main__":
    print(main())

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for s in range(1,X+1):
  if X%s == 0:
    for n in range(0, X):
      a = n
      b = n - s
      t = a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4
      if s*t == X:
        print(a,b)
        break

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

def search(x):
    for div in make_divisors(x):
        for a in range(div):
            b = -(div-a)
            if x == (a**5-(b**5)):
                print(a, b)
                return
              
search(x)

Submission status: Time Limit Exceeded

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

x = int(input())
a = 0
while(True):
    a_1 = a**5-x
    if a_1 < 0:
        a_2 = a_1*(-1)
    b = (a_2)**(0.2)
    if b.is_integer():
        if a_1 < 0:
            b = b*(-1)
        break
    a += 1

print(a,int(b))

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x=INT()

for i in range(-1*int(x**(1/5))-1,int(x**(1/5))+1):
    for j in range(-1*int(x**(1/5))-1,int(x**(1/5))+1):
        if i**5-j**5==x:
            print(i,j)
            exit()
while True:
    j+=1

Submission status: Time Limit Exceeded

Solution code:

import math


def fact(x):
    for cand in range(2, math.ceil(math.sqrt(x)) + 1):
        q, r = divmod(x, cand)
        if r == 0:
            return min(q, cand), max(q, cand)
    return 1, x


# def check(a, b):
#     a2 = a * a
#     a3 = a2 * a
#     a4 = a3 * a
#     b2 = b * b
#     b3 = b2 * b
#     b4 = b3 * b
#     return a4 + a3*b + a2*b2 + a*b3 + b4

def pow5(x):
    return x ** 5


def func(a, b):
    return pow5(a) - pow5(b)


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

    if x == 1:
        print("0 -1")
        return

    q1, q2 = fact(x)
    # パターン2 a > 0, b < 0
    a = q1
    b = 0
    f = func(a, b)
    while a > 0 and f != x:
        a -= 1
        b -= 1
        f = func(a, b)
    if f == x:
        print("{} {}".format(a, b))
        return

    # パターン1, a, b > 0
    a = q1
    b = 0
    f = func(a, b)
    while f < x:
        a += 1
        b += 1
        f = func(a, b)
    if f == x:
        print("{} {}".format(a, b))
        return

    # パターン3 a, b < 0
    a = 0
    b = -q1
    f = func(a, b)
    while f != x:
        a -= 1
        b -= 1
        f = func(a, b)
    if f == x:
        print("{} {}".format(a, b))
        return

        
submit()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

i = 1
a = 1
b = 0
while a**5 - b**5 <= x:
    if a**5 - b**5 == x:
        print(a, b)
        exit()
    a += 1
    b -= 1

while True:
    i += 1
    if x % i:
        continue

    b = 1
    a = i - b
    while b < a and a**5 - b**5 <= x:
        if a**5 - b**5 == x:
            print(a, b)
            exit()
        a += 1
        b -= 1

    a = i
    b = 0
    while a**5 - b**5 <= x:
        if a**5 - b**5 == x:
            print(a, b)
            exit()
        a += 1
        b -= 1

Submission status: Time Limit Exceeded

Solution code:
import math

X = int(input())

for B in range(X):
    B5 = B**5
    XB_pow = math.pow(X+B5, 0.2)
    A_f = math.floor(XB_pow)
    A_c = math.ceil(XB_pow)

    # print(B)

    A_f5 = A_f**5
    A_c5 = A_c**5
    
    if A_f5 - B5 == X:
        print(A_f,B)
        break
    if A_c5 - B5 == X:
        print(A_c,B)
        break
    if A_f5 + B5 == X:
        print(A_f,-B)
        break
    if A_c5 + B5 == X:
        print(A_c,-B)
        break

Submission status: Time Limit Exceeded

Solution code:
def f(x):
    div = 1
    while div * div <= x:
        if x % div == 0:
            for a in range(0, div + 1):
                b = a - div
                if a ** 5 - b ** 5 == x:
                    return a, b

            opp_div = x // div
            for a in range(0, opp_div + 1):
                b = a - opp_div
                if a ** 5 - b ** 5 == x:
                    return a, b
        div += 1


def main():
    x = int(input())
    a, b = f(x)
    print(a, b)


main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from io import StringIO
import unittest
import math

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

    a = math.floor(x ** 0.2)

    b5 = a ** 5 - x # マイナスになる

    b = 0

    right = 0
    left = -1 * (10 ** 9)
    if x == 1:
        a = 0
        b = -1
    else:
        while 1:
            mid = (right + left) // 2

            if mid ** 5 > b5:
                right = mid
            elif mid ** 5 < b5:
                left = mid
            else:
                b = mid
                break

    print(a, b, sep=' ')


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """33"""
        output = """2 -1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1"""
        output = """0 -1"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
sign = ((1,1),(1,-1),(-1,1),(1,1))
isloop=True
for a in range(10**5):
    if(isloop==False):
        break
    for b in range(10**5):
        if(isloop==False):
            break
        for s1,s2 in sign:
            if(isloop==False):
                break
            a1 = s1*a
            b1 = s2*b
            if((a1**5)==(x+b1**5)):
                print(a1,b1)
                isloop=False
                break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

X = int(input())

ans = None

while ans is None:
  for i in range(math.ceil(abs(X)**0.2)+1, 0, -1):
    for j in range(math.ceil(abs(X)**0.2)+1, 0, -1):
      if i ** 5 - j ** 5 == X:
        ans = (i, j)
      elif (i*-1) ** 5 - j ** 5 == X:
        ans = (-i, j)
      elif i ** 5 - (j*-1) ** 5 == X:
        ans = (i, -j)
      elif (i*-1) ** 5 - (j*-1) ** 5 == X:
        ans = (-i, -j)
print(ans[0],ans[1])

Submission status: Time Limit Exceeded

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

can = []
for a in range(10**4):
    if not a in can:
        can.append(a**5)

result = []
for a in can:
    for b in can:
        if a - b == x:
            ans = "{} {}".format(int(a**(1/5)),int(b**(1/5)))
            if not ans in result:
                result.append(ans)
        if a + b == x and a > b:
            ans = "{} {}".format(int(a**(1/5)),int(-1 * b**(1/5)))
            if not ans in result:
                result.append(ans)

for r in result:
    print(r)

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
    check = (float(X)/float(x) - x**4)**0.25 
    if (float(X)/float(x) - x**4)<=0:
        check=-1
    flag=0
    while(True):
        if fn(a,x) == X/x - x**4:
            flag=1
            print(a, a-x)
            break
        if (a**3 > x**3*10) and check < a:
            break
        a+=1
    if flag==1:
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
d = 2
while(X%d!=0):
    d+=1
b = -(10**4)
a = b+d
while(X!=((a**5)-(b**5))):
    b+=1
    a=b+d
print(a,b)