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: Wrong Answer

Solution code:
import sys
x = int(input())
box = [a**5 for a in range(0,101)]
for i in range(100):
    for j in range(100):
        if box[i] - box[j] == x:
            print(i,j)
            sys.exit()
for k in range(100):
    for l in range(100):
        if (-1)*box[k] + box[l] == x:
            print(-(k),-(l))
            sys.exit()
for s in range(100):
    for t in range(100):
        if box[s] + box[t] == x:
            print(s,-(t))
            sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
X = int(input())
A = []
for i in factorization(X):
  for j in range(0,i[1]+1):
    a = i[0]**j
    b = X//a
    if(a<b):
      A.append([a,b])
    else:
      A.append([b,a])
 
A = list(map(list, set(map(tuple, A))))
flag = 0
for i in A:
  r = list(range(-10000,10000+1))
  for a in r:
    b = a - i[0]
    if a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4 == i[1]:
      print(a,b)
      flag = 1
      break
  if flag==1:
    break

Submission status: Wrong Answer

Solution code:
# A**5 = X + B**5
X = int(input())

l = []
for i in range(-100, 100):
    l.append(i**5)

for b, b_5 in enumerate(l, start=-100):
    # print(b, b_5, X)
    if X+b_5 in l:
        a_5 = X+b_5
        a = l.index(a_5)-100
        print(a, b)
        break

Submission status: Wrong Answer

Solution code:
# A**5 = X - B**5
X = int(input())

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

for li in l:
    if (X-li) in l:
        print(li, l.index(X-li))

Submission status: Wrong Answer

Solution code:
X=int(input())

for a in range(-125,125):
    for b in range(-125,125):
        i = a**5-b**5
        if i == X:
            print(a,b)
            break

Submission status: Wrong Answer

Solution code:
x = int(input())
#5x^4 <= 10^9
#x = 150くらい？
for i in range(-150,150):
    for j in range(-149,151):
        if i^5 - j^5 == x:
            print(i,j)
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
l = [i**5 for i in range(100)]
for idx, a in enumerate(l):
    b = a - x
    if b in l:
        print(idx, l.index(b))
        exit()
    elif -b in l:
        print(idx, -l.index(abs(b)))
        exit()

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np


def main():
    x = int(input())
    A = np.arange(-100, 100)
    a = A ** 5
    for i, a_1 in enumerate(a):
        for j, a_2 in enumerate(a):
            if a_1 - a_2 == x:
                print(A[i], A[j])
                return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r


def solve():
    n=inp()
    for i in range(1,int(n**0.2)+1):
        x=i**5
        n-=x
        print(n,x)
        break
    
 
for _ in range(1):
    solve()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=False
for i in range(200):
  for j in range(200):
    if i**5-j**5==n:
      print(i,j)
      a=True
    elif i**5+j**5==n:
      print(i,-j)
      a=True
    if a:
      break

Submission status: Wrong Answer

Solution code:
X = int(input())

X_5 = int(pow(X, 1/5))+1

for i in range(X_5, -X_5-1, -1):
    for j in range(-X_5, X_5+1):
        if pow(i, 5) - pow(j, 5) == X:
            print(i, j)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
y = 10*4

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

Submission status: Wrong Answer

Solution code:
x = int(input())
y = 10*4

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

Submission status: Wrong Answer

Solution code:
#import time

def main():
    X = int(input())
    #print(isprime(int((9**5-5**5)/4)))
    lis = [[ [] for _ in range(240)] for _ in range(240)]
    ansA, ansB = 0, 0
    #print(type(ansA), ansB)
    for i in range (240):
        for j in range(240):
            lis[i][j].append(i-120)
            lis[i][j].append(j-120)
    
    for i in range(240):
        for j in range(240):
            A, B = lis[i][j]
            #print(lis[i][j])

            if A**5 - B**5 == X:
                ansA, ansB = A, B

    return ansA, ansB


