Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
A,B,C,D,E,F = map(int,input().split())
am,bm,cm,dm=ceil(31/A),ceil(31/B),ceil(E*30/C)+1,ceil(E*30/D)+1
temp = []
for a in range(am):
    for b in range(bm):
        for c in range(cm):
            for d in range(dm):
                w = 100*a*A+100*b*B
                s = c*C+d*D
                if w + s > F:
                    break
                else:
                    if w / 100 * E >= s:
                        temp.append([w+s,s])
print(*sorted(temp, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])

Fixed submission:
from math import ceil
A,B,C,D,E,F = map(int,input().split())
am,bm,cm,dm=ceil(31/A),ceil(31/B),ceil(F*E/(100+E)/C)+1,ceil(F*E/(100+E)/D)+1
temp = []
for a in range(am):
    for b in range(bm):
        for c in range(cm):
            for d in range(dm):
                w = 100*a*A+100*b*B
                s = c*C+d*D
                if w + s > F:
                    break
                else:
                    if w / 100 * E >= s:
                        temp.append([w+s,s])
print(*sorted(temp, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])

Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F = map(int,input().split())
smax =int(F*E/(100+E))
wmax =F-smax
temp = []
for a in range(wmax//(A*100)+1):
    for b in range(wmax // (B*100)+1):
        for c in range(smax // (C)+1):
            for d in range(smax // (D)+1):
                if a == 0 and b== 0:
                    pass
                elif (c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)<=E/(100+E) and 100*a*A+100*b*B <=wmax and c*C+d*D <=smax:
                    temp.append([100*a*A+100*b*B+c*C+d*D,c*C+d*D,(c*C+d*D)/(100*a*A+100*b*B+c*C+d*D)])
a = sorted(temp,key= lambda x:x[2],reverse=True)
print(str(a[0][0])+' '+str(a[0][1]))

Fixed submission:
from math import ceil
A,B,C,D,E,F = map(int,input().split())
am,bm,cm,dm=ceil(31/A),ceil(31/B),ceil(F*E/(100+E)/C)+1,ceil(F*E/(100+E)/D)+1
temp = []
for a in range(am):
    for b in range(bm):
        for c in range(cm):
            for d in range(dm):
                w = 100*a*A+100*b*B
                s = c*C+d*D
                if w + s > F:
                    break
                else:
                    if w / 100 * E >= s:
                        temp.append([w+s,s])
print(*sorted(temp, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])

Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F = map(int,input().split())
smax =int(F*E/(100+E))
wmax =F-smax
temp = []
for a in range(wmax//min(A*100,B*100)+1):
    for b in range(wmax // min(A*100, B*100)+1):
        for c in range(smax // min(C, D)+1):
            for d in range(smax // min(C, D)+1):
                if a == 0 and b== 0:
                    pass
                elif (c*C+d*D)/(100*a*A+100*b*B)<=E/(100+E) and 100*a*A+100*b*B <=wmax and c*C+d*D <=smax:
                    temp.append([100*a*A+100*b*B,c*C+d*D])
maxn =[]
for i in temp:
    maxn.append(i[1]/i[0])
print(' '.join(map(str,temp[maxn.index(max(maxn))])))

Fixed submission:
from math import ceil
A,B,C,D,E,F = map(int,input().split())
am,bm,cm,dm=ceil(31/A),ceil(31/B),ceil(F*E/(100+E)/C)+1,ceil(F*E/(100+E)/D)+1
temp = []
for a in range(am):
    for b in range(bm):
        for c in range(cm):
            for d in range(dm):
                w = 100*a*A+100*b*B
                s = c*C+d*D
                if w + s > F:
                    break
                else:
                    if w / 100 * E >= s:
                        temp.append([w+s,s])
print(*sorted(temp, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])