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: Runtime Error

Solution code:

N ,M = list(map(int, input().split()))
H = list(map(int, input().split()))

AB = []
res = []

for _ in range(M):
    AB.append(sorted(list(map(int, input().split()))))

for i in range(1,N+1):
    for j in range(M):
        if AB[j][0] == i:
            if H[AB[j][0]-1] <= H[AB[j][1]-1]:
                not_res.append(AB[j][0])
                break
    else:
        res.append(i)

print(len(res))

Submission status: Runtime Error

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

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


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

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

print(ans_a, ans_b)

Submission status: Runtime Error

Solution code:
X = int(input())

for a in range(-300, 300):
    for b in range(-300, 300):
        if a ** 5 - b ** 5 == X:
            print(str(A) + " " + str(B))
            exit()

Submission status: Runtime Error

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

from pprint import pprint
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float("inf")

x = int(input())


def find(x):
    for a in range(300):
        for b in range(300):
            b = -b
            if a ** 5 - b ** 5 == x:
                return [a, b]


a, b = find(x)
print(a, b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

if __name__ == '__main__':
  x = int(input())
	for a in range(-120, 120):
    	for b in range(-120, 120):
        	if a ** 5 - b ** 5 == x:
            	print(a, b)

Submission status: Runtime Error

Solution code:
from decimal import Decimal

X = Decimal(input())

A = Decimal('0')
B = Decimal('0')

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

# while

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

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

while B>=0:
    A = (B ** Decimal('5') + X) ** Decimal('0.2')
    if float(A).is_integer():
        break

    A = (Decimal('-1') * B ** Decimal('5') + X) ** Decimal('0.2')
    if float(A).is_integer():
        B = -1 * B
        break

    B += 1

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

Submission status: Runtime Error

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
# 約数列挙
def find_divisor(n):
    divisors=[]
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            if i*i!=n:
                divisors.append(n // i)
    return divisors


def main():
    X=I()
    S=set()
    for i in range(10**5):
        S.add(i**5)
        S.add(-i**5)
    for s in S:
        if(X-s in S):
            B=int((X-s)**(1/5))
            A=int(s**(1/5))
            print(A,-B)
            break

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main(x):
  for i in range(100):
    for j in range(100):
      if(i**5-j**5 == x):
        print(str(i)+" "+str(j))
        return

if __name__ = '__main__':
  main(input())

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
# 約数列挙
def find_divisor(n):
    divisors=[]
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            if i*i!=n:
                divisors.append(n // i)
    return divisors


def main():
    X=I()
    S=set()
    for i in range(10**5):
        S.add(i**5)
        S.add(-i**5)
    for s in S:
        if(X-s in S):
        	B=int((X-s)**(1/5))
            A=int(s**(1/5))
            print(A,-B)
            break

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x = int(input())

def f(x,b):
    return int((x+b**5)**(1/5))

b=0
plus=1
while True:
    ans = f(x,b)
    print(ans)
    if ans**5-b**5 == x:
        print(ans, b)
        break
    elif plus == 1:
        b=b*(-1)
        plus = 0
    elif plus == 0:
        b=b*(-1)
        b+=1
        plus = 1

Submission status: Runtime Error

Solution code:
x = input()
for i in range(100):
  for j in range(100):
    if(i**5-j**5 == x):
      print(str(i)+" "+str(j))
      return

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())

c = 0
for a in range(-118, 119):
  for b in range(-118, 119):
    Y = a ** 5 - b ** 5
    if Y == X:
      A = a
      B = b
      c = 1
      break
  if c == 1:
    break
print(A, B)

Submission status: Runtime Error

Solution code:
X = int(input())

for a in range(-118, 119):
  for b in range(-118, 119):
    Y = a ** 5 - b ** 5
    if Y == X:
      A = a
      B = b
      break
    else:
      continue
      
print(A, B)

Submission status: Runtime Error

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

for i in range(X+1):
  #print(pow(X-pow(i,5),1/5),i)
  if pow(X-pow(i,5),1/5)%1==0:
    break
print(int(pow(X-pow(i,5),1/5)),-i)

Submission status: Runtime Error

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

for i in range(X+1):
  print(pow(X-pow(i,5),1/5),i)
  if pow(X-pow(i,5),1/5)%1==0:
    break
print(int(pow(X-pow(i,5),1/5)),-i)

Submission status: Runtime Error

Solution code:
X = int(input())

for a in range(-118, 119):
  for b in range(-118, 119):
    Y = a ** 5 - b ** 5
    if Y == X:
      A = a
      B = b
      break
      
print(A, B)

Submission status: Runtime Error

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

def f(x,b):
    return math.floor((x+b**5)**(1/5))

b=0
plus=1
while True:
    ans = f(x,b)
    print(ans)
    if ans**5-b**5 == x:
        print(ans, b)
        break
    elif plus == 1:
        b=b*(-1)
        plus = 0
    elif plus == 0:
        b=b*(-1)
        b+=1
        plus = 1

Submission status: Runtime Error

Solution code:
X=int(input())
A=0
for a in range(X):
  if (a+1)**5-a**5 <= X <= (a+1)**5+a**5:
    A = a
    break

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

Submission status: Runtime Error

Solution code:
def solv_quadratic_equation(a, b, c):
    D = (b**2 - 4*a*c) ** (1/2)
    if isinstance(D, float) == True:
      x_1 = (-b + D) / (2 * a)
      x_2 = (-b - D) / (2 * a)
      return x_1,x_2
    else:
      return 0.1,0.1

n = int(input())
a,ch = n // 10,0
while ch == 0:
    s,t,u = a,-pow(a,3),(pow(a,5) -n)/5
    v,w = solv_quadratic_equation(s,t,u)
    if v.is_integer() == True:
        e,f = solv_quadratic_equation(1,-a,v)
        if e.is_integer() == True & f.is_integer() == True:
            if abs(int(e)) >= abs(int(f)):
                print(int(e),int(-f))
            else:
                print(int(f),int(-e))
            ch = 1
    if w.is_integer() == True:
        e,f = solv_quadratic_equation(1,-a,w)
        if e.is_integer() == True & f.is_integer() == True:
            if abs(int(e)) >= abs(int(f)):
                print(int(e),int(-f))
            else:
                print(int(f),int(-e))
            ch = 1
    a += 10

Submission status: Runtime Error

Solution code:
N=int(input())
for A in range(-118,120):
  for B in range(-119.119):
    if A**5-B**5==N:
      print(A,B)

Submission status: Runtime Error

Solution code:
N=int(input())
for A in range(-118,120):
  for B in range(-119.119):
    if A**5-B**5==N:
      print(A,B)

Submission status: Runtime Error

Solution code:
X = int(input())
M = []
for i in range(119):
    M.append(i**5)
for i in range(119):
    for j in range(119):
      if(M[i] - M[j] == X):
          A = i
          B = j
      elif(M[i] + M[j] == X):
          A = i
          B = -1*j

print(A,B)

Submission status: Runtime Error

Solution code:
X = int(input())

p = [0]*1000

flag = False
for i in range(1000):
    p[i] = i**5

for i in range(1,1000):
    for j in range(1,1000):
        if p[i]-p[j] == X:
            a = i
        
            b = j
            flag=True
        if p[i] + p[j] ==X:
            a=i
            b=-j
            flag=True


        if flag:
            break
    if flag:
        break

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

Submission status: Runtime Error

Solution code:
x=int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a=prime_factorize(x)

a.append(1)
a=list(set(a))
len=len(a)
for i in range(len):
    if a[i]>11:
        a[i]=0
a=list(set(a))
len=len(a)
t=max(a)*(-1)
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

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

Submission status: Runtime Error

Solution code:

n = int(input())

l = []
for _ in range(100):
    x = _**5
    if x > 10**20:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)
#print(l)
#print(len(l))

from itertools import combinations
y = (list(combinations(l, 2)))
#print(y)

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j
        break
#print(y[z])

if y[z][0] >= 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] >= 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))

