Buggy python submission (verdict: Runtime Error):
def per(a, b):
    if a == 0 or b == 0:
        return 0
    return 100 * b / (a + b)


a, b, c, d, e, f = [int(i) for i in input().split()]
max_sugar = e * f / 100
max_water = f - max_sugar
s = 0
water = set()
check = 0
n = 0
while check <= f:
    while check <= f:
        water.add(check)
        check += b * 100
    check = a*100*n
    n += 1
check = 0
n = 0
sugar_ans = 0
g = 0
for i in water:
    max_sugar = e * i / 100
    while check <= max_sugar and check + i <= f:
        while check <= max_sugar and check + i <= f:
            if g < per(i, check) and i + check <= f:
                sugar_ans = check
                g = per(i, check)
                water_ans = i
            check += d
        check = c * n
        n += 1

print(water_ans + sugar_ans, sugar_ans)


Fixed submission:
def node(hen, sin):
    if hen == 0 or sin == 0:
        return 0
    return 100 * sin / (hen + sin)


a, b, c, d, e, f = [int(i) for i in input().split()]
node_ans = 0
water_ans = 0
sugar_ans = 0
for A in range(0, f, a * 100):
    for B in range(0, f, b * 100):
        water = A + B
        max_sugar = water * e
        for C in range(0, f, c):
            for D in range(0, f, d):
                sugar = C + D
                if max_sugar < sugar*100 or f < water + sugar or water == 0:
                    break
                elif node_ans <= node(water, sugar):
                    node_ans = node(water, sugar)
                    sugar_ans = sugar
                    water_ans = water

print(water_ans + sugar_ans, sugar_ans)

Buggy python submission (verdict: Runtime Error):
def per(a, b):
    if a == 0 or b == 0:
        return 0
    return 100 * b / (a + b)


a, b, c, d, e, f = [int(i) for i in input().split()]
max_sugar = e * f / 100
max_water = f - max_sugar
s = 0
water = set()
numa = f // a
numb = f // b
for i in range(numa):
    check = 100 * a * i
    if f < check:
        break
    water.add(check)
    for m in range(numb):
        h = check + 100 * b * m
        if f < h:
            break
        water.add(h)
check = 0
n = 0
sugar_ans = 0
g = 0
for i in water:
    max_sugar = e * i /100
    while check <= max_sugar and check + i <= f:
        while check <= max_sugar and check + i <= f:
            if g < per(i, check) and i + check <= f:
                sugar_ans = check
                g = per(i, check)
                water_ans = i
            check += d
        check = c * n
        n += 1

print(water_ans + sugar_ans, sugar_ans)




Fixed submission:
def node(hen, sin):
    if hen == 0 or sin == 0:
        return 0
    return 100 * sin / (hen + sin)


a, b, c, d, e, f = [int(i) for i in input().split()]
node_ans = 0
water_ans = 0
sugar_ans = 0
for A in range(0, f, a * 100):
    for B in range(0, f, b * 100):
        water = A + B
        max_sugar = water * e
        for C in range(0, f, c):
            for D in range(0, f, d):
                sugar = C + D
                if max_sugar < sugar*100 or f < water + sugar or water == 0:
                    break
                elif node_ans <= node(water, sugar):
                    node_ans = node(water, sugar)
                    sugar_ans = sugar
                    water_ans = water

print(water_ans + sugar_ans, sugar_ans)