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:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

dd=defaultdict(int)
#take care of 0
for i in range(0, 121):
    for j in range(i+1):
        temp = i**5 - j**5
        dd[temp] = (i, j)
        temp1 = i**5 + j**5
        dd[temp1] = (i, -j)
# print(dd[2066178367])
x = INT()
if(dd[x]!=0):
    print(dd[x][0], dd[x][1])

Submission status: Accepted

Solution code:
from decimal import Decimal

x = int(input())
now = 0
while True:
    tmp = now ** 5
    need = abs(tmp - x)
    sqrt = Decimal(str(need)) ** Decimal("0.2")
    if sqrt % 1 == 0:
        if tmp - x > 0:
            print(now, int(sqrt))
        else:
            print(now, int(sqrt) * -1)
        break
    now += 1

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())
lis = make_divisors(x)
flg = False

for i in range(0, len(lis)):

  for j in range(-1000,1000):
    if (j+lis[i])**5 -j**5 ==x:
      ans = str(j+lis[i])+' '+str(j)
      #flg = False
      break


if flg:
  for i in range(0, len(lis)):
    for j in range(-1000,1000):
      if (j+lis[i])**5 -j**5 ==x:
        ans = str(j+lis[i])+' '+str(j)
        break

  
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(read())

x = np.arange(-300, 300, dtype=np.int64)

x5 = x**5
diff = np.subtract.outer(x5, x5)

i = np.where(diff == X)

x, y = i[0][0], i[1][0]
x -= 300
y -= 300

assert x**5 - y**5 == X
print(x, y)

Submission status: Accepted

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

for i in range(-200, 200):
    A.append(i**5)
t=False

for i in range(len(A)):
    for j in range(len(A)):
        if A[i]-A[j]==X:
            print(i-200,j-200)
            t=True
            break
    if t:
        break

Submission status: Accepted

Solution code:
import sys

X = int(input())
i = 0

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

Submission status: Accepted

Solution code:
x = int(input())

A = [i for i in range(500)]
B = [i for i in range(-500, 500)]

for a in A:
	for b in B:
		if a - b != 0:
			if x % (a - b) == 0:
				if a ** 5 - b ** 5 == x:
					print(a, b)
					exit()

Submission status: Accepted

Solution code:
import math

X = int(input())

num_list = [i ** 5 for i in range(-120, 121)]

for i in range(len(num_list)-1):
    for j in range(i,len(num_list)):
        if num_list[j] - num_list[i] == X:
            A = -120 + j
            B = -120 + i
            print(A, B)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
from math import sqrt
import sys

# print('input >>')
X = int(input())

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

for x in range(1, int(sqrt(X))):
    if X % x == 0:
        flg = False
        for a in range(1000000):
            if (a-1) ** 5 - (a-1-x) ** 5 < a ** 5 - (a-x) ** 5:
                flg = True
            if flg and a ** 5 - (a-x) ** 5 > X:
                break
            if a ** 5 - (a-x) ** 5 == X:
                print(a, a-x)
                sys.exit()

# print('-----output-----')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

for A in range(1000):
    A5 = A**5
    for B in range(1000):
        B5 = B**5
        if A5 - B5 == X:
            print(A, B)
            exit()
        elif A5 + B5 == X:
            print(A, -B)
            exit()
        else:
            continue

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def calc(a, b):
    c = a - b
    d = a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
    
    return c * d

X = int(input())

for i in range(-10**3, 10**3 + 1):
    for j in range(-10**3, 10**3 + 1):
        if calc(i, j) == X:
            print(f"{i} {j}")
            sys.exit()

Submission status: Accepted

Solution code:
X=int(input())
num_list=[i-120 for i in range(240)]
temp=0
for A in num_list:
  for B in num_list:
    if A**5-B**5==X:
      print(A,B)
      temp=1
      break
  if temp==1:
    break

Submission status: Accepted

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

  for i in range(1,int(math.sqrt(X))+1):
    if X % i == 0:
      A = -int(X**(1/5))
      B = A - i
      while A**5-B**5>X:
        A = A+1
        B = A-i
      while A**5-B**5<=X:
        if A**5-B**5==X:
          print(A,B)
          return
        A = A + 1
        B= A - i
        
solve()

Submission status: Accepted

Solution code:
X = int(input())
k = list(range(0,100000))
k5 = []
for i in k:
    k5.append(i**5)
for j in k5:
    if X + j in k5:
        print(k[k5.index(X+j)],k[k5.index(j)])
        exit()
    elif X - j in k5:
        print(k[k5.index(X-j)],-k[k5.index(j)])
        exit()

