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

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

Solution code:
X = int(input())

c = []
for i in range(1, int((X+1)**(1/2))+1):
    if i != 0 and X % i == 0:
        c.append([i, X//i])

for x1, x2 in c:
    for b in range(-1000, 1000):
        if b != 0:
            if (x1+b)**3 * (2*b+x1) + (b**2) * (x1**2 + 3*x1*b+3*(b**2)) == x2:
                print(x1+b, b)
                break

Submission status: Accepted

Solution code:
X= int(input())

for b in range(-200, 200):
    for a in range(200):
        if a**5 == X + b**5:
            ans =(a, b)
            break
print(*ans)

Submission status: Accepted

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

for b in range(0, -1000, -1):
    for a in range(100, -1000, -1):
        if (a ** 5 - b ** 5) == X:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
import math
import itertools
X = int(input())
# a = math.floor((math.pow(X, 1/5)))
lst = [i**5 for i in range(0, 10000)]
comb = itertools.combinations(lst, 2)
for i in comb:
    if i[0]-i[1] == X:
        a = math.pow(i[0], 1/5)
        b = math.pow(i[1], 1/5)
        print("{} {}".format(int(a), int(b)))
        break
    elif i[0]+i[1] == X:
        a = math.pow(i[0], 1/5)
        b = -math.pow(i[1], 1/5)
        print("{} {}".format(int(a), int(b)))
        break
    elif -i[0]-i[1] == X:
        a = -math.pow(i[0], 1/5)
        b = math.pow(i[1], 1/5)
        print("{} {}".format(int(a), int(b)))
        break
    elif -i[0]+i[1] == X:
        a = -math.pow(i[0], 1/5)
        b = -math.pow(i[1], 1/5)
        print("{} {}".format(int(a), int(b)))
        break

Submission status: Accepted

Solution code:
X = int(input())
for B in range(131):
    for A in range(B,131):
        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            exit()
        elif A**5 + B**5 == X:
            print(str(A) + " " + str(-1*B))
            exit()

Submission status: Accepted

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)
 
    # divisors.sort()
    return divisors

yakusu = make_divisors(X)
for k in yakusu:
    for A in range(-1000, 1000):
        B = A-k
        if A**4 + (A**3)*B + (A**2)*(B**2) + A*(B**3) + B**4 == X/k:
            print(A, B)
            break

Submission status: Accepted

Solution code:
x=int(input())

flag=0
for i in range(-121,400):
  for j in range(0,150):
    n=j**5-((i)**5)
    
    if n==x:
      flag=1
      a=j
      b=i
      break
  if flag==1:
    break
print(a,b)

Submission status: Accepted

Solution code:
import sys

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

N=1000
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: Accepted

Solution code:
x = int(input())

a = 0
while True:
	t = abs(a**5-x)
	s = 0
	c = 0
	while s<t:
		c += 1
		s = c**5
	
	if s == t:
		b = int(c*((a**5-x)/t))
		break
	a += 1

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

Submission status: Accepted

Solution code:
def main():
    x=int(input())
    for i in range(1000):
        for j in range(-1000,1000):
            if pow(i,5)-pow(j,5)==x:
                print(str(i)+" "+str(j))
                exit()

if __name__ =='__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

memo = [0]
i = 1
while(pow(i, 5) < 10**18):
  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: Accepted

Solution code:
#!/usr/bin/env python3
X = int(input().strip())


def solve():
    nums = [i ** 5 for i in range(-1000, 1000)]
    ans = set()
    for A in nums:
        for B in nums:
            if A - B == X:
                a = 0 if A == 0 else int(A / abs(A) * (abs(A) ** 0.2))
                b = 0 if B == 0 else int(B / abs(B) * (abs(B) ** 0.2))
                print(a, b)
                exit()

solve()

Submission status: Accepted

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

x = input()
X = int(x)

div = make_divisors(X)

for item in div:
    for A in range(-1000,1000):
        B = A - item

        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            break
        else:
            continue
        break

Submission status: Accepted

Solution code:
import math

X = int(input())
# X = 33981761


def calculate(x):

    b = 0
    while True:
        tmp1 = x + b ** 5
        a1 = math.pow(tmp1, 0.2)

        if (a1 - math.floor(a1) < 1e-7):
            print(int(a1), int(b))
            break

        tmp2 = x + (-1 * b) ** 5
        if tmp2 >= 0:
            a2 = math.pow(tmp2, 0.2)
            if (a2 - math.floor(a2) < 1e-7):
                print(int(a2), int(-1 * b))
                break

        b = b + 1


calculate(X)

Submission status: Accepted

Solution code:
x = int(input())

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

for i in range(300):
    flag = 0
    for j in range(300):
        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: Accepted

Solution code:
X = int(input())

# a-bで割り切れるからa-bをXの約数になるようにする
# a-bはXの倍数、aとbはxで割ったときの余りは等しく

# aとbは-100~+100の中にあると思うので、総当たりしてしまう

flag = False
for a in range(1000):
    for b in range(-1000,1000):
        if a-b == 0:
            break
        if X%(a-b) == 0 and a**5 - b**5 == X:
                flag = True
        if flag:
            break
    if flag:
        break
print(str(a) + ' ' + str(b))

Submission status: Accepted

Solution code:
X = int(input())

CNT = 500

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    inf = 1e9
    x = ri()
    n = 0
    nums = dict()
    bef = 0
    while True:
        p = n**5
        if p - bef > 2*inf:
            break
        nums[p] = n
        nums[-p] = -n
        bef = p
        n += 1
    for i in range(n+1):
        p = i**5
        if x+p in nums:
            print(nums[x+p],i)
            return
        if x-p in nums:
            print(nums[x-p],-i)
            return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

flag = False
for i in range(150):
    for j in range(150):
        if i**5 - j**5 == X:
            print(i,j)
            flag = True
            break
        if (-i)**5 - j**5 == X:
            print(-i,j)
            flag = True
            break
        if i**5 - (-j)**5 == X:
            print(i,-j)
            flag = True
            break
        if (-i)**5 - (-j)**5 == X:
            print(-i,-j)
            flag = True
            break
    if flag:
        break

Submission status: Accepted

Solution code:
x = int(input())

for a in range(122):
    for b in range(-122,122):
        if a**5 - b**5 == x:
            print(a,b)
            break
    else:
      continue
    break

Submission status: Accepted

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

Solution code:
def I(): return int(input())
X = I()
kouho = []
for i in range(1000):
    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: Accepted

Solution code:
X = int(input())
#Y = int(X**(1/5))

for i in range(10001):
    for j in range(10001):
        if i**5 + j**5 ==X:
            x=max(i,j)
            y=min(i,j)
            print(x, -y)
            exit()
        if i**5 - j**5 ==X:
            x=max(i,j)
            y=min(i,j)
            print(x, y)
            exit()

Submission status: Accepted

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

while (5*a**4+10*a**3+5*a**2+1 < X):
    a = a + 1

I = [i for i in range(-a,a+1)]

flag = 0

for i in I:
    for j in range(-a,i+1):
        if (i**5 - j**5 == X):
            print("%d %d" % (i, j))
            flag = 1
    if (flag):
        break

Submission status: Accepted

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

for i in range(-1000, 1001):
    # print(i)
    for j in range(-1000, 1001):
        # print(i**5 - j**5)
        if (i**5 - j**5) == X:
            print(str(i) + ' ' + str(j))
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())

