Buggy python submission (verdict: Runtime Error):
import numpy as np


def solve(stdin):
    A, B, C, D, E, F = stdin
    if A == 1:
        raise
    conc = -1
    ans = (1, 2)
    for na in range(F // (100 * A) + 1):
        for nb in range(F // (100 * B) + 1):
            if na == nb == 0:
                continue
            G = F - na * 100 * A - nb * 100 * B
            for nc in range(G // C + 1):
                for nd in range(G // D + 1):
                    W = na * 100 * A + nb * 100 * B + nc * C + nd * D
                    if 0 < W <= F and nc * C + nd * D <= E * (na * A + nb * B):
                        conc2 = 100 * (nc * C + nd * D) / W
                        if conc < conc2 <= 100 * E / (100 + E):
                            ans = (W, nc * C + nd * D)
                            conc = conc2
    return ans


def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(*solve(stdin))


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


Fixed submission:
import itertools
A, B, C, D, E, F = [int(_) for _ in input().split()]
W = [0] * (F+1)
S = [0] * (F+1)
for a, b in itertools.product(range(F // (100*A) + 1), range(F//(100*B) + 1)):
    if 100*A*a+100*B*b <= F:
        W[100*A*a+100*B*b] = min(E*(A*a+B*b), F-100*A*a-100*B*b)

for c, d in itertools.product(range(F // C + 1), range(F // D + 1)):
    if C*c+D*d <= F:
        S[C*c+D*d] = C*c+D*d
for i in range(F):
    if S[i+1] == 0:
        S[i+1] = S[i]
water = 100*A
sugar = 0
for i in range(1, F+1):
    if W[i] and S[W[i]]/i > sugar/water:
        sugar, water = S[W[i]], i
print(sugar+water, sugar)

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = [int(_) for _ in input().split()]
if A==1:
  raise


def main(A, B, C, D, E, F):
    conc = -1
    ans = (1, 2)
    for na in range(F // (100 * A) + 1):
        for nb in range(F // (100 * B) + 1):
            if na == nb == 0:
                continue
            G = F - na * 100 * A - nb * 100 * B
            for nc in range(G // C + 1):
                for nd in range(G // D + 1):
                    W = na * 100 * A + nb * 100 * B + nc * C + nd * D
                    if 0 < W <= F and nc * C + nd * D <= E * (na * A + nb * B):
                        conc2 = 100 * (nc * C + nd * D) / W
                        if conc < conc2 <= 100 * E / (100 + E):
                            ans = (W, nc * C + nd * D)
                            conc = conc2
    return ans


print(*main(A, B, C, D, E, F))


Fixed submission:
import itertools
A, B, C, D, E, F = [int(_) for _ in input().split()]
W = [0] * (F+1)
S = [0] * (F+1)
for a, b in itertools.product(range(F // (100*A) + 1), range(F//(100*B) + 1)):
    if 100*A*a+100*B*b <= F:
        W[100*A*a+100*B*b] = min(E*(A*a+B*b), F-100*A*a-100*B*b)

for c, d in itertools.product(range(F // C + 1), range(F // D + 1)):
    if C*c+D*d <= F:
        S[C*c+D*d] = C*c+D*d
for i in range(F):
    if S[i+1] == 0:
        S[i+1] = S[i]
water = 100*A
sugar = 0
for i in range(1, F+1):
    if W[i] and S[W[i]]/i > sugar/water:
        sugar, water = S[W[i]], i
print(sugar+water, sugar)

Buggy python submission (verdict: Runtime Error):
A, B, C, D, E, F = [int(_) for _ in input().split()]
if A==1:
  raise


def main(A, B, C, D, E, F):
    conc = -1
    ans = (1, 2)
    for na in range(F // (100 * A) + 1):
        for nb in range(F // (100 * B) + 1):
            if na == nb == 0:
                continue
            G = F - na * 100 * A - nb * 100 * B
            for nc in range(G // C + 1):
                for nd in range(G // D + 1):
                    W = na * 100 * A + nb * 100 * B + nc * C + nd * D
                    if 0 < W <= F and nc * C + nd * D <= E * (na * A + nb * B):
                        conc2 = 100 * (nc * C + nd * D) / W
                        if conc < conc2 <= 100 * E / (100 + E):
                            ans = (W, nc * C + nd * D)
                            conc = conc2
    return ans


print(*main(A, B, C, D, E, F))


Fixed submission:
import itertools
A, B, C, D, E, F = [int(_) for _ in input().split()]
W = [0] * (F+1)
S = [0] * (F+1)
for a, b in itertools.product(range(F // (100*A) + 1), range(F//(100*B) + 1)):
    if 100*A*a+100*B*b <= F:
        W[100*A*a+100*B*b] = min(E*(A*a+B*b), F-100*A*a-100*B*b)

for c, d in itertools.product(range(F // C + 1), range(F // D + 1)):
    if C*c+D*d <= F:
        S[C*c+D*d] = C*c+D*d
for i in range(F):
    if S[i+1] == 0:
        S[i+1] = S[i]
water = 100*A
sugar = 0
for i in range(1, F+1):
    if W[i] and S[W[i]]/i > sugar/water:
        sugar, water = S[W[i]], i
print(sugar+water, sugar)