Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
def sym(s):                                                                                                                                                                                                 
    even = True if len(s)%2 == 0 else False                                                                                                                                                                 
                                                                                                                                                                                                            
    if len(s) < 4:                                                                                                                                                                                          
        if even:                                                                                                                                                                                            
            f = s[:len(s)//2]                                                                                                                                                                               
            l = s[len(s)//2:]                                                                                                                                                                               
                                                                                                                                                                                                            
            return f == l[::-1]                                                                                                                                                                             
                                                                                                                                                                                                            
        else:                                                                                                                                                                                               
            f = s[:len(s)//2]                                                                                                                                                                               
            l = s[len(s)//2 + 1:]                                                                                                                                                                           
                                                                                                                                                                                                            
            return f == l[::-1]                                                                                                                                                                             
    else:                                                                                                                                                                                                   
        if s[0] != s[-1]:                                                                                                                                                                                   
            return False                                                                                                                                                                                    
        else:                                                                                                                                                                                               
            return True                                                                                                                                                                                     
                                                                                                                                                                                                            
                                                                                                                                                                                                            
A = input()                                                                                                                                                                                                 
L = len(A)                                                                                                                                                                                                  
                                                                                                                                                                                                            
r = range(L)                                                                                                                                                                                                
                                                                                                                                                                                                            
count = 1                                                                                                                                                                                                   
                                                                                                                                                                                                            
                                                                                                                                                                                                            
a = [sum([1 if not sym(A[i:j+1]) else 0 for j in r[i+1:]]) for i in r[:L-1]]                                                                                                                                

#    for j in r[i+1:]:                                                                                                                                                                                      

#        if not sym(s):                                                                                                                                                                                     
#            count += 1                                                                                                                                                                                     
                                                                                                                                                                                                            
#print(count)                                                                                                                                                                                               
print(sum(a)+1) 

Q, H, S, D = [int(i) for i in input().split()]                                                       
N = int(input())                                                                                     
                                                                                                     
price = [Q, H, S, D]                                                                                 
vol = [0.25, 0.5, 1, 2]                                                                              
unit = [Q*4, H*2, S, D//2]                                                                           
                                                                                                     
p = 0                                                                                                
idx = 4                                                                                              
while True:                                                                                          
    idx = unit.index(min(unit[:idx]))                                                                
                                                                                                     
    p += int(N / vol[idx]) * price[idx]                                                              
    N -= vol[idx]*int(N / vol[idx])                                                                  
                                                                                                     
    if N == 0:                                                                                       
        break;  

print(int(p))

Verdicts: Wrong Answer

Accepted