for A in range(-500,500):
    for B in list(range(-500,500)):
        if A**5 - B**5 == X:
            print(f'{A} {B}')
            exit()

Submission status: Accepted

Solution code:
x=int(input())
c=0
for i in range(0,501):
    for j in range(0,501):
        if (i*i*i*i*i)+(j*j*j*j*j)==x:
            print(i,"-"+str(j))
            c+=1
            break
        elif (i*i*i*i*i)-(j*j*j*j*j)==x:
            print(i,j)
            c+=1
            break
    if c==1:
        break

Submission status: Accepted

Solution code:
X = int(input())
div = []
for i in range(1, int(X**0.5)+1):
    if X % i == 0:
        div.append(i)
        if i != X // i:
            div.append(X//i)
for p in div:
    i = 0
    while (i+p-p//2)**5 - (i-p//2) ** 5 <= X:
        if (i+p-p//2)**5 - (i-p//2) ** 5 == X:
            print(i+p-p//2, i-p//2)
            break
        i += 1
    else:
        continue
    break
    i = 0
    while (i+p)**5 - i ** 5 <= X:
        if (i+p)**5 - i ** 5 == X:
            print(i+p, i)
            break
        i += 1
    else:
        continue
    break

Submission status: Accepted

Solution code:
import sys
X = int(input())
for i in range(-300,300):
    for j in range(-300,300):
        if i**5-j**5 == X:
            print("{0} {1}".format(i,j))
            sys.exit(0)

Submission status: Accepted

Solution code:
import math
import numpy as np
x = int(input())
for i in range(1, 10**6):
	b_tmp = np.power(i, 5) - x
	b = round(np.power(max(b_tmp, -b_tmp), 0.2), 10)
	if float.is_integer(b):
		if b_tmp < 0:
			print(i, int(-b))
			break
		else:
			print(i, int(b))
			break

Submission status: Accepted

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)

    # divisors.sort()
    return divisors
  
divisors = make_divisors(x)

for d in divisors:
  b = - int(x**(1/5)) - 1
  f = False
  while True:
    if (b+d)**5 - b**5 == x:
      f = True
      break
    elif (b+d)**5 - b**5 > x and b > 0:
      break
    b += 1
  if f:
    print(b+d, b)
    break

Submission status: Accepted

Solution code:
X = int(input())

A = []
for i in range(1000):
    A.append(i ** 5)

x, y = 0, 0

flag = False
for i, a in enumerate(A):
    for j, b in enumerate(A[i+1:]):
        if b - a == X:
            flag = True
            x = j + i + 1
            y = i
            break
        if a + b == X:
            flag = True
            x = i
            y = -(j + i + 1)
            break
    if flag:
        break
print(x, y)

Submission status: Accepted

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    x = int(input())
    a = 0
    bl = -1000
    br = 1000
    b = False
    while not b:
        z = a**5
        bl = -1000
        br = 1000
        while abs(bl-br)!=1:
            if z-((bl+br)//2)**5<x:
                br = (bl+br)//2
            elif z-((bl+br)//2)**5>x:
                bl = (bl+br)//2
            if z-((bl+br)//2)**5==x:
                b = (bl+br)//2
                break
        if not b:
            a += 1
    print(a,b)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

a = 0
b = 0
while True :
    b1 = 0
    b2 = 0
    y = a**5-x
    if y>0 :
        z = float(y)**0.2
        b1 = int(z)
        b2 = int(z) + 1
    elif y<0 :
        z = -((-float(y))**0.2)
        b1 = int(z)
        b2 = int(z) -1
    else :
        break

    if y==b1**5 :
        b = b1
        break
    elif y==b2**5 :
        b = b2
        break
    else :
        a = -a
        if a>=0 :
            a += 1
        
print(a,b)

Submission status: Accepted

Solution code:
X = int(input())
flag=1
for A in range(-500,500):
    for B in range(-500,500):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
import itertools
x = int(input())
digits = len(str(x))
dic = {}
keta = []
for i in range(121):
    num = i ** 5    
    if (num > 10**(digits+2)):
        break
    if num > 10**(digits-2):
        dic[i] = num
        dic[-i] = -num
    elif num < 10**(digits+1):
        dic[i] = num
        dic[-i] = -num
        
for num1,num2 in itertools.combinations(dic.keys(), 2):
    a, b = dic[num1], dic[num2]
    if x == (a-b):
        ans = (num1,num2)
        break
    if x == (-a+b):
        ans = (num2,num1)
        break
print(f"{ans[0]} {ans[1]}")

Submission status: Accepted

Solution code:
def find(n):
  dif = 0
  i = 0
  while dif <=n:
    i+=1
    dif=i**5-(i-1)**5
  return i


X= int(input())
lim = find(X)
condition = True
for i in range(lim):
  if condition:
    puissance = i**5-X
    signe = (abs(puissance)//puissance)
    entier = int(((puissance*signe)**(1/5)))
    if entier**5 == signe*puissance:
      print(i, entier*signe)
      condition = False

Submission status: Accepted

Solution code:
X = int(input())

c = 1
result = False


while not result:
    for i in range(c):
        a = c -i
        b = i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        b = c - i
        a = - i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        a = -c+i
        b = -i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    for i in range(c):
        a = i
        b = -c + i
        if a**5 - b**5 == X:
            result = True
            A = a
            B = b
            break
    if result == True:
        break
    c += 1

print(A, B)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
import numpy as np
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

# coding: utf-8
# Your code here!
#N, K = map(int, input().split())
X = int(input())

div = make_divisors(X)

for diff in div:
    for a in range(int(X**0.5)):
        if (a**5 - (a-diff)**5) == X:
            print(a, a-diff)
            break

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

al = [i**5 for i in range(0, 1001)]
bl = [i**5 for i in range(0, 1001)]

for i in bl:
    a1 = x - i
    a2 = x + i
    if a1 in al:
        print(al.index(a1), - (bl.index(i)))
        exit()
    if a2 in al:
        print(al.index(a2), bl.index(i))
        exit()

Submission status: Accepted

Solution code:
x=int(input())
a=0
while True:
    g=a**5
    c=g-x
    b=(abs(c))**(0.2)
    b=round(b)
    if abs(c)-b**5==0:
        b=round(b)
        if c<0:
            b=-b
        break
    a+=1
print(a, b)

Submission status: Accepted

Solution code:
import sys

x=int(input())
for a in range(10**3):
    for b in range(10**3):
        if a**5 - b**5==x:
            print(a,b)
            sys.exit()
        if (-a)**5 - b**5==x:
            print(-a,b)
            sys.exit()
        if a**5 - (-b)**5==x:
            print(a,-b)
            sys.exit()
        if (-a)**5 - (-b)**5==x:
            print(-a,-b)
            sys.exit()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

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

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if (a ** 5 - b ** 5) == X:
                print("{} {}".format(a, b))
                exit()

    logging.info("error")
        
            
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X=int(input())
ans=[]
for i in range(1,1000):
  for j in range(-1000,1000):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])

Submission status: Accepted

Solution code:
import sys

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())
yakusu = make_divisors(x)
for i in yakusu:
    for a in range(-int(x**(1/4)+1),int(x**(1/4)+2)):
        b = i + a
        if a**5 - b**5 == x:
            print(a,b)
            exit()
        b = -i + a
        if a**5 - b**5 == x:
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())
A=[]
i=1
while i*i<=x:
  if x%i==0:
    A += [i, x//i]
  i += 1
for j in A:
  c= j//2
  a = c
  while a**5-(a-j)**5 < x:
    a +=1
  else:
    if a**5-(a-j)**5 == x:
      print(a,a-j)
      break

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

x = int(input())

m = 500
aa = [0]*(m*2)
for i in range(-m,m):
    j = -m+i
    aa[j] = i**5

for i in range(m*2):
    for j in range(m*2):
        if aa[i] - aa[j] == x:
            print(-m+i,-m+j)
            exit()

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    x=int(readline())
    to=1001
    memo=[0]*to
    #memo={}
    for i in range(to):
        memo[i]=i**5

    a=0
    b=0
    if x==0:
        print(a,b)
        return

    for i in range(to):
        z1=x-memo[i]
        z2=memo[i]-x
        if z1 in memo:
            a=i
            for j in range(to):
                if memo[j]==z1:
                    b=j*-1
            break
        if z2 in memo:
            a=i
            for j in range(to):
                if memo[j]==z2:
                    b=j
            break
    #if a!=0 or b!=0:
    #    print(a,b)
    #    return
    print(a,b)
    return
    
    b=1000**5
    for i in range(1001,100000000):
        a=b
        b=i**5
        if (b-a)==x:
            print(i,(i-1))
            return

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

x = int(input())
div = make_divisors(x)

if x == 1: print("0 -1")

for i in range(len(div)//2):
    u = div[i*2]
    if len(div)%2 == 1: v = div[i*2]
    else: v = div[i*2+1]
    t = int(v**(1/2))
    for j in range(t):
        a = j
        b = j-u
        if a**4 + (a**3)*b +(a**2)*(b**2) + a*(b**3) + b**4 == v:
            print(a, b)
            break

Submission status: Accepted

Solution code:
x=int(input())

for a in range(1000):
    for b in range(-1000,1000):
        if(a**5-b**5==x):
            print(a,b)
            exit()

Submission status: Accepted

Solution code:
import numpy as np
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
n = int(input())
a_b = sorted(make_divisors(n))
flag = False
for i in a_b:
  if i ** 5 == n:
    print(i, 0)
    break
  else:
    for b in range(-int(np.sqrt(n)), int(np.sqrt(n + 1))):
      if (i+b)**5-b**5 == n:
        print(i + b, b)
        flag = True
        break
  if flag:
    break

Submission status: Accepted

Solution code:
# D - I hate Factorization
x = (int)(input())

flg = False
if x >= 0:
    for i in range(0, x + 1):
        for j in range(-i - 1, i + 1):
            if i ** 5 - j ** 5 == x:
                flg = True
                break

        if flg:
            print(str(i) + " " + str(j))
            break
else:
    for i in range(0, x + 1):
        for j in range(-i - 1, i + 1):
            if i ** 5 - j ** 5 == x:
                flg = True
                break

        if flg:
            print(str(j) + " " + str(i))
            break

Submission status: Accepted

Solution code:
x = int(input())

for i in range(2*10**2):
    for j in list(range(-i, i)):
        if i**5 - j**5 == x:
            print(i, j)
            break

Submission status: Accepted

Solution code:
x=int(input())
ans=[]
for a in range(1001):
    for b in range(-1000,1001):
        if a==b==0:
            pass
        else:
            if x%(a**4+a*a*a*b+a*a*b*b+a*b*b*b+b**4)==0:
                if a**5-b**5==x:
                    print(a,b)
                    exit()

Submission status: Accepted

Solution code:
def main():
    x=int(input())
    for i in range(-200, 200):
        for j in range(-200,200):
            if  i*i*i*i*i-j*j*j*j*j==x:
                print(i, j)
                return

if __name__=='__main__':
    main()