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())
for A in range(-10000, 10000):
    for B in range(-10000, 10000):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Submission status: Time Limit Exceeded

Solution code:
import math
def do():
    x=int(input())
    x1=math.sqrt(x)
    # print(math.sqrt(x1))
    for i in range(int(x1+1)):
        if i**5==x:
            return "{} 0".format(i)
        for j in range(int(x1+1)):
            if j ** 5 == x:
                return "0 {}".format(-j)
            elif (i**5)-(j**5)==x:
                return "{} {}" .format(i,j)
            elif (i**5)+(j**5)==x:
                return "{} {}" .format(i,-j)
            elif -(i**5)+(j**5)==x:
                return "{} {}" .format(-i,-j)
            elif -(i**5)-(j**5)==x:
                return "{} {}" .format(-i,j)
            # print((i ** 5) - (j ** 5))



print(do())

Submission status: Time Limit Exceeded

Solution code:
import math
def do():
    x=int(input())
    x1=math.sqrt(x)
    # print(math.sqrt(x1))
    for i in range(int(x1+1)):
        for j in range(int(x1+1)):
            if (i**5)-(j**5)==x:
                return "{} {}" .format(i,j)
            elif (i**5)+(j**5)==x:
                return "{} {}" .format(i,-j)
            elif -(i**5)+(j**5)==x:
                return "{} {}" .format(-i,-j)
            elif -(i**5)-(j**5)==x:
                return "{} {}" .format(-i,j)
            # print((i ** 5) - (j ** 5))



print(do())

Submission status: Time Limit Exceeded

Solution code:
i=j=x=int(input())
while(i:=i+1&95)**5-j**5-x:j=j%257-i
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
i=j=x=int(input())
while(i:=-~i%99)**5-j**5-x:j=j%200-i
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
i=j=x=int(input())
while(i:=-~i%99)**5-j**5-x:j=j%257-i
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
i=j=x=int(input())
while(i:=-~i%221)**5-j**5-x:j=j%98-i
print(i,j)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
i=0
while 1:
    i+=1
    #a=(i**5 + x)**(1/5)
    #if a%1==0:
    #print(i,i**5 + x,a,a%1)
    if (i**5 + x)**(1/5)%1==0:
    #print(i,int((i**5 + x)**(1/5)),(i**5 + x)%1)
        print(int((i**5 + x)**(1/5)),i)
        break
    elif x>=-(-i)**5 and ((-i)**5 + x)**(1/5)%1==0:
    #print(-i,int(((-i)**5 + x)**(1/5)),((-i)**5 + x)%1)
        print(int(((-i)**5 + x)**(1/5)),-i)
        break

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
i=0
while 1:
    i+=1
    #a=(i**5 + x)**(1/5)
    #if a%1==0:
    #print(i,i**5 + x,a,a%1)
    if (i**5 + x)**(1/5)%1==0:
    #print(i,int((i**5 + x)**(1/5)),(i**5 + x)%1)
        print(int((i**5 + x)**(1/5)),i)
        break
    elif x>=(i)**5 and ((-i)**5 + x)**(1/5)%1==0:
    #print(-i,int(((-i)**5 + x)**(1/5)),((-i)**5 + x)%1)
        print(int(((-i)**5 + x)**(1/5)),-i)
        break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

B = -1
while True:
    A = pow(X + pow(B, 5), 1 / 5)
    if A.is_integer():
        break
    B += 1
print(int(A), B)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

A = 0
while True:
  t = abs(int(A**5 - X))
  t_root = t**(1/5)
  if t_root.is_integer():
    B = int(t_root)
    if A**5 + B**5 == X or A**5 - B**5 == X:
      break
  A += 1
if A**5 + B**5 == X:
  print("{} {}".format(A, B*-1))
else:
  print("{} {}".format(A, B))

Submission status: Time Limit Exceeded

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

flag = 0
a_s = 0
if x == 1:
  print(1, 0)
else:
  l = make_divisors(x)
  for i in range(x+1):
    if 2*(i**5) >= x:
      a_s = i
      break
  for a in range(a_s, x+1):
    if flag == 1:
      break
    for b_a in l:
      if b_a <= a:
        b = a - b_a
        if a**5 - b**5 == x:
          print(a, b)
          flag += 1
          break
        elif a**5 + b**5 == x:
          print(a, -1*b)
          flag += 1
          break
      else:
        continue

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
def make_divisors(n):
    divisors = [0]
    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

