s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s144947329
p01137
u731235119
1421956071
Python
Python
py
Runtime Error
19930
4404
238
import math while 1 : e = int(raw_input()) if e == 0: break z = 0 m = e while math.pow(z,3) <= e: y = 0 while y ** 2 <= e - math.pow(z,3): m = min(e + y + z - y**2 - math.pow(z,3), m) y += 1 z += 1 print int(m) quit()
s082286684
p01137
u120360464
1423024523
Python
Python
py
Runtime Error
19920
42872
398
#! /usr/bin/python # -*- coding: utf-8 -*- e = int(raw_input()) while e != 0: Min = 1000000 for i in range(e+1): z = i if z*z*z > e: break y = 0 x = 0 while (y+1)*(y+1) <= e-z*z*z: y += 1 while (x+1) <= e-z*z*z-y*y: x += 1 Min = min(x+y+z, Min) print min(x+y+z, Min) e = int(raw_input())
s748243750
p01137
u120360464
1423024693
Python
Python
py
Runtime Error
19920
42872
398
#! /usr/bin/python # -*- coding: utf-8 -*- e = int(raw_input()) while e != 0: Min = 1000000 for i in range(e+1): z = i if z*z*z > e: break y = 0 x = 0 while (y+1)*(y+1) <= e-z*z*z: y += 1 while (x+1) <= e-z*z*z-y*y: x += 1 Min = min(x+y+z, Min) print min(x+y+z, Min) e = int(raw_input())
s347968627
p01137
u120360464
1423025525
Python
Python
py
Runtime Error
19930
43740
367
#! /usr/bin/python # -*- coding: utf-8 -*- e = int(raw_input()) while e != 0: Min = 1000000 for i in range(e+1): z = i if z*z*z > e: break y = 0 x = 0 while (y+1)*(y+1) <= e-z*z*z: y += 1 x = e-z*z*z-y*y Min = min(x+y+z, Min) print min(x+y+z, Min) e = int(raw_input())
s957999028
p01137
u120360464
1423025819
Python
Python
py
Runtime Error
19910
43904
332
#! /usr/bin/python # -*- coding: utf-8 -*- import math e = int(raw_input()) while e != 0: Min = 1000000 for i in range(e+1): z = i if z*z*z > e: break y = int(math.sqrt(e-z*z*z)) x = e-z*z*z-y*y Min = min(x+y+z, Min) print min(x+y+z, Min) e = int(raw_input())
s460773718
p01137
u120360464
1423026789
Python
Python
py
Runtime Error
19920
43672
367
#! /usr/bin/python # -*- coding: utf-8 -*- e = int(raw_input()) while e != 0: Min = 1000000 for i in range(e+1): z = i if z*z*z > e: break y = 0 x = 0 while (y+1)*(y+1) <= e-z*z*z: y += 1 x = e-z*z*z-y*y Min = min(x+y+z, Min) print min(x+y+z, Min) e = int(raw_input())
s139879121
p01137
u124909914
1432627261
Python
Python3
py
Runtime Error
19930
6716
820
cubics = [ x * x * x for x in range(101)] squares = [ x * x for x in range(1000)] while True: x, y, z = -1, -1, -1 m = 1000000 e = int(input()) if e == 0: break # for i in range(len(cubics)): # if e - cubics[i] < 0: # e -= cubics[i - 1] # z = i - 1 # break # for i in range(len(squares)): # if e - squares[i] < 0: # e -= squares[i -1] # y = i - 1 # break # x = e for cubic in cubics: if e < cubic: break else: z += 1 tmp = e - cubic #print("tmp:",tmp) y = -1 for squ in squares: if tmp < squ: break else: x = tmp - squ y += 1 #print(x,y,z) m = min(m, x + y + z) print(m)
s535395930
p01137
u966364923
1436984577
Python
Python3
py
Runtime Error
39860
6752
376
def main(): while True: e = int(input()) if e==0: return m = e z = int(e**(1/3)) while z >= 0: y = int(int(e-z**3)**(1/2)) while y >= 0: x = e - z**3 - y**2 m = min(m, x+y+z) y -= 1 z -= 1 print(m) if __name__ == '__main__': main()
s318008994
p01137
u966364923
1436985209
Python
Python3
py
Runtime Error
39870
6752
376
def main(): while True: e = int(input()) if e==0: return m = e z = int(e**(1/3)) while z >= 0: y = int(int(e-z**3)**(1/2)) while y >= 0: x = e - z**3 - y**2 m = min(m, x+y+z) y -= 1 z -= 1 print(m) if __name__ == '__main__': main()
s150053600
p01137
u966364923
1439525503
Python
Python3
py
Runtime Error
39860
6784
384
def main(): while True: e = int(input()) if e==0: return m = e z = int(e**(1/3)) while z >= 0: y = int(int(e-z**3)**(1/2)) while y >= 0: x = e - z**3 - y**2 m = min(m, x+y+z) y -= 1 z -= 1 print(m) if __name__ == '__main__': main()
s292315555
p01137
u966364923
1439525606
Python
Python3
py
Runtime Error
39860
6780
384
def main(): while True: e = int(input()) if e==0: return m = e z = int(e**(1/3)) while z >= 0: y = int(int(e-z**3)**(1/2)) while y >= 0: x = e - z**3 - y**2 m = min(m, x+y+z) y -= 1 z -= 1 print(m) if __name__ == '__main__': main()
s958938440
p01137
u966364923
1439829315
Python
Python3
py
Runtime Error
40000
7808
384
def main(): while True: e = int(input()) if e==0: return m = e z = int(e**(1/3)) while z >= 0: y = int(int(e-z**3)**(1/2)) while y >= 0: x = e - z**3 - y**2 m = min(m, x+y+z) y -= 1 z -= 1 print(m) if __name__ == '__main__': main()
s239900306
p01137
u766163292
1455379985
Python
Python3
py
Runtime Error
40000
8532
509
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import math def solve(e): candidates = array.array("L") for z in range(0, math.floor(math.pow(e, 1.0 / 3.0)) + 1): for y in range(0, math.floor(math.sqrt(e - z * z * z)) + 1): x = e - z * z * z - y * y candidates.append(x + y + z) return min(candidates) if __name__ == '__main__': while True: e = int(input()) if e == 0: break else: print(solve(e))
s312340557
p01137
u766163292
1455380385
Python
Python3
py
Runtime Error
40000
11060
502
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import heapq import math def solve(e): candidates = [] for z in range(0, math.floor(math.pow(e, 1.0 / 3.0)) + 1): for y in range(0, math.floor(math.sqrt(e - z * z * z)) + 1): x = e - z * z * z - y * y heapq.heappush(candidates, x + y + z) return candidates[0] if __name__ == '__main__': while True: e = int(input()) if e == 0: break else: print(solve(e))
s277338652
p01137
u766163292
1455454724
Python
Python3
py
Runtime Error
40000
11132
572
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import heapq import math def solve(e): candidates = [] for z in range(0, math.floor(math.pow(e, 1.0 / 3.0)) + 1): if e < z * z * z: break else: for y in range(0, math.floor(math.sqrt(e - z * z * z)) + 1): x = e - z * z * z - y * y heapq.heappush(candidates, x + y + z) return candidates[0] if __name__ == '__main__': while True: e = int(input()) if e == 0: break else: print(solve(e))
s099553356
p01137
u248416507
1464233658
Python
Python
py
Runtime Error
40000
38104
586
if __name__ == "__main__": while True: e = input() if e == 0: break min = 1000000 for x in range(1000001): if x > e: break for y in range(1001): if x + (y * y) > e: break for z in range(11): temp = x + (y * y) + (z * z * z) if temp > e: break elif temp == e: if temp < min: min = x + y + z print min
s669068276
p01137
u798803522
1469550856
Python
Python3
py
Runtime Error
40000
7768
827
import math targ = int(input()) while True: y,z =0,0 minans = float("inf") if (targ ** ( 1 / 3)) == int(targ ** ( 1 / 3)): z = int(targ ** ( 1 / 3)) targ = 0 elif (targ ** ( 1 / 2)) == int(targ ** ( 1 / 2)): y = int(targ ** ( 1 / 2)) targ = 0 else: for n in range(math.ceil(targ ** ( 1 / 3))): if minans == 0: break for m in range(math.ceil(targ ** ( 1 / 2))): if n ** 3 + m **2 > targ: break if minans > targ - (n ** 3 + m ** 2): minans = targ - (n ** 3 + m ** 2) y,z = m,n if minans != float("inf"): print(minans + y + z) else: print(y + z) targ = int(input()) if targ == 0: break
s294160384
p01137
u798803522
1469615947
Python
Python3
py
Runtime Error
40000
7736
831
import math targ = int(input()) while True: y,z =0,0 minans = float("inf") if (targ ** ( 1 / 3)) == int(targ ** ( 1 / 3)): z = int(targ ** ( 1 / 3)) targ = 0 elif (targ ** ( 1 / 2)) == int(targ ** ( 1 / 2)): y = int(targ ** ( 1 / 2)) targ = 0 else: for n in range(math.ceil(targ ** ( 1 / 3))): if minans == 0: break for m in range(math.ceil(targ ** ( 1 / 2))): if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m ** 2): minans = targ - (n ** 3 + m ** 2) y,z = m,n if minans != float("inf"): print(minans + y + z) else: print(y + z) targ = int(input()) if targ == 0: break
s950214703
p01137
u798803522
1469619372
Python
Python3
py
Runtime Error
0
0
793
import math targ = int(input()) while True: minans = float("inf") if (targ ** ( 1 / 3)) == int(targ ** ( 1 / 3)): z = int(targ ** ( 1 / 3)) targ = 0 elif (targ ** ( 1 / 2)) == int(targ ** ( 1 / 2)): y = int(targ ** ( 1 / 2)) targ = 0 else: for n in range(math.ceil(targ ** ( 1 / 3))): if minans == 0: break for m in range(math.ceil(targ ** ( 1 / 2))): if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m ** 2) + n + m: minans = targ - (n ** 3 + m ** 2) + n + m if minans != float("inf"): print(minans) else: print(y + z) targ = int(input()) if targ == 0: break
s726629414
p01137
u798803522
1469620307
Python
Python3
py
Runtime Error
0
0
763
import math targ = int(input()) while True: minans = float("inf") if (targ ** ( 1 / 3)) == int(targ ** ( 1 / 3)): z = int(targ ** ( 1 / 3)) targ = 0 elif (targ ** ( 1 / 2)) == int(targ ** ( 1 / 2)): y = int(targ ** ( 1 / 2)) targ = 0 else: for n in range(math.ceil(targ ** ( 1 / 3))): if minans == 0: break m = int(math.sqrt(targ - n**3)) if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m**2) + n + m: minans = targ - (n ** 3 + m**2) + n + m if minans != float("inf"): print(minans) else: print(y + z) targ = int(input()) if targ == 0: break
s656767043
p01137
u798803522
1469620454
Python
Python3
py
Runtime Error
0
0
751
targ = int(input()) while True: minans = float("inf") if (targ ** ( 1 / 3)) == int(targ ** ( 1 / 3)): z = int(targ ** ( 1 / 3)) targ = 0 elif (targ ** ( 1 / 2)) == int(targ ** ( 1 / 2)): y = int(targ ** ( 1 / 2)) targ = 0 else: for n in range(math.ceil(targ ** ( 1 / 3))): if minans == 0: break m = int(math.sqrt(targ - n**3)) if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m**2) + n + m: minans = targ - (n ** 3 + m**2) + n + m if minans != float("inf"): print(minans) else: print(y + z) targ = int(input()) if targ == 0: break
s771238819
p01137
u798803522
1469622086
Python
Python3
py
Runtime Error
0
0
525
import math targ = int(input()) y,z = 0,0 while True: minans = float("inf") for n in range(math.ceil(targ ** ( 1 / 3))+1): if minans == 0: break m = int(math.sqrt(targ - n**3)) if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m**2) + n + m: minans = targ - (n ** 3 + m**2) + n + m if minans != float("inf"): print(minans) else: print(y + z) targ = int(input()) if targ == 0: break
s934375782
p01137
u798803522
1469622117
Python
Python3
py
Runtime Error
0
0
525
import math targ = int(input()) y,z = 0,0 while True: minans = float("inf") for n in range(math.ceil(targ ** ( 1 / 3))+1): if minans == 0: break m = int(math.sqrt(targ - n**3)) if (n ** 3) + (m **2) > targ: break if minans > targ - (n ** 3 + m**2) + n + m: minans = targ - (n ** 3 + m**2) + n + m if minans != float("inf"): print(minans) else: print(y + z) targ = int(input()) if targ == 0: break
s047622270
p01137
u166860661
1482069861
Python
Python
py
Runtime Error
0
0
470
#coding: utf-8 def yis(z): for i in range(1000): if i * i > e - z * z * z: y = i - 1 break return y while True: e = int(raw_input()) y = 0 z = 0 if e == 0: break for i in range(100): if i * i * i > e: z = i - 1 break n = z m = e for i in range(n + 1): y = yis(z) m = min(m,e - y * y - z * z * z + y + z) z = z - 1 print m
s344343433
p01137
u737543412
1491888143
Python
Python3
py
Runtime Error
40000
7704
576
import math # z ??¨ y ????±?????????????x????±????????????? # ?????????????????°????????????e?????????????????? 10^5 ??? while True: e = int(input()) if e == 0: break min_e = e for i in range( math.floor(pow(e, 1.0/3.0)) + 1 ): for j in range( math.floor(math.sqrt(e - i**3)) + 1): x = e - (i**3) - (j**2) y = j z = i # print(x) # print(y) # print(z) # print("") if ( (x + y + z) < min_e ): min_e = x + y + z print(min_e)
s743761672
p01137
u923668099
1495622544
Python
Python3
py
Runtime Error
40000
7936
499
import sys inf = 1<<30 def solve(): while 1: e = int(sys.stdin.readline().rstrip()) if e == 0: return ans = inf for z in range(int(e**(1/3)) + 10): if e - z**3 < 0: break for y in range(int((e - z**3)**0.5) + 10): x = e - z**3 - y**2 if x < 0: break ans = min(ans, x + y + z) print(ans) if __name__ == '__main__': solve()
s457387474
p01137
u659034691
1503516880
Python
Python3
py
Runtime Error
0
0
194
#grab e=int(input()) while e>0: z=0 while z**3<=e z+=1 z-=1 e-=z**3 y=0 while y*y<=e: y+=1 y-=1 e-=y*y e+=y+z print(e) e=int(input())
s411068072
p01137
u015553205
1507403592
Python
Python3
py
Runtime Error
40000
7724
299
Answer = [] while True: e = int(input()) if e == 0: break m = e for z in range(int(e**(1/3)+1)): for y in range(int((e-z**3)**(1/2))+1): x = e-z**3-y**2 m = min(m,x+y+z) Answer.append(m) for i in range(len(Answer)): print(Answer[i])
s850500147
p01137
u015553205
1507403971
Python
Python3
py
Runtime Error
40000
7660
372
Answer = [] while True: e = int(input()) if e == 0: break m = e for z in range(int(e**(1/3)+1)): if e == z**3: m = min(m,z) else: for y in range(int((e-z**3)**(1/2)+1)): x = e-z**3-y**2 m = min(m,x+y+z) Answer.append(m) for i in range(len(Answer)): print(Answer[i])
s425684854
p01137
u506554532
1513070662
Python
Python3
py
Runtime Error
0
0
300
def ok(m,e): for x in range(m+1): for y in range(m+1-x): z = m-x-y if z < 0: break if x + y**2 + z**3 == e: return True return False while True: E = int(input()) if E == 0: break m = 1 while not ok(m,E): m += 1 print(m)
s387982625
p01137
u506554532
1513071260
Python
Python3
py
Runtime Error
0
0
306
def ok(m,e): for z in range(m+1): if z**3 > e: return False for y in range(m-z+1): x = m-z-y if x + y**2 + z**3 == e: return True return False while True: E = int(input()) if E == 0: break m = 1 while not ok(m,E): m += 1 print(m)
s808312544
p01137
u506554532
1513073206
Python
Python3
py
Runtime Error
0
0
344
def ok(m,e): for z in range(m+1): if z**3 > e: return False for y in range(m-z+1): if z**3 + y**2 > e: break x = m-z-y if z**3 + y**2 + x == e: return True return False while True: E = int(input()) if E == 0: break m = 1 while not ok(m,E): m += 1 print(m)
s714663443
p01137
u741801763
1514809363
Python
Python3
py
Runtime Error
0
0
244
while 1: e = int(input()) if not e :break m = e for z in range(e): for y in range(e): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s565903421
p01137
u741801763
1514809478
Python
Python3
py
Runtime Error
0
0
244
while 1: e = int(input()) if not e :break m = e for z in range(e): for y in range(e): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s377803622
p01137
u741801763
1514809721
Python
Python3
py
Runtime Error
0
0
298
import numpy while 1: e = int(input()) if e == 0 :break m = e for z in range(int(numpy.cbrt(e))+1): for y in range(int(numpy.sqrt(e) + 1)): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s638681070
p01137
u741801763
1514809736
Python
Python3
py
Runtime Error
0
0
298
import numpy while 1: e = int(input()) if e == 0 :break m = e for z in range(int(numpy.cbrt(e))+1): for y in range(int(numpy.sqrt(e) + 1)): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s869824120
p01137
u741801763
1514809867
Python
Python3
py
Runtime Error
0
0
277
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(e): for y in range(int(math.sqrt(e))+ 1): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s035429829
p01137
u741801763
1514809956
Python
Python3
py
Runtime Error
0
0
277
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(e): for y in range(int(math.sqrt(e))+ 1): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s319055324
p01137
u741801763
1514810325
Python
Python3
py
Runtime Error
0
0
275
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(e): for y in range(int(math.sqrt(e))+ 1): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s851116014
p01137
u741801763
1514810419
Python
Python3
py
Runtime Error
0
0
295
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(int(math.sqrt(e)) + 1): for y in range(int(math.sqrt(e))+ 1): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s084130478
p01137
u672443148
1515082118
Python
Python3
py
Runtime Error
0
0
260
while True: e=int(input()) if e==0: break m=e for z in range(int(e**(1/3))+1): temp=e-z**3 for y in range(int(e**(1/2))+1): x=temp-y**2 if x>=0 and (x+y+z<m): m=x+y+z print(m)
s142102259
p01137
u672443148
1515082577
Python
Python3
py
Runtime Error
0
0
272
while True: e=int(input()) if e==0: break m=e for z in range(int(e**(1/3))+1,-1,-1): temp=e-z**3 for y in range(int(e**(1/2))+1,-1,-1): x=temp-y**2 if x>=0 and (x+y+z<m): m=x+y+z print(m)
s313797908
p01137
u672443148
1515082632
Python
Python3
py
Runtime Error
0
0
275
while True: e=int(input()) if e==0: break m=e for z in range(int(e**(1/3))+1,-1,-1): temp=e-z**3 for temp in range(int(e**(1/2))+1,-1,-1): x=temp-y**2 if x>=0 and (x+y+z<m): m=x+y+z print(m)
s327874462
p01137
u672443148
1515082856
Python
Python3
py
Runtime Error
0
0
271
while True: e=int(input()) if e==0: break m=e for z in range(int(e**(1/3)),-1,-1): temp=e-z**3 for y in range(int(temp**(1/2)),-1,-1): x=temp-y**2 if x>=0 and (x+y+z<m): m=x+y+z print(m)
s611947690
p01137
u741801763
1517744473
Python
Python3
py
Runtime Error
0
0
295
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(int(math.sqrt(e)) + 1): for y in range(int(math.sqrt(e))+ 1): if e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z print(m)
s960642345
p01137
u741801763
1517746014
Python
Python3
py
Runtime Error
0
0
269
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(int(math.sqrt(e)) + 1): for y in range(int(math.sqrt(e))+ 1): x = e - y**2-z**3 if x <0:break if m > x+y+z: m = x+y+z print(m)
s808918123
p01137
u741801763
1517748416
Python
Python3
py
Runtime Error
0
0
269
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(int(math.sqrt(e)) + 1): for y in range(int(math.sqrt(e))+ 1): x = e - y**2-z**3 if x <0:break if m > x+y+z: m = x+y+z print(m)
s228225312
p01137
u741801763
1517748429
Python
Python3
py
Runtime Error
0
0
274
import math while 1: e = int(input()) if e == 0 :break m = e for z in range(int(math.sqrt(e)) + 1): for y in range(int(math.sqrt(e))+ 1): x = e - y**2-z**3 if x < 0:continue if m > x+y+z: m = x+y+z print(m)
s829429386
p01137
u234579471
1521980053
Python
Python3
py
Runtime Error
0
0
346
while True: e = int(input()) if e == 0: break m = e + 1 for y in range(e + 1): y2 = y ** 2 if y2 > e: break for z in range(e + 1): z3 = z ** 3 if z3 + y2 > e: break x = e - y2 - z3 m = min(m, x + y + z) print(m)
s643658157
p01137
u234579471
1521980618
Python
Python3
py
Runtime Error
0
0
385
while True: e = int(input()) if e == 0: break m = e + 1 y = 0 while y <= e: y2 = y ** 2 if y2 > e: break z = 0 while z <= e: z3 = z ** 3 if z3 + y2 > e: break x = e - y2 - z3 m = min(m, x + y + z) z += 1 y += 1 print(m)
s532941500
p01137
u234579471
1521980803
Python
Python3
py
Runtime Error
0
0
395
flg = True while flg: e = int(input()) if e == 0: break m = e + 1 y = 0 while y <= e: y2 = y ** 2 if y2 > e: break z = 0 while z <= e: z3 = z ** 3 if z3 + y2 > e: break x = e - y2 - z3 m = min(m, x + y + z) z += 1 y += 1 print(m)
s951785423
p01137
u234579471
1521981901
Python
Python3
py
Runtime Error
0
0
281
while True: e = int(input()) if e == 0: break m = e + 1 y = 0 while y ** 2 <= e: z = 0 while y ** 2 + z ** 3 <= e: x = e - y ** 2 - z ** 3 m = min(m, x + y + z) z += 1 y += 1 print(m)
s247901875
p01137
u234579471
1521982171
Python
Python3
py
Runtime Error
0
0
286
while True: e = int(input()) if e == 0: break m = e + 1 y = 0 while y ** 2 <= e: z = 0 while y ** 2 + z ** 3 <= e: x = e - y ** 2 - z ** 3 m = min(m, x + y + z) z += 1 y += 1 print(m)
s133595375
p01137
u234579471
1521982724
Python
Python3
py
Runtime Error
0
0
290
while True: e = int(input().strip()) if e == 0: break m = e + 1 y = 0 while y ** 2 <= e: z = 0 while y ** 2 + z ** 3 <= e: x = e - y ** 2 - z ** 3 m = min(m, x + y + z) z += 1 y += 1 print(m)
s342316809
p01137
u878596989
1523853374
Python
Python3
py
Runtime Error
0
0
266
while True: e = int(input()) temp = 10**6 if e == 0: break for z in range(int(e**(1/3)+1)): for y in range(int((e-z**3)**(1/2)+1)): x = e-z**3-y**2 if x+y+z < temp: temp = x+y+z print(temp)
s993064656
p01137
u269391636
1523867075
Python
Python3
py
Runtime Error
0
0
255
while(True): e = int(input()) if e == 0: quit() ans = e for i in range(0,int(e ** (1/3))+1): for j in range(0,int((e - i ** 3)**0.5)+1): k = e - i ** 3 - j ** 2 + i + j if k < ans: ans = k print(ans)
s330826590
p01137
u269391636
1523867437
Python
Python3
py
Runtime Error
0
0
254
while(True): e = int(input()) if e == 0: quit() ans = e for i in range(0,int(e ** (1/3))+1): for j in range(0,int((e - i ** 3)**0.5)+1): k = e - i ** 3 - j ** 2 + i + j if k < ans: ans = k print(ans)
s154685307
p01137
u859637829
1523868338
Python
Python3
py
Runtime Error
0
0
686
import math def solve(e): k = [] for z in range(99, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) xzlm = 3 * z * z + 3 * z + 1 for y in range(ylm, -1, -1): y2 = y * y if y2 > e2: continue e3 = e2 - y2 xylm = 2 * y + 1 x = e3 if x > xylm or x > xzlm: continue k.append(z + y + x) return sorted(k)[0] def main(): while True: a = int(input()) if a == 0: break print(solve(a)) if __name__ == '__main__': main()
s114441186
p01137
u859637829
1523868462
Python
Python3
py
Runtime Error
0
0
682
import math def solve(e): k = 2 ** 32 for z in range(99, -1, -1): z3 = z * z * z if z3 > e: continue e2 = e - z3 ylm = int(math.sqrt(e2)) xzlm = 3 * z * z + 3 * z + 1 for y in range(ylm, -1, -1): y2 = y * y if y2 > e2: continue e3 = e2 - y2 xylm = 2 * y + 1 x = e3 if x > xylm or x > xzlm: continue k = min(k, x + y + z) return k def main(): while True: a = int(input()) if a == 0: break print(solve(a)) if __name__ == '__main__': main()
s591351137
p01137
u878596989
1523876381
Python
Python3
py
Runtime Error
0
0
448
# -*- coding: utf-8 -*- # 宇都宮涼 # J5-170029 # Space Coconut Grab # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012 # 右中央 while True: e = int(input()) temp = 10**6 if e == 0: break for z in range(int(e**(1/3)+1)): for y in range(int((e-z**3)**(1/2)+1)): x = e-z**3-y**2 if x+y+z < temp: temp = x+y+z print(temp)
s782961648
p01137
u089116225
1524309879
Python
Python3
py
Runtime Error
0
0
711
''' JAG Domestic 2007 'Space Coconut Grab' http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012 ''' ans_list = [] while True: e = int(input()) if e == 0: break else: ans = e for z in range(1, e+1): z3 = z ** 3 if z3 < e: for y in range(1, e-z3+1): y2 = y ** 2 if y2 < e - z3: x = e - z3 - y2 s = x + y + z if s < ans: ans = s else: break else: break ans_list.append(ans) for x in ans_list: print(x)
s150134522
p01137
u089116225
1524319785
Python
Python3
py
Runtime Error
0
0
608
ans_list = [] while True: e = int(input()) if e == 0: break else: ans = float('inf') for z in range(e+1): z3 = z ** 3 if z3 <= e: for y in range(e-z3+1): y2 = y ** 2 if y2 <= e - z3: x = e - z3 - y2 s = x + y + z if s < ans: ans = s else: break else: break ans_list.append(ans) for x in ans_list: print(x)
s087732584
p01137
u089116225
1524319785
Python
Python3
py
Runtime Error
0
0
608
ans_list = [] while True: e = int(input()) if e == 0: break else: ans = float('inf') for z in range(e+1): z3 = z ** 3 if z3 <= e: for y in range(e-z3+1): y2 = y ** 2 if y2 <= e - z3: x = e - z3 - y2 s = x + y + z if s < ans: ans = s else: break else: break ans_list.append(ans) for x in ans_list: print(x)
s941102475
p01137
u089116225
1524319890
Python
Python3
py
Runtime Error
0
0
565
ans_list = [] while True: e = int(input()) if e == 0: break else: ans = float('inf') for z in range(e+1): z3 = z ** 3 if z3 <= e: for y in range(e-z3+1): y2 = y ** 2 if y2 <= e - z3: x = e - z3 - y2 s = x + y + z if s < ans: ans = s else: break else: break print(ans)
s138752755
p01137
u089116225
1524320321
Python
Python3
py
Runtime Error
0
0
570
flag = True while flag: e = int(input()) if e == 0: flag = False else: ans = float('inf') for z in range(e+1): z3 = z ** 3 if z3 <= e: for y in range(e-z3+1): y2 = y ** 2 if y2 <= e - z3: x = e - z3 - y2 s = x + y + z if s < ans: ans = s else: break else: break print(ans)
s322796572
p01137
u089116225
1524322813
Python
Python3
py
Runtime Error
0
0
582
while True: e = int(input()) if e == 0: break else: ans = float('inf') for z in range(e+1): z3 = z ** 3 rest1 = e - z3 if rest1 >= 0: for y in range(rest1+1): y2 = y ** 2 rest2 = rest1 - y2 if rest2 >= 0: s = rest2 + y + z if s < ans: ans = s else: break else: break print(ans)
s016698539
p01137
u089116225
1524324742
Python
Python3
py
Runtime Error
0
0
571
while True: e = int(input()) if e != 0: ans = float('inf') for z in range(e): r1 = e - z ** 3 if r1 >= 0: for y in range(r1+1): x = r1 - y ** 2 if x >= 0: s = z + y + x if ans > s: ans = s else: pass else: break else: break print(ans) else: break
s562408056
p01137
u089116225
1524326438
Python
Python3
py
Runtime Error
0
0
569
l = [] ans_list = [] while True: e = int(input()) if e == 0: #print('=========================') break else: l.append(e) for e in l: ans = float('inf') for z in range(e): r1 = e - z ** 3 if r1 >= 0: for y in range(r1+1): x = r1 - y ** 2 if x >= 0: s = z + y + x ans = min(ans, s) else: break else: break ans_list.append(ans) for ans in ans_list: print(ans)
s450376109
p01137
u584093205
1524997374
Python
Python3
py
Runtime Error
0
0
280
while(1): e = int(input()) if e == 0: break m = e for z in range(100): for y in range(1000): x = e - y * y - z * z * z if 0 > x: break if m > x + y + z: m = x + y + z print(m)
s145877873
p01137
u146816547
1525118363
Python
Python
py
Runtime Error
0
0
278
while True: e = int(raw_input()) if e == 0: break ans = float('inf') for z in range(10**2+1): for y in range(10**3+1): if y**2 + z**3 <= e: x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s952095650
p01137
u146816547
1525118458
Python
Python
py
Runtime Error
0
0
269
while True: e = int(raw_input()) if e == 0: break ans = 1e8 for z in range(10**2+1): for y in range(10**3+1): if y**2 + z**3 <= e: x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s211093493
p01137
u146816547
1525118608
Python
Python
py
Runtime Error
0
0
274
while True: e = int(raw_input()) if e == 0: break ans = 1e8 for z in range(10**2+1): for y in range(10**3+1): if y**2 + z**3 > e: break x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s366340287
p01137
u146816547
1525118708
Python
Python
py
Runtime Error
0
0
296
while True: e = int(raw_input()) if e == 0: break ans = 1e8 x, y, z = 0, 0, 0 for z in range(e): if z**3 > e: break for y in range(e): if y**2 + z**3 > e: break x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s285980470
p01137
u146816547
1525119613
Python
Python
py
Runtime Error
0
0
289
while True: e = int(raw_input()) if e == 0: break x, y, z, ans = 0, 0, 0, e for z in range(e): if z**3 > e: break for y in range(e): if y**2 + z**3 > e: break x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s009344272
p01137
u146816547
1525119868
Python
Python
py
Runtime Error
0
0
271
from math import sqrt while True: e = int(raw_input()) if e == 0: break x, y, z, ans = 0, 0, 0, e for z in range(e): if z**3 > e: break y = int(sqrt(e - z**3)) x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s505021805
p01137
u146816547
1525120054
Python
Python
py
Runtime Error
0
0
277
from math import sqrt while True: e = int(raw_input()) if e == 0: break x, y, z, ans = 0, 0, 0, e for z in range(e+1): if z**3 > e: break y = int(sqrt(e - z**3)) x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s190567900
p01137
u146816547
1525120120
Python
Python
py
Runtime Error
0
0
260
from math import sqrt while True: e = int(raw_input()) if e == 0: break z, ans = 0, e for z in range(e+1): if z**3 > e: break y = int(sqrt(e - z**3)) x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s208237090
p01137
u146816547
1525120302
Python
Python
py
Runtime Error
0
0
251
from math import sqrt while True: e = int(raw_input()) if e == 0: break ans = e for z in range(e): if z**3 > e: break y = int(sqrt(e - z**3)) x = e - y**2 - z**3 ans = min(ans, x+y+z) print ans
s142816429
p01137
u023471147
1527056418
Python
Python3
py
Runtime Error
0
0
343
from math import floor while True: e = int(input()) if e == 0: break ans = 10 ** 10 for z in range(floor(e ** (1 / 3)) + 1): for y in range(floor((e - z) ** (1 / 2)) + 1): x = e - y ** 2 - z ** 3 if x < 0: continue ans = min(ans, x + y + z) print (ans)
s817215172
p01137
u023471147
1527056542
Python
Python3
py
Runtime Error
0
0
388
from math import floor while True: e = int(input()) if e == 0: break ans = 10 ** 10 for z in range(floor(e ** (1 / 3)) + 1): ez = e - z ** 3 if ez < 0: break for y in range(floor(ez ** (1 / 2)) + 1): x = ez - y ** 2 if x < 0: break ans = min(ans, x + y + z) print (ans)
s985937844
p01137
u011621222
1529577587
Python
Python3
py
Runtime Error
0
0
480
import math def main(): while True: e = int(input()) if e == 0: break p = 0 cs = list(reversed(range(math.floor(e**(1/3))+1))) bs = list(reversed(range(math.floor(e**(1/2))+1))) for c in cs: for b in bs: if c**3+b**2<e and c**3+b**2>p: r = c+b p = c**3+b**2 if c**3+b**2<p: break print(r+e-p) main()
s684057957
p01137
u011621222
1529578117
Python
Python3
py
Runtime Error
0
0
204
import math while True: e=int(input()) if e==0: break m=e A=[] for z in range(e+1): y=0 while y**2+z**3<=e: d=z**3+y**2 A.append(e-d+y+z) y+=1 print(min(A))
s875112562
p01137
u925259339
1529579314
Python
Python3
py
Runtime Error
0
0
518
import math def main(): while True: e = int(input()) if e == 0: break r = 0 p = 0 cs = list(reversed(range(math.floor(e**(1/3))+1))) bs = list(reversed(range(math.floor(e**(1/2))+1))) if e**(1/3) <= 1: cs = [0] if e**(1/2) <= 1: bs = [0] for c in cs: for b in bs: if c**3+b**2<=e and c**3+b**2>p: r = c+b p = c**3+b**2 print(r+e-p) main()
s288642125
p01137
u136916346
1530239664
Python
Python3
py
Runtime Error
0
0
180
while 1: n=int(input()) if not n:break m=n for z in range(int(n**(1/3))+1): for y in range(int((n-z**3)**(1/2))+1): x=n-y**2-z**3 m=min(m,x+y+z) print(m)
s419620089
p01137
u779627195
1353355435
Python
Python
py
Runtime Error
19930
6640
640
import sys d = [[0,0,1], [0,1,0], [1,0,0]] def cal(x,y,z): global e,l,ans if x+y+z >= ans: return #print sys.stderr, x,y,z temp = x+y**2+z**3 l.append([x,y,z]) if temp == e: #print sys.stderr, x,y,z ans = x+y+z elif temp < e: for i in xrange(3): if not([x+d[i][0], y+d[i][1], z+d[i][2]] in l): cal(x+d[i][0], y+d[i][1], z+d[i][2]) while 1: e = int(raw_input()) if not e: break ans = 10*6 l = [] cal(0,0,0) print ans
s111104245
p01137
u779627195
1353356409
Python
Python
py
Runtime Error
19930
5544
472
import sys def cal(e): global ans x,y,z = 0,0,0 while (z**3 <= e): y = 0 while (y**2 <= e-z**3): x = e-z**3-y**2 ans = min(x+y+z, ans) #print sys.stderr, x,y,z y += 1 z += 1 while 1: e = int(raw_input()) if not e: break ans = 10*6 cal(e) print ans
s963296055
p01137
u109084363
1359564914
Python
Python
py
Runtime Error
19930
4736
387
import sys import collections import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): x = e - math.pow(z, 3) - math.pow(y, 2) result = min(result, int(x + y + z)) print result
s948197882
p01137
u109084363
1359565065
Python
Python
py
Runtime Error
19930
4740
387
import sys import collections import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): x = e - math.pow(z, 3) - math.pow(y, 2) result = min(result, int(x + y + z)) print result
s840630639
p01137
u109084363
1359565280
Python
Python
py
Runtime Error
19930
4440
415
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): x = e - math.pow(z, 3) - math.pow(y, 2) if x < 0: continue result = min(result, int(x + y + z)) print result
s895041801
p01137
u109084363
1359565573
Python
Python
py
Runtime Error
19930
4436
416
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): x = e - math.pow(z, 3) - math.pow(y, 2) if x < 0: continue #result = min(result, int(x + y + z)) print result
s505905957
p01137
u109084363
1359565613
Python
Python
py
Runtime Error
0
0
417
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): #x = e - math.pow(z, 3) - math.pow(y, 2) if x < 0: continue #result = min(result, int(x + y + z)) print result
s670892333
p01137
u109084363
1359565698
Python
Python
py
Runtime Error
19930
4432
418
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): x = e - math.pow(z, 3) - math.pow(y, 2) #if x < 0: # continue #result = min(result, int(x + y + z)) print result
s994331981
p01137
u109084363
1359565988
Python
Python
py
Runtime Error
19930
4440
501
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 1000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): if z < 0: continue for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): if y < 0: continue x = e - math.pow(z, 3) - math.pow(y, 2) if x < 0: continue result = min(result, int(x + y + z)) print result
s250063235
p01137
u109084363
1359566072
Python
Python
py
Runtime Error
19930
4448
528
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 10000000 for z in xrange(int(math.pow(e, 1.0/3)), -1, -1): if z < 0 or e - math.pow(z, 3) < 0: continue for y in xrange(int(math.pow(e - math.pow(z, 3), 1.0 / 2)), -1, -1): if y < 0: continue x = e - math.pow(z, 3) - math.pow(y, 2) if x < 0: continue result = min(result, int(x + y + z)) print result
s754656777
p01137
u109084363
1359566306
Python
Python
py
Runtime Error
19930
4340
385
import sys import math while True: e = int(sys.stdin.readline()) if e == 0: break result = 10000000 for z in xrange(1000001): if z ** 3 > e: break for y in xrange(1000001): if z ** 3 + y ** 2 > e: break x = e - z ** 3 - y ** 2 result = min(result, int(x + y + z)) print result
s154364456
p01137
u104911888
1371952101
Python
Python
py
Runtime Error
20000
4260
229
while True: e=input() if e==0:break minInt=1e10 for z in range(100,-1,-1): for y in range(1000,-1,-1): if e-(y*y+z*z*z)>=0: minInt=min(minInt,y+z+e-(y*y+z*z*z)) print minInt
s754814496
p01137
u361804125
1381839913
Python
Python
py
Runtime Error
39870
4200
258
eList = [] while 1: e = input() if e == 0: break; else: mini = 10000 for x in range(100): for y in range(100): for z in range(10): if x + y*y + z*z*z == e: a = x + y + z if a < mini: mini = x + y + z print mini
s233535254
p01137
u361804125
1381840565
Python
Python
py
Runtime Error
39870
36020
264
eList = [] while 1: e = input() if e == 0: break; else: mini = 10000 for x in range(1000000): for y in range(1000): for z in range(100): if x + y*y + z*z*z == e: a = x + y + z if a < mini: mini = x + y + z print mini
s034150648
p01137
u361804125
1381840774
Python
Python
py
Runtime Error
39870
4200
262
eList = [] while 1: e = input() if e == 0: break; else: mini = 10000000 for x in range(100): for y in range(100): for z in range(100): if x + y*y + z*z*z == e: a = x + y + z if a < mini: mini = x + y + z print mini
s327320654
p01137
u361804125
1381840873
Python
Python
py
Runtime Error
39870
36024
267
eList = [] while 1: e = input() if e == 0: break; else: mini = 10000000 for x in range(1000000): for y in range(1000): for z in range(100): if x + y*y + z*z*z == e: a = x + y + z if a < mini: mini = x + y + z print mini