print(a, b)

Submission status: Runtime Error

Solution code:
x=int(input())
for i in range(-118, 120):
  if x-pow(i, 5)>=0:
    if pow((x-pow(i, 5)), 0.2).is_integer():
      b=pow((x-pow(i, 5)), 0.2)
      print(a, b)
      break
  else:
    if pow(-(x-pow(i, 5)), 0.2).is_integre():
      b=pow(-(x-pow(i, 5)), 0.2)
      print(a, b)
      break

Submission status: Runtime Error

Solution code:

n = int(input())

l = []
for _ in range(100):
    x = _**5
    if x > 10**12:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)
#print(l)
#print(len(l))

from itertools import combinations
y = (list(combinations(l, 2)))
#print(y)

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j
        break
#print(y[z])

if y[z][0] >= 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] >= 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))

print(a, b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

Submission status: Runtime Error

Solution code:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def fifthroot(n):
    for i in range(-int(n**(1/5)+1),int(n**(1/5)+1)) :
        if i**5==n:
            return i
    return -1

def main():
    x = int(input().strip())
    for a in range(-10*3, 10**3):
        b_candidate = fifthroot(x - a**5)
        if b_candidate!=-1:
            b=b_candidate
            print(a,b)
            return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        if 0 < x-y:
            print(f"{l.index(x-y)} {-i}")
            break
        else:
            print(f"{i} {-(l-index(abs(x-y)))}")
            break

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
H=list(map(int,input().split()))
ans=[i  for i in range(1,n+1)]
low=[]
for i in range(m):
    x,y=map(int,input().split())
    if H[x-1]==H[y-1]:
        low.append(x)
        low.append(y)
    elif  H[x-1]>H[y-1]:
        low.append(y)
    else:
        low.append(x)
low=list(set(low))
print(len(ans)-len(low))

Submission status: Runtime Error

Solution code:
def divisor(n):
    L = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            L.append(i)
            L.append(n//i)
    return L
    
n = int(input())
li = sorted(divisor(n))

for i in range(len(li)):
    a = (n - (li[i])**5)**0.2
    a1 = (n - (li[i])**5)**0.2
    b1 = (n-a**5)**0.2

    a1 = round(a1)
    b1 = round(b1)
    if a1**5 - b1**5 == n:
        print(a1,b1)
        exit()
    elif a1**5 + b1**5 == n:
        print(a1,-b1)
        exit()

Submission status: Runtime Error

Solution code:
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        print(f"{l.index(x-y)} {-i}")
        break

Submission status: Runtime Error

Solution code:
import numpy as np

x = int(input())
flag = 0
for i in range(1, int(np.sqrt(x))):
    if x % i == 0:
        k = int(x / i)
        if k < 31:
            for c in range(100):
                a = c
                b = a - i
                d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                if d == k:
                    flag += 1
                    break
            if flag != 1:
                for c in range(100):
                    a = c
                    b = a - k
                    d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                    if d == i:
                        flag += 1
                        break
        else:
            for c in range(1, 10):
                a = c
                b = a - i
                d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                if d == k:
                    flag += 1
                    break
            if flag != 1:
                for c in range(10):
                    a = c
                    b = a - k
                    d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                    if d == i:
                        flag += 1
                        break
        if flag == 1:
            break

print(a, b)

Submission status: Runtime Error

Solution code:
import numpy as np

x = int(input())
flag = 0
for i in range(1, int(np.sqrt(x))):
    if x % i == 0:
        k = int(x / i)
        if k < 31:
            for c in range(10):
                a = c
                b = a - i
                d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                if d == k:
                    flag += 1
                    break
            if flag != 1:
                for c in range(10):
                    a = c
                    b = a - k
                    d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                    if d == i:
                        flag += 1
                        break
        else:
            for c in range(1, 10):
                a = c
                b = a - i
                d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                if d == k:
                    flag += 1
                    break
            if flag != 1:
                for c in range(10):
                    a = c
                    b = a - k
                    d = a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4
                    if d == i:
                        flag += 1
                        break
        if flag == 1:
            break

print(a, b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())

j = 1

while 1:
  if x < j ** 5:
    j -=1
    break
  j += 1
a = j
#print(a)
# j or j - 1

f = False
for i in range(a, a + 2):
  a_5 = i ** 5
  #print(a_5)
  for k in range(0, i + 1):
    #print(a_5 - k ** 5, a_5 + k ** 5)
    if a_5 - k ** 5 == x:
      b = k
      f = not f
      break
    elif a_5 + k ** 5 == x:
      b = -k
      f = not f
      break
    #print(i,k)
  if f:
    a = i
    break
print(a,b)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D
# CreatedDate:  2020-05-03 22:36:44 +0900
# LastModified: 2020-05-03 22:56:22 +0900
#


import os
import sys


def main():
    x=int(input())
    tmp=1
    for i in range(2,x):
        if x%i==0:
            tmp=i
            break

    b=-1
    for i in range(x):
        if x==((tmp-1)*i)**5+1:
            a=(tmp-1)*i
            break
    print("{} {}".format(a,b))
    return 

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
x=int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a=prime_factorize(x)

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

t=max(a)*(-1)
ansx=0
ansy=0
while True:
    if not ansx== 0 or not ansy== 0:
        break

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

Submission status: Runtime Error

Solution code:
X = int(input())

B = [n**5 for n in range(300)]

A = []

for i in range(300):
    a = i**5- X if i**5 >= X else X-i**5
    A.append(a)

for j in range(300):
    if A[j] in B:
        a = j
        b = B.index(A[j])
        if a**5-b**5 = X:
            print(a,b)
        elif a**+b**5 = X:
            print(a,-b)
        break

Submission status: Runtime Error

Solution code:
B=0
for b in range((a+1)**5-a**5,(a+1)**+a**5+1):
  if (a+1)**5-b**5 == X:
    B=b
    break

print(A+1, B)

Submission status: Runtime Error

Solution code:
import math, sys
X = int(input())
for a in range(-200,200):
  a5 == a**5
  for b in range(-200,200):
    if a5-b**5==X:
      print(str(a)+" "+str(b))
      sys.exit()

Submission status: Runtime Error

Solution code:
x = int(input())

for b in range(-1000, 1000):
    tmp = pow(b, 5)
    tmp += x
    a = pow(tmp, 0.2)
    if a == int(a):
        print(a, b)
        exit()

Submission status: Runtime Error

Solution code:
X = int(input())
 
ans = None
 
for i in range(119):
  for j in range(119):
    if i ** 5 - j ** 5 == X:
      ans = (i, j)
    elif (i*-1) ** 5 - j ** 5 == X:
      ans = (-i, j)
    elif i ** 5 - (j*-1) ** 5 == X:
      ans = (i, -j)
print(ans[0],ans[1])

Submission status: Runtime Error

Solution code:
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 118):
    for b in range(-118, 119):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)