flag = 0
a_s = 0
if x == 1:
  print(1, 0)
else:
  l = make_divisors(x)
  for i in range(x+1):
    if 2*(i**5) >= x:
      a_s = i
      break
  for a in range(a_s, x+1):
    if flag == 1:
      break
    for b_a in l:
      if b_a <= a:
        b = a - b_a
        if a**5 - b**5 == x:
          print(a, b)
          flag += 1
          break
        elif a**5 + b**5 == x:
          print(a, -1*b)
          flag += 1
          break
      else:
        continue

Submission status: Time Limit Exceeded

Solution code:
import math
import sys

X = int(input())

is_even = X%2==0

i = -1
while True:
    B = math.pow(i, 5)

    if X-B > 0:
        ans = math.pow(X-B, 0.2)
        if ans.is_integer():
            print(int(ans), -i)
            sys.exit()

    if X+B > 0:
        ans = math.pow(X+B, 0.2)
        if ans.is_integer():
            print(int(ans), i)
            sys.exit()

    i = i-1

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
flag = 0
a_s = 0
b_e = int((x+1)/2)
if x == 1:
  print(1, 0)
else:
  for i in range(x+1):
    if i**5 >= x:
      a_s = i
      break
  for b in range(b_e):
    if flag == 1:
      break
    for a in range(a_s-1, x+1):
      if a**5 - b**5 == x:
        print(a, b)
        flag += 1
        break
      elif a**5 + b**5 == x:
        print(a, -1*b)
        flag += 1
        break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
flag = 0
if x == 1:
  print(1, 0)
else:
  for i in range(x+1):
    a_0 = 0
    if i**5 >= x:
      a_0 = i
      break
  for a in range(a_0-1, x+1):
    if flag == 1:
      break
    for b in range(x+1):
      if a**5 - b**5 == x:
        print(a, b)
        flag += 1
        break
      elif a**5 + b**5 == x:
        print(a, -1*b)
        flag += 1
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

A = 0
while True:
    for B in range(A+1):
        if A ** 5 + B ** 5 == X:
            print(A, B)
            break
        if A ** 5 - B ** 5 == X:
            print(A, B)
            break
    A += 1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

A = 0
while True:
    for B in range(A):
        if A ** 5 + B ** 5 == X:
            print(A, B)
            break
        if A ** 5 - B ** 5 == X:
            print(A, B)
            break
    A += 1

Submission status: Time Limit Exceeded

Solution code:
X=int(input())
stp=0
for a in range(10**5):
    if stp==1:
        break
    else:
        for b in range(10**5):
            A=a**5
            B=b**5
            tmp1=A-B
            tmp2=-A+B
            tmp3=-A-B
            tmp4=A+B
            if tmp1==X:
                print(a,b)
                stp=1
                break
            elif tmp2==X:
                print(-a,-b)
                stp=1
                break
            elif tmp3==X:
                print(-a,b)
                stp=1
                break
            elif tmp4==X:
                print(a,-b)
                stp=1
                break

Submission status: Time Limit Exceeded

Solution code:
import sys

x = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())


def check(x):
    i = 1
    while True:
        for j in range(1, i + 1):
            if (i == j):
                continue
            elif (x % (i - j) == 0) and (x == ((i ** 5) - (j ** 5))):
                print(i, j)
                return
            elif (x % (i + j) == 0) and ( x == ((i ** 5) + (j ** 5))):
                print(i, -j)
                return
        i = i + 1

check(x)

Submission status: Time Limit Exceeded

Solution code:
i=j=c=x=int(input())
while i**5-j**5-x:i=c%128;j=c>>7;c-=1
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
c=0
while c-x:i=c%120;j=c%217-98;c=i**5-j**5
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
i=j=0
while i**5-j**5-x:i=i%120+1;j=(j+99)%219-98
print(i,j)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
for a in range(10**9):
    B = a**5 - X
    b = B**-5
    if b % 1 == 0:
        print(str(int(a))+" "+str(int(b)))
        break

Submission status: Time Limit Exceeded

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
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 list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()
    i = 0
    while True:
        t = x - i**5
        if t >= 0:
            u = int(t**0.2)
            for j in range(u-1, u+2):
                if j**5 - i**5 == x:
                    return JA([j,i], " ")

        t = x + i**5
        u = int(t**0.2)
        for j in range(u-1, u+2):
            if j**5 + i**5 == x:
                return JA([j,-i], " ")
        i += 1

    return -1