Submission status: Accepted

Solution code:
X = int(input())
hantei = 0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5 == X:
            print(i,j)
            hantei = 1
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())

running = True
for a in range(-1000, 1001):
    if not running:
        break
    for b in range(-1000, 1001):
        if a**5 - b**5 == X:
            print(a, b)
            running = False
            break

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
sysread = sys.stdin.readline

import math
def run():
    X = int(input())
    s = int(X ** (1/5))
    for A in range(s+1):
        B = -((-A**5 + X)**(1/5))
        if abs(round(B) - B) < 1e-6:
            print(A, int(B))
            return None
    for A in range(s+1, X+1):
        B = (A ** 5 - X) ** (1 / 5)
        if abs(round(B) - B) < 1e-8:
            print(A, int(B))
            return None


if __name__ == "__main__":
    run()

Submission status: Accepted

Solution code:
x = int(input())
if int(x**0.2)==int(x)**0.2:
  print(int(x**0.2),0)
  exit()
for i in range(1,10**5):
  b = i
  c = -i
  x1 = x + b**5
  x2 = x + c**5
  if x1>=0 and int(x1**0.2)**5==x1:
    print(int(x1**0.2),b)
    exit()
  if x2>=0 and int(x2**0.2)**5==x2:
    print(int(x2**0.2),c)
    exit()
  if x2<0:
    for j in range(1,10**3):
      v = -j
      if v**5==x2:
        print(v,c)
        exit()

Submission status: Accepted

Solution code:
X = int(input())
k = 0
for a in range(151):
    for b in range(-150,150):
        if X == a**5 - b**5:
            print("{} {}".format(a,b))
            k = 1
            break
    if k == 1:
        break

Submission status: Accepted

Solution code:
from itertools import combinations
X = int(input())
l = [(0,0)]
for i in range(1,121):
    a = pow(i,5)
    l.append((a,i))
    l.append((-a,-i))
for x in combinations(l,2):
    if abs(x[0][0]-x[1][0]) == X:
        if x[0][0]-x[1][0] > 0:
            ans = [x[0][1],x[1][1]]
        else:
            ans = [x[1][1],x[0][1]]
        break
print(*ans)

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    for i in range(-1000, 1000):
        m = x + i ** 5 
        if m >= 0:
            if (m ** 0.2 - int(m**0.2)) <= 10e-5:
                B = i
                break
    A = (x + B ** 5)**0.2
    print(int(A), B)
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())


c = 0
l = []
idx = []
bre = False
for i in range(-1800, 1800):
    idx.append(i)
    l.append(i**5)


for i in range(len(l)):
    if bre:
        break
    for j in range(len(l)):
        if l[i]-l[j] == x:
            a = i
            b = j
            bre = True
            break
    
    
    

print(idx[a], idx[b])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-10000, 10000):
	z = x - i**5
	if int((z**(1.0/5)).real)**5 == z:
		print(int((z**(1.0/5)).real), -1*i)
		break

