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:
A = list()
B = list()
i=0
X = int(input())
while(True):
    tmp = i**5
    A.append(tmp)
    B.append(i)
    if i%2 ==1:
        A.append(tmp*-1)
        B.append(i)
    if tmp >= 10**20:
        break
    i +=1
result = [0,0]
for i in range(len(A)):
    for j in range(len(A)):
        if A[i] -A[j] ==X:
            result[0] = B[i]
            result[1] = B[j]
            break

print(*result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())

a = 0
b = 0
while a ** 5 < x:
    a += 1
a -= 1

b = -(x - a ** 5)

f = False
if b < 0:
    b = -b
    f = True
    
for i in range(5):
    b = math.sqrt(b)

while b - int(b) != 0.0:
    a += 1
    b = -(x - a ** 5)

    f = False
    if b < 0:
        b = -b
        f = True
        
    for i in range(5):
        b = math.sqrt(b)

if f == True:
    b = -int(b)
print(a , b)

Submission status: Time Limit Exceeded

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

import sys
import math

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return

def enumerate_factor(x):
    i = 1
    factors = []
    while i * i <= x:
        if x % i == 0:
            factors.append(i)
            if x // i != i:
                factors.append(x // i)
        i += 1
    return factors

def main():
    x = read(int)
    
    boundary = math.ceil(math.pow(x, 1/5))
    for factor in enumerate_factor(x):
        for b in range(-boundary - factor, boundary + factor + 1):
            a = b + factor
            if a**5 - b**5 == x:
                print(f"{a} {b}")
                return

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
X = int(input())
div = divisor(X)
div.sort()
for i in range(len(div)):
    if X < 0:
        a = 0
        b = -1
        while a**5 - (b**5) != X or abs(a**5 - (b**5)) < abs(X):
            a = a-1
            b += 1
    else:
        a = 1
        b = 0
        while a**5 - (b**5) != X or a**5 - (b**5) < X:
            a += 1
            b = b-1
print(a,b)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

p = 0
flag = 0

while flag==0:
  p += 1
  #print("P = " + str(p))
  if x%p==0:
    for a in range(0,x+1):
      b = a-p
      #print("  A = " + str(a) + ", B = " + str(b))
      if a**5-b**5==x:
        a0 = a
        b0 = b
        flag = 1
print(a0,b0)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
x = int(input())
a = 0
product = 0

while True:
    _product = a * a * a * a * a
    
    if _product > x:
        a -= 1
        break
    
    product = _product
    a += 1
   
bproduct = product - x
b = 0

while True:
    _bproduct = b * b * b * b * b
    
    if bproduct == _bproduct:
        print(str(a) + ' ' + str(b))
        break
    
    b -= 1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

c = []
for i in range(-(X+1), X+1):
    if i != 0 and X % i == 0:
        c.append([i, X//i])

for x1, x2 in c:
    for b in range(-1000, 1000):
        if b != 0:
            if (x1+b)**4 + ((x1+b)**3)*b + ((x1+b)**2)*(b**2) + (x1+b)*(b**3) + b**4 == x2:
                print(x1+b, b)
                break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for i in range(-2000, 0):
  for j in range(2000):
    B = i**5
    A = j**5
    if (A - B) == X:
      print('{} {}'.format(A,B))
      break
  if (A - B) == X:
    break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for a in range(-10**3, 10**3):
    for b in range(-10**3, 10**3):
        if a**5 - b**5 == x:
            k = [a, b]

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
n = 10 ** 9
for b in range(n):
    a = (x + b ** 5) ** 0.2
    if a == int(a.real):
        a = int(a.real)
        break
    b *= -1
    a = (x + b ** 5) ** 0.2
    if a == int(a.real):
        a = int(a.real)
        break
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
m = X
pf={}
if X == 1:
    pf[1] = 1
else:
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1

for p in pf.keys():
    i = 0
    while True:
        if pow(i,5) - pow(i-p,5) == X:
            print(i,i-p)
            exit()
        i+=1

Submission status: Time Limit Exceeded

Solution code:
# D - I hate Factorization
x = (int)(input())

flg = False
for i in range(-x, x):
    for j in range(-x, x):
        if i ** 5 - j ** 5 == x:
            flg = True
            break
    
    if flg:
        break

print(str(i) + " " + str(j))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

for i in range(-200000, 200000):
    if (i+3)**5 - (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print((i+3), (i+2))
        break
    elif (i+3)**5 + (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print((i+3), -(i+2))
        break
    elif -(i+3)**5 - (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print(-(i+3), (i+2))
        break
    elif -(i+3)**5 + (i+2)**5 == X:
        # print(i, (i+3)**5 , (i+2)**5)
        print(-(i+3), -(i+2))
        break

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
A=X**(1/5)
A=round(A)
a=A**5
if(a<X):
    B=-1
    while(a-B**5!=X):
        B-=2
else:
    B=0
    while(a-B**5!=X):
        B+=1
print(A,B)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
# 1 <= x <= 10^9
a, b = 0, 0

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

d = make_divisors(x)
d.sort()

for i in d:
    #print("div:",i)
    a, b = i, 0
    z = x//i
    while(b != -i):
        #print("sw:",a, b)
        if z == (a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 ):
            print(a, b)
            exit()
        else:
            a -= 1
            b -= 1

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for i in range(-1*x, x):
    if i**5 < x-1: continue

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

Submission status: Time Limit Exceeded

Solution code:
flg=False
x=int(input())
for a in range(-x-1,x+1):
  for b in range(-x-1,x+1):
    if a**5-b**5==x:
      print(a,b)
      flg=True
      break
  if flg:
    break

Submission status: Time Limit Exceeded

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


X = int(input())
A=B=0
while True:
    while True:
        #print(A,B)
        if(X==A**5+B**5):
            print(B,-A)
            break
        elif(X<A**5+B**5):
            break
        B+=1
    if(X==A**5+B**5):
        break
    A+=1
    B=A

Submission status: Time Limit Exceeded

Solution code:
import math


def GetMulti(a, b):
    return pow(a, 4)+pow(a, 3)*b+pow(a, 2)*pow(b, 2)+pow(b, 3)*a+pow(b, 4)


def IsPossible(p, q):
    a = -1
    b = -1
    # for i in range(-p*q,p*q):
    # l = max(p,q)
    l = p*q
    # l = int((p*q)**(1/5))
    for i in range(l+1):
        # print(p, q, i, GetMulti(i, p-i), GetMulti(i, -i))
        if GetMulti(i, i-p) == q:
            a = i
            b = i-p
            break
        elif GetMulti(i, i-q) == p:
            a = i
            b = i-q
            break
    
    return a,b

X = int(input())
ok = False
for i in range(1,int(math.sqrt(X))+1):
    if X%i==0:
        p = i
        q = X//i
        # print(p,q)
        result = IsPossible(p, q)
        # ok = False
        for r in result:
            if r is not -1:
                ok = True
        if ok:
            # print(result)
            break

if ok:
    print("%d %d" % (result[0], result[1]))

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

c = []
for i in range(-(X+1), X+1):
    if i != 0 and X % i == 0:
        c.append([i, X//i])

for x1, x2 in c:
    for b in range(-10000, 10000):
        if b != 0:
            if (x1+b)**4 + ((x1+b)**3)*b + ((x1+b)**2)*(b**2) + (x1+b)*(b**3) + b**4 == x2:
                print(x1+b, b)
                break

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
for b in range(-10**9, 10**9, 1):
    a = (b**5+x)**(1/5)
    if type(a) is float:
        if a==a//1:
            break
print(int(a),b)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
a=0
b=0
set5 = set([i**5 for i in range(100)])
set5 = set5 | set([-i**5 for i in range(100)])
while True:
    a += 1
    #calc = a**5 - b**5
    #if calc == x:
    #    print(str(a)+" "+str(b))
    #    break
    #else:
    #    if
    if (a**5-x) in set5:
        if a**5-x < 0:
            b = -int((x-a**5)**(1/5)+0.01)
        else:
            b = int((a**5-x)**(1/5)+0.01)
        print(str(a)+" "+str(b))
        break

Submission status: Time Limit Exceeded

Solution code:

x=int(input())
value=0
index=0
hashmap=dict()
while value<int(1e9)+1:
    value=pow(index,5)
    hashmap[value]=index
    index+=1
#print(hashmap)    

for i in range(1,x+1):
    b1=x+int(pow(i,5))
    b2=x+int(pow(-i,5))
#    print(i,b1,b2)
    if hashmap.get(b1)!=None:
        print(hashmap[b1],i)
        break
    if hashmap.get(b2)!=None:
        print(hashmap[b2],-i)
        break

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==0 or j-i==0:
      continue
    if not X%(i-j)==0 or not X%(j-i)==0:
      continue
    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:
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
X = int(input())
soin = factorization(X)
small = soin[0][0]

for i in range(10**9):
    if i**5-(i-small)**5==X:
        print(i,i-small)
        break

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,10**5,2):
        for j in range(-1,-10**5,-2):
            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:
# coding: utf-8

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

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

if X == 1:
    S.append(2)

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

Submission status: 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=100000
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:
from math import pow
from itertools import combinations
x = int(input())

def prime_factorize(n):
    a = [1]
    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

def func(a, b):
    return pow(a, 5) - pow(b,5)
    
cands = prime_factorize(x) + [1]
ok = False

for i in range(1, len(cands)):
    for c in combinations(cands, i):    
        y = 1
        for j in c:
            y *= j
        for a in range(1, y + 1):
            b = a - y
            if func(a,b) == x:
                print(a, b)
                ok = True
                break
        if ok:
            break
    if ok:
        break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
b = (-1)
for i in range(10**7):
    a = i
    if (a-b)*(a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4) == x:
        print(a,b)
        break

Submission status: Time Limit Exceeded

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

i = 0
while True:
    n = abs(i**5 - X)**(1/5)
    if n.is_integer():
        if (i**5 - X) < 0:
            n *= -1
        if i**5-n**5==X:
            print(i,int(n))
            break
    n = abs((-i)**5 - X)**(1/5)
    if n.is_integer():
        if (i**5 - X) < 0:
            n *= -1
        if i**5-n**5==X:
            print(i,int(n))
            break
    i += 1

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())


for i in range(1, x+1):
    if x % i == 0:
        for a in range(i//2,x,1):
            b = a - i
            if a**5 - b**5 == x:
                print(a, b)
                break
            elif a**5 - b**5 > x:
                break

Submission status: Time Limit Exceeded

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

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)
    a = b+d
    while(X!=((a**5)-(b**5))):
        b+=1
        a+=1
    print(a,b)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
ans = [None, None]

for A in range(1, X+1):
    if X % A == 0:
        B = X // A
        for b in range(1, B+1):
            substitute_a = b + A
            left_side = pow(substitute_a, 4)+pow(substitute_a, 3)*b + pow(substitute_a, 2)*pow(b, 2)+substitute_a*pow(b, 3)+pow(b, 4)
            # print("A,B", A, B, "left_side", left_side)
            if left_side == B:
                ans[0], ans[1] = substitute_a, b
                break
            elif left_side > B:
                b = b * (-1)
                substitute_a = b + A
                left_side = pow(substitute_a, 4)+pow(substitute_a, 3)*b + pow(substitute_a, 2)*pow(b, 2)+substitute_a*pow(b, 3)+pow(b, 4)
                if left_side == B:
                    ans[0], ans[1] = substitute_a, b
    if ans[0] != None:
        break

print(ans[0], ans[1])

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f <=n:
        if n%f ==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
if X!=1:
    M=prime_factorize(X)
    M=list(set(M))
else:
    M=[1]
for i in M:
    for k in range(X):
        A=k
        B=A-i
        if A**5-B**5==X:
            print(A,B)
            break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
b = (-1)
for i in range(10**8):
    a = i
    if (a-b)*(a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4) == x:
        print(a,b)
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

X = int(input())

for i in range(-int(X**0.2),int(1e7)):
    tmp = (X+i**5)**0.2
    if tmp%1 == 0:
        print(int(tmp),i)
        exit()

Submission status: Time Limit Exceeded

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


X = int(input())
A=B=0
while True:
    while True:
        #print(A,B)
        if(X==A**5+B**5):
            print(B,-A)
            break
        elif(X<A**5+B**5):
            break
        B+=1
    if(X==A**5+B**5):
        break
    A+=1
    B=0

Submission status: Time Limit Exceeded

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

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

        if an == X:
            print(a, b)
            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
X = int(input())
data = make_divisors(X)
for i in data:
  b=0
  while (b+i)**4 + b**4 <= X/i:
    if (b+i)**5 - b**5 == X:
      print(b+i,b)
      exit(0)
    else:
      b +=1
  b=-1
  while b+i > 0:
    if (b+i)**5 - b**5 == X:
      print(b+i,b)
      exit(0)
    else:
      b -=1

Submission status: Time Limit Exceeded

Solution code:
def main():
    X = int(input())
    a = 0
    b = 0
    if X != 1:
        for i in range(2, 10**9):
            if X % i == 0:
                a = i
                b = X // i
                break
    else:
        a = 1
        b = 1
    #print(a, b)
    for y in range(10**9):
        x = y + a
        if x**5 - y**5 == X:
            print(x, y)
            break
        x = y + b
        if x**5 - y**5 == X:
            print(x, y)
            break
        y *= -1
        x = y + a
        if x**5 - y**5 == X:
            print(x, y)
            break
        x = y + b
        if x**5 - y**5 == X:
            print(x, y)
            break
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x=int(input())

min=10**12

a=0

def gojosu(x):
    n=1
    while True:

        if n**5==x:
            return True
        elif n**5>x:
            return False
        n+=1

def mitatsu(x):
    n=1
    while True:

        if n**5>x:
            return n-1
        n+=1

def choka(x):
    n=1
    while True:

        if n**5>x:
            return n
        n+=1

if gojosu(x):
    print(x,0)
    exit()

mit=mitatsu(x)
cho=choka(x)

y=1
while True:

    if mit**5+y**5==x:
        print(mit,-y)
        break
    elif cho**5-y**5==x:

        print(cho,y)
        break
    y+=1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

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

print(str(int(A)) + " " + str(B))

Submission status: Time Limit Exceeded

Solution code:
import math

X = int(input())

ok = False
n = math.pow(X, 0.2)
if n.is_integer():
    print(int(n), 0)
    ok = True

i = 1
while not ok:
    b1 = i
    b2 = -i

    a1 = X + math.pow(b1, 5)
    a2 = X + math.pow(b2, 5)

    a1n = math.pow(a1, 0.2)
    a2n = math.pow(a2, 0.2)

    if a1n.is_integer():
        print(int(a1n), b1)
        break

    if a2n.is_integer():
        print(int(a2n), b2)
        break

Submission status: Time Limit Exceeded

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

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

cnt = 0
m_cnt = -1 
a = 0
B = 0
X = int(input())
while True:
    a = X+(cnt**5)
    if(is_integer_num(pow(a,1/5)) == True):
        B = cnt
        break
    cnt += 1
    a = X+(m_cnt**5)
    if(is_integer_num(pow(a,1/5)) == True):
        B = m_cnt
        break 
    m_cnt += -1

print(str(int(pow(a,1/5))) + " " + str(B))

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 d in divisors:
  b = -d
  f = False
  while True:
    if (b+d)**5 - b**5 == x:
      f = True
      break
    elif (b+d)**5 - b**5 > x and b > 0:
      break
    b += 1
  if f:
    print(b+d, b)
    break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
lim = int(x**(1/5))+1
for i in range(-100000*lim, 100000*lim):
    if x + i**5 < 0:
        continue
    if (x+i**5)**(1/5) == int((x+i**5)**(1/5)):
        print(int((x+i**5)**(1/5)), i)
        exit()

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

for i in make_divisors(x):
    for a in range(i + 1):
        b = a - i
        if a ** 5 - b ** 5 == x:
            print(str(a) + ' ' + str(b))
            break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

x=int(input())

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

ret=enum_div(x)

y=100000
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 = 1
b = -10000
while 1:
    if (a**5 -b ** 5-x) == 0:
        break
    else:
        b += 1
print(a , b)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

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

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 = 1
    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:
import sys

n = int(input())

def calc(a, b):
  return a**5 - b**5
  
for i in range(-10000, 10001):
  for j in range(-10000, 10001):
    if calc(i, j) == n:
      print(i, j)
      sys.exit()

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

def main():
    X = int(input())
    ROOT = 1/5
    for a in range(10000000):
        a5 = a ** 5
        b = a5 - X
        b_root = abs(b)**ROOT
        if not is_integer_num(b_root):
            continue
        if b < 0:
            if a5 + b_root ** 5 == X:
                print(a, -int(b_root))
                exit()
        else:
            if a5 - b_root ** 5 == X:
                print(a, int(b_root))
                exit()

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
res = {}
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        ans = i ** 5 - j ** 5
        res[ans] = (i, j)
n = int(input())
print(res[n][0], res[n][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())
di = make_divisors(X)
for i in range(len(di)):
    k = di[i]
    for b in range(-di[-1], di[-1] + 1):
        val = 5 * k * b ** 4 + 10 * k ** 2 * b ** 3 + 10 * k ** 3 * b ** 2 + 5 * k ** 4 * b + k ** 5 - X
        if val == 0:
            a = k + b
            print(a, b)
            exit()

Submission status: Time Limit Exceeded

Solution code:
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

def check(a,b,X):
  if a**5-b**5 == X:
    return 1
  else:
    return 0
  
def check2(a,b,X):
  if (a <= b+X) and (a > b):
    return 1
  else:
    return 0

X = inp()
tmp = 0
B = 0
reverse = -1
while 1:
  A = B+X
  if check(A,B,X):
    print(str(A)+ " "+str(B))
    break
  else:
    while check2(A,B,X):
      A = A - 1
      if check(A,B,X):
        print(str(A)+ " "+str(B))
        tmp = 1
        break
        
  if tmp:
    break
  if reverse == -1:
    B = B + 1
    reverse = 0
  elif reverse == 1:
    B = B + 1
    reverse = 0
  else:
    B = (-1)*B
    reverse = 0

Submission status: Time Limit Exceeded

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

# Input
x = int(input())

# Calc
eflg = False
for a in range(30000):
    wk_a = a ** 5
    for b in range(30000):
        if wk_a - (b ** 5) == x:
            ans1 = a
            ans2 = b
            eflg = True
            break

        if wk_a - (-b ** 5) == x:
            ans1 = a
            ans2 = -b
            eflg = True
            break

    if eflg == True:
        break

# Output
print(ans1, ans2)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
factor=1
for i in range(2,int(pow(x,0.5))+1):
    if x%i==0:
        factor=i
        break
e=0
for b in range(-x,x+1):
    for a in range(b,x+1,factor):
        if a**5-b**5==x:
            print(a,b)
            e=1
            break
    if e==1:
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
A = -5
B = -5
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())

l = []
for i in range(10 ** 9):
    if i ** 5 <= 10 ** 20:
        l.append(i)
        l.append(-i)
    else:
        break

for i in range(len(l) - 1):
    for j in range(i, len(l)):
        if l[i] ** 5 - l[j] ** 5 == x:
            print(l[i], l[j])
            exit()

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
for j in range(2,int(X**0.5)+1):
    if X%j==0:
        for a in range(X):
            b=a-j
            S=j*(a**4+b**4+(a**3)*b+(a**2)*(b**2)+a*(b**3))
            if S==X:
                print(a,b)
                exit(0)
if X==1:
    print(0,-1)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

def gen_divisor(x):
    for i in range(1, x + 1):
        if x % i == 0:
            yield i

def gen_candidates(limit, divisor):
    for a in range(limit):
        yield (a, a - divisor)


for divisor in gen_divisor(x):
    for a, b in gen_candidates(x + 1, divisor):
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Time Limit Exceeded

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

for b in range(1145141919810):
    #bが正の場合
    try:
        a = (x + b ** 5) ** (1 / 5)
    except:
        pass;
    else:
        try:
            if a.is_integer():
                break;
        except:
            pass;
  
    #bが負の場合
    try:
        b = - b
        a = (x + b ** 5) ** (1 / 5)
    except:
        pass
    else:
        try:
            if a.is_integer():
                break;
        except:
            pass;

print(int(a),b)