print(main())

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

def main():
    x = int(input())
    a = -119
    while True:
        for b in range(-120,120):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                break
        a += 1


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import numpy as np


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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
for i in range(-10000, 10000):
    for j in range(-10000, 10000):
        if i**5 - j**5 == x:
            print(str(i) + " " + str(j))
            exit()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
for i in range(-1000000, 1000000):
    for j in range(-1000000, 1000000):
        if i**5 - j**5 == x:
            print(str(i) + " " + str(j))
            exit()

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)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(150):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

x = inp()
for i in range(-2000,2000):
    for j in range(-2000,2000):
        if pow(i,5) - pow(j,5) == x:
            print(i,j)
            quit()

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

def divs(a, x):
    for i in range(1,x+1):
        if x%i == 0:
            a.append(i)
    return a

dvs = []
divs(dvs,X)

A = -X
m = 0
while 1:
    for i in range(len(dvs)):
         B = A - dvs[i]
         if A**5 - B**5 == X:
            s = f'{A} {B}'
            print(s)
            m = 1
            break
    if m == 1:
        break
    A+=1

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
a, b = 0, -24
while a**5 - b**5 != X:
    a += 1
    b = -24
    while a**5 - b**5 != X:
        b += 1
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
for i in range(-x*999,x):i,j=i%x,i//x;i**5-x-j**5or exit(print(i,j))

Submission status: Time Limit Exceeded

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

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

X = int(input())

for i in range(-10000,10001):
    for j in range(-10000,10001):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            sys.exit()

Submission status: Time Limit Exceeded

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

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

X = int(input())

for i in range(-2000,2001):
    for j in range(-2000,2001):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            sys.exit()

Submission status: Time Limit Exceeded

Solution code:
x=int(input());r=range(-99,x);[i**5-x-j**5or exit(print(i,j))for i in r for j in r]

Submission status: Time Limit Exceeded

Solution code:
## D
X = int(input())
Y = [y**5 for y in range(100000)]
for a in range(0, 100000):
    for b in range(1+a, 100000):
        if Y[a] - Y[b] == X:
            print(a, b)
            exit
        if Y[a] + Y[b] == X:
            print(a, -b)
            exit

Submission status: Time Limit Exceeded

Solution code:
X=int(input())

for i in range(int(pow(X,0.5)+1),0,-1):
  if X%i==0:
    s=int(pow(X/i/4,1/4))
    l,u=s-X//i,s+X//i+1
    for j in range(l,u):
      if X==(j+i)**5-j**5:
        print(j+i,j)
        exit()

Submission status: Time Limit Exceeded

Solution code:
X=int(input())

for i in range(1,int(pow(X,0.5)+1)):
  if X%i==0:
    s=int(pow(X/i/4,1/4))
    l,u=s-X//i,s+X//i+1
    for j in range(l,u):
      if X==(j+i)**5-j**5:
        print(j+i,j)
        exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
