Problem p03599 (python)

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

indxmax=0.0
wmax=0
emax=0
elimit=(100*e)/(100+e)
c31=int(f/c)+1
for ai in range(0,f+1,a):
    for bi in range(0,f-ai+1,b):
        w=100*ai+100*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            c31=(w*e)//100+c
            for ci in range(0,c31,c):
#                for di in range(d31):
                for di in range(0,c31-ci,d):
                    indx=(ci+di)*100/w
                    if indxmax<indx and e-indx>=0.0 and w+ci+di<=f:
                        wmax=w+ci+di
                        indxmax=indx 
                        emax=ci+di
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

rmax=0
for a100 in range(0,f+1,100*a):
   for b100 in range(0,f-a100+1,100*b):
#   for b100 in range(0,f+1,100*b):
        if a100+b100>0:
            fcd=f-a100-b100
            for ci in range(0,fcd+1,c):
                for di in range(0,fcd+1,d):
                    if a100+b100+ci+di <=f:
                        if (a100+b100)/100*e>=ci+di:
                            if rmax<(ci+di)/(a100+b100):
                                rmax=(ci+di)/(a100+b100)
                                rab=a100+b100+ci+di
                                rcd=ci+di
print(rab,rcd)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

rmax=0
for a100 in range(0,f+1,100*a):
#    for b100 in range(0,f-a100+1,100):
    for b100 in range(0,f+1,100*b):
        if a100+b100>0:
            fcd=f-a100-b100
            for ci in range(0,fcd+1,c):
                for di in range(0,fcd+1,d):
                    if a100+b100+ci+di <=f:
                        if (a100+b100)//100*e>=ci+di:
                            if rmax<(ci+di)/(a100+b100):
                                rmax=(ci+di)/(a100+b100)
                                rab=a100+b100+ci+di
                                rcd=ci+di
print(rab,rcd)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int, input().split())

indxmax=0.0
wmax=0
emax=0
elmt=100*e/(100+e)
a31=int(f/100/a)+1
b31=int(f/100/b)+1
c31=int(f/c)+1
for ai in range(a31):
    for bi in range(b31):
        w=100*a*ai+100*b*bi
#        print("a,b:",ai,bi,w)
        if w<=f and w>0:
#            c31=int(w/100*e/c)+1
#            c31=min(int(w/100*e/c)+1,31)
#            d31=int(w/100*e/d)+1
            for ci in range(c31):
#                di=int((w/100*e-c*ci)/d+10**(-10))
                dii=max(0,int((w/100*e-c*ci)/d))
#                for di in range(d31):
                for di in range(dii-1,dii+2):
                    diii=max(0,di)
#                    indx=(c*ci+d*diii)*100/w
                    indx=100*(c*ci+d*diii)/(w+c*ci+d*diii)
                    if indxmax<indx and elmt-indx>=0.0 and w+c*ci+d*diii<=f:
                        wmax=int(w+c*ci+d*diii)
                        indxmax=indx 
                        emax=int(c*ci+d*diii)
#                    print("c,d",ci,di,emax,wmax,diii)
if wmax>0:
    print(wmax,emax)
else:
    print(100*a,emax