Problem:


Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import queue
# import heapq


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 r(a, b):
    return (a ** 4) + ((a ** 3) * b) + ((a ** 2) * (b ** 2)) + (a * (b ** 3)) + (b ** 4)


def main():
    print(*solve())


def solve():
    X = int(input())
    facts = factorization(X)

    facts.sort(key=lambda x: x[0])
    f0 = facts[0][0]

    f1 = X // f0

    for a in range(10**7):
        b = f0 + a
        if r(a, b) == f1:
            return a, b

        a = -a
        b = f0 + a

        if a < b:
            a,b = b,a

        if r(a, b) == f1:
            return a, b


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np

x=int(input())

tmp_list=[]
c=0
tmp_2=0
while(1):
    tmp_1=c**5
    if (tmp_1 - tmp_2)<x:
        tmp_list+=[tmp_1]
    else:
        break
    tmp_2=tmp_1
    c+=1

tmp_list = np.array(tmp_list)

# 生側
ans=0
target = tmp_list
for i in np.flipud(target):
    for j in target:
        if x==i+j:
            print(int(i**(1/5)),int(j**(1/5)*(-1)))
            ans=1
            break
        if ans==1:
            break
if ans==0:
    # ふがわ
    for i in np.flipud(target):
        for j in target:
            if x==i-j:
                print(int(i**(1/5)),int(j**(1/5)))
                break

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
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 main():
    x=int(input())
    x_lis=make_divisors(x)
    q_lis=set()
    for xx in x_lis:#xの約数
        q_lis|={xx}
    for q in list(q_lis):
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b+=1
        a=q
        b=0
        while a**5-b**5<=x:
            if a**5-b**5==x:
                print(a,b)
                sys.exit()
            a+=1
            b-=1


