Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a, b, c, d, e, f = LI()

x = f // (100*a)
y = f // (100*b)

max_ = 0
max__ = 1
for i in range(x + 1):
    for j in range(y + 1):
        if i == 0 and j == 0:
            continue
        E = min((a*i + b*j)*e, f-(100*a*i + 100*b*j))
        E -= min(E % c, E % d)
        if max_ * (a*i + b*j) < E * max__:
            max_ = E
            max__ = a*i + b*j
            ans1 = (a*i + b*j) * 100 + E
            ans2 = E
print(ans1, ans2)

Fixed submission:
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a, b, c, d, e, f = LI()

x = f // 100*a
y = f // 100*b

max_ = 0
for i in range(x + 1):
    for j in range(y + 1):
        if i == 0 and j == 0:
            continue
        E = min((i + j)*e, f-(100*i + 100*j))
        E -= min(E % c, E % d)
        if max_ < E / (i+j):
            max_ = E / (i+j)
            ans1 = (i + j) * 100 + E
            ans2 = E
print(ans1, ans2)

Fixed submission:
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
water = [100*a*A + 100*b*B for B in range(t+1) for A in range(s+1) if 100*a*A + 100*b*B != 0]
suger = [c*C + d*D for D in range(v+1) for C in range(u+1)]
ans1 = 0
ans2 = 0
for W in water:
    for S in suger:
        if W + S <= f:
            if W//100*e >= S:
                if concentration < S/(W+S):
                    concentration = S/(W+S)
                    ans1 = W+S
                    ans2 = S
if ans1 == 0:
    ans1 = 100*a
print(ans1,ans2)


Fixed submission:
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
water = []
suger = []
for A in range(s+1):
    for B in range(t+1):
        if 100*a*A + 100*b*B != 0:
            water.append(100*a*A + 100*b*B)

for C in range(u+1):
    for D in range(v+1):
        suger.append(c*C + d*D)

ans1 = 0
ans2 = 0
for W in water:
    for S in suger:
        if W + S <= f:
            if W//100*e >= S:
                if concentration < S/(W+S):
                    concentration = S/(W+S)
                    ans1 = W+S
                    ans2 = S
if ans1 == 0:
    ans1 = 100*a
print(ans1,ans2)


Fixed submission:
#!/usr/bin/env python3
#ABC74 C

a,b,c,d,e,f = map(int,input().split())

s = f//(100*a)
t = f//(100*b)
u = f//c
v = f//d

concentration = 0
solution = 0
suger = 0
for A in range(s+1):
    for B in range(t+1):
        for C in range(u+1):
            for D in range(v+1):
                if 100*a*A + 100*b*B + c*C + d*D <= f:
                    if (a*A+b*B)*e >= (c*C + d*D):
                        if 100*a*A + 100*b*B + c*C + d*D != 0:
                            if concentration < (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D):
                                concentration = (c*C + d*D)/(100*a*A + 100*b*B + c*C + d*D)
                                solution = 100*a*A + 100*b*B + c*C + d*D
                                suger = c*C + d*D
if solution == 0:
    solution = 100*a
print(solution,suger)