Submission status: Runtime Error

Solution code:
import sys
from math import ceil, sqrt
def input(): return sys.stdin.readline().strip()


def main():
    X = int(input())
    x = int(X ** (1/5))
    if x == X ** (1/5):
        print("{} {}".format(x, 0))
        return
    
    for B in range(1, x + 1):
        A = (X - B**5) ** (1/5)
        if A < B: break
        if int(A) == A:
            print("{} {}".format(int(A), -B))
            return
    
    y = sqrt(X)
    if int(y) == y:
        upper = int(y) + 1
    else:
        upper = ceil(y)

    for d in range(1, upper):
        """
        if X % d == 0:
            B = 1
            while (B + d) ** 5  < B ** 5 + X:
                B += 1
            if (B + d) ** 5 == B ** 5 + X:
                print("{} {}".format(B + d, B))
                return
            
            e = X // d
            B = 1
            while (B + e) ** 5  < B ** 5 + X:
                B += 1
            if (B + e) ** 5 == B ** 5 + X:
                print("{} {}".format(B + e, B))
                return
        """
        B = 1
            while (B + d) ** 5  < B ** 5 + X:
                B += 1
            if (B + d) ** 5 == B ** 5 + X:
                print("{} {}".format(B + d, B))
                return
            
            e = X // d
            B = 1
            while (B + e) ** 5  < B ** 5 + X:
                B += 1
            if (B + e) ** 5 == B ** 5 + X:
                print("{} {}".format(B + e, B))
                return