Submission status: Accepted

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

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

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

    def divisor(n):
        # nの約数を列挙する
        i = 1
        ans = []
        while i*i <= n:
            if n%i == 0:
                ans.append(i)
                if i != n//i:
                    ans.append(n//i)
            i += 1
        return ans

    # 因数分解すると、
    # A-BはXの約数であることがわかる
    ds = divisor(X)

    for d in ds:
        a = 0
        cnt = X**(1/2)+1
        while cnt > 0:
            cnt -= 1
            b = a - d
            ff = f(a,b)
            if ff == X//d:
                print(a, b)
                return
            # elif ff > X//d and b > 0:
            #     break
            a += 1

        a = 0
        cnt = X**(1/2)+1
        while cnt > 0:
            cnt -= 1
            b = a - d
            ff = f(a,b)
            if ff == X//d:
                print(a, b)
                return
            # elif ff > X//d:
            #     break
            a -= 1


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

a = 0
b = 0

while True:
        
    for i in range(a+1):
        b = i
        s = -i
        
        if a**5 - b**5 == x:
            print(a,b)
            exit()
        
        if a**5 - s**5 == x:
            print(a,s)
            exit()
            
    a += 1

Submission status: Accepted

Solution code:
X=int(input())
A=[]
B=[]
import sys
for i in range(-500,500):
  for j in range(-500,500):
    if i**5-j**5==X:
      print(i,j)
      sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

#tmp = []
#for i in range(-100,101):
#    tmp.append(i)


a = 0
b = 0
for k in range(-500,501):
    for h in range(-500,501):
        if k**5 - h**5 == x:
            a = k
            b = h
            break

print(a, b)

Submission status: Accepted

Solution code:
X = int(input())
a = 0
while True:
    a5 = a**5
    d  = X-a5
    if d >= 0:
        c  = d**0.2
        b1 = int(c)
        b2 = b1+1
        if a5 + b1**5 == X:
            print(a,-b1)
            break
        if a5 + b2**5 == X:
            print(a,-b2)
            break
    else:
        c = ((-d)**0.2)
        b1 = int(c)
        b2 = b1+1
        if a5 - b1**5 == X:
            print(a,b1)
            break
        if a5 - b2**5 == X:
            print(a,b2)
            break
    a += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

p = 1
while p * p <= x:
    if x % p != 0:
        p += 1
        continue

    q = x // p
    a = 0
    while a < 1000:
        b = a - p
        f = a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4
        if f == q:
            print(a, b)
            exit(0)
        a += 1
    p += 1

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
L=make_divisors(X)
Y=False
ans=[]
for x in L:
    a=0
    while True:
        tmp=a**5-(a-x)**5
        if tmp==X:
            Y=True
            ans=[a,a-x]
            break
        if tmp>X and a>int(X**0.2)+1:
            break
        a+=1
        
    if Y:
        break
print(ans[0],ans[1])

Submission status: Accepted

Solution code:
def f(n):
    low, high = -1100, 1100
    while high - low > 1:
        mid = (high + low) // 2
        if mid**5 <= n:
            low = mid
        else:
            high = mid
    return low

x = int(input())
for a in range(1000):
    b = f(a**5 - x)
    if a**5 - b**5 == x:
        print(a, b)
        quit()

Submission status: Accepted

Solution code:
x=int(input())
for n in range(1,int(x**0.5)+1):
    if x%n==0:
        for a in range(int(x**0.5)+1):
            if 5*a**4-10*a**3*n+10*a**2*n**2-5*a*n**3+n**4==x//n:
                print(str(a)+" "+str(a-n))
                break
            a=-a
            if 5*a**4-10*a**3*n+10*a**2*n**2-5*a*n**3+n**4==x//n:
                print(str(a)+" "+str(a-n))
                break
        else:
            continue
        break

Submission status: Accepted

Solution code:
X = int(input())

divisor = []
for i in range(1, int(X ** 0.5) + 1):
    if X % i == 0:
        divisor.append(i)
        if i != X // i:
            divisor.append(X // i)

ok = False
for d in divisor:
    if ok:
        break

    for x in range(-1000, 1000):
        v = x ** 5 - (x - d) ** 5
        if v == X:
            print(x, x - d)
            ok = True
            break

Submission status: Accepted

Solution code:
x = int(input())
for a in range(120):
    for b in range(-120,120):
        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(0,10**3):
 for B in range(0,10**3):
  A1,A2,B1,B2 = A,-A,B,-B
  if(A1**5-B1**5 == X):
    ans = [A1,B1]
    break
  elif(A1**5-B2**5 == X):
    ans = [A1,B2]
    break
  elif(A2**5-B1**5 == X):
    ans = [A2,B1]
    break  
  elif(A2**5-B2**5 == X):
    ans = [A2,B2]
    break    
            
print(ans[0],ans[1])

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x=int(input())
dic={}
for i in range(1,120):
  dic[i**5]=i
for i in range(1,120):
  a=i**5
  if a>x:
    if a-x in dic.keys():
      print(str(i)+' '+str(dic[a-x]))
      break
  elif a<x:
    if x-a in dic.keys():
      print(str(i)+' -'+str(dic[x-a]))
      break
  else:
    if a in dic.keys():
      print(str(i)+' 0')
      break

Submission status: Accepted

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

Submission status: Accepted

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

def input_one_number():
    return int(input())
def out2(n,m):
	print(str(n)+ " " + str(m) )
	exit()


X = input_one_number()

for i in range(1000000):
	for j in range(i+1):
		if j**5 - (i-j)**5 == X:
			out2(j,(i-j))
		if -j**5 - (i-j)**5 == X:
			out2(-j,(i-j))
		if -j**5 + (i-j)**5 == X:
			out2(-j,-(i-j))
		if j**5 + (i-j)**5 == X:
			out2(j,-(i-j))

Submission status: Accepted

Solution code:
x = int(input())
c = int(x**(1/3))
if c == x**(1/3):
    print(0, -1*c)
else:
    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if a**5 - b**5 == x:
                print(a, b)
                exit()

Submission status: Accepted

Solution code:
X=int(input())

factors=[]
for i in range(1,int(X**0.5)+1):
    if X%i==0:
        factors.append(i)
        if i!= X//i:
            factors.append(X//i)

for C in factors:
    for A in range(1000):
        B=A-C
        if A**5-B**5==X:
            print(A,B)
            exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    X = Scanner.int()
    L = [(0, 0) for _ in range(1000)]
    for i in range(0, 1000):
        L[i] = (i, i ** 5)
    for l1 in L:
        for l2 in L:
            a, b = l1[1], l2[1]
            c, d = l1[0], l2[0]
            if a < b:
                continue
            if a - b == X:
                print(c, d)
                return
            elif a + b == X:
                print(c, -d)
                return


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

a = [-500 + i for i in range(1001)]
b = [-500 + i for i in range(1001)]

A = -1000
B = -1000
for i in range(1001):
    for j in range(1001):
        #print('a[i]:{}, b[j]:{}'.format(a[i], b[j]))
        #print(a[i] ** 5)
        #print(b[j] ** 5)
        #print(a[i] ** 5 - b[j] ** 5)
        if(a[i] ** 5 - b[j] ** 5 == X):
            A = a[i]
            B = b[j]
print('{} {}'.format(A, B))

Submission status: Accepted

Solution code:
import sys

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

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):

            if X == a**5 - b**5:
                break

        else:
            continue
        break

    print(a, b)
    return

if __name__ == '__main__':
    main()
    sys.exit(0)

Submission status: Accepted

Solution code:
x = int(input())
B = True
a = 0
while B == True:
    btarget = a ** 5 - x
    b = 0
    if btarget >= 0:
        while b ** 5 <= btarget:
            if b ** 5 == btarget:
                print(a, b)
                exit()
            b += 1
    else:
        while b ** 5 >= btarget:
            if b ** 5 == btarget:
                print(a, b)
                exit()
            b -= 1
    a += 1

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 check(a, b, x):
    if a ** 5 - b ** 5 == x:
        return True
    else:
        return False


def main():
    x = int(input())
    l = make_divisors(x)
    for a in range(1000):
        for b in range(-1000, 1000):
            if check(a, b, x):
                print(a, b)
                exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

x = int(input())

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

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

X = int(input())

def solve(X):
    for a in range(1000):
        for b in range(-1000, 1000):
            a ** 5 - b ** 5
            if a ** 5 - b ** 5 == abs(X):
                return a, b

a,b = solve(X)
if a ** 5 - b** 5 == X:
    print(a, b)
else:
    print(b, a)

Submission status: Accepted

Solution code:
import numpy as np
def check(x):
    x=abs(x)
    n=int(x**(float(0.2)))
    return n**5==x
def sol(x):
    for i in range(1,1001):
        if (check(i**5-x)):
            print (i,int(np.sign(i**5-x)*abs(i**5-x)**(float(0.2))))
            return

if __name__=='__main__':
    x=int(input())
    sol(x)

Submission status: Accepted

Solution code:
a=int(input())
for i in range(int(2*abs(a**(1/5)))+1):
    for j in range(int(2*abs(a**(1/5)))+1):
        if i**5+j**5==a:
            ans1=i
            ans2=j*-1
            break
        elif i**5-j**5==a:
            ans1=i
            ans2=j
            break
        elif j**5-i**5==a:
            ans1=i*-1
            ans2=j*-1
        elif (i**5-j**5)*-1==a:
            ans1=i*-1
            ans2=j
print(str(ans1)+' '+str(ans2))

Submission status: Accepted

Solution code:
X = int(input())
for b in range(-1*pow(10,3), pow(10,3)+1):
  for a in range(b+1, pow(10,3)+1):
    if pow(a, 5) - pow(b, 5) == X:
      print(a, b)
      exit()

Submission status: Accepted

Solution code:
x = int(input())

testa = 0
while True:
    testb = int((abs((testa**5)-x))**(0.2))
    if testa**5 - x < 0:
        testb *= -1
    if (testa**5-testb**5) == x:
        print(testa,testb)
        exit()
    testa += 1

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())
l=make_divisors(x)
ll=[(i,i-j) for i in range(200) for j in l]
for a,b in ll:
  if a**5-b**5==x:
    print(a,b)
    break

Submission status: Accepted

Solution code:
X = int(input())
for a in range(-200, 200):
    for b in range(-200, 200):
        if pow(a, 5) - pow(b, 5) == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
lis = []
for i in range(-200, 201):
    lis.append(i**5)
flag = 0
for a, i in enumerate(lis):
    for b, j in enumerate(lis):
        if (i + j == X) or (j - i == X):
            flag = 1
            break
    if flag == 1:
        break
    
print((a-200)*(-1), (b-200)*(-1))

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-1000,1001):
  for b in range(-1000,1001):
    if a**5 - b**5 == X :#or (-a)**5 - b**5 ==X or a**5 - (-b)**5 == X or (-a)**5 - (-b)**5 == X:
      print("{} {}".format(a,b))
      exit()

