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:
def factorization(n):
    from collections import Counter
    arr = Counter()
    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[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(arr.keys()) == 0 and n != 1:
        arr[n] = 1

    return arr


X = int(input())
arr = factorization(X)
INF = 10 ** 15
if X == 1:
    print(0, -1)
    exit()

for p in arr:
    a = 0
    A = pow(a, 5)
    b = a - p
    B = pow(b, 5)
    while A - B <= X:
        if A - B == X:
            print(a, b)
            exit()
        a += 1
        A = pow(a, 5)
        b = a - p
        B = pow(b, 5)

Submission status: Wrong Answer

Solution code:
import math

def resolve():
    x = int(input())

    five_f = []
    for i in range(101):
        five_f.append(i ** 5)

    for five_fa in five_f:
        if x - five_fa in five_f:
            print(-int(math.pow(five_fa, 1 / 5)), int(math.pow(x - five_fa, 1 / 5)))
            return
        elif x + five_fa in five_f:
            print(int(math.pow(five_fa, 1 / 5)), int(math.pow(x - five_fa, 1 / 5)))
            return
resolve()

Submission status: Wrong Answer

Solution code:
X = int(input())

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

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


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

lst = make_divisors(X)

ans_A = 0
ans_B = 0
flag = True
for l in lst:
    a = l
    b = 0
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        flag = False
    while flag and calc(a, b) < X:
        a += 1
        b += 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            flag = False

    a = l -1
    b = -1
    if calc(a, b) == X:
        ans_A = a
        ans_B = b
        flag = False

    while flag and calc(a, b) < X:
        a -= 1
        b -= 1
        if calc(a, b) == X:
            ans_A = a
            ans_B = b
            flag = False



print(str(ans_A), str(ans_B))

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

fL = [i**5 for i in range(0, 101)]

for i, f1 in enumerate(fL):
    for j, f2 in enumerate(fL):
        a = j
        b = i
        if f1 + f2 == x:
            print(a, -b)
            exit()
        if f1 - f2 == x:
            print(b, a)
            exit()

Submission status: Wrong Answer

Solution code:
X = int(input())
A = 0
B = 0

for a in range(int(X ** 0.25 - 1), X + 1):
    b = - (X - a ** 5) ** 0.2

    if b.imag == 0.0 and b == int(b):
        A = a
        B = b
        break

print(str(A) + " " + str(B))

Submission status: Wrong Answer

Solution code:
x=int(input())
y=int(x**(-3))

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

Submission status: Wrong Answer

Solution code:
import math
def D():
    X = int(input())
    for x in range(X):
        A = math.pow(x, 5)
        B = A-X
        ans = math.log(abs(B), 5)
        if B == 0 or ans.is_integer():
            print(int(x), int(ans))

D()

Submission status: Wrong Answer

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:
        if j**5 >= X:
            print(j,B.index(A[j]))
            break
        else:
            print(-j,B.index(A[j]))
            break

Submission status: Wrong Answer

Solution code:
import math
X=int(input())
for a in range(-X,X+1):
    if pow(a,5)-1==X:
        print(a,1)
        break
    elif pow(a,5)+1==X:
        print(a,-1)
        break

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(0,100000+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:
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

S = int(input())
l = factorization(S)

if len(l) == 1:
    l.append([0,0])
    f = l[0][0] * l[0][1]
    s = l[1][0] * l[1][1]
    print(f, s)

f = l[0][0]*l[0][1]
s = l[1][0]*l[1][1]

for i in range(-f, f):
    a = f + i
    b = i
    if a**4+a**3*b+a**2*b**2+a*b**3+b**4 == s:
        print(a, b)
        exit()

Submission status: Wrong Answer

Solution code:
x=int(input())
a=0
b=0
for i in range(0,x):
  for j in range(-i,x):
    if i**5-j**5==x:
      a=i
      b=j
      break
  else:
    continue
  break
print(a,b)

Submission status: Wrong Answer

Solution code:
X=int(input())
ans1=0
ans2=0
for a in range(-(10*9),10*9):
    for b in range(-(10*9),10*9):
        if a**5-b**5==X:
            ans1=a
            ans2=b
            break
print(ans1,ans2)

Submission status: Wrong Answer

Solution code:
import itertools


X = int(input())
ans_A = 0
ans_B = 0
for i, j in itertools.combinations(range(0, 200), 2):
    j *= -1
    if i**5 - j**5 == X:
        ans_A = i
        ans_B = j
        break
if ans_A == 0 and ans_B == 0:
    for i, j in itertools.combinations(range(0, 200), 2):
        if i**5 - j**5 == X:
            ans_A = i
            ans_B = j
            break
print(ans_A, ans_B)

Submission status: Wrong Answer

Solution code:
x=int(input())
for n in range(10**4+1):
    try:
        t = int((n**5-x)**(1/5))
        if isinstance(t,int)==True:
            print(n,t)
            exit()
    except TypeError:
        continue

Submission status: Wrong Answer

Solution code:
# D
x = int(input())
for b in range(-1000, 1001):
    a = x + b**5
    if a**5 - b**5 == x:
        print(a, b)

Submission status: Wrong Answer

Solution code:
x = int(input())
for a in range(-1000,1001):
    b = int(pow(a,5))+x
    if b<0:
        continue
    b = pow(b,1/5)
    if b==int(b):
        if int(pow(a,5) - int(pow(b,5))) == x:
            print(a,int(b))
            break

Submission status: Wrong Answer

Solution code:
import math
from itertools import combinations as c
x=int(input())
if x==1:
    print("0 -1")
else:
    ans=int(math.log(x)/math.log(5))
    c=list(c(range(1,ans+1),2))
    count=0
    for i,j in c:
        if i**5 - j**5==x:
            print(j,i)
            break
        elif (-i)**5-(-j)**5==x:
            print(-j,-i)
            break
        elif (-i)**5-(j)**5==x:
            print(j,-i)
            break
        elif (i)**5-(-j)**5==x:
            print(-j,i)
            break

Submission status: Wrong Answer

Solution code:
X = int(input())
A = 0
B = 0

for a in range(int(X ** 0.25 - 1), X + 1):
    b = - (X - a ** 5) ** 0.2

    if b.imag == 0.0 and b == int(b):
        A = a
        B = b

print(str(A) + " " + str(B))

Submission status: Wrong Answer

Solution code:
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
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
    
x=int(input())

if is_prime(x):
    for i in range(118):
        a = i+1
        b = i
        n = a**5 - b**5
        if n == x:
            print('{} {}'.format(a,b))

else:
    divisors = make_divisors(x)
    for d in divisors:
        #print(d)
        for i in range(-2,118):
            a = i+d
            b = i
            n = a**5 - b**5
            #print(i, n)
            if n == x:
                print('{} {}'.format(a,b))
                import sys
                sys.exit()
            if n > 10**9:
                break

Submission status: Wrong Answer

Solution code:
X = int(input())

if X == 1:
    print(1,0)
    exit()

def repeat_any_square( a,n ):
    if n == 1:
        return a
    x = repeat_any_square( a,n//2 )
    x *= x
    if n % 2 == 1:
        x *= a
    return x

ans = []
for i in range(-1000,1000):
    ans.append(repeat_any_square(i,5))

#print(ans)
for i in range(2000):
    if ((ans[i] - X) in ans) == True:
        print(ans[i] ** (1/5),(ans[i]-X)**(1/5))
        exit()

Submission status: Wrong Answer

Solution code:
import sys


X = int(sys.stdin.readline().rstrip())
Y = [i ** 5 for i in range(X + 1)]

def check(d):
    if d == 1:
        print(0, -1)
    for a in range(1, d // 2 + 1):
        b = a - d
        a5 = Y[a]
        b5 = Y[b] if b >= 0 else -Y[-b]
        if a5 == b5 + X:
            print(a, b)
            sys.exit()


for i in range(1, int(X**0.5)+1):
    if X % i == 0:
        check(i)
        if i != X // i:
            check(X//i)

Submission status: Wrong Answer

Solution code:
def pow1(x, n):
    if n == 0: return 1
    value = pow1(x, int(n / 2))
    value *= value
    if n % 2 == 1: value *= x
    return value
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

X = int(input())
a=prime_factorize(X)
for j in range(len(a)):
    for i in range (50000):
        if pow1(i-25000,5)-pow1(i-25000-a[j],5)==X:
            ans1=i-25000
            ans2=i-25000-a[j]
            print(ans1,ans2)
            break

Submission status: Wrong Answer

Solution code:
import sys,bisect,string,math,time,functools,random
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            a,b,c=(inp+[1])[:3]
            org_inp.append(inp)
        else:
            index=0
            a,b,c=(ls[i]+[1])[:3]
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

class Tree:
    def __init__(self,inp_size=None,init=True):
        if init:
            self.stdin(inp_size)
        return

    def stdin(self,inp_size=None):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1)
        return
    
    def listin(self,ls):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls)
        return

    def __str__(self):
        return  str(self.edges)

    def dfs(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append(x)
        v=[-1]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==-1:
                    q.append(nb)
                    v[nb]=func(v[c],nb,d)
        return v

    def EulerTour(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append((-1,x))
        v=[None]*self.size
        v[x]=root_v
        et=[]
        while q:
            cb,ce=q.pop()
            et.append(ce)
            for nb,d in self.edges[ce]:
                if v[nb]==None:
                    q.append((nb,ce))
                    q.append((ce,nb))
                    v[nb]=func(v[ce],nb,d)
        vid=[[-1,-1]for i in range(self.size)]
        for i,j in enumerate(et):
            if vid[j][0]==-1:
                vid[j][0]=i
            else:
                vid[j][1]=i
        return v,et,vid
    
    def LCA_init(self,depth,et):
        self.st=SegTree(self.size*2-1,func=min,ide=inf)
        for i,j in enumerate(et):
            self.st.update(i,j)
        self.LCA_init_stat==True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            depth,et,vid=self.EulerTour(root)
            self.LCA_init(depth,et)
        return self.st.query(x,y+1)

## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

show_flg=False
show_flg=True

def func(y):
    global x
#    show('d',y)
    for i in range(int(x**0.2)-10**4,int(x**0.2)+10**5):
        if (i)**5-(i-y)**5==x:
            return i,i-y
    
    l,r=0,10**18+1
    while r-l>1:
        mid=(l+r)//2
        #show((l,r),(mid+y,mid),(mid+y)**5-mid**5)
        if (mid+y)**5-mid**5==x:
            return mid+y,mid
        if (mid+y)**5-mid**5>=x:
            r=mid
        else:
            l=mid
    
    l,r=-10**18,0
    while r-l>1:
        mid=(l+r)//2
        #show((l,r),(mid+y,mid),(mid+y)**5-mid**5)
        if (mid+y)**5-mid**5==x:
            return mid+y,mid
        if (mid+y)**5-mid**5>=x:
            l=mid
        else:
            r=mid
        
    return -1


x=I()

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

for i in range(1,int(x**0.5)+1+1):
    if x%i==0:
        
        k=func(i)
        if k==-1:
            0
        else:
            print(*k)
            exit()

        k=func(x//i)
        if k==-1:
            0#continue
        else:
            print(*k)
            exit()

Submission status: Wrong Answer

Solution code:
def main():
    x = int(input())

    i = 0
    while True:
        j = i ** 5
        a1, a2 = x + j, x - j

        p = a1 ** (1 / 5)
        if int(p) - p == 0:
            p = int(p)
            print(p, i)
            break
        if a2 >= 0:
            p = a2 ** (1 / 5)
            if int(p) - p == 0:
                p = int(p)
                print(p, -1 * i)
                break
        else:
            p = abs(a2) ** (1 / 5) * -1
            if int(p) - p == 0:
                p = int(p)
                print(p, -1 * i)
                break
        i += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
import itertools
X=int(input())
S=round(math.sqrt(X))
list=[]
list5x=[]
list=range(-S,S)
def calc_5p(n):
    return n ** 5
for val in list:
    list5x.append(calc_5p(val))
print(list5x)
for c  in itertools.combinations(list5x, 2):
    if sum(c) == X:
        c0 = int(math.pow(c[0], 1/5))
        c1 = int(math.pow(c[1], 1/5))
        if c0>=0 and c1>=0:
          if c0>c1:
            c1=-c1
          if c0<c1:
            c0=-c0
          print(c0,c1)
          break;
        if c0<0:
          c0 = -c0
          print(c0,c1)
          break;
        if c1<0:
          c1 = -c1
          print(c0,c1)
          break;

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
x=int(input())
c=1

while c**5<x:
  c+=1
b=0  
c+=1
for i in range(c-1,-1,-1):
  if c**5-i**5==x:
    b=i
    break
  if (c-1)**5-i**5==x:
    b=i
    c-=1
    break
    
    
print(c,b)

Submission status: Wrong Answer

Solution code:
def main():
    x=int(input())
    chec=0
    if x<0:
        x=-x
        chec=1
    for i in range(x):
        if i**5<x:
            for j in range(x):
                s=i**5-(-j)**5
                if s==x:
                    if chec==1:
                        print(-j,i)
                        
                        return 0
                    else:
                        print(j,-i)
                        
                        return 0
        elif x<i**5:
            for j in range(x):
                s=i**5-(j)**5
                if s==x:
                    if chec==1:
                        print(j,i)
                        
                        return 0
                    else:
                        print(i,j)
                        
                        return 0
        else:
            print(i,0)
            return 0
main()

Submission status: Wrong Answer

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:
        a = -a
        a = pow(a, 1.0 / 5.0)
        if a.is_integer():
            A, B = int(-a), -b
            break
    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: Wrong Answer

Solution code:
def read_int():
    return int(input())

def read_int_map():
    return map(int,input().split(' '))

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

def read_s_list_loop(n):
    return [input() for _ in range(n)]

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

X = read_int()

prime_value  = prime_factorize(X)

def calc(diff):
    threads = 10**10
    a = diff
    b = 0
    ## + & +
    while True:
        tmp_x =  (a**5 - b**5)
        if tmp_x == X:
            print(a,b)
            exit(0)
        elif tmp_x > threads:
            break
        a += 1
        b += 1

    a = diff
    b = 0
    ## + & - and -
    while True:
        tmp_x =  (a**5 - b**5)
        if tmp_x == X:
            print(a,b)
            exit(0)
        elif tmp_x > threads:
            break
        a -= 1
        b -= 1
calc(1)
for p in prime_value:
    calc(p)

Submission status: Wrong Answer

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

y = floor(10 ** 1.8)
s = -floor(10 ** 1.8)
t = -floor(10 ** 1.8)

a = 0
b = 0

while s < y:
    t = -y
    while t < y:
        if s ** 5 - t ** 5 == x:
            a = int(s)
            b = int(t)
        t += 1
    s += 1

print(a, b)

Submission status: Wrong Answer

Solution code:
def abc166_d():
  x = int(input())

  def divisor(n):
    # nの約数列挙、戻り値はsortされていない
    ret = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        ret.append(i)
        ret.append(n//i)
    return ret

  divs = sorted(divisor(x))
  a = 0
  b = divs[1]
  while True:
    if a**5 - (a-b)**5 == x:
      print(a, b)
      return
    a += 1

abc166_d()

Submission status: Wrong Answer

Solution code:
X = int(input())
x = 1
while ((x-1)**4)*9 < X:
  x += 1
for i in range(x):
  for j in range(-x, i):
    if i**5-j**5 == X:
      a = [i,j]
      print(*a)

Submission status: Wrong Answer

Solution code:
import sys
import math
sys.setrecursionlimit(10**9)

def main():
    X = int(input())
    for b in range(-1000000,1000000):
        a = pow(X+b**5,1/5)
        if a.imag == 0:
            a = a.real
            if a.is_integer():
                if int(a**5) - b**5 == X:
                    print(int(a),b)
                    exit()



if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
X = int(input())
factors = []

for f in range(1, int(X ** (1 / 2)) + 1, 2):
    if X % f == 0:
        for i in range(f):
            a = i
            b = a - f
            if X % (a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4) == 0:
                print(a, b)
                break
        if X % (a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4) == 0:
            break
    if X % (a ** 4 + a ** 3 * b + a ** 2 * b ** 2 + a * b ** 3 + b ** 4) == 0:
        break

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
i = 0
j = 0
while True:
    a = pow((i ** 5 + x), 0.2)
    afloor = math.floor(a)
    aceil = math.ceil(a)
    b = pow((i ** 5 + x),0.2)
    bfloor = math.floor(b)
    bceil = math.ceil(b)
    zero = 0.00000001 
    if abs(a - afloor) <= zero or abs(a - aceil):
        j = (i ** 5 + x) ** (1 / 5)
        print(i, int(j))
        exit()
    if  abs(b - bfloor) or abs(b - bceil):
        j = (i ** 5 - x) ** (1/5)
        print(i, int(j))
        exit()
    i += 1

Submission status: Wrong Answer

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

for i in range(0 - X, X):
        A5 = 0
        A5 = X + (i ** 5)
        A = A5 ** (1/5)
        # print(type(A))
        if type(A) is float:
                if A.is_integer() is True:
                        print(i, A)
                        break

Submission status: Wrong Answer

Solution code:
x = int(input())


i = 0
a, b = 0, 0
while i**5 < x:
    i += 1
mx = i
for k in range(-mx, mx + 1):
    for j in range(-k, k + 1):
        if k**5 - j**5 == x:
            a, b = k, j
print(a, b)

Submission status: Wrong Answer

Solution code:
def main():
  from itertools import combinations
  x = int(input())
  ls = [0]
  a = 0
  b = 0
  if x == 1:
    print(0, -1)
    exit()
  for i in range(1, 100):
    ls.append(i**5)
    ls.append(-i**5)
  ls.sort()
  for b in ls:
    if x + b in ls:
      a = x + b  
      break
  if a < 0:
    print(-1*int(pow(-a, 0.2)), end=' ')
  else:
    print(int(pow(a, 0.2)), end=' ')
  if b < 0:
    print(-1*int(pow(-b, 0.2)), end=' ')
  else:
    print(int(pow(b, 0.2)), end=' ')
  


if __name__ == '__main__':
  main()