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

Solution code:
import math
import numpy as np
x = int(input())
fac = []
fac2 = []

for i in range(1, int(math.sqrt(x))+1):
  if x % i == 0:
    fac.append(i)
    fac2.append(int(x/i))

fac = fac + list(reversed(fac2))
#print(fac)

flag = True
for i in range(len(fac)):
  factor = fac[i]
  a = 0
  while flag:
    b = a - factor
    tmp = a*a*a*a+b*b*b*b+a*b*(b*b+a*a+a*b)
    #print("{} {} {} {}".format(a, b, tmp,fac[-int(i+1)]))
    if int(tmp) == int(fac[-int(i+1)]):
      flag = False
      print("{} {}".format(a, b))
      break
    if b > 0 and tmp > fac[-(i+1)]:
      break
    a += 1
      
  if flag == False:
    break

Submission status: Accepted

Solution code:
X = int(input())
A, B = 0, 0
for a in range(-1000,1000):
    for b in range(-1000,a):
        if a**5 - b**5 == X:
            A, B = a, b
print(A, B)

Submission status: Accepted

Solution code:
x = int(input())
temp = int(x ** 0.25)
flag = True
for i in range(-temp, temp + 1):
    for j in range(-temp, temp + 1):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            flag = False
            break
    if flag == False:
        break

Submission status: Accepted

Solution code:
from sys import stdin
import math

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


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    X = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    X_fac = make_divisors(X)
    flag = False
    for fac in X_fac:
        A = math.ceil(fac/2)
        while True:
            B = A-fac
            if X == A**5-B**5:
                s = f'{A} {B}'
                flag == True
                break
            else:
                if A**5-B**5>X:
                    break
            A += 1
        if flag:
            break
    if flag==False:
        for fac in X_fac:
            A = math.ceil(fac/2)
            while True:
                B = A-fac
                if X == A**5-B**5:
                    s = f'{A} {B}'
                    flag == True
                    break
                else:
                    if A**5-B**5>X:
                        break
                A -= 1
            if flag:
                break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(s)

Submission status: Accepted

Solution code:
X = int(input())