if __name__ == '__main__':
    #start = time.time()
    print(main())
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(pow(x, 1/5))*2
A = [i**5 for i in range(y+1)]
B = [i**5 for i in range(y+1)]

for i in range(len(A)):
  for j in range(len(B)):
    if ( A[i] + B[j] ) == x:
      exit(print(i, j))
    elif ( A[i] - B[j] ) == x:
      exit(print(i, -j))

Submission status: Wrong Answer

Solution code:

x = int(input())
y = int(pow(x, 1/5))
A = [i**5 for i in range(y+1)]
B = [i**5 for i in range(y+1)]

for i in range(len(A)):
  for j in range(len(B)):
    if ( A[i] + B[j] ) == x:
      exit(print(i, j))
    elif ( A[i] - B[j] ) == x:
      exit(print(i, -j))

Submission status: Wrong Answer

Solution code:
x = int(input())
y = int(pow(x, 1/5))
A = [i**5 for i in range(y+1)]
B = [i**5 for i in range(y+1)]

for i in range(len(A)):
  for j in range(len(B)):
    print(i,j,A[i],B[j],A[i] + B[j],A[i] - B[j])
    if ( A[i] + B[j] ) == x:
      print(i, j)
    elif ( A[i] - B[j] ) == x:
      print(i, -j)

Submission status: Wrong Answer

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

import math
x = int(input())

#aもbも0以上のとき
border = 1;
while border ** 5 - (border - 1) ** 5 < x:
    border += 1

for i in range(border + 1):
    aa = ((x + i ** 5) ** (1.0 / 5.0)) #仮
    if aa % 1 == 0:
        a = int(aa)
        b = i
        print(a, b)
        break
else:
    b = -1

    while x + b ** 5 >= 0:

        aa = ((x + b ** 5) ** (1.0 / 5.0))  # 仮
        a = round(aa)
        if a ** 5 - b ** 5 == x:
            print(a, b)
            break
        b -= 1

Submission status: Wrong Answer

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

import math
x = int(input())

#aもbも0以上のとき
border = 1;
while border ** 5 - (border - 1) ** 5 < x:
    border += 1

for i in range(border + 1):
    aa = ((x + i ** 5) ** (1.0 / 5.0)) #仮
    if aa % 1 == 0:
        a = int(aa)
        b = i
        print(a, b)
        break
else:
    b = -1
    while x + b ** 5 >= 0:
        aa = ((x + b ** 5) ** (1.0 / 5.0))  # 仮
        if aa % 1 == 0:
            a = int(aa)
            print(a, b)
            break
        b -= 1

Submission status: Wrong Answer

Solution code:
import sys

x = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
n=100
for i in range(-101,101):
    for j in range(-101,101):
        if pow(i,5) - pow(j,5) == x:
            print(str(i)+" "+str(j))
            exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
ans=0

for b in range(1000):
  for a in range(int(X**(1/5))+1):
    if a**5-b**5 == X:
      ans = str(a)+" "+str(b)
      break
    if a**5+b**5 == X:
      ans = str(a)+" "+str(-b)
      break
print(ans)

Submission status: Wrong Answer

Solution code:
X=int(input())

for b in range(1000000000000000000):
  a = (abs(X+b**5))**(1/5)
  if int(a) == a:
    print(str(int(a)) + " " + str(b))
    break
  a = (abs(X-b**5))**(1/5)
  if int(a) == a:
    print(str(int(a)) + " " + str(-b))
    break

Submission status: Wrong Answer

Solution code:
X=int(input())

for b in range(1000000000):
  a = (abs(X+b**5))**(1/5)
  if int(a) == a:
    print(str(int(a)) + " " + str(b))
    break
  a = (abs(X-b**5))**(1/5)
  if int(a) == a:
    print(str(int(a)) + " " + str(-b))
    break

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
def getInts():
    return [ int(x) for x in input().split() ]

def f(B):
    base = (X + B**5 )
    if base < 0:
        return 0.0
    return (X + B**5 ) ** (1/float(5))

