Buggy python submission (verdict: Runtime Error):
'''
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):
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


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)

Buggy python submission (verdict: Runtime Error):

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)


Fixed submission:
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)