Problem p03599 (python)

Fixed submission:
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
w.sort()
del w[0]
s=list(s)
s.sort()
M=-1
for i in w:
    for j in range(len(s)-1,-1,-1):
        if s[j]*100<=E*i:
            if s[j]>M*i and i+s[j]<=F:
                W,S=i,s[j]
                M=s[j]/i
print(W+S,S)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
w.sort()
del w[0]
s=list(s)
s.sort()
M=-1
for i in w:
    for j in range(len(s)-1,-1,-1):
        t=s[j]/i
        if t*100<=E:
            if t>M and i+s[j]<=F:
                W,S=i,s[j]
                M=t
            break
print(W+S,S)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
w.sort()
del w[0]
s=list(s)
s.sort()
M=0
for i in w:
    for j in range(len(s)-1,-1,-1):
        t=s[j]/i
        if t*100<=E:
            if t>M and i+s[j]<=F:
                W,S=i,s[j]
                M=t
            break
print(W+S,S)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
del w[0]
s=list(s)
s.sort()
M=0
for i in w:
    for j in range(len(s)-1,-1,-1):
        t=s[j]/i
        if t*100<=E:
            if t>M and i+s[j]<=F:
                W,S=i,s[j]
                M=t
            break
print(W+S,S)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
del w[0]
s=list(s)
s.sort()
a=0
M=0
for i in w:
    for j in range(len(s)-1,-1,-1):
        t=s[j]/i
        if t*100<=E and t>M and i+s[j]<=F:
            W,S=i,s[j]
            M=t
            break
print(W+S,S)

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())
w=set()
s=set()
for i in range(31):
    for j in range(16):
        if 100*(A*i+B*j)<=F:
            w.add(100*(A*i+B*j))
for i in range(1501):
    for j in range(751):
        if C*i+D*j<=F/2:
            s.add(C*i+D*j)
w=list(w)
del w[0]
s=list(s)
s.sort()
a=0
M=0
for i in w:
    for j in range(len(s)-1,-1,-1):
        t=s[j]/i
        if t*100<=E and t>M and i+s[j]<=F:
            W,S=i,s[j]
            M=t
            break
print(W+S,S)