[X] = getInts()

BP = 0
BN = 0
while not f(BP).is_integer() and not f(BN).is_integer():
    BP += 1
    BN -= 1

if f(BP).is_integer():
    print(int(f(BP)), BP)
else:
    print(int(f(BN)), BN)

Submission status: Wrong Answer

Solution code:
x = int(input())
d = {}
for i in range(1000):
  b = (-1000+i)**5
  d[b] = -1000+i
for i in range(1000):
  a = i**5
  if a-x in d:
    b = d[a-x]
    a = i
    break
print(a,b)

Submission status: Wrong Answer

Solution code:
x = int(input())
d = {}
for i in range(1000):
  b = (-1000+i)**5
  d[b] = -1000+i
for i in range(1000):
  a = i**5
for i in range(1000):
  a = i**5
  if a-x in d:
    b = d[a-x]
    a = i
    break
print(a,b)

Submission status: Wrong Answer

Solution code:
def main():
    x = int(input())
    a, b = 1, 0

    while True:
        for b in reversed(range(-a + 1, a)):
            print(a, b)
            q = a**5 - b**5
            if q == x:
                print(f'{a} {b}')
                return
        a += 1

main()

Submission status: Wrong Answer

Solution code:
X = int(input())
from math import pow
for a in range(-100,100,1):
    for b in range(-100,100,1):
        if pow(a,5)-pow(b,5)==X:
            print(a,b);exit()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
for i in range(1, 121):
    b = x - i**5
    b = b**.2
    if math.ceil(b) - math.floor(b) < 1e6:
        print(i, int(b))
        exit(0)

Submission status: Wrong Answer

Solution code:
X = int(input())
for A in range(100, 0, -1):
    for B in range(-100, A):
        if A**5 - B**5 == X:
            break
print(A, B)

Submission status: Wrong Answer

Solution code:
X=int(input())

i = 1
while 1:
  try:
    q = (i**5 - X)**(1/5)
    if int(q) == q:
      break
  except:
    pass
  i += 1

print(i, int(q))

Submission status: Wrong Answer

Solution code:
x = int(input())
aa, bb = 0, 0
for i in range(-200, 200):
  for j in range(-200, 200):
    if(j**5 - i**5 == x):
      aa, bb = i, j
    if(aa != 0 or bb != 0):
      break
  if(aa != 0 or bb != 0):
    break
print(str(aa) + " " + str(bb))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = int(input())
pre = [i ** 5 for i in range(1001)] # Fuck it
for i in range(1, 1001):
    for j in range(i + 1, 1001):
        if pre[i] - pre[j] == x: print(i, j); exit()
        elif pre[i] + pre[j] == x: print(i, -j); exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
comb = []
for i in range(1,64+1):
    for j in range(-64,64+1):
        if i**5 - j**5 == X:
            print(i,j)
            exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** .5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    divisors.sort()
    return divisors