if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import math,itertools,copy
  
X = int(input())
x = math.sqrt(X)
cands = [0]
 
for i in range(1,x+1):
  cands.append(i)
  cands.append(-i)
  
c_cands = copy.copy(cands)
 
for a,b in itertools.product(cands,c_cands):
  if a**5-b**5 == X:
    print(str(a),' ',str(b))
    break

Submission status: Runtime Error

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)
      keep=1
      break
  if keep==1:
    break

Submission status: Runtime Error

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

for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if math.pow(a, 5) == x + math.pow(b, 5):
            print(a, b)
            exit()

Submission status: Runtime Error

Solution code:
X=int(input())
j=1
a=len(table)
for j in range(X):
    p=j
    A=1
    while A**5-(A-p)**5<=X:
        if X==A**5-(A-p)**5:
            print(A,A-p)
            break
        A+=1
    j+=1

Submission status: Runtime Error

Solution code:
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 119):
    b = a - a_factor_of_x

    ab_max =
    if not a in checked:
        checked[a_factor_of_x] = {}

    if a ** 5 - b ** 5 == x_diff_of_5th_factor:
        print('{} {}'.format(a, b))
        sys.exit(0)

sys.exit(1)

Submission status: Runtime Error

Solution code:
from numba import jit
import math
X = int(input())