rep = 10**4
for i in range(rep):
    for j in range(rep):
        if (i-(rep//2))**5-(j-(rep//2))**5 == x:
            print(i-(rep//2),j-(rep//2))
            exit()

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())
a = math.ceil(x ** 0.2)
while True:
    aa = a ** 5
    bb = aa - x
    bbb = bb ** 0.2
    if bb < 0:
        b = -1
    else:
        b = 1
    b *= int(bbb.real + bbb.imag)
    if aa - b ** 5 == x:
        print(a,b)
        break
    a -= 1

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())
a = math.ceil(math.log(x,5))
while True:
    aa = a ** 5
    bb = aa - x
    bbb = bb ** 0.2
    if bb < 0:
        b = -1
    else:
        b = 1
    b *= int(bbb.real + bbb.imag)
    # print(a,b)
    if aa - b ** 5 == x:
        print(a,b)
        break
    a -= 1

Submission status: Time Limit Exceeded

Solution code:
import math

x = int(input())
a = 0
while True:
    aa = a ** 5
    bb = aa - x
    bbb = bb ** 0.2
    if bb < 0:
        b = -1
    else:
        b = 1
    b *= int(bbb.real + bbb.imag)
    # print(a,b)
    if aa - b ** 5 == x:
        print(a,b)
        break
    a += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x=int(input())
flag=0
for i in range(10**4):
    
    
    for j in range(-1,-1*10**4,-1):
        
        
        # print(i,j)
        # print(0**5-(-1)**5)
        if i**5-j**5==x:
            
            print(i,j,end=" ")
            flag=1
            break
        
    if flag==1:
        break

Submission status: Time Limit Exceeded

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

    # divisors.sort()
    return divisors

def main():
    X = int(input())
    divs = make_divisors(X)
    for d in divs:
        if (X-pow(d,5))%10!=0:
            continue
        for i in range(-d,X):
            Y=pow(i+d,5)-pow(i,5)
            if Y==X:
                print(i+d,i)
                sys.exit()
            elif Y>X and i>0:
                break

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

a = 0
while(True):
    a5 = a ** 5
    b = x - a5
    b = int(x ** (1 / 5))
    b5 = b**5
    if a5 - b5 == x:
        break
#     if a5 - (b5*-1) == x:
#         b *= -1
#         break
    b = x + a5
    b = int(x ** (1 / 5))
    b5 = b**5
    if a5 - b5 == x:
        a *= -1
        break
#     if a5 - (b5*-1) == x:
#         a *= -1
#         b *= -1
#         break
    a += 1
print(a, b)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
l=6300
for a in range(-l,l+1):
  for b in range(-l,l+1):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
l=6500
for a in range(-l,l+1):
  for b in range(-l,l+1):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
for a in range(-7000,7001):
  for b in range(-7000,7001):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
for a in range(-8000,8001):
  for b in range(-8000,8001):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
for a in range(-9000,9001):
  for b in range(-9000,9001):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
for a in range(-9500,9501):
  for b in range(-9500,9501):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

Submission status: Time Limit Exceeded

Solution code:
x = int(input())
done=False
for a in range(-10000,10001):
  for b in range(-10000,10001):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

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

a=prime_factorize(x)

a.append(1)
a=list(set(a))
le=len(a)
for i in range(le):
    if a[i]>100:
        a[i]=0
a=list(set(a))

len=len(a)
t=-10000
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

    for i in range(len):
        if ((t+a[i])**5-t**5)-x==0:
            ansx=t+a[i]
            ansy=t
            break
        else:
            t+=1
print(ansx,ansy)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
X = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import random

X = int(input())
x = 0
y = 0
while(1):
  x = random.randint(-100000, 1000000)
  y = random.randint(-100000, 1000000)
  if x^5 - y^5 == X:
      break  
print(x, end=" ")
print(y)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())


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


p = factorization(x)
# print(p)
Bas = 0
Aas = 0
for i in range(1):
    _p = p[i][0]
    # print(_p)
    B = 0
    flg = 0
    while True:

        xnew = (B + _p)**5 - B ** 5
        # print(xnew)
        if xnew == x:
            Bas = B
            Aas = B + _p
            break
        if xnew > x:
            if flg == -1:
                B *= 10
            else:
                B -= 1
            flg = -1
        else:
            if flg == 1:
                B *= 10
            else:
                B += 1
            flg = 1

print(f'{Aas} {Bas}')

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

x = int(input())

for i in range(1, x+1):
    if x % i != 0:
        continue
    else:
        for a in range(x):
            b = a - i
            if a**5 - b**5 == x:
                ans_a = a
                ans_b = b
                break
        if a**5 - b**5 == x:
            break

print(ans_a, ans_b)

Submission status: Time Limit Exceeded

Solution code:
x = int(input())


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


p = factorization(x)
# print(p)
Bas = 0
Aas = 0
for i in range(1):
    _p = p[i][0]
    # print(_p)
    B = 0
    while True:

        xnew = (B + _p)**5 - B ** 5
        # print(xnew)
        if xnew == x:
            Bas = B
            Aas = B + _p
            break
        if xnew > x:
            B -= 1
        else:
            B += 1

print(f'{Aas} {Bas}')

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

x = int(input())
s_candidates = []


for i in range(1, x+1):
    if x % i == 0:
        s_candidates.append(i)

for s in s_candidates:
    for a in range(x):
        b = a - s
        t = x / s
        tmp = a**4 + (a**3) * b + (a**2) * (b**2) + a * (b**3) + b**4
        if t == tmp:
            ans_a = a
            ans_b = b
            break
    if t == tmp:
        break

print(ans_a, ans_b)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
i = 1
a = 0
b = 0
while a==0 and b==0:
    for j in range(-i,i):
        if j**5 - i**5 ==X:
            a = j
            b = i
    i = i + 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())