if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())
import math
#print(x)
for i in range(1000000):
    a = x + (i ** 5)
    a2 = x + (-i ** 5)

    if a > 0:
        v = math.pow(a, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            if(v ** 5 - (i)**5) == x:
                print(v, i)
                break
    else:
        v = math.pow(-a, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            if((-v) ** 5 - i**5) == x:
                print(-v, i)
                break

    if a2 > 0:
        v = math.pow(a2, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            if((v) ** 5 - (-i)**5) == x:
                print(v, -i)
                break
    else:
        v = math.pow(-a2, 1.0/5.0)
        if v.is_integer():
            v=int(v)
            if((-v) ** 5 - (-i)**5) == x:
                print(-v, -i)
                break

Submission status: Wrong Answer

Solution code:
x = int(input())
i = 0
while i**5 < x and (i + 1)**5 < x:
    i += 1
tmp1 = i ** 5
rest1 = x - tmp1
j = 0
flag = 0
start, end = 0, rest1
while start <= end:
    middle = (start + end)//2
    if tmp1 + middle ** 5 > x:
        end = middle - 1
    elif tmp1 + middle ** 5 == x:
        flag = 1
        print(i, -middle)
        break
    else:
        start = middle + 1
if not flag:
    tmp2 = (i+1) ** 5
    rest1 = tmp2 - x
    start, end = 0, rest1
    while start <= end:
        middle = (start + end) // 2
        if tmp2 - middle ** 5 > x:
            start = middle + 1
        elif tmp2 - middle ** 5 == x:
            flag = 1
            print(i, -middle)
            break
        else:
            end = middle - 1

Submission status: Wrong Answer

Solution code:
x=int(input())
import math
x5=math.ceil(x**0.2)
#print(x5)
import numpy as np 
for ii in np.arange(x5,-1,-1):
    for jj in range(x5+1):
        #print(ii,jj)
        if ii**5+jj**5==x:
            print(ii,-jj)
            exit()
        if ii**5-jj**5==x:
            print(ii,jj)
            exit()

Submission status: Wrong Answer

Solution code:
import math

x = int(input())

ans = 0

a = 0

dst = x / 2

diff = x
while True:
    diff = x - int(math.pow(a, 5))

    if dst > diff:
        break
    else:
        a += 1

b = -int(pow(10, 5) - 1)

a_5 = int(math.pow(a, 5)) - x

while True:
    b_5 = int(math.pow(b, 5))
    if b_5 == a_5:
        break
    else:
        b += 1

print(ans)

Submission status: Wrong Answer

Solution code:
x=int(input())
if x >= 0:
  a=round(pow(x, 0.2))
  if x>a**5:
    b=-1*int(pow(x-a**5, 0.2))
  else:
    b=int(pow(a**5-x, 0.2))
else:
  b=round(pow(-x, 0.2))
  if -x>b**5:
    a=-1*int(pow(-x-b**5, 0.2))
  else:
    a=int(pow(b**5+x, 0.2))
print(a, b)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.readline
import math

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

def main():
    X = int(readline())
    if X == 1:
        print(0, -1)
        return
    fct = factorize(X)
    if len(fct) == 1:
        fct.append(1)
    f1 = fct[0]
    f2 = fct[1]
    ai = math.ceil(f1/2) - 10**3
    bi = ai - f1
    for i in range(2 * 10**3):
        if ai**4+ai**3*bi+ai**2*bi**2+ai*bi**3+bi**4 == f2:
            print(ai, bi)
            return
        ai += 1
        bi += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
X = int(input())
i=0
while(True):
  B =  i**5 - X
  if B<0:
    powB = pow(-B,0.2)
    if(float.is_integer(powB)):
      print(str(i)+" "+str(int(-powB)))
      break
  else:
    powB = pow(B,0.2)
    if(float.is_integer(powB)):
      print(str(i)+" "+str(int(powB)))
      break
  i+=1

Submission status: Wrong Answer

Solution code:
import sys

s = int(input())
#print(s)

N=100
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit

Submission status: Wrong Answer

Solution code:
x = int(input())

x2 = int(x**0.5)
if x2**5 == x:
  print(x2, 0)
  exit()
elif x2**5-1 == x:
  print(X2, -1)
  exit()

for i in range(1, int(x*0.5)+2):
  if i==0:
    continue
  if x%i == 0:
    tmp1 = 0
    tmp2 = 0
    a1 = i
    b1 = 0
    a2 = i-1
    b2 = -1
    while tmp1 <= x or tmp2 <= x:
      tmp1 = a1**5 - b1**5
      tmp2 = a2**5 - b2**5
      if tmp1 == x:
        print(a1, b1)
        exit()
      elif tmp2 == x:
        print(a2, b2)
        exit()
      a1+=1
      b1+=1
      a2-=1
      b2-=1

Submission status: Wrong Answer

Solution code:
X=int(input())
N=[0]*101
for i in range(0,101):
    N[i]=i**5
for i in range(0,101):
    for j in range(0,101):
        if abs(N[i]-N[j])==X:
            print(int(max(N[i],N[j])**(1/5)),int(min(N[i],N[j])**(1/5)))
            exit()
        elif N[i]+N[j]==X:
            print(int(N[i]**(1/5)),int(-1*N[j]**(1/5)))
            exit()

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

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())
if X == 1:
  print(1,0)
  sys.exit()

tmp = prime_factorize(X)
Xp = tmp[0]
Xpp = X/Xp

a_1 = 5
a_2 = - 10*Xp
a_3 =  10*Xp*Xp
a_4 = - 5*Xp*Xp*Xp
a_5 =  Xp*Xp*Xp*Xp - Xpp

ANS = np.roots([a_1, a_2, a_3, a_4, a_5])

for ans in ANS:
  if ans.imag == 0:
    if ans.real == int(ans.real):
      A = int(ans.real)
      B = A - Xp
      print(A,B)
      sys.exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
n = 10*10

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while r-l>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            l = mid+1
        else:
            r = mid-1
    return 0

def bln(dp,num):
    l = 0
    r = len(dp)-1
    while l-r>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            r = mid+1
        else:
            l = mid-1
    return 0
            
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]

for b in range(-n,n):
    num = x + b**5
    a = max(blp(ap,num),bln(an,num))
    if a:print(a,b) ; break

Submission status: Wrong Answer

Solution code:
x = int(input())

for i in range(int(x**(2/5)+1)):
    for j in range(-int((x)**(1/5))-1,int((x)**(1/5))+1):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
x = int(input())
flag = True
for a in range(-65, 65):
    for b in range(-65, 65):
        if a ** 5 - b ** 5 == x:
            print(' '.join([str(a), str(b)]))
            flag = False
            break
    if not flag:
        break

Submission status: Wrong Answer

Solution code:

x=int(input())
value=0
index=0
hashmap=dict()
while value<int(1e9)+1:
    value=pow(index,5)
    hashmap[value]=index
    index+=1
#print(hashmap)    

for i in range(1,100):
    b1=x+int(pow(i,5))
    b2=x+int(pow(-i,5))
#    print(i,b1,b2)
    if hashmap.get(b1)!=None:
        print(hashmap[b1],i)
        break
    if hashmap.get(b2)!=None:
        print(hashmap[b2],-i)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())