ddd = make_divisors(X)
for d in ddd:
    sss = np.roots([5, 10 * d, 10 * d**2, 5 * d**3, d**4 - X//d])
    for s in sss:
        if s.imag == 0:
            a = d + int(s)
            b = int(s)
            if a ** 5 - b ** 5 == X:
                print(a, b)
                exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
X = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** .5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    # divisors.sort()
    return divisors

ddd = make_divisors(X)
for d in ddd:
    sss = np.roots([5, 10 * d, 10 * d**2, 5 * d**3, d**4 - X//d])
    for s in sss:
        if s.imag == 0:
            a = d + int(s)
            b = int(s)
            if a ** 5 - b ** 5 == X:
                print(a, b)
                exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(10):
    b = round(abs(a ** 5 - x) ** (1 / 5))
    if x in [a ** 5 + b ** 5, a ** 5 - b ** 5]:
        if a ** 5 < x: b *= -1
        print(a, b)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

ans=[]
for i in range(-100,101):
    for j in range(-100,101):
        sum = i**5 - j**5
        if sum == X:
            ans.append(i)
            ans.append(j)
            print(*ans)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
L = []
for i in range(1000):
    a = int(i**5)
    L.append(a)
    for j in range(len(L)):
        if X == a-L[j]:
            print(j, i)
            sys.exit()
        elif X == a+L[j]:
            ans = i*-1
            print(j, ans)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
X = int(input())
L = []
for i in range(1000):
    a = int(i**5)
    L.append(a)
    for j in range(len(L)):
        if X == L[j]-a:
            print(j, i)
            sys.exit()
        elif X == L[j]+a:
            ans = i*-1
            print(j, ans)
            sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
i=1
while(True):
   check=pow(i,5)
   diff=abs(x-check)
   
   val=pow(diff,0.2)
   if(int(val)==val):
       print(i,-int(val))
       break
   i+=1
#print(diff)

Submission status: Wrong Answer

Solution code:
import collections
x = int(input())
dd = collections.defaultdict(int)
a = [0]*100
for i in range(100):
    tmp = i**5
    a[i] = tmp
for i in range(100):
    for j in range(100):
        if(abs(a[i]-x) == abs(a[j])):
            if(a[i]-a[j]==x):
                print(i,j)
            elif(a[i]-x <= 0):
                print(i,-j)
            exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
a=[]
for i in range(-100,200):
  for j in range(-100,200):
    if i^5-j^5==X:
      a.append(str(i))
      a.append(str(j))
      break
  break    
print(' '.join(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

found = False
for a in range(-100, 100):
    if found: break;
    for b in range(-100, 100):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            found = True
            break

Submission status: Wrong Answer

Solution code:
# +の場合
i = 0
ans = 0
while ans <= 1000000000:
   i += 1
   ans = i**5 - (i-1)**5
# i: 120

# -の場合
i = 0
ans = 0
while ans <= 1000000000:
   i -= 1
   ans = i**5 - (i-1)**5 
# i: -119

n = int(input())
l = [_**5 for _ in range(1, 120)]

for i in range(1,119):
    for j in range(119):
        if l[i] - l[j] == n:
            print(int(l[i]**0.2), int(l[j]**0.2))
            break
        if l[i] + l[j] == n:
            print(int(l[i]**0.2), int(-1*l[j]**0.2))
            break

Submission status: Wrong Answer

Solution code:
import sys
X=int(input())
l=[i**5 for i in range(1000)]
for i in range(1000):
    for j in range(-999,0):
        if l[i]+l[j*-1]==X:
            print(i,j)
            sys.exit()
    for j in range(i):
        if l[i]-l[j]==X:
            print(1,l[i],l[j])
            print(i,j)
            sys.exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# A^5-B^5=(B+d)^5-B^5

X=int(input())

div=[1,X]

for i in range(2,X):
    if X%i==0:
        div.append(i)
        div.append(X//i)
    if i*i>=X:
        break

for d in div:
    for j in range(-100,100):
        A=j+d
        B=j
        if A**5-B**5==X:
            print(str(A)+" "+str(B))
            exit(0)

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
import numpy as np

X=int(input())
ans=[0,0]

for i in range(-64,64):
  a=i
  for j in range(-64 , 64):
    b=j
    if (a**5 - b**5) ==X:
      ans[0]=a
      ans[1]=b

print("{} {}".format(ans[0],ans[1]))

Submission status: Wrong Answer

Solution code:
import numpy as np

X=int(input())
ans=[0,0]
n=round(X**0.2)
b=(-X+n**5)

if b>0:
  b=round(b**0.2)
else:
  b=round((-b)**0.2)*-1

ans[0]=n
ans[1]=b

print("{} {}".format(ans[0],ans[1]))

Submission status: Wrong Answer

Solution code:
import numpy as np

X=int(input())
ans=[0,0]
n=int(X**0.2)
for i in range(2*n+1):
  a=i-n
  b=int((X-a**5)**0.2)
  if (a**5-b**5) == X:
    ans[0]=a
    ans[1]=b
  if (b**5-a**5) == X:
    ans[0]=b
    ans[1]=a

print("{} {}".format(ans[0],ans[1]))

Submission status: Wrong Answer

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

a = np.arange(0, 101)
d = 2 * a**5

for i in range(1, len(a)):
    if d[i-1] < X <= d[i]:
        # print(f"{X} between {d[i-1]} and {d[i]}")
        break

for b in range(-i, i+1):
    # print(f"{a[i]}^5 - {b}^5 = {a[i]**5 - b**5}")
    if a[i]**5 - b**5 == X:
        print(f"{a[i]} {b}")
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
d= {}
for a in range(10**25):
    print(a,d)
    a5 = a**5
    b5 = a5-x
    if b5 in d:
        print(a,d[b5])
        exit()
    d[a5] = a
    print('--------------',a,d)
    a5 = -a5
    b5 = a5-x
    if b5 in d:
        print(a,d[b5])
        exit()
    d[a5] = -a

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
 
x = int(input())
x_pow = round(math.pow(x, 1/5))
ok = 0
 
for a in range(-x_pow-10, x_pow+10):
  for b in range(-x_pow-10, x_pow+10):
    if a**5 - b**5 == x:
      print(a,b)
      ok = 1
      exit()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(-x_pow-10, x_pow+10):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if b.is_integer() and a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(-300, 300):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if b.is_integer() and a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(-x_pow,x_pow+1):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(x+1):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(x_pow+10):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

Solution code:
import math

x = int(input())
x_pow = round(math.pow(x, 1/5))

for a in range(x_pow+1):
  b = a**5 - x
  if b<0:
    b = math.pow(abs(b), 1/5)
    b *= -1
  else:
    b = math.pow(b, 1/5)
  if a**5-b**5 == x:
    print(int(a),int(b))
    break

Submission status: Wrong Answer

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

for a in range(-1000, 1000):
  b5 = a ** 5 - x
  minus = False
  if b5 < 0:
    minus = True
    b5 = -b5
  kb = math.pow(b5, 1 / 5)
  if minus:
    kb = -kb
  rb = round(kb)
  for d in (-1, 0, 1):
    b = rb + d
    if b**5 == b5:
      print(a, b)
      exit()

Submission status: Wrong Answer

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

for a in range(1000):
  b5 = a ** 5 - x
  minus = False
  if b5 < 0:
    minus = True
    b5 = -b5
  b = math.pow(b5, 1 / 5)
  if minus:
    b = -b
  rb = round(b)
  for d in (-1, 0, 1):
    kb = rb + d
    if kb**5 == b5:
      print(a, kb)
      exit()

Submission status: Wrong Answer

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

for a in range(1000):
  b5 = a ** 5 - x
  minus = False
  if b5 < 0:
    minus = True
    b5 = -b5
  b = math.pow(b5, 1 / 5)
  if minus:
    b = -b
  rb = round(b)
  for d in (-1, 0, 1):
    b = rb + d
    if b**5 == b5:
      print(a, b)
      exit()

Submission status: Wrong Answer

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

ps = []
for i in range(1, int(sqrt(x)) + 1):
  if x % i == 0:
    ps.append(i)
    ps.append(x // i)

for p_ in ps:
  for p in (-p_, p_):
    for r in (-1, 1):
      for s in (-1, 1):
        try:
          a = (p + r * sqrt(-5 * p**2 + s * (2 * sqrt(5) *
                                             sqrt(p ** 6 + 4 * p * x)) / p) / sqrt(5)) / 2
          if a == int(a):
            a = int(a)
            print(a, a - p)
            exit()
        except ValueError:
          pass

Submission status: Wrong Answer

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

ps = []
for i in range(1, int(sqrt(x)) + 1):
  if x % i == 0:
    ps.append(i)
    ps.append(x // i)

for p in ps:
  for r in (-1, 1):
    for s in (-1, 1):
      try:
        a = (p + r * sqrt(-5 * p**2 + s * (2 * sqrt(5) *
                                           sqrt(p ** 6 + 4 * p * x)) / p) / sqrt(5)) / 2
        if a == int(a):
          a = int(a)
          print(a, a - p)
          exit()
      except ValueError:
        pass

Submission status: Wrong Answer

Solution code:
from math import pow

x = int(input())

for a in range(x):
    b5 = a**5 - x
    b = pow(abs(b5), 1/5)
    if int(b*10) == int(b)*10:
        if b5 < 0:
            b = -b
        break

print(a, int(b))

Submission status: Wrong Answer

Solution code:
from math import pow

x = int(input())

for a in range(x):
    b5 = a**5 - x
    b = pow(abs(b5), 1/5)
    if b == int(b):
        if b5 < 0:
            b = -b
        break

print(a, int(b))

Submission status: Wrong Answer

Solution code:
from math import pow

x = int(input())

for a in range(x):
    b5 = a**5 - x
    b = pow(abs(b5), 1/5)
    print(b)
    if b == int(b):
        if b5 < 0:
            b = -b
        break

print(a, int(b))

Submission status: Wrong Answer

Solution code:
from math import pow

x = int(input())

for a in range(x):
    b5 = a**5 - x
    b = pow(abs(b5), 1/3)
    if abs(b) == int(b):
        if b5 < 0:
            b = -b
        break

print(a, int(b))

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)

for x in range(10**5):
    for m in range(10):
        if x ** 5 + m ** 5 == n:
            print(x,-m)
            exit()

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)

for x in range(10**4):
    for m in range(10):
        if x ** 5 + m ** 5 == n:
            print(x,-m)
            exit()

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)

for x in range(1000):
    for m in range(100):
        if x ** 5 + m ** 5 == n:
            print(x,-m)
            exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

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

Submission status: Wrong Answer

Solution code:
X=int(input())
MAX=int((10**9)**(1/5))+1
MIN=-int((10**9)**(1/5))-1
for A in range(MIN,MAX):
    for B in range(MIN,MAX):
        if A**5-B**5==X:
            print(A,B)
            exit()

Submission status: Wrong Answer

Solution code:
X=int(input())
MAX_A=int((10**9)**(1/5))+1
MIN_B=-int((10**9)**(1/5))-1
for A in range(MAX_A):
    for B in range(0,MIN_B,-1):
        if A**5-B**5==X:
            print(A,B)
            exit()

Submission status: Wrong Answer

Solution code:
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

x = int(input())
a = 0
b = 0
done = False
for f in range(-100, 100):
    for l in range(-100, 100):
        if(f**5-l**5==x):
            a = f
            b = l
            done = True
            break
    if(done):
        break
print(a,b)

Submission status: Wrong Answer

Solution code:
import glob
import bisect

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\166\\D'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def calc(self, num):
        if num < 2:
            return 0
        return num * (num-1) / 2

    def resolve(self):

        X = int(self.input_data())

        squares = [0]*201
        for i in range(0,201):
            squares[i] = i ** 2

        for i in range (1,201):
            for j in range(0,200):
                if squares[i] - squares[j] == X:
                    print(str(i) + ' ' + str(j))
                    exit(0)


solver = Solver(REL_PATH)
solver.exec_resolve()

Submission status: Wrong Answer

Solution code:
X = int(input())
N = int(X**(1/5))
ans = [0,0]
for i in range(-N-1, N+2):
  for j in range(-N-1, N+2):
    if i**5-j**5==X:
      ans = [i, j]
ans = [str(i) for i in ans]
ans = ' '.join(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())
N = int(X**(1/5))
ans = [0,0]
for i in range(N+2):
  for j in range(-N-1, i+1):
    if i**5-j**5==X:
      ans = [i, j]
ans = [str(i) for i in ans]
ans = ' '.join(ans)
print(ans)