Submission status: Accepted

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

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

l = make_divisors(x)

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

Submission status: Accepted

Solution code:
x = int(input())

m = 220
for i in range(1, m):
    for j in range(-m, m):
        if i**5 - j**5 == x:
            print('{0} {1}'.format(i, j))
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(x):
  if x == 1:
    print(1, 0)
    return
  if x == 2:
    print(1, -1)
    return
  for d in range(1, x):
    #print('0:', d)
    if d**2 > x:
      break
    if x % d:
      continue
    for a in range((d+1)//2, x):
      #print('1:', a, a - d)
      t = a**5 + (d - a)**5
      if t == x:
        print(a, a-d)
        return
      if t > x:
        break
                

X = int(input())
solve(X)

Submission status: Accepted

Solution code:
# (x - y) (x^4 + x^3 y + x^2 y^2 + x y^3 + y^4)
import math


def check(x, y):
    # a - b == x
    # a = x
    # b = 0
    # (x ^ 4 + x ^ 3 y + x ^ 2 y ^ 2 + x y ^ 3 + y ^ 4) == y
    for i in range(x):
        a = x - i
        b = i
        if a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4 == y:
            print(a, b)
            exit()


X = int(input())

# for i in range(1, math.ceil(X ** 0.5)):
#     if X % i == 0:
#         # i * X//i
#         check(i, X // i)

for b in range(-2*math.ceil(X ** 0.2) - 3, math.ceil(X ** 0.2) + 3):
    sig = 1
    if b ** 5 + X < 0:
        sig = -1
    a = sig * int(abs(b ** 5 + X) ** 0.2)
    if a**5 - b**5 == X:
        print(int(a), b)
        exit()

raise

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-10**5, 10**5):
    if (x + i**5) < 0:
        continue
    #     flag = '-'
    # else:
    #     flag = '+'
    else:
        A_tmp = (x + i**5)**(1.0/5)
        # print("i", i)
        # print(x + i**5)
        # print(A_tmp)
        if int(A_tmp)**5 == (x + i**5):
            A = int(A_tmp)
            B = i
            # if flag == '-':
            #     A *= -1
            break