base = 0

count = 1
aa = [0,]
while X > base:
  base = count ** 5
  aa.append(base)
  count += 1

# print(aa)

answer = []

next = aa.pop()
# print(next)

A = len(aa) - 1
A5 = aa[len(aa) - 1]
# print(A, A5)
for i in range(0, A+1):
  if A5 + aa[i] == X:
    answer.append("{} {}".format(A, -i))

if answer:
  print(answer[0])
else:
  A += 1
  for i in range(0, A):
    if next - aa[i] == X:
      print(A, i)

Submission status: Wrong Answer

Solution code:
x = int(input())

notsolved = True
for a in range(-65, 65):
    if notsolved:
        for b in range(-65, 65):
            if a**5-b**5 < x:
                continue
            if a**5-b**5 == x:
                print(str(a)+" "+str(b))
                notsolved = False

Submission status: Wrong Answer

Solution code:
x = int(input())


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append((i, cnt))
    if tmp != 1:
        retval.append((tmp, 1))
    if not retval:
        retval.append((n, 1))
    return retval


fact = factorization(x)
a = fact[0][0]
a -= 1
b = -1


def f(a, b):
    return (a**5-b**5) == x


for z in range(1, 100000):
    if f(a*z, b*z):
        print(a, b)
        break

Submission status: Wrong Answer

Solution code:
X=int(input())
for B in range(10000):
    A = (X+(B**5))**(1/5)
    if (abs(A))%1==0:
        print(int(A), B)
        break
    B *= -1
    A = (X+(B**5))**(1/5)
    if (abs(A))%1==0:
        print(int(A), B)
        break

Submission status: Wrong Answer

Solution code:
x = int(input())
ls = []
for i in range(101):
    ls.append(pow(i, 5))

a = 1
while True:
    c = abs(x - pow(a, 5))
    if c in ls:
        print(a, ls.index(c))
        break

Submission status: Wrong Answer

Solution code:
x = int(input())

BIG = 1000000000

def form(k, f):
    return k*k*k*k + k*k*k*(k+f) + k*k*(k+f)*(k+f) + k*(k+f)*(k+f)*(k+f) + (k+f)*(k+f)*(k+f)*(k+f)

def check(f, s):
    k = -1
    b = BIG
    while b >= 1:
        while k+b <= BIG:
            k += b
            cur = form(k, f)
            if cur > s:
                k -= b
                break
        b //= 2

    if form(k, f) == s:
        print(k+f, k)
        return True
    return False


