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:
# coding: utf-8
import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)
###################################################
def f():
    return
def main():
    x=int(input())
    n=600
    for a in range(-n,n):
        for b in range(-n,n):
            if a**5-b**5==x:
                print(a,b)
                return
main()

Submission status: Accepted

Solution code:
x=int(input())

answer=0

for i in range(240):
    for j in range(240):
        p=i-120
        q=j-120
        if p**5-q**5==x:
            answer=(p, q)

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

Submission status: Accepted

Solution code:
def solve():
    X = int(input())
    for A in range(-1000,1000):
        for B in range(-1000,1000):
            if pow(A,5) - pow(B,5) == X:
                print(A,B)
                return

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
X = int(input())
cand = [(i**5, i) for i in range(-119, 120)]
for i5a, ia in cand:
    for i5b, ib in cand:
        if i5a - i5b == X:
            print(ia, ib)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
A = [0] * 201
flag = True
for i in range(200):
    A[i] = i ** 5
for i in range(200):
    if(flag == False):
        break
    for i2 in range(i):
        if abs(X - A[i]) == A[i2]:
            if X - A[i] >= 0:
                print(str(i) + " "+ str(-1 * i2))
            else:
                print(str(i) + " "+ str(i2))
            flag = False
            break

Submission status: Accepted

Solution code:
x=int(input())
p=0
q=0
flag=True
for a in range(1000):
    if flag:
        B=abs(a**5-x)
        for i in range(int(B**(0.2))+1):
            if i**5==B:
                q=i
                p=a
                flag=False
                break
for a,b in [(p,q),(-p,q),(p,-q),(-p,-q),(q,p),(-q,p),(q,-p),(-q,-p)]:
    if a**5-b**5==x:
        print(a,b)
        break

Submission status: Accepted

Solution code:
five_powers = []
x = 0
while x < 10 ** 3:
    five_powers.append(x)
    x += 1
x = int(input())
n = len(five_powers)
flag = False
for i in range(n):
    for j in range(n):
        a = five_powers[i]
        b = five_powers[j]
        if a ** 5 - b ** 5 == x:
            print('{} {}'.format(a, b))
            flag = True
            break
        if a ** 5 + b ** 5 == x:
            print('{} {}'.format(a, -1 * b))
            flag = True
            break
    if flag: break

Submission status: Accepted

Solution code:
"""
aを10^3くらいまででいいよね
"""
# print(19**5-10**5)
x = int(input())
# a>0 b>0のとき
for i in range(10**3):
    for j in range(i+1,10**3):
        if j ** 5 - i ** 5 == x:
            print(j,i)
            exit()
# a>0, b<0のとき
for i in range(10**3):
    for j in range(10**3):
        if i**5 + j**5 == x:
            print(i,-j)
            exit()

Submission status: Accepted

Solution code:
#!python3

# input
X = int(input())


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