print(str(A) + ' ' + str(B))

Submission status: Accepted

Solution code:
import math

x = int(input())

a = 0
b = 0
while b**5 > -x:
    b -= 1

while a**5-b**5 != x:
    if a**5-b**5 < x:
        a += 1
    else:
        b += 1
        
print(a, b)

Submission status: Accepted

Solution code:
d = {}
for i in range(-1000,1000):
	temp = i**5
	if temp not in d:
		d[temp] = i

posd = {}
for i in range(0,1000):
	temp = i**5
	if temp not in posd:
		posd[temp] = i

x = int(input())
for i in posd:
	if i-x in d:
		print(posd[i],d[i-x])
		break

Submission status: Accepted

Solution code:
X = int(input())
n = 1
while(X > n**5):
    n += 1
#A>B
#A**5+B**5
for i in range(1,n+1):
    for j in range(0,i+1):
        test = i**5+j**5
        if(X == test):
            print(i,-j)
            exit()
#A**5-B**5
for i in range(n,200):
    for j in range(0,i+1):
        test = i**5-j**5
        if(X == test):
            print(i,j)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

num_list = tuple(x**5 for x in range(10**4+1))
for i, a in enumerate(num_list):
    for j, b in enumerate(num_list):
        if a-b == X:
            print(i, j)
            exit(0)
        elif a+b == X:
            print(i, -j)
            exit(0)

Submission status: Accepted

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

MAX = pow(10,4)

for b in range(-MAX,MAX):
  #print(b)
  temp = X+pow(b,5) #これがaの5乗
  if temp < 0:
    continue
  aa = pow(temp,1/5)
  a = round(aa,5)
  #print(a,b)
  if a.is_integer():
    print(int(a),int(b))
    sys.exit()