y = int((X**0.2) //1 + 1)

def array(y):
    a = [0]
    for i in range(1,y+1):
        a.append(i**5)
        a.append(-i**5)
    a.sort()
    return a

y = y*2
a = array(y)

N = len(a)
for i in range(N-1):
    for j in range(i+1,N):
        if a[j] - a[i] == X:
            A,B = -y+j, -y+i

print(A,B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

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

def get(B):
    f = B/abs(B)
    i=1
    B=abs(B)
    while i**5<B:
        i+=1
    return int(i*f)



A_cand=[]
i=0
while i**5<=10**10:
    A_cand.append(i)
    i+=1

#print(A_cand)
for a in range(300):
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
        break
for a in A_cand:
    a*=-1
    B_5=a**5-X
    if ok(B_5):
        r=get(B_5)
        print(a,r)
        exit()
print(0/0)

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-1000,1001) :
    powa = pow(a,5)
    for b in range(-1000,1001) :
        powb = pow(b,5)
        # print(a,b,powa,powb)
        if (powa - powb == X) :
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for A in range(-122,123):
    for B in range(A,122):
        if A**5-B**5==X:
            print(A,B)
            exit()
        if A**5-B**5==-X:
            print(B,A)
            exit()

Submission status: Accepted

Solution code:
x = int(input())
for i in range(1000):
    for j in range(i):
        if i**5 - j**5 == x:
            print(i,j, sep=' ')
            break
        elif i**5 + j**5 == x:
            print(i,j*(-1), sep=' ')
            break

Submission status: Accepted

Solution code:
X=int(input())
tmp=False

for a in range(-10**5//2,10**5//2):
  b5=(int(a**5)-X)
  if b5<0:
    b5=-b5
    tmp=True
  b=int(b5**0.2)
  
  if tmp==True:
    b=-b
    
  if a**5-b**5==X:
    print(a,b)
    break

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    a = 0
    while True:
        b = a**5 - x
        if b < 0:
            b = abs(b-0)**(1/5)
            b = b * (-1)
        else:
            b = b**(1/5)
        b = int(b)

        if a**5 - b**5 == x:
            print(a,b)
            return 0
        else:
            a+=1
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    X = int(input())
    x = make_divisors(X)
    for i in range(1, int(X**0.5)+1):
        for j in x:
            B = i-j
            if i**5-B**5==X:
                print(i,B)
                break
        else:
            continue
        break
main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
import heapq
import itertools
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X = I()

a = [0,1]
for i in range(2,300):
  a.append(i**5)
#print(a)

for i,j in itertools.combinations(a, 2):
  #print(i,j)
  for k in [-1,1]:
    if j - i*k == X:
      print(int(j**0.2), int(i**0.2)*k)
      exit()
print(error)

Submission status: Accepted

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())

# n,m,q = map(int, input().split())
# abcd = [map(int, input().split())for _ in range(q)]

# a = list(map(int, input().split()))

_numbers = make_divisors(x)
numbers = []
for i in _numbers:
    numbers.append(i)
    numbers.append(-i)
make = []
for a in range(-178,179):
    for b in range(-178, 179):
        if a**4 + b*a**3 + (a**2)*(b**2) + a*(b**3) + b**4 in numbers:
            if a**5 - b**5 == x:
                print(a,b)
                exit()

Submission status: Accepted

Solution code:
x = int(input())

flag = False
for a in range(-200, 200):
    for b in range(-200, 200):
        if a ** 5 - b ** 5 == x:
            flag = True
            print(str(a) + " " + str(b))
            break
    if flag:
        break

Submission status: Accepted

Solution code:
X = int(input())

def search(x):
    for a in range(1000):
        for b in range(1000):
            a5 = a**5
            b5 = b**5
            if (a5 - b5 == X):
                print(a, b)
                return
            elif (a5 + b5 == X): 
                print(a, -b)
                return
            elif (-a5 - b5 == X):
                print(-a, b)
                return

search(X)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
from functools import reduce

def prime_factors(n):
    for i in itertools.chain([2], itertools.count(3, 2)):
        if n <= 1:
            break
        while n % i == 0:
            n //= i
            yield i

def factors(n):    
    return set(reduce(list.__add__, 
                ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def main():
    X = int(input())
    divisors = factors(X)
    A = 0
    while True:
        for d in divisors:
            B = A - d
            check1 = A**5 - B**5
            check2 = -check1
            if check1 == X:
                print('{} {}'.format(A, B))
                sys.exit(0)
            if check2 == X:
                print('{} {}'.format(B, A))
                sys.exit(0)
        A += 1
            


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
def main():
    x = int(input())
    tmp = [0] * 1000
    for i in range(1000):
        tmp[i] = i**5
    for i in range(1000):
        a = x+tmp[i]
        if abs(a) in tmp:

            print(int(a**0.2),i)
            return

        a = x - tmp[i]
        if abs(a) in tmp:

            print(int(a**0.2),-i)
            return

if __name__=='__main__':
    main()

Submission status: Accepted

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


def five(n):
    ans = 1
    for i in range(5):
        ans *= n

    return ans


break_flag = False
for i in range(100000000):
    b_five = five(i)
    x_plus_b = x + b_five
    x_minus_b = x - b_five
    for k in range(100000000):
        a_five = five(k)
        a_five_minus = -1 * a_five
        if a_five == x_plus_b:
            a = k
            b = i
            break_flag = True
            break
        elif a_five == x_minus_b:
            a = k
            b = -i
            break_flag = True
            break
        elif a_five_minus == x_plus_b:
            a = -k
            b = i
            break_flag = True
            break
        elif a_five_minus == x_minus_b:
            a = -k
            b = -i
            break_flag = True
            break
        elif a_five > x_plus_b and a_five_minus < x_minus_b:
            break
    if break_flag:
        break

print("{} {}".format(a, b))

Submission status: Accepted

Solution code:
x = int(input())
for a in range(121):
    for b in range(120):
        a2 = a**5
        b2 = b**5
        if a2-b2 == x:
            print(str(a) +' '+str(b))
            break
        elif a2+b2 == x:
            print(str(a) +' '+str(-b))
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys

n = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import itertools
x = int(input())
l = [0, 1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000, 161051, 248832, 371293, 537824, 759375, 1048576, 1419857, 1889568, 2476099, 3200000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176, 69343957, 79235168, 90224199, 102400000, 115856201, 130691232, 147008443, 164916224, 184528125, 205962976, 229345007, 254803968, 282475249, 312500000, 345025251, 380204032, 418195493, 459165024, 503284375, 550731776, 601692057, 656356768, 714924299, 777600000, 844596301, 916132832, 992436543, 1073741824, 1160290625, 1252332576, 1350125107, 1453933568, 1564031349, 1680700000, 1804229351, 1934917632, 2073071593, 2219006624, 2373046875, 2535525376, 2706784157, 2887174368, 3077056399, 3276800000, 3486784401, 3707398432, 3939040643, 4182119424, 4437053125, 4704270176, 4984209207, 5277319168, 5584059449, 5904900000, 6240321451, 6590815232, 6956883693, 7339040224, 7737809375, 8153726976, 8587340257, 9039207968, 9509900499, 10000000000, 10510100501, 11040808032, 11592740743, 12166529024, 12762815625, 13382255776, 14025517307, 14693280768, 15386239549, 16105100000, 16850581551, 17623416832, 18424351793, 19254145824, 20113571875, 21003416576, 21924480357, 22877577568, 23863536599, 24883200000, 25937424601, 27027081632, 28153056843, 29316250624, 30517578125, 31757969376, 33038369407, 34359738368, 35723051649, 37129300000, 38579489651, 40074642432, 41615795893, 43204003424, 44840334375, 46525874176, 48261724457, 50049003168, 51888844699, 53782400000, 55730836701, 57735339232, 59797108943, 61917364224, 64097340625, 66338290976, 68641485507]
for comb in itertools.combinations_with_replacement(l, 2):
    if comb[0] - comb[1] == x:
        print(l.index(comb[0]), l.index(comb[1]))
        exit()
    elif comb[0] + comb[1] == x:
        print(l.index(comb[0]), -(l.index(comb[1])))
        exit()
    elif - comb[0] + comb[1] == x:
        print(-(l.index(comb[0])), -(l.index(comb[1])))
        exit()
    elif - comb[0] - comb[1] == x:
        print(-(l.index(comb[0])), l.index(comb[1]))
        exit()

Submission status: Accepted

Solution code:
import sys
import itertools
arr = [i for i in range(-150,151)]
X = int(input())
t = len(arr)

for v in itertools.permutations(arr,2):
   if v[0]**5 - v[1]**5==X:
      print("{0} {1}".format(v[0],v[1]))
      sys.exit()

Submission status: Accepted

Solution code:
from itertools import combinations
def main():
    gojo_lst = [i**5 for i in range(-200,200)]
    gojo_dict = {}
    for i in range(-200,200):
        gojo_dict[i**5] = i
    kumiawase = combinations(gojo_lst,2)
    x = int(input())
    for a,b in kumiawase:
        #print(a,b)
        if a - b == x:
            print(gojo_dict[a],gojo_dict[b])
            break
        elif b - a == x:
            print(gojo_dict[b],gojo_dict[a])
            break



if __name__ == '__main__':
    main()

Submission status: Accepted

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(-200, 201):
        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: Accepted

Solution code:
x = int(input())
flag = False
for i in range(120):
    if flag:
        break
    k = i**5
    for j in range(120):
        l = j**5
        if k - l == x:
            print(i, j)
            flag = True
            break
        if k + l == x:
            print(j, -i)
            flag = True
            break

Submission status: Accepted

Solution code:
x = int(input())

l5 = [i**5 for i in range(0, 10000)]
for a5 in l5:
    for b5 in l5:
        if x == a5 - b5:
            print(int(a5**(1/5)), int(b5**(1/5)))
            exit()
        elif x == a5 + b5:
            print(int(a5**(1/5)), int((-1) * b5**(1/5)))
            exit()

Submission status: Accepted

Solution code:
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Submission status: Accepted

Solution code:
d = {}
for i in range(1, 1000):
    if i ** 5 - (i-1) ** 5 > 10 ** 9:
        break
    for j in range(i-1, -i-1, -1):
        if i ** 5 - j ** 5 > 10 ** 9:
            break
        d[i ** 5 - j ** 5] = (i, j)
print(*d[int(input())])

Submission status: Accepted

Solution code:
X = int(input())

a = [i**5 for i in range(200)]

for i in range(200):
    for j in range(i+1,200):
        if a[j] - a[i] == X:
            print(j,i)
            break
        if a[j] + a[i] == X:
            print(j,-i)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
x=int(input())
A=[i**5 for i in range(-1000,1000)]
B=[i**5 for i in range(-1000,1000)]

for a in A:
    for b in B:
        if a-b==x:
            if a<0:
                a=abs(a)
                a=a**0.2
                ans_a=int(-a)
            else:
                a=abs(a)
                a=a**0.2
                ans_a=int(a)
            if b<0:
                b=abs(b)
                b=b**0.2
                ans_b=int(-b)
            else:
                b=abs(b)
                b=b**0.2
                ans_b=int(b)                
print(ans_a,ans_b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import time
X = int(input())
flag = 0
T_0 = time.time()

A = 0
B = 0
for a in range(2000):
    for b in range(2000):
        if (a-1000)**5 - (b-1000)**5 == X:
            flag = 1
            A = a-1000
            B = b-1000
            break
        else:
            pass
    if flag == 1:
        break
T_1 = time.time()

print(A,B)

Submission status: Accepted

Solution code:

X = int(input())
flag = -1
i1 = 0
j1 = 0
for i in range(1000):
    for j in range(-1000, 1000):
        if i ** 5 - j ** 5 == X:
            flag = 0
            i1 = i
            j1 = j
            break
    if flag == 0:
        break
print(i1, j1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
done = False
for a in range(-120, 121):
  if done:
    break
  for b in range(-120, 121):
    if a**5 - b**5 == x:
      ans_a = a
      ans_b = b
      done = True
      break

print(ans_a, ans_b)

Submission status: Accepted

Solution code:
import sys,math,copy,queue,itertools,bisect,collections
from heapq import *
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(-1,0),(0,1),(0,-1))

X = NI()

y = math.ceil(math.pow(X/5,1/4))
for i in range(-y,y+1):
    for j in range(-y,y+1):
        if i**5 - j**5 == X:
            print(i,j)
            exit(0)

Submission status: Accepted

Solution code:
x = int(input())

for a in range(1,1001):
    sub = a ** 5
    ss = sub - x
    for b in range(-1000, 1000):
        if b ** 5 == ss:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x=int(input())
d={}
for i in range(200):
    b=i**5
    c=(-i)**5
    d[b]=i
    d[c]=-i
for i in range(200):
    y=x+i**5
    try:
        print(d[y],i)
        break
    except:
        None
    z=x+(-i)**5
    try:
        print(d[z],-i)
        break
    except:
        None

Submission status: Accepted

Solution code:
x = int(input())

def check(n):
    m = int(n**0.2)
    if abs(m**5 - n) < 1e-6:
        return True
    else:
        return False

for i in range(10**7):
    y = abs(x-i**5)
    if check(y):
        if x-i**5>0:
            print(i, int(y**0.2)*(-1))
        else:
            print(i, int(y**0.2))
        exit()

Submission status: Accepted

Solution code:
def find(x):
    b = 0
    while True:
        right = pow(b,5)+x
        left = pow(right,1/5)
        if pow(int(left), 5)==right:
            return left, b
        right = pow(-b,5)+x
        if right>=0:
            left = pow(right,1/5)
            if pow(int(left), 5)==right:
                return left, -b
        b+=1
x = int(input())
a,b = find(x)
print(int(a),b)

Submission status: Accepted

Solution code:

#https://www.geeksforgeeks.org/fifth-root-of-a-number/
def floorRoot5(n):
	if n == 0 or n == 1:
		return n
	low, high, ans = 1, n, 0
	while low <= high:
		mid = (low + high) // 2
		mid5 = mid * mid * mid * mid * mid

		if mid5 == n:
			return mid
		if mid5 < n:

			low = mid + 1
			ans = mid
		else:
			high = mid - 1

	return ans


val = int(input())
start = -floorRoot5(val) - 1

while True:
	b = start
	a = floorRoot5(val + b ** 5)
	for aa in range(a - 1, a + 2):
		for bb in range(b - 1, b + 2):
			if aa ** 5 - bb ** 5 == val:
				print(aa, bb)
				exit(0)
			if bb ** 5 - aa ** 5 == val:
				print(bb, aa)
				exit(0)
	start += 1

Submission status: Accepted

Solution code:
import numpy as np
X=int(input())
flag=1
for c in range(np.power(10,9)):
    c+=1
    x=X
    if x%c==0:
        x=x//c
        for a in range(np.power(10,3)):
            if (np.power(a,4) + np.power(a,3)*(a-c) + np.power(a,2)*np.power(a-c,2) + a*np.power(a-c,3) + np.power(a-c,4))==x:
                print(a,a-c)
                flag=0
                break
    if flag==0:
        break

Submission status: Accepted

Solution code:
x = int(input())

l = []
for i in range(10 ** 9):
    if i ** 5 <= 10 ** 13:
        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: Accepted

Solution code:
import math
import collections
X=int(input())
# N,M=map(int,input().split())
# S=[[]for i in range(N)]
# # for i in range(Q):
# H=list(map(int,input().split()))
# #     S[i]=a
# # ans=0
# # print()
for A in range(-120,120):
    for B in range(-120, 120):
        if A**5-B**5==X:
            print(A,B)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
A = 0
flag = False
while True:
    B = A-1
    while pow(B,5)>=pow(A,5)-X:
        if pow(B,5)==pow(A,5)-X:
            flag=True
            break
        B -= 1
    if flag:
        break
    A+=1
print(A,B)

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-10**3, 10**3+1):


    #b5 = pow(a, 5) - X
    for b in range(-10**3, 10**3+1):
        if b**5 == pow(a, 5) - X:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())

l = range(-10**3,10**3)

for i in l:
  for j in l:
    if i**5 - j**5 == X:
      print(str(i) + " " + str(j))
      exit()

Submission status: Accepted

Solution code:
x = int(input())

for a in range(0,1000):
    for b in range(-1000, 1000):
        if a ** 5 - b ** 5 == x:
            print(a,b)
            break
    else:
        continue
    break

Submission status: Accepted

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

X = int(input())

for i in range(-1000, 1001):
    for j in range(-1000, 1001):
        if pow(i, 5) - pow(j, 5) == X:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
# N, M = map(int, input().split(' '))
X = int(input())

gojou = []
i = 0
saidai = 10**12

while 1:
    temp = i**5
    if temp > saidai:
        break
    gojou.insert(0, [i, temp])
    gojou.insert(0, [-i, -temp])
    i += 1

ls = len(gojou)
for i in range(ls):
    for j in range(i, ls):
        if gojou[i][1]-gojou[j][1] == X:
            print(gojou[i][0], gojou[j][0])
            exit()

Submission status: Accepted

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


def calc(X):
    i = 0
    while True:
        y = i ** 5
        if y == X:
            return "{0} {1}".format(i, 0)
        elif y < X:
            j = int((X - y) ** (1 / 5))
            intj = int(j)
            if abs(j - intj) < 1e-5 and y + intj ** 5 == X:
                return "{0} {1}".format(i, -intj)
        else:
            j = int((y - X) ** (1 / 5))
            intj = int(j)
            if abs(j - intj) < 1e-5 and y - intj ** 5 == X:
                return "{0} {1}".format(i, intj)
        i += 1
    

X = int(input())
print(calc(X))

Submission status: Accepted

Solution code:
res = {}
for i in range(-500, 500):
    for j in range(-500, 500):
        ans = i ** 5 - j ** 5
        res[ans] = (i, j)
n = int(input())
print(res[n][0], res[n][1])

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

# -- submit ----

import itertools

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---
x = float(inputs[0])

a_range = range(1, 10**3)
b_range = range(-10**3, 10**3)

for a in a_range:
    for b in b_range:
        if a ** 5 - b ** 5 == x:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a5=[i**5 for i in range(300)]
x=int(input())
flag=0
for i in range(300):
  for j in range(300):
    if flag==0 and a5[i]-a5[j]==x:
      print(str(i)+" "+str(j))
      flag=1
    if flag==0 and a5[i]+a5[j]==x:
      print(str(i)+" -"+str(j))
      flag=1

Submission status: Accepted

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

m=dict()
for a in range(-100000,100001):
    a5=int(math.pow(a,5))
    m[a5]=a

for b in range(-100000,100001):
    b5=int(math.pow(b,5))
    a5=b5+x
    if a5 in m:
        a=m[a5]
        print(a,b)
        break

Submission status: Accepted

Solution code:
import itertools


X = int(input())

u = -1000
A = []
while u < 1000:
    A.append(u)
    u += 1
AA = list((itertools.product(A, repeat=2)))
for a,b in AA:
    if a**5-b**5 == X:
        print(a,b)
        break

Submission status: Accepted

Solution code:
x = int(input())
flag = False

for i in range(1, 200):
    resid = i ** 5 - x
    for j in range(-200, 200):
        if j**5 == resid:
            print(i, j)
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
x = int(input())
import sys
if x == 1:
    print(1, 0)
    sys.exit()
for i in range(x):
    if i ** 5 == x:
        print(i, 0)
        sys.exit()
    for j in range(1, i):
        for j in range(1, i):
            if i ** 5 - (-j) ** 5 == x:
                print(i, -j)
                sys.exit()
            elif i ** 5 - j ** 5 == x:
                print(i, j)
                sys.exit()
            else:
                continue

Submission status: Accepted

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())
div=make_divisors(x)
def depth_limited(x,div):
    depth=-50
    while True:
        depth+=50
        for t in div:
            for b in range(depth,depth+50):
                if x==t*(5*b**4+10*b**3*t+10*b**2*t**2+5*b*t**3+t**4):
                    return (b+t,b)
                b=-b
                if x==t*(5*b**4+10*b**3*t+10*b**2*t**2+5*b*t**3+t**4):
                    return (b+t,b)
ans=depth_limited(x,div)
print(str(ans[0])+' '+str(ans[1]))

Submission status: Accepted

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

# process
a, b = 0, 0

nl = []
i = 0
np = 0
n = i**5
while n - np <= 10**9:
    nl.append(n)
    i += 1
    np = n
    n = i**5

for i in range(len(nl)):
    t = X-nl[i]
    if t in nl:
        a = i
        b = -(nl.index(t))
        break

    if -t in nl:
        a = i
        b = nl.index(-t)
        break

# output
print("{} {}".format(a, b))

Submission status: Accepted

Solution code:
X = int(input())

a = 2
b = 1

n = int((X ** (1 / 5)) // 1) * 100
# print(n)


for a in range(1, n + 10):
    minus = 1
    b5 = (a ** 5) - X
    if b5 < 0:
        minus = -1
        b5 *= - 1
    b = int(pow(b5, (1 / 5)))
    if (a ** 5 - b ** 5 * minus) == X:
        # print(X)
        print(a, b * minus)
        # print(a, b * minus)
        exit()

Submission status: Accepted

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

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


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


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

    import math
    test = math.ceil(math.sqrt(math.sqrt(x)))

    for i in range(-test, test + 1):
        for j in range(-test, test + 1):
            if i ** 5 - j ** 5 == x:
                return " ".join([str(i), str(j)])


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

Submission status: Accepted

Solution code:
import sys
x=int(input())
for a in range(-200,200):
  for b in range(-200,200):
    if a**5-b**5 ==x:
      print(a,b)
      sys.exit()

Submission status: Accepted

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(1000):
    b = a - divisor
    if (a**5 - b**5 == x):
      print(a, b)
      break

Submission status: Accepted

Solution code:
X = int(input())
MAX = 10**4
Flag = False
for i in range(MAX):
    A = i
    for j in range(A,MAX):
        B = j
        if A**5 - B**5 == X:
            print(A,B)
            Flag = True
            break
        elif A**5 + B**5 == X:
            print(A,-B)
            Flag = True
            break
        elif B**5 - A**5 == X:
            print(-A,-B)
            Flag = True
            break
    if Flag:
        break

Submission status: Accepted

Solution code:
import math

X=int(input())

root = math.floor(X**0.2)
half = root//2 - 5

while root > half:
    root2 = int((X-root**5)**0.2)
    if root**5 + root2**5 == X:
        print(int(root),-int(root2))
        exit()
    root -= 1

root = math.ceil(X**0.2)

while True:
    root2 = int((root**5-X)**0.2)
    if root**5 - root2**5 == X:
        print(int(root),int(root2))
        exit()
    root+=1