@jit
def solver(X):
    sol = []
    i = 2
    while i <= math.sqrt(X)+1:
        if X % i == 0:
            sol.append(i)
        i += 1
    return sol


if X == 1:
    print(0, -1)
    exit()
sol = solver(X)


for i in sol:
    for s in range(-130 130):
        t = s - i
        if s ** 5 - t ** 5 == X:
            print(s, t)
            break

Submission status: Runtime Error

Solution code:
X = int(input())

a = 0
while True:
    a += 1
    if a**5 > X:
        A1 = (a-1)**5
        A2 = a**5
        break

B1 == X - A1
B2 == X - A2

b=0
c=0
d=0
e=0

if B1 < 0:
    while True:
        b -= 1
        if B1 == b**5:
            print(a-1, b)
            break
        elif b**5 < B1:
            break
elif B1 >= 0:
    while True:
        c += 1
        if B1 == c**5:
            print(a-1, c)
            break
        elif c**5 > B1:
            break
elif B2 < 0:
    while True:
        d -= 1
        if B2 == d**5:
            print(a-1, d)
            break
        elif d**5 < B2:
            break
elif B2 >= 0:
    while True:
        e += 1
        if B1 == e**5:
            print(a-1, e)
            break
        elif e**5 > B1:
            break

Submission status: Runtime Error

Solution code:
import itertools
x = int(input())
num = [i**5 for i in range(3000)]
ans= list(itertools.combinations_with_replacement(num, 2))
for i in ans:
    if abs(i[0]-i[1]) == x:
        if i[0] < i[1]:
            print(int(i[1]**0.2),int(i[0]**0.2)*)
        else:
            print(int(i[0]**0.2),int(i[1]**0.2))
        break
    elif i[0]+i[1] == x:
        print(int(i[0]**0.2),int(i[1]**0.2)*-1)
        break

Submission status: Runtime Error

Solution code:
def main():
  sFlag=False
  X= int(input())
  X_table=prime_decomposition(X)
  X_table.append(1)
  for i in range(-1000,1000):
    A=i
    for j in range(-1000,1000):
      X_n=i**5-j**5
      if(X_n==X):
        print(A,B)
        sFlag=True
        break
    if(sFlag==True):
      break

if __name__=='__main__':
  main()

Submission status: Runtime Error

Solution code:
import math,itertools,copy
  
X = int(input())
x = math.sqrt(X)
cands = [0]
 
for i in range(x+1):
  cands.append(i)
  cands.append(-i)

c_cands = copy.copy(cands)

for a,b in itertools.products(cands,c_cands):
  if a**5-b**5 == X:
    print(str(a),' ',str(b))
    break

Submission status: Runtime Error

Solution code:

n = int(input())

l = []
for _ in range(100):
    x = _**5
    if x > 10**9:
        break
    else:
        l.append(x)
tmp = len(l)

for i in range(len(l)):
    l.append(l[i]*-1)
#print(l)
#print(len(l))

from itertools import combinations
y = (list(combinations(l, 2)))
#print(y)

for j in range(len(y)):
    if y[j][0] - y[j][1] == n:
        z = j
        break
#print(y[z])

if y[z][0] >= 0:
    a = l.index(y[z][0])
else:
    a = -1 * (l.index(y[z][0]*-1))

if y[z][1] >= 0:
    b = l.index(y[z][1])
else:
    b = -1 * (l.index(y[z][1]*-1))


print(a, b)

Submission status: Runtime Error

Solution code:
x = int(input())
ans = []
for i in range(-105, 105):
  for j in range(-105, 105):
    if pow(i, 5) - pow(j, 5) == x:
      ans += [[i, j]]
ans = list(map(str, ans[0]))
print(" ".join(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
 = int(input())
ans = []
for i in range(-105, 105):
  for j in range(-105, 105):
    if pow(i, 5) - pow(j, 5) == x:
      ans += [[i, j]]
ans = list(map(str, ans[0]))
print(" ".join(ans))