def main():
    ans = solve()
    print(*ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# (X - Y) (X^4 + X^3 Y + X^2 Y^2 + X Y^3 + Y^4)
X = ir()

def make_divisors(n):  # 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

U = 5 * 10 ** 6
div = make_divisors(X)
for b in range(U):
    for d in div:        
        a = b + d
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()
        a = b - d
        if b ** 5 - a ** 5 == X:
            print(b, a)
            exit()

Submission status: Accepted

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(-500,501):
    for j in range(-500,501):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            sys.exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

i = -1000;j = -1000
def siki(a,b):
    return a**5 - b**5
while True:
    if siki(i,j) < x:
        i += 1
        continue
    elif siki(i,j) > x:
        j += 1
        continue
    else:break
print(i,j)

Submission status: Accepted

Solution code:
import sys
x = int(input())
result = [1,1]
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if x == pow(i, 5)-pow(j, 5):
            result = [i, j]
            print(*result)
            sys.exit()
print(*result)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    l = [pow(i, 5, 10**20) for i in range(1000)]
    for vi, i in enumerate(l):
        for vj, j in enumerate(l):
            if i + j == X:
                print(vi, -vj)
                return
            elif i - j == X:
                print(vi, vj)
                return
            elif j - i == X:
                print(-vi, -vj)
                return
main()

Submission status: Accepted

Solution code:
x=int(input())
for a in range(0,1000):
    for b in range(0,1000):
        a5=a**5
        b5=b**5
        if(a5-b5)==x:
            print(a,b)
            exit()
        if(a5+b5==x):
            print(a,-b) 
            exit()

Submission status: Accepted

Solution code:
n=int(input())
flag=False
for i in range(1000):
    for j in range(-1000,i):
        if i*i*i*i*i-j*j*j*j*j==n:
            print(i,j)
            flag=True
            break
    if flag:
        break
#4970069925031
#1985049910084967

Submission status: Accepted

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    X = int(input())
    for a in range(-100, 1001):
        for b in range(-1000, 1001):
            if a ** 5 - b ** 5 == X:
                print(a, b)
                exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x=int(input())
a=0
b=-64

while True:
  t=a**5-b**5
  if t==x:
    break
  if t>x:
    b+=1
  else:
    a+=1
print(a,b)

Submission status: Accepted

Solution code:
X = int(input())
fork = 1
Done = False
while not Done:
    for A in range(-fork, fork+1):
        for B in range(-fork, fork+1):
            if A**5 - B**5 == X:
                Done = True
                break
            
        if Done:
            break
    fork += 1
print(A, B)

Submission status: Accepted

Solution code:
X = int(input())

memo = []
A = -1
while True:
    A += 1
    A5 = A ** 5
    memo.append(A5)
    if A5 > X:
        try:
            i = memo.index(A5 - X)
        except ValueError:
            continue
        else:
            B = i
            break
    else:
        try:
            i = memo.index(X - A5)
        except ValueError:
            continue
        else:
            B = -i
            break

print(A, B)

Submission status: Accepted

Solution code:
x = int(input())
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:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

x=int(input())
lst=[]
for i in range(1000):
    lst.append(i**5)
# print(lst)
for i in range(len(lst)):
    for j in range(i,len(lst)):
        if lst[i]+lst[j]==x:
            print(j,-i)
            quit()
        if -lst[i]+lst[j]==x:
            print(j,i)
            quit()
        if lst[i]-lst[j]==x:
            print(-j,i)
            quit()

Submission status: Accepted

Solution code:
x = int(input())

i = 0
tmp = []
for i in range(10 ** 5):
    tmp.append([i ** 5, i])
    tmp.append([(-i) ** 5, -i])
    i += 1

tmp.sort()

tmpset = set([t[0] for t in tmp])

for i in range(len(tmp)):
    if x + tmp[i][0] in tmpset:
        break

b = tmp[i][1]
a5 = x + tmp[i][0]

for j in range(len(tmp)):
    if tmp[j][0] == a5:
        break

a = tmp[j][1]

print(a, b)

Submission status: Accepted

Solution code:
def main(d):
    t=0
    for i in range(-10**3,10**3):
        if t==0:
            for j in range(-10**3,10**3):
                if i**5-j**5==d:
                    print(i,j)
                    t+=1
                    break
d=int(input())
main(d)

Submission status: Accepted

Solution code:
X = int(input())
mem = dict()
i = 0
while True :
    a = pow(i, 5)
    if X == a*2 :
        print(-i, i)
        break
    if a in mem :
        print ( i, mem[a] )
        break

    mem[X-a] = -i
    mem[X+a] = i
    
    i += 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(" ".join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


dp = dd(int)
for i in range(501):
    dp[i] = pow(i, 5)
    dp[-i] = pow(-i, 5)
n = int(data())
for i in dp.keys():
    for j in dp.keys():
        if dp[i] - dp[j] == n:
            out(i, j)
            exit()

Submission status: Accepted

Solution code:
from itertools import combinations
x = int(input())
s = []
tov = dict()
for i in range(1000):
    s.append(i**5)
    tov[i**5] = i
    s.append(-i**5)
    tov[-i**5] = -i
for a, b in combinations(s, 2):
    if a - b == x:
        print(tov[a], tov[b])
        break
    elif b - a == x:
        print(tov[b], tov[a])
        break

Submission status: Accepted

Solution code:
x = int(input())

ansa = 0
ansb = 0
for a in range(500):
    for b in range(-500,500):
        if a**5 - b**5 == x:
            ansa=a
            ansb=b
            break

print(ansa,ansb)

Submission status: Accepted

Solution code:
x = int(input())

five_pows = []
for i in range(1000):
    five_pows.append(i**5)

flag = 0
for i in range(1000):
    if flag:
        break
    for j in range(i, 1000):
        if five_pows[j] - five_pows[i] == x:
            flag = 1
            print(j, i)
            break
        elif five_pows[j] + five_pows[i] == x:
            flag = 1
            print(j, -i)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

x = ni()
def sol():
    for i in range(-200, 200):
        for j in range(-200, 200):
            if (i ** 5) - (j ** 5) == x:
                print(i, j)
                return

sol()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

for i in range(-500,501):
    for j in range(-500,501):
        a=i
        b=j
        val=a**5-b**5
        if val==X:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
t =1
#t = int(input())
for _ in range(t):
    #a,b = map(int,input().split(' '))
    n = int(input())
    f=0
    #ls = list(map(int,input().split(' ')))
    for i in range(-1000,1001):
        for j in range(-1000,1001):
            if((i**5 - j**5) == n):
                print(i,j)
                f=1
                break
        if(f==1):
            break

Submission status: Accepted

Solution code:
import sys
x = int(input())
for i in range(-500, 500, 1):
    for j in range(-500, 500, 1):
        if (pow(i, 5)-pow(j,5) == x):
            print(i, j)
            sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
for i in range(1,400000):
  a=i
  b=int(abs((a**5-x)**0.2))
  for j in range(-1,2):
    if (b+j)**5==a**5-x:
      print(a,b)
      quit()
    if (-b+j)**5==a**5-x:
      print(a,-b)
      quit() 
    
  #else:pass

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def h(a,b):
    return a**5-b**5


x = n_in()

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if x==h(a,b):
            print(a,b)
            exit()

print(-1)

Submission status: Accepted

Solution code:
x=int(input())

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

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

Submission status: Accepted

Solution code:
X = int(input())


def iroot(x, n):
    lo, hi = 0, x
    while lo <= hi:
        mi = (lo + hi) // 2
        if pow(mi, n) > x:
            hi = mi - 1
        elif pow(mi, n) < x:
            lo = mi + 1
        else:
            return (mi, True)
    return (None, False)


for b in range(X + 1):
    A, f = iroot(X + pow(b, 5), 5)
    if f:
        print(A, b)
        break
    A, f = iroot(X - pow(b, 5), 5)
    if f:
        print(A, -b)
        break

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:
            print(A,B)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

def divisor(n):
    cd = []
    i = 1
    while i*i <= n:
        if n%i==0:
            cd.append(i)
            if i != n//i:
                cd.append(n//i)
        i += 1
    return cd

def solve(X):
    fac = divisor(X)
    for f in fac:
        for i in range(1,10**4):
            A = i
            B = i-f
            p = i**5-B**5
            if p==X:
                break
        else:
            continue
        break
    ans = [A,B]
    return ans
print(*solve(X),sep=' ')

Submission status: Accepted

Solution code:
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

x = int(input())
num = []
for i in range(1000):
    num.append(i)
    num.append(-i)
for i in range(len(num)):
    for j in range(len(num)):
        if num[i]**5 - num[j]**5 == x:
            print(num[i],num[j])
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for i in range(1000):
    for u in range(-1000,1000):
        if i**5-u**5==X:
            print(i,u)
            exit()
        else:
            pass

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

x=int(input())
for i in range(0,201):
	for j in range(-200,i):
		if i**5-j**5==x:
			print(i,j)
			exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    x = II()
    for i in range(-int(x ** 0.2)*2 - 1, int(x ** 0.2) + 1):
        for j in range(-int(x ** 0.2) * 2 - 1, int(x ** 0.2) * 2 + 1):
            if i ** 5 - j ** 5 == x:
                print(i , j)
                return
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
X = int(input())
fif = [i**5 for i in range(200)]
for i in range(len(fif)):
    B5 = fif[i] - X
    if abs(B5) in fif:
        index = fif.index(abs(B5))
        B = B5//abs(B5) * index
        break

print(i, B)

Submission status: Accepted

Solution code:
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x=INT()
    flg=0
    for i in range(1,201):
        if x%i==0:
            temp=int(x/i)
            #print(str(temp)+'aaa')
            for k in range(201):
                a=k
                b=a-i
                ans=a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4
                if temp==ans:
                    print(a,b)
                    flg=1
                    break
        if flg==1:
            break
                    
                
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
X = int(input())
L = [i ** 5 for i in range(0, 500)]
for i in L:
    for j in L:
        if i + j == X:
            print(int(i**0.2), -int(j**0.2))
            exit()
        if i - j == X:
            print(int(i**0.2), int(j**0.2))
            exit()
        if -i + j == X:
            print(-int(i**0.2), -int(j**0.2))
            exit()
        if -i - j == X:
            print(-int(i**0.2), int(j**0.2))
            exit()

Submission status: Accepted

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

for a in range(1500):
    for b in range(1500):
        A=a-1000
        B=b-1000
        if A**5 - B**5 ==X:
            ans1=A
            ans2=B


print(ans1,ans2)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

X = int(input())

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

def solve(X):
    # a > 0 and b > 0
    for a in range(10000):

        k = a**5 - X
        if k > 0:
            b = round(k**(1/5))
            if a**5 - b**5 == X:
                return a,b
        elif k < 0:
            b = (-k)**(1/5)
            b = round(b)
            if a**5 + b**5 == X:
                return a,-b
    return None

a,b = solve(X)
print(a,b)

Submission status: Accepted

Solution code:
X = int(input())
flg = False
for a in range(3*10**3):
    if flg:
        break
    for b in range(-3*10**3,a):
        if a**5-b**5==X:
            print(a,b)
            flg = True
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-5000,5001):
  for k in range(-5000,5001):
    tmp = i**5 - k**5
    if(tmp == X):
      print(i,k)
      exit()
    else:
      pass

Submission status: Accepted

Solution code:
x = int(input())
if x == 0:
    print("1 1")
    exit(0)

i = 1
while True:
    for a in range(-i, i + 1):
        b = i
        if a ** 5 - b ** 5 == x:
            print("{} {}".format(a, b))
            exit(0)
    
        b = -i
        if a ** 5 - b ** 5 == x:
            print("{} {}".format(a, b))
            exit(0)
    
    for b in range(-i, i + 1):
        a = i
        if a ** 5 - b ** 5 == x:
            print("{} {}".format(a, b))
            exit(0)
    
        a = -i
        if a ** 5 - b ** 5 == x:
            print("{} {}".format(a, b))
            exit(0)
    
    i += 1

Submission status: Accepted

Solution code:
x = int(input())
p5 = [i ** 5 for i in range(121)]

a = 0
b = 0

for _p5 in p5:
  if _p5 + x in p5:
    a = p5.index(_p5 + x)
    b = p5.index(_p5)
    break
  
  if x - _p5 in p5:
    a = p5.index(x - _p5)
    b = -(p5.index(_p5))
    break

print(str(a) + " " + str(b))

Submission status: Accepted

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

for a in range(-300,300):
    for b in range(-300,300):
        if a**5 - b**5 == x:
            print(a,b)
            sys.exit()

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

d = make_divisors(x)

for i in d:
    for a in range(100000):
        b = a - i
        if a ** 5 - b ** 5 == x:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

x = onem()

po = [0,1]

for i in range(1,10**3+1):
    po.append((i+1)**5)

a,b = 0,0
for i in range(10**3+2):
    for j in range(10**3+2):
        if po[i] - po[j] == x:
            a = i
            b = j
            break
        elif po[i] + po[j] == x:
            a = i
            b = -j
            break
    else:
        continue
    break

print(a,b)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

d5=[0]*(10001)
for i in range(10001):
    d5[i]=i**5


for i in range(10001):
    for j in range(10001):
        ans1=d5[i]-d5[j]
        if ans1==X:
            print(i,j)
            exit()
        ans2=d5[i]+d5[j]
        if ans2==X:
            print(i,(-1)*j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-2001, 2001):
    for b in range(-2001, 2001):
        if (a ** 5) - (b ** 5) == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
breakFlg = False
for a in range(-200,201):
    for b in range(-200,201):
        if a**5-b**5 == X:
            print(a,b)
            breakFlg=True
            break
    if breakFlg: break

Submission status: Accepted

Solution code:
x=int(input())
flag=False
i=-1000
while i<1000 and flag==False:
    j=-1000
    while j<1000 and flag==False:
        if i**5-j**5==x:
            flag=True
            print(i,j)
            break
        j+=1
    i+=1

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-200, 201):
    t = a ** 5
    for b in range(-200, 201):
        if t - (b ** 5) == x:
            print('{} {}'.format(a, b))
            exit()

Submission status: Accepted

Solution code:
X=int(input())
for a in range(201):
 for b in range(401):
  if a**5-(b-200)**5==X:
   x=str(a)
   y=str(b-200)
L=[x,y]
L=' '.join(L)
print(L)