Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d,e,f=map(int, input().split())
amax=f//(a*100)
bmax=f//(b*100)
c_list=[]
sw_list=[]
s_list=[]

for i in range(amax+1):
   for j in range(bmax+1):
       water=100*a*i+100*b*j
       if f>=water>0:
           smax=f-water
           for k in range(smax+1):
               for l in range(smax+1):
                   sugar=c*k+d*l
                   if water*e/100>=sugar and water+sugar<=f:
                       concentration=100*sugar/(water+sugar)
                       c_list.append(concentration)
                       sw_list.append(sugar+water)
                       s_list.append(sugar)

num=c_list.index(max(c_list))
print(sw_list[num],s_list[num])


Fixed submission:
a,b,c,d,e,f=[int(i) for i in input().split()]

max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d

#水リスト
x_list=[]
for i in range(max_a+1):
   for j in range(max_b+1):
        #水
       x=100*a*i+100*b*j
       if 0<x<=f and x not in x_list:
           x_list.append(x)
#print(x_list)
       
#砂糖リスト
y_list=[]
for i in range(max_c+1):
   for j in range(max_d+1):
        #砂糖
       y=c*i+d*j
       if 0<=y<f and y not in y_list:
           y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
   for j in y_list:
       if i+j<=f and j/i<=e/100:
           concentration=100*j/(i+j)
           concentration_list.append(concentration)
           sugar_water_list.append(i+j)
           sugar_list.append(j)
                   
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int, input().split())
amax=f//(a*100)
bmax=f//(b*100)
c_list=[]
sw_list=[]
s_list=[]

for i in range(amax+1):
   for j in range(bmax+1):
       water=100*a*i+100*b*j
       if water>0:
           smax=f-water
           for k in range(smax+1):
               for l in range(smax+1):
                   sugar=c*k+d*l
                   if water*e/100>=sugar and sugar>0:
                       concentration=100*sugar/(water+sugar)
                       c_list.append(concentration)
                       sw_list.append(sugar+water)
                       s_list.append(sugar)
num=c_list.index(max(c_list))
print(sw_list[num],s_list[num])


Fixed submission:
a,b,c,d,e,f=[int(i) for i in input().split()]

max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d

#水リスト
x_list=[]
for i in range(max_a+1):
   for j in range(max_b+1):
        #水
       x=100*a*i+100*b*j
       if 0<x<=f and x not in x_list:
           x_list.append(x)
#print(x_list)
       
#砂糖リスト
y_list=[]
for i in range(max_c+1):
   for j in range(max_d+1):
        #砂糖
       y=c*i+d*j
       if 0<=y<f and y not in y_list:
           y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
   for j in y_list:
       if i+j<=f and j/i<=e/100:
           concentration=100*j/(i+j)
           concentration_list.append(concentration)
           sugar_water_list.append(i+j)
           sugar_list.append(j)
                   
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f=[int(i) for i in input().split()]


max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d



#水リスト
x_list=[]
for i in range(max_a+1):
    for j in range(max_b+1):
         #水
        x=100*a*i+100*b*j
        if 0<x<f and x not in x_list:
            x_list.append(x)
#print(x_list)
        
#砂糖リスト
y_list=[]
for i in range(max_c+1):
    for j in range(max_d+1):
         #砂糖
        y=c*i+d*j
        if 0<y<f and y not in y_list:
            y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
    for j in y_list:
        if i+j<=f and j/i<=e/100:
            concentration=100*j/(i+j)
            concentration_list.append(concentration)
            sugar_water_list.append(i+j)
            sugar_list.append(j)
                    
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])                




Fixed submission:
a,b,c,d,e,f=[int(i) for i in input().split()]

max_a=f//(100*a)
max_b=f//(100*b)
max_c=f//c
max_d=f//d

#水リスト
x_list=[]
for i in range(max_a+1):
   for j in range(max_b+1):
        #水
       x=100*a*i+100*b*j
       if 0<x<=f and x not in x_list:
           x_list.append(x)
#print(x_list)
       
#砂糖リスト
y_list=[]
for i in range(max_c+1):
   for j in range(max_d+1):
        #砂糖
       y=c*i+d*j
       if 0<=y<f and y not in y_list:
           y_list.append(y)
#print(y_list)

concentration_list=[]
sugar_water_list=[]
sugar_list=[]

for i in x_list:
   for j in y_list:
       if i+j<=f and j/i<=e/100:
           concentration=100*j/(i+j)
           concentration_list.append(concentration)
           sugar_water_list.append(i+j)
           sugar_list.append(j)
                   
sugar_index=concentration_list.index(max(concentration_list))
print(sugar_water_list[sugar_index],sugar_list[sugar_index])