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:
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[i**5 for i in range(100)]
    for i,a in enumerate(l):
        for j,b in enumerate(l):
            if a-b==X:
                print(i,j)
                exit()
            elif a+b==X:
                print(i,-j)
                exit()
    raise Exception
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
X = int(input())

for A in range(-10,100+1):
  for B in range(-10,100+1):
    if(A**5 - B**5 == X):
      ans = [A,B] 
      
print(ans[0],ans[1])

Submission status: Runtime Error

Solution code:
X=int(input())

for i in range(-100,100):
    for j in range(-100,100):
        if i**5==j**5+X:
            A=i
            B=j
            break
print(A,B)

Submission status: Runtime Error

Solution code:
import sys
x = int(sys.stdin.readline())
a = 0.1
b = 0
while not a.is_integer():
  a = x-b**5
  a = a**0.2
  b += 1
print(int(a), b-1)

Submission status: Runtime Error

Solution code:
import networkx as nx
import matplotlib.pyplot as plt
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

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

for k in range(1, 10000):
    for l in range(10000):
        if (l + k) ** 5 - l ** 5 == x:
            print(l + k, l)
            exit()
        if (l + k) ** 5 - l ** 5 > x:
            break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    X = int(input())
    for B in range(501):
        A5 = X + B ** 5
        A = int(A5 ** 0.2)
        if A ** 5 == A5:
            print(A, B)
            return 

        A5 = X - B ** 5
        A = int(A5 ** 0.2)
        if A ** 5 == A5:
            print(A, -B)
            return 

    print(-1)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import numpy as np
import math
x = int(input())
flag = False
for i in range(10**10):
    for j in range(1,10**10):
        if (i+j)**5-i**5 == x:
            print(i+j,j)
            flag = True
            break
        elif (i+j)**5-i**5 > x:
            break
    if Flag:
        break

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define emp emplace
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MAXN = 200100;
const ll INF = 1e9;
const ll MOD = 1e9+7;

ll N,Q,a,b,c,d,e,M,X;
ll A[MAXN];
ll B[MAXN];
map<ll,ll> p;
ll ans;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>X;
	for (int a=-1000;a<=1000;++a){
		for(int b=-1000;b<=1000;++b){
			if(a*a*a*a*a-b*b*b*b*b==X){
				cout<<a<<' '<<b;
				return 0;
			}
		}
	}
}

Submission status: Runtime Error

Solution code:
import numpy as np
import math
x = int(input())
flag = False
for i in range(10**10):
    for j in range(1,10**10):
        if (i+j)**5-i**5 == x:
            print(i+j,j)
            flag = True
            break
    if Flag:
        break

Submission status: Runtime Error

Solution code:
a = int(input())
x = int(input())
y = int(input())
if x**5 - y**5 == a:
  print (x,y)

Submission status: Runtime Error

Solution code:
x = int(input())

for i in range(x):
    s = x - i**5
    t = int(s ** 0.2)
    if(s == t**5):
        print(i,-t)
        exit()

Submission status: Runtime Error

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

for i in range(-1000,1000):
	B = i**5
	A5 = X + B
	T = abs(A5)
	C = T**0.2
	if int(C)==C:
		if T!=A5:C=-C
		print(str(int(C)) + ' ' + str(i))
		sys.exit()

assert False

Submission status: Runtime Error

Solution code:
import sys
X = int(input())
MAX = 10**9
M = [0]
i = 1
while i**5 < MAX:
  M.append(i**5)
  M.append(-i**5)
  i += 1
#print(M)
  
for i in M:
  for j in M:
    if (i%MAX - j%MAX)%MAX == X%MAX:
      if j < 0:
        print(int(i**(1/5)), -int((-j)**(1/5)))
      else:
        print(int(i**(1/5)), int(j**(1/5)))
      sys.exit(0)

Submission status: Runtime Error

Solution code:
from math import log, floor
s = int(input())
b = -1
while True:
    a = s + (b**5)
    temp_a = log(a, 2)
    if temp_a == floor(temp_a):
        print("{} {}".format(floor(temp_a), b))
        break
    b += 1

Submission status: Runtime Error

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    X = int(input())
    for B in range(1001):
        A5 = X + B ** 5
        A = int(A5 ** 0.2)
        if A ** 5 == A5:
            print(A, B)
            return 

        A5 = X - B ** 5
        A = int(A5 ** 0.2)
        if A ** 5 == A5:
            print(A, -B)
            return 


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
X = int(input())
MAX = 10**9
M = [0]
i = 1
while i**5 < MAX:
  M.append(i**5)
  M.append(-i**5)
  i += 1
#print(M)
  
for i in M:
  for j in M:
    if i - j == X:
      if j < 0:
        print(int(i**(1/5)), -int((-j)**(1/5)))
      else:
        print(int(i**(1/5)), int(j**(1/5)))
      sys.exit(0)

Submission status: Runtime Error

Solution code:
x=input()
a=[0]
d={}
for i in range(1,1000):
	a+=[i**5]
	a+=[-i**5]
	d[i**5]=i
	d[-i**5]=-i

a.sort()
for i in range(len(a)):
    if x+a[i] in a:
        print d[a[i]+x],d[a[i]]
        break

Submission status: Runtime Error

Solution code:
import sys
for i in range(1000):
    for j in range(1000):
        if i**5+j**5 == x:
            print(i, -j)
            sys.exit()
        if i**5-j**5 == x:
            print(i, j)
            sys.exit()

Submission status: Runtime Error

Solution code:
import sys
X = int(input())
MAX = 10**9
M = [1, -1]
i = 1
while i**5 < MAX:
  i += 1
  M.append(i**5)
  M.append(-i**5)
  
for i in M:
  for j in M:
    if i - j == X:
      if j < 0:
        print(int(i**(1/5)), -int((-j)**(1/5)))
      else:
        print(int(i**(1/5)), int(j**(1/5)))
      sys.exit(0)

Submission status: Runtime Error

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

import sys
sys.setrecursionlimit(300000)


def solve(X: int):
    a = 0
    b = 0
    while True:
        tmp = X + b ** 5
        t = int(tmp ** (1 / 5))
        if t ** 5 == tmp:
            a = t
            print(a, b)
            break
        tmp = X + (-b) ** 5
        t = int(tmp ** (1 / 5))
        if t ** 5 == tmp:
            a = t
            print(a, -b)
            break
        b += 1
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
input = sys.stdin.readline


def inp():
    return int(input())


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


X = inp()

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


assert False