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:
import math
X=int(input())

for i in range(X):
  if　isinstance(pow(1/5, X+pow(5,i)), int)=='true'
    break
    
print(pow(1/5, X+pow(5,i),i)

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
num = []
nn = -1

while nn ** 5 < N :
  nn += 1
  A = nn ** 5 - N
  if A in num:
    print(nn, index(A))
    exit()
  num.append(nn ** 5) 
  
An = -1
Bn = -1
A = 0
B = 0
while True :
  An += 1
  Bn = An
  A = 0
  B = 0
  while A + B < N :
    Bn += 1
    A = An ** 5
    B = Bn ** 5
    if A + B == N:
      print(An, Bn * -1)
      sys.exit()

Submission status: Runtime Error

Solution code:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table
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(len(X_table)):
      B=A-X_table[j]
      X_n=A**5-B**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:
x=int(input())
n = 1000
l = [x**5 for x in range(-n, n)]
for i,y in enumerate(l):
    if y+x in l:
        print(f'{int(l.index(y+x)-len(l)/2+1)} {int(i-len(l)/2+1)}')
        break
    elif y-x in l:
        print(f'{int(i-len(l)/2+1)} {int(l.index(y-x)-len(l)/2+1)}')
	break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
nn = int(pow(n,1/5)) + 1
for i in range(nn):
    b = pow(i ** 5 - n, 1/5)
    if float.is_integer(b):
        break

print(i,int(-b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())

def func():
    for a in range(-10**2 - 100, 10**2 + 100):
        for b in range(-10**2, 10**2):
            if a**5 - b**5 == x:
                k = [a, b]
                return k
    

k = func()
for i in range(2):
    print(k[i], end=" ")

Submission status: Runtime Error

Solution code:
x = int(input())
l = [1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000, 161051, 248832, 371293, 537824, 759375, 1048576, 1419857, 1889568, 2476099, 3200000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176, 69343957, 79235168, 90224199, 102400000, 115856201, 130691232, 147008443, 164916224, 184528125, 205962976, 229345007, 254803968, 282475249, 312500000, 345025251, 380204032, 418195493, 459165024, 503284375, 550731776, 601692057, 656356768, 714924299, 777600000, 844596301, 916132832, 992436543, 1073741824, 1160290625, 1252332576, 1350125107, 1453933568, 1564031349, 1680700000, 1804229351, 1934917632, 2073071593, 2219006624, 2373046875, 2535525376, 2706784157, 2887174368, 3077056399, 3276800000, 3486784401, 3707398432, 3939040643, 4182119424, 4437053125, 4704270176, 4984209207, 5277319168, 5584059449, 5904900000, 6240321451, 6590815232, 6956883693, 7339040224, 7737809375, 8153726976, 8587340257, 9039207968, 9509900499, 10000000000, 10510100501, 11040808032, 11592740743, 12166529024, 12762815625, 13382255776, 14025517307, 14693280768, 15386239549, 16105100000, 16850581551, 17623416832, 18424351793, 19254145824, 20113571875, 21003416576, 21924480357, 22877577568, 23863536599]
s = False
for a in range(119, -1, -1):
    for b in range(a, -1, -1):
        if l[a] == x + l[b]:
            print(a+1, b+1)
            s = True
            break
        elif l[a] + l[b] == x:
            print(a+1, -b-1)
            s = True
            break
    if s:
        break

Submission status: Runtime Error

Solution code:
# 2020/05/03
# AtCoder Beginner Contest 166 - D

# Input
x = int(input())

# Calc
eflg = False
for a in range(200):
    wk_a = a ** 5
    b = 0
    sav = 10 ** 10
    for b in range(200):
        val_1 = wk_a - (b ** 5)
        val_2 = wk_a - (-b ** 5)

        if val_1 == x:
            ans1 = a
            ans2 = b
            eflg = True
            break

        if val_2 == x:
            ans1 = a
            ans2 = -b
            eflg = True
            break
        
        sav = abs(val_2) - x

        if sav > x:
            break

    if eflg == True:
        break

# Output
print(ans1, ans2)

Submission status: Runtime Error

Solution code:
import math
import itertools
  
X = int(input())
x = math.sqrt(X)
cands = [0]

for i in range(x+1):
  cands.append(i)
  cands.append(-i)
  
for a,b in itertools.combinations(cands,2):
  if a**5-b**5 == X:
    print(str(a),' ',str(b))
    break

Submission status: Runtime Error

Solution code:
m=0
if m==0:
  while  n==0:
    u=e**5-w**5
    if u>x:
      r+=1
      w=r
      e=r+1
    if x==u:
      print(e,end=" ")
      print(w)
      n+=1
    else:
      e+=1

Submission status: Runtime Error

Solution code:
X = int(input())

b = 0
while 1:
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    b += 1
print(int(a), b)

Submission status: Runtime Error

Solution code:
/*input

*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
using namespace std;
unsigned long long n;
unsigned long long pw(int x){
    return 1LL*x*x*x*x*x;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    unsigned long long x = 0;
    while (pw(x) <= n){
        unsigned long long y = n - pw(x);
            y = pow(y, 0.2);
        if (pw(x) + pw(y) == n) {
            cout << x << ' ' << -y << '\n';
            return 0;
        }
        x++;
    }   
    for(int i=1;i<=1000;++i){
        if (n % i == 0){
            int j = 1;
            while (pw(j+i) - pw(j) <= n){
                if (pw(j+i) - pw(j) == n) {
                    cout << j+i << ' ' << j << '\n';
                    return 0;
                }
                j++;
            }
        }
    }
}

Submission status: Runtime Error

Solution code:
def f(x):
    for a in range(-100, 101):
        for b in range(-100, 101):
            if a ** 5 - b ** 5 == x:
                A = [a, b]
                return A
B = f(int(input()))
print(B[0], B[1])

Submission status: Runtime Error

Solution code:
x=int(input())
count=0
hugou=1
while True:
  y=(x+count**5)**(1/5)
  if int(y)==y:
    break
  y=(x+((-1)*count)**5)**(1/5)
  if int(y)==y:
    hugou*=(-1)
    break
  count+=1
  
print(int(y),hugou*count)

Submission status: Runtime Error

Solution code:
X = int(input())

b = 0
while 1:
    a = (X + b ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    a = (X + (b) ** 5) ** (1/5)
    if a.is_integer() == True:
        break
    b = -b
    b += 1
print(int(a), b)

Submission status: Runtime Error

Solution code:
X = int(input())
A = 0
while 0==0:
    if int((X-A**5)**(1/5))==(X-A**5)**(1/5):
        B = (X-A**5)**(1/5)
        print(A,int(B))
        exit()
    elif int((X+A**5)**(1/5))==(X-A**5)**(1/5):
        B = (X-A**5)**(1/5)
        print(-A,int(B))
        exit()
    else:
        A+=1

Submission status: Runtime Error

Solution code:
x = int(input())
if x == 1:
  print(0,-1)
  exit()
  
def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

c = []
fct = factorize(x)
for div in divisorize(fct):
    c.append(num(div))
    
chk = False
for s in c:
  if chk:
    break
  for i in range(1000):
    if (i+s)**5-i**5 > x:
      break
    if (i+s)**5-i**5 == x:
      ans = (i+s,i)
      chk = True
      break
  if s <1000:    
    for p in range(s,1000):
      j = -1*p
      #print(s,(j+s)**5-j**5)
      if (j+s)**5-j**5 > x:
        break 
      if (j+s)**5-j**5 == x:
        ans = (j+s,j)
        chk = True
        break 
  for ww in range(1,(s+1)//2):
    jj = -1*ww
    if (jj+s)**5-jj**5 > x:
      break    
    if (jj+s)**5-jj**5 == x:
      ans = (jj+s,jj)
      chk = True
      break 
print(*ans)

Submission status: Runtime Error

Solution code:
def f(x):
    for a in range(-100, 101):
        for b in range(-100, 101):
            if a ** 5 - b ** 5 == x:
                A = [a, b]
                return A
A = f(int(input()))
print(A[0], A[1])

Submission status: Runtime Error

Solution code:
X = int(input())
for A in range(0, X):
  
  A5 = A**5
  B5 = X - A5
  B = B5 ** (1/5) 
  if float.is_integer(B):
    print(A, int(B*-1))
    break

Submission status: Runtime Error

Solution code:
n = int(input())
x = 0
y = 0
while x**5 < n:
	y = (n - x**5);
	y = int(y)
	if (x**5 + y**5 == n):
		print(x, -1 * y, sep = " ");
		break
	x+=1
if (x**5 + y**5 != n):
	i = 0
	while(i <= 200):
		if (n % i == 0):
			j = 0;
			ok = False;
			while((i+j)**5 - j**5 <= n):
				if (i+j)**5 - j**5 == n:
					print(i+j,j, sep = ' ');
					ok = True;
					break;
				j+=1
		i+=1
		if (ok == True):
			break;

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

for A in range(100):
  for B in range(100):
    if A**5 - B**5 == X:
      print(str(A) + " " + str(B))
  break
    if A**5 + B**5 == X:
      print(str(A) + " -" + str(B))
  break

Submission status: Runtime Error

Solution code:
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

def main():
    N,A,B,C = map(int,input().split())
    choice = [input() for _ in range(N)]
    ab = 0
    bc = 0
    ca = 0
    for s in choice:
        if s == 'AB':
            ab += 1
        elif s == 'BC':
            bc += 1
        else:
            ca += 1
    
    ans = [[0,0] for _ in range(3)]
    if A > 0 or B > 0:
        ans[0][0] += ab//2
        ans[0][1] += ab//2
        ab %= 2
    else:
        if bc > 0 and C > 0:
            bc -= 1
            C -= 1
            B += 1
            ans[1][0] += 1
        elif ca > 0 and C > 0:
            ca -= 1
            C -= 1
            A += 1
            ans[2][0] += 1
        else:
            print('No')
            return
        ans[0][0] += ab//2
        ans[0][1] += ab//2
        ab %= 2
        
    if B > 0 or C > 0:
        ans[1][0] += bc//2
        ans[1][1] += bc//2
        bc %= 2
    else:
        if ab > 0 and A > 0:
            A -= 1
            B += 1
            ab -= 1
            ans[0][1] += 1
        elif ca > 0 and A > 0:
            A -= 1
            C += 1
            ca -= 1
            ans[2][0] += 1
        else:
            print('No')
            return
        ans[1][0] += bc//2
        ans[1][1] += bc//2
        bc %= 2
                
    if C > 0 or A > 0:
        ans[2][0] += ca//2
        ans[2][1] += ca//2
        ca %= 2
    else:
        if bc > 0 and B > 0:
            B -= 1
            C += 1
            bc -= 1
            ans[1][1] += 1
        elif ab > 0 and B > 0:
            B -= 1
            A += 1
            ab -= 1
            ans[0][0] += 1
        else:
            print('No')
            return
        ans[1][0] += bc//2
        ans[1][1] += bc//2
        bc %= 2
    
    if ab > 0 and bc > 0 and ca > 0:
        if A > 0 or B > 0 or C > 0:
            ans[0][1] += 1
            ans[1][1] += 1
            ans[2][1] += 1
        else:
            print('No')
            return
    elif ab > 0 and bc > 0:
        if A > 0:
            ans[0][1] += 1
            ans[1][1] += 1
        elif C > 0:
            ans[1][0] += 1
            ans[0][0] += 1
        elif B > 1:
            ans[0][0] += 1
            ans[1][1] += 1
        else:
            print('No')
            return
    elif bc > 0 and ca > 0:
        if A > 0:
            ans[2][0] += 1
            ans[1][0] += 1
        elif B > 0:
            ans[1][1] += 1
            ans[2][0] += 1
        elif C > 1:
            ans[1][0] += 1
            ans[2][1] += 1
        else:
            print('No')
            return
    elif ca > 0 and ab > 0:
        if C > 0:
            ans[2][0] += 1
            ans[0][1] += 1
        elif B > 0:
            ans[1][0] += 1
            ans[2][0] += 1
        elif A > 1:
            ans[0][1] += 1
            ans[2][1] += 1
        else:
            print('No')
            return
    
    elif ab > 0:
        if A > 0:
            ans[0][1] += 1
        elif B > 0:
            ans[0][0] += 1
        else:
            print('No')
            return
    
    elif bc > 0:
        if B > 0:
            ans[1][1] += 1
        elif C > 0:
            ans[1][0] += 1
        else:
            print('No')
            return
    
    elif ca > 0:
        if A > 0:
            ans[2][1] += 1
        elif C > 0:
            ans[2][0] += 1
        else:
            print('No')
            return
    

    print('Yes')
    for s in choice:
        if s == 'AB':
            if ans[0][0] > 0:
                print('A')
                ans[0][0] -= 1
            else:
                print('B')
        elif s == 'BC':
            if ans[1][0] > 0:
                print('B')
                ans[1][0] -= 1
            else:
                print('C')
        else:
            if ans[2][0] > 0:
                print('C')
                ans[2][0] -= 1
            else:
                print('A')

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x = int(input())
start = int(pow(x,0.2))
for i in range(-1000,1000+1):
    k = pow(x + pow(i,5),0.2)
    k = round(k,7)
    if pow(int(k),5) - pow(i,5) == x:
        print(int(k),i)
        exit()

Submission status: Runtime Error

Solution code:
import itertools

x = int(input())
n = 100
table = [pow(i, 5) for i in range(-n, n+1)]
choices = list(itertools.product([i for i in range(len(table))], repeat=2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)

Submission status: Runtime Error

Solution code:
from decimal import Decimal
X= int(input())

B=-X**(1/5)
while True:
    print(B)
    A= Decimal((X+B**5)**(1/5))
    
    if int(A)==A and A>B:
        print(A,B)
        break
    else:
        B=B+1

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <math.h>


using ll = long long;
using llu = long long unsigned;

int main(void)
{
    //scanf("%d", );
    //scanf("%llu", );
    //scanf("%ll", );
    //printf("%d");
    //printf("%lli");
    //printf("%llu");

    llu fives[64000];
    llu x;
    scanf("%llu", &x);
    for (register llu i=0; i<32000; i++)
        fives[i] = i*i*i*i*i;
    for (register llu i=32000; i<64000; i++)
        fives[i] = -i*i*i*i*i;

    bool found = false;
    register llu i,j;
    for (i=0; i<64000; i++) {
        for (j=0; j<64000; i++) {
            if ((fives[i]-fives[j])==x) {
                found = true;
            break;
            }
        }
        if (found) break;
    }
    if (i>32000)
        i*=-1;
    if (j>32000)
        j*=-1;
    printf("%d %d", i, j);

    return 0;
}

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np

X = int(input())
maxs = int(X**(1/5))

l = np.arange(-maxs, maxs+1)

comb = np.array(list(itertools.combinations_with_replacement(l, 2)))

sum1 = comb[:, 0]**5 - comb[:, 1]**5
sum2 = comb[:, 1]**5 - comb[:, 0]**5

if len(np.where(sum1==X)[0]) != 0:
    result1 = np.where(sum1==X)[0][0]
    print(comb[result1][0], comb[result1][1])
else:
    result2 = np.where(sum2==X)[0][0]
    print(comb[result2][1], comb[result2][0])

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

div = make_divisors(X)

for d in div:
    i = 1
    j = i-d
    while True:
        if pow(i,5)-pow(j,5)<X:
            i += 1
            j += 1
            continue
        if pow(i,5)-pow(j,5)==X:
            print(i,j)
            break
        elif pow(i,5)-pow(j,5)>X:
            break

Submission status: Runtime Error

Solution code:
X = int(input())
for B in range(10 ** 7):
    num = X + (B ** 5)
    num = num ** 0.2
    if num.is_integer():
        num = int(num)
        print(max(num, B), min(num, B))
        break
    num = X - (B ** 5)
    num = num ** 0.2
    if num < 0: continue
    if num.is_integer():
        num = int(num)
        print(max(num, -B), min(num, -B))
        break

Submission status: Runtime Error

Solution code:
X = int(input())
y = 1
z = X
for i in range(2,int((X**(1/2)))+1):
  if X%i==0:
    y = i
    z = x//i
    break
    
for a in range(10**5):
  b = a-y
  if a**4 + (a**3)*b + (a**2)*(b**2) + a*(b**3) + b**4==z:
    print(a,b)
    exit()

Submission status: Runtime Error

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

X = int(input())

li = prime_factorize(X)

if len(li) == 2:
  A = li[0]
  B = li[1]
else:
  A = li[0]
  B = li[0]

import numpy as np
ans = np.roots([5, 10*A, 10*A*A, 5*A*A*A, A*A*A*A-B])

li2 = []
for i in range(len(ans)):
  y = np.round(ans[i].real).tolist()
  x = A + y
  if x**5 - y**5 == X:
    break

print("{} {}".format(int(x), int(y)))

Submission status: Runtime Error

Solution code:
import collections


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

prime = prime_factorize(x)[0]

print(prime)

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

Submission status: Runtime Error

Solution code:
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a b)

Submission status: Runtime Error

Solution code:
import math
x = int(input())
y = int(math.pow(x, 1/5))
x - (y)**5 = z
print(x, y)

Submission status: Runtime Error

Solution code:
X = int(input())
l = []
for i in range(X):
    for v in range(X):
        if (i - v) * (i**4 + i**3 *v + (i**2)*(v**2) +  i*(v**3) + v**4 == X):
            l.append(i)
            l.append(v)
            break
        elif (i + v) * (i**4-(i**3)*v + (i**2)*(v**2) -  i*(v**3) + v**4 == X):
            l.append(i)
            l.append(v)
            break
print(l[0], l[1])

Submission status: Runtime Error

Solution code:
X = int(input())
Y = X**(1/5)
for i in range(Y,X-Y):
	if f.is_integer(i**5-X):
		print(i," ",i**5-X)
		break

Submission status: Runtime Error

Solution code:
X = int(input())
a = 1
while True:
    b = (a ** 5 - X) ** (1/5)
    if b.is_integer():
        b = int(b)
        break
    a += 1
print(a, 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:
            print(int(max(e,f)),int(min(e,f)))
            ch = 1
    elif w.is_integer() == True:
        e,f = solv_quadratic_equation(1,-a,-w)
        if e.is_integer() == True & f.is_integer() == True & ch == 0:
            print(int(max(e,f)),int(min(e,f)))
            ch = 1
    a += 10

Submission status: Runtime Error

Solution code:
x = int(input())

for i in range(x//10):
    if x%2!=0:
        for j in range((-x//10)-10, x//10):
            if (i**5-j**5)==x:
                break
    else:
        for j in range(x//10):
            if (i**5-j**5)==x:
                break

print(i,j)

Submission status: Runtime Error

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

for i in range(len(make_divisors(X))):
    A = make_divisors(X)[i]
    for j in range(-int(X**(1/5))-1,int(X**(1/5))+1):
        if (A+j)**5-j**5==X:
            a = j + A
            b = j
            break
        else:
            continue
        break
    else:
        continue
    break
print(a,b)

Submission status: Runtime Error

Solution code:
X = int(input())

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

xfactor = prime_factors(X)

for i in (0, len(xfactor)-1):
	for j in range (-1000000, 1000000):
		if xfactor[i]*(5*j^4-10*j^3*xfactor[i]^1+10*j^2*xfactor[i]^2-5*j^1*xfactor[i]^3-xfactor[i]^4) == X:
			print(j, j-xfactor[i])
			exit()

Submission status: Runtime Error

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

x = int(input())

if math.ceil(math.log(x, 5)) == 0:
    n = x
else:
    n = math.ceil(math.log(x, 5))

A_pre = np.arange(0, n)
A_pre = A_pre.reshape([-n, n])
ones = np.ones((2*n, 1))
A = (ones@A_pre)**5
B = A.T

print(np.where(A-B == x)[0][0], np.where(A-B == x)[0][1])

Submission status: Runtime Error

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

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

F = factorization(X)

ans = []

Y = 0
#while Y < 10**9:
f2 = False
nex = F[0][0]
b = - X//nex
a = b + nex
ans = []
while Y<10**9:
    Y = a**5 - b**5
    if X == Y:
        ans = [a,b]
        break
    a += nex
    b += nex


print(str(ans[0]) + ' ' + str(ans[1]))

Submission status: Runtime Error

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

a=0
b=0
for a in range(64):
	b=((a**5)-X)**0.2
	if type(b)==int:
		break
	else:
		a=a+1
		
print(a　b)

Submission status: Runtime Error

Solution code:
import sys
#sys.exit()
#sorted( ,reverse=True)
X = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
A = 0
#cnt = 0
while True:
    #cnt +=1 
    #print(cnt)
    b = ((X-A**5))
    #print(b)
    if b ==0:
        print(A,int(b))
        break
    elif b > 0:
        B = b**(1/5)
        if B-int(B) == 0:
            print(A,int(-B))
            break
        else:
            A +=1
            
    else:
        B = -b**(1/5)
        if B -int(B) == 0:
            print(A,int(B))
            break
        else:
            A +=1


#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
#print(cnt)

Submission status: Runtime Error

Solution code:
X = int(input())

import sys

for i in range(1,10**9+1):
    a = pow(i,5)
    f_i = pow(a-X,0.2)
    if f_i.is_integer() == True:
        print(i,pow(a-X,0.2))
        sys.exit()

Submission status: Runtime Error

Solution code:
X = int(input())
B=0
while B<X :
    #print(B)
    a1 = (X+B**5)**0.2
    a2 = (X-B**5)**0.2
    if a1.is_integer():
        A = a1
        break
    elif a2.is_integer():
        A = a2
        break
    B+=1
print(A,B)

Submission status: Runtime Error

Solution code:
X = int(input())

for b in range(X):
    a = X + b ** 5
    a = pow(a, 1.0 / 5.0)
    if a.is_integer():
        A, B = int(a), b
        break
    a = X - b ** 5
    if a < 0:
        continue
    else:
        a = pow(a, 1.0 / 5.0)
        if a.is_integer():
            A, B = int(a), -b
            break

if X == 1:
    print(1, 0)
else:
    print(A, B)

Submission status: Runtime Error

Solution code:
x=int(input())
for i in range(100):
    k=x-i**5
    a=k**0.2
    if type(a)==complex:
        continue
    if a.is_integer():
        print(i)
        break
print(-i,int(a))

Submission status: Runtime Error

Solution code:
N = 1000000

x = int(input())


def equation(a, b, x):
    a ** 5 - b ** 5 - x


ans = ""

for a in range(N):
    low, high = -N, N

    b = None

    while high - low > 1:
        mid = (high + low) // 2
        if equation(a,mid,x) == 0:
            b = mid
        elif equation(a,mid,x) > 0:
            high = mid
        else:
            low = mid

    if b is not None:
        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:38:33 +0900
#


import os
import sys


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


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
X = int(input())

# 初期値
A = 0
B = 0


def dfs(A, B):
    target_val = A**5 - B**5 - X
    #print(f"A:{A} B:{B} -> {target_val}")
    if(target_val == 0):
        return [A, B]
    if(target_val > 0):
        dfs(A, B+1)
    if(target_val < 0):
        dfs(A+1, B)
        dfs(A, B-1)

ans = dfs(A, B)
print(f"{ans[0]} {ans[1]}")

Submission status: Runtime Error

Solution code:
X = int(input())

max_a = 128
min_a = -63

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

Submission status: Runtime Error

Solution code:
X = int(input())
a = 0
b = 0
def cal(a, b):
    return (a-b)*(a**4+a**3*b+a**2*b**2+a*b**3+b**4)

for i in range(10**9):
    if cal(0, -i) > X:
        b = -i+1
        break
a = (X-cal(0, b))


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

Submission status: Runtime Error

Solution code:
X=int(input())
Y=int(X**(0.2))
for i in range(Y,0,-1):
    for t in range(-Y//2,Y,1):
        if (i**5)-(t**5)==X:
            S=i
            Z=t
            break
        else:
            continue
print(S,Z)

Submission status: Runtime Error

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

while true:
  while true:
    if (a-b)*(a**5+a**4*b+a**3*b**2+a**2*b**3+a*b**4+b**5):
      print(a,b)
      exit()

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))
if (0 in a)==1:
    a.remove(0)

t=-100
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:
# -*- coding: utf-8 -*-
import numpy as np
import math

x = int(input())

if math.ceil(math.log(x, 5)) == 0:
    n = x
else:
    n = math.ceil(math.log(x, 5))

A_pre = np.arange(0, n)
A_pre = A_pre.reshape([-n, n])
ones = np.ones((2*n, 1))
A = (ones@A_pre)**5
B = A.T

print(np.where(A-B == x)[[0][0]], np.where(A-B == x)[[0][1]])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a,b)

Submission status: Runtime Error

Solution code:
X = int(input())

numbers = dict()

for i in range(-101, 101):
    numbers.setdefault(i, i**5)


for i in range(-101, 101):
    for j in range(-101, 101):
        if numbers[i] - numbers[j] == X:
            output = [i, j]
            break
print(output[0], output[1])

Submission status: Runtime Error

Solution code:
X=int(input())
import numpy as np
t=int(X**(1/5))+10
a=[]
for i in range(t):
    a.append(i**5)

b=[]
for i in range(t):
    for j in range(i+1,t):
        if a[i]+a[j]==X:
            b.append([i,-j])
        if a[j]-a[i]==X:
            b.append([i,j])
        
print(b[0][0],b[0][1])