a=make_divisors(X)
check=0
for i in range(len(a)):
    if check==1:
        break
    Y = a[i]
    Z = a[len(a)-1-i]
    for j in range(1,a[len(a)-1]+1):
        A = j
        B = A-Y
        C = A-Z
        if (A-B)*( A**4 + (A**3)*B + (A**2)*(B**2) + (A)*(B**3) + B**4 )==X:
            print(A,B)
            check=1
            break
        if (A-C)*( A**4 + (A**3)*C + (A**2)*(C**2) + (A)*(C**3) + C**4 )==X:
            print(A,C)
            check=1
            break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

for a in range(0, 5000):
  for b in range(-5000, 0):
    if (a ** 5 - b ** 5) == 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)

    divisors.sort()
    return divisors

X=int(input())
a=make_divisors(X)
check=0
for i in range(len(a)):
    if check==1:
        break
    Y = a[i]
    for j in range(1,Y+1):
        A = j
        B = A-Y
        if (A-B)*( A**4 + (A**3)*B + (A**2)*(B**2) + (A)*(B**3) + B**4 )==X:
            print(A,B)
            check=1
            break

Submission status: Time Limit Exceeded

Solution code:
X = int(input())
flag = False
for a in range(-10000,10000):
    for b in range(-10000,10000):
        if a**5 - b**5 == X:
            print("{0} {1}".format(a,b))
            flag = True
            break
    if flag:
        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())
a=make_divisors(X)
check=0
for i in range(len(a)):
    if check==1:
        break
    Y = a[i]
    for j in range(1,2*Y+1):
        A = j
        B = A-Y
        if (A-B)*( A**4 + (A**3)*B + (A**2)*(B**2) + (A)*(B**3) + B**4 )==X:
            print(A,B)
            check=1
            break

Submission status: Time Limit Exceeded

Solution code:
x = int(input())

poypoyo = 'po'
for i in range(1000):
    for j in range(100000):
        if i**5 - j**5 == x:
            print(i,j)
            quit()
            break
        if i**5 - (-j)**5 ==x:
            print(i,-j)
            quit()
            break
        po = 'po'
        poypoyo += po

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

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

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


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

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

a=prime_factorize(x)

a.append(1)
a=list(set(a))
le=len(a)
for i in range(le):
    if a[i]>40:
        a[i]=0
a=list(set(a))

len=len(a)
t=-10000
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

    for i in range(len):
        if ((t+a[i])**5-t**5)-x==0:
            ansx=t+a[i]
            ansy=t
            break
        else:
            t+=1
print(ansx,ansy)

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

a=prime_factorize(x)

a.append(1)
a=list(set(a))
le=len(a)
for i in range(le):
    if a[i]>20:
        a[i]=0
a=list(set(a))

len=len(a)
t=-10000
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

    for i in range(len):
        if ((t+a[i])**5-t**5)-x==0:
            ansx=t+a[i]
            ansy=t
            break
        else:
            t+=1
print(ansx,ansy)

Submission status: Time Limit Exceeded

Solution code:
X = int(input())

A = 0
B = 0

    # if X == (A - B) * (pow(A,4) + pow(A,3)*B + pow(A,2)*pow(B,2) + a*pow(B,3) + pow(B,4)):
    #     print(str(A) +' '+str(B))

# while

# pow(A,5) - X == pow(B,5)

while B>=0:
    A = pow((pow(B, 5) + X), 1/5)
    if isinstance(A,float) and A.is_integer():
        break

    A = pow((pow(-1 * B, 5) + X) , 1/5)
    if isinstance(A,float) and A.is_integer():
        B = -1 * B
        break

    B += 1

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

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

a=prime_factorize(x)

a.append(1)
a=list(set(a))
le=len(a)
for i in range(le):
    if a[i]>11:
        a[i]=0
a=list(set(a))

len=len(a)
t=-10000
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

    for i in range(len):
        if ((t+a[i])**5-t**5)-x==0:
            ansx=t+a[i]
            ansy=t
            break
        else:
            t+=1
print(ansx,ansy)