for d in range(1, x+1):
    if x%d == 0:
        if check(d, x//d):
            break
        if check(x//d, d):
            break
    if d*d > x:
        break

Submission status: Wrong Answer

Solution code:
import sys
key = int(input())
for i in range(0, 1000):
    for j in range(i + 1, 1000):
        if key == i ** 5 - j ** 5:
            print(i, j)
            sys.exit(1)
        elif key == i ** 5 - (-j) ** 5:
            print(i, -j)
            break
            sys.exit(1)

Submission status: Wrong Answer

Solution code:
import sys

X = int(sys.stdin.readline())

temp = [0, 
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, 
24883200000, 
25937424601, 
27027081632, 
28153056843, 
29316250624, 
30517578125, 
31757969376, 
33038369407, 
34359738368, 
35723051649, 
37129300000, 
38579489651, 
40074642432, 
41615795893, 
43204003424, 
44840334375, 
46525874176, 
48261724457, 
50049003168, 
51888844699, 
53782400000, 
55730836701, 
57735339232, 
59797108943, 
61917364224, 
64097340625, 
66338290976, 
68641485507, 
71008211968, 
73439775749, 
75937500000, 
78502725751, 
81136812032, 
83841135993, 
86617093024, 
89466096875, 
92389579776, 
95388992557, 
98465804768, 
101621504799, 
104857600000, 
108175616801, 
111577100832, 
115063617043, 
118636749824, 
122298103125, 
126049300576, 
129891985607, 
133827821568, 
137858491849, 
141985700000, 
146211169851, 
150536645632, 
154963892093, 
159494694624, 
164130859375, 
168874213376, 
173726604657, 
178689902368, 
183765996899, 
188956800000, 
194264244901, 
199690286432, 
205236901143, 
210906087424, 
216699865625, 
222620278176, 
228669389707, 
234849287168, 
241162079949, 
247609900000, 
254194901951, 
260919263232, 
267785184193, 
274794888224, 
281950621875, 
289254654976, 
296709280757, 
304316815968, 
312079600999, 
320000000000, 
328080401001, 
336323216032, 
344730881243, 
353305857024, 
362050628125, 
370967703776, 
380059617807, 
389328928768, 
398778220049, 
408410100000, 
418227202051, 
428232184832, 
438427732293, 
448816553824, 
459401384375, 
470184984576, 
481170140857, 
492359665568, 
503756397099, 
515363200000, 
527182965101, 
539218609632, 
551473077343, 
563949338624, 
576650390625, 
589579257376, 
602738989907, 
616132666368, 
629763392149, 
643634300000, 
657748550151, 
672109330432, 
686719856393, 
701583371424, 
716703146875, 
732082482176, 
747724704957, 
763633171168, 
779811265199, 
796262400000, 
812990017201, 
829997587232, 
847288609443, 
864866612224, 
882735153125, 
900897818976, 
919358226007, 
938120019968, 
957186876249, 
976562500000, 
996250626251, 
1016255020032, 
1036579476493, 
1057227821024, 
1078203909375, 
1099511627776, 
1121154893057, 
1143137652768, 
1165463885299, 
1188137600000, 
1211162837301, 
1234543668832, 
1258284197543, 
1282388557824, 
1306860915625, 
1331705468576, 
1356926446107, 
1382528109568, 
1408514752349, 
1434890700000, 
1461660310351, 
1488827973632, 
1516398112593, 
1544375182624, 
1572763671875, 
1601568101376, 
1630793025157, 
1660443030368, 
1690522737399, 
1721036800000, 
1751989905401, 
1783386774432, 
1815232161643, 
1847530855424, 
1880287678125, 
1913507486176, 
1947195170207, 
1981355655168, 
2015993900449, 
2051114900000, 
2086723682451, 
2122825311232, 
2159424884693, 
2196527536224, 
2234138434375, 
2272262782976, 
2310905821257, 
2350072823968, 
2389769101499, 
2430000000000, 
2470770901501, 
2512087224032, 
2553954421743, 
2596377985024, 
2639363440625, 
2682916351776, 
2727042318307, 
2771746976768, 
2817036000549, 
2862915100000, 
2909390022551, 
2956466552832, 
3004150512793, 
3052447761824, 
3101364196875, 
3150905752576, 
3201078401357, 
3251888153568, 
3303341057599, 
3355443200000, 
3408200705601, 
3461619737632, 
3515706497843, 
3570467226624, 
3625908203125, 
3682035745376, 
3738856210407, 
3796375994368, 
3854601532649, 
3913539300000, 
3973195810651, 
4033577618432, 
4094691316893, 
4156543539424, 
4219140959375, 
4282490290176, 
4346598285457, 
4411471739168, 
4477117485699, 
4543542400000, 
4610753397701, 
4678757435232, 
4747561509943, 
4817172660224, 
4887597965625, 
4958844546976, 
5030919566507, 
5103830227968, 
5177583776749, 
5252187500000, 
5327648726751, 
5403974828032, 
5481173216993, 
5559251349024, 
5638216721875, 
5718076875776, 
5798839393557, 
5880511900768, 
5963102065799, 
6046617600000, 
6131066257801, 
6216455836832, 
6302794178043, 
6390089165824, 
6478348728125, 
6567580836576, 
6657793506607, 
6748994797568, 
6841192812849, 
6934395700000, 
7028611650851, 
7123848901632, 
7220115733093, 
7317420470624, 
7415771484375, 
7515177189376, 
7615646045657, 
7717186558368, 
7819807277899, 
7923516800000, 
8028323765901, 
8134236862432, 
8241264822143, 
8349416423424, 
8458700490625, 
8569125894176, 
8680701550707, 
8793436423168, 
8907339520949, 
9022419900000, 
9138686662951, 
9256148959232, 
9374815985193, 
9494696984224, 
9615801246875, 
9738138110976, 
9861716961757, 
9986547231968, 
10112638401999, 
10240000000000, 
10368641602001, 
10498572832032, 
10629803362243, 
10762342913024, 
10896201253125, 
11031388199776, 
11167913618807, 
11305787424768, 
11445019581049, 
11585620100000, 
11727599043051, 
11870966520832, 
12015732693293, 
12161907769824, 
12309502009375, 
12458525720576, 
12608989261857, 
12760903041568, 
12914277518099, 
13069123200000, 
13225450646101, 
13383270465632, 
13542593318343, 
13703429914624, 
13865791015625, 
14029687433376, 
14195130030907, 
14362129722368, 
14530697473149, 
14700844300000, 
14872581271151, 
15045919506432, 
15220870177393, 
15397444507424, 
15575653771875, 
15755509298176, 
15937022465957, 
16120204707168, 
16305067506199, 
16491622400000, 
16679880978201, 
16869854883232, 
17061555810443, 
17254995508224, 
17450185778125, 
17647138474976, 
17845865507007, 
18046378835968, 
18248690477249, 
18452812500000, 
18658757027251, 
18866536236032, 
19076162357493, 
19287647677024, 
19501004534375, 
19716245323776, 
19933382494057, 
20152428548768, 
20373396046299, 
20596297600000, 
20821145878301, 
21047953604832, 
21276733558543, 
21507498573824, 
21740261540625, 
21975035404576, 
22211833167107, 
22450667885568, 
22691552673349, 
22934500700000, 
23179525191351, 
23426639429632, 
23675856753593, 
23927190558624, 
24180654296875, 
24436261477376, 
24694025666157, 
24953960486368, 
25216079618399, 
25480396800000, 
25746925826401, 
26015680550432, 
26286674882643, 
26559922791424, 
26835438303125, 
27113235502176, 
27393328531207, 
27675731591168, 
27960458941449, 
28247524900000, 
28536943843451, 
28828730207232, 
29122898485693, 
29419463232224, 
29718439059375, 
30019840638976, 
30323682702257, 
30629980039968, 
30938747502499]

for i, x in enumerate(temp):
    if x >= X:
        for j, y in enumerate(temp):
            if x - y == X:
                print(i, j)
                exit()
        temp_x = temp[i-1]
        for j, y in enumerate(temp):
            if temp_x + y == X:
                print(i-1, -j)
                exit()

Submission status: Wrong Answer

Solution code:
x = int(input())
a = 1
b = 1
while True:
    if type((a**5 - x) ** 0.2) == complex:
        if ((x - a**5) ** 0.2).is_integer():
            b = -int((x - a**5) ** 0.2)
            break
        a += 1
        continue
    elif ((a**5 - x) ** 0.2).is_integer():
        b = int((a**5 - x) ** 0.2)
        break
    a += 1
print('{} {}'.format(a, b))

Submission status: Wrong Answer

Solution code:
X = int(input())

# Aの数は10**4個ある
# そして二分探索する

nums = [0]
n = 0
while (((n + 1)**5) - (n**5)) <= 10 ** 9:
    nums.append((n + 1)**5)
    n += 1
# print(nums)
ans = None
for num in nums:
    if X - num in nums:
        ans = (num, -(X - num))
        break
    elif X + num in nums:
        ans = (num, X + num)
        break
if ans:
    print(*ans)

Submission status: Wrong Answer

Solution code:
import itertools

x = int(input())

y = itertools.combinations(range(-80,80), 2)
for n in y:
    if (n[0]**5 - n[1]**5) == x:
        print(n[0], n[1])
        break
    elif (n[1]**5 - n[0]**5) == x:
        print(n[1], n[0])
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
fives = list(i**5 for i in range(100))
for i, five in enumerate(fives):
    if five-X in fives:
        print(i, fives.index(five-X))
        break
    if X-five in fives:
        print(fives.index(X-five), -i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())
d = [[0 for i in range(110)] for j in range(110)]
e = [[0 for i in range(110)] for j in range(110)]
for i in range(110):
    d[0][i] = i**5
    d[i][0] = i**5
for i in range(1,110):
    for j in range(1,110):
        d[i][j] = d[0][j]-d[i][0]
        e[i][j] = d[0][j]+d[i][0]
for m in range(110):
    if x in d[m]:
        print(d[m].index(x),m)
        break
    elif x in e[m]:
        print(e[m].index(x),-m)
        break

Submission status: Wrong Answer

Solution code:
X = int(input())
f = []
for i in range(1,int(X**0.5)+1):
    if X % i == 0:
        f.append([i,X//i])
def fac(a,b):
    return a**4 + a*a*a*b + a*a*b*b + a*b*b*b + b**4
for i in range(len(f)):
    L = -f[i][0]
    R = 10**9
    while R - L > f[i][0]:
        a = (R+L)//2
        b = a - f[i][0]
        if fac(a,b) == f[i][1]:
            print(a,b)
            exit()
        elif fac(a,b) < f[i][1] and b >= 0:
            L = a
        elif fac(a,b) > f[i][1] and b < 0:
            L = a
        else:
            R = a

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
y = math.pow(x, 1.0/5.0)
a = math.ceil(y)
if a^5-(a-1)^5 == x:
    print(a, a-1)
else:
    print(a-1, -round((math.pow(-round((a-1)**5-x), 1/5))))

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(1,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(1,int(i[1]**(1/4))+3+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:

x = int(input())

def gen_divisor(x):
    for i in range(1, x + 1):
        if x % i == 0:
            yield i

def gen_candidates(divisor):
    a = 0
    while True:
        a = a + 1
        b = a - divisor
        if a**5 - b**5 == x:
            yield (a, b)
        elif a**5 - b**5 > x:
            break


for divisor in gen_divisor(x):
    for a, b in gen_candidates(divisor):
        print(a,b)
        break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
import math
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
if X!=1:
    M=prime_factorize(X)
    M=list(set(M))
else:
    M=[1]
p=math.sqrt(X)
p=int(p)
for i in M:
    for k in range(p):
        A=k
        B=A-i
        if A**5-B**5==X:
            print(A,B)
            break

Submission status: Wrong Answer

Solution code:
x = int(input())
s = -(int(x**0.2)-1)
g = int(x**0.2)+1
for i in range(s,x):
    r = i**5 + x
    if (r**0.2)%1 == 0:
        print(-i,-int(r**0.2))
        exit()

Submission status: Wrong Answer

Solution code:
x = int(input())

memo = [0]
i = 1
while(pow(i, 5) < 10**9):
  memo.append(pow(i, 5))
  i+=1
  
  
for i in range(len(memo)):
  for j in range(len(memo)):
    if memo[i]-memo[j] == x:
      print(i, j)
      exit()
    if memo[i]+memo[j]  == x:
      print(i, -j)
      exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
a=1
while a<1001:
    for i in range(-1000,1001):
        if a**5+i**5==X:
            b=i
            print(a,b)
            exit()
    a+=1

Submission status: Wrong Answer

Solution code:
x = int(input())

a = [i**5 for i in range(0, 65)]

for i in range(65):
    flag = 0
    for j in range(65):
        if a[i] - a[j] == x:
            print(i,j)
            flag = 1
            break
            
        if a[i] + a[j] == x:
            print(i,-j)
            flag = 1
            break
    if flag == 1:
        break

Submission status: Wrong Answer

Solution code:
# Problem D - I hate Factorization

# 素因数分解
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

# input
X = int(input())

# initialization
f_list = factorization(X)
f_list = sorted(f_list, key=lambda x: x[0])

# count
ans = [0, 0]
is_ok = False
for f in f_list:
    for k in range(1, f[1]+1):
        tmp_num = f[0] ** k
        tmp_num_2 = X // tmp_num


        for a in range(tmp_num, -1, -1):
            b = a - tmp_num
            if (a**4 + (a**3) * b + (a**2) * (b**2) + a*(b**3) + b**4)==tmp_num_2:
                ans[0] = a
                ans[1] = b
                is_ok = True
                break
        if is_ok:
            break

# output
print(" ".join(list(map(str, ans))))

Submission status: Wrong Answer

Solution code:
def I(): return int(input())
X = I()
kouho = []
for i in range(100):
    kouho.append(i**5)
for a in kouho:
    for b in kouho:
        if a<b:
            continue
        if a+b==X:
            print(int(a**(1/5)),int(-b**(1/5)))
            break
        if a-b==X:
            print(int(a**(1/5)),int(b**(1/5)))
            break

Submission status: Wrong Answer

Solution code:
import collections
x = int(input())
a = b = 0
b = -1
l = [i**5 for i in range(1000)]
for i in range(1000):
    tmp_i = i**5
    tmp_l = list(map(lambda n: n+tmp_i, l))
    if x in tmp_l:
        b = i-1
        a = tmp_l.index(x)+1
print(a, b)

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    X = int(input())

    N = int( X ** (1/5) ) + 1

    isFound = False

    res = [N-1,0]

    for i in range(N):
        A = N - i
        temp1 = X - A ** 5
        if temp1 >= 0:
            temp1 = int( temp1 ** (1/5) )
        else:
            temp1 *= -1
            temp1 = int( temp1 ** (1/5) )
            temp1 *= -1
        # print(A,temp1)
        posi = True
        nega = True
        for j in range(N):
            if posi:
                Bp = temp1 + j
                # print(A,Bp)
                temp2 = A ** 5 - Bp ** 5
                if temp2 == X:
                    res = [A,Bp]
                    isFound = True
                    break
                if temp2 < X:
                    posi = False
            if nega:
                Bn = temp1 - j
                # print(A,Bn)
                temp2 = A ** 5 - Bn ** 5
                if temp2 == X:
                    res = [A,Bn]
                    isFound = True
                    break
                if temp2 > X:
                    nega = False
        if isFound:
            break

    print(res[0],res[1])



main()

Submission status: Wrong Answer

Solution code:
import itertools


max_num = 2000
num_list = [i for i in range(-max_num,  max_num+1)]
num_comb = list(itertools.combinations(num_list, 2))

x = int(input().strip())
for comb in num_comb:
    a = comb[0]
    b = comb[1]
    a5 = a ** 5
    b5 = b ** 5
    if a5 - b5 == x:
        print(a, b)
        break