TnT/Multi_CodeNet4Repair huggingface dataset:
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):
s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)


s = input()

count = 1

for i in range(1, len(s)):
    ss = s[0:i]
    # print(ss, s[i])

    n = len(ss) - ss.count(s[i])
    count += n
    # print(n, count)
print(count)


def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

q, h, s, d = read_line(int, int, int, int)
n, = read_line(int)

# print(q, h, s, d)
# print(n)

# print()

menu = sorted({0.25: (q, q * 4), 0.5: (h, h * 2), 1: (s, s), 2: (d, d * 0.5)}.items(), key = lambda x: x[1][1])

# print(list(menu))

charge = 0
while True:
    for size, (price, _) in menu:
        if n >= size:
            count = int(n // size)
            charge += count * price
            n -= size * count
        if n == 0:
            print(int(charge))
            exit()


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
b=list(map(int,input().split()))
c = int(input())
ans = 0
r = min([b[0]*4, b[1]*2, b[2]])
r2 = min([r*2, b[3]])
#if c % 2 == 1:
#    ans += r
#   c -= 1

#print(int(ans))

if c%2==1:
	print(((c-1)/2)*r2+r)
else :
	print((c/2)*r2)


a = input().split(" ")
b = list(map(int, a))
c = int(input())
ans = 0
r = min([b[0] * 4, b[1] * 2, b[2]])
r2 = min([r * 2, b[3]])
if c % 2 == 1:
    ans += r
    c -= 1
ans += r2 * (c // 2)
print(int(ans))


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d = map(int,input().split())
n = int(input())
a= min([q*4,h*2,s])
b= min([a*2,d])
print(a+b*n//2)

q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(a*2,d)
print(a*(n%2)+b*(n//2))

Verdicts: Wrong Answer

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())

d = [[2, 2/D, D], [1, 1/S, S], [0.5, 0.5/H, H], [0.25, 0.25/Q, Q]]
d = sorted(d, key=lambda x: x[1])[::-1]

ans = 0
for i in range(4):
    amt, _, price = d[i]
    num = N // amt
    N -= num * amt
    ans += num * price

    if N == 0:
        print(ans)
        exit()


Q, H, S, D = map(int, input().split())
N = int(input())

H = min(H, 2 * Q)
S = min(S, 2 * H)
D = min(D, 2 * S)
print((N // 2) * D + (N % 2) * S)


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2))

q,h,s,d=map(int,input().split())
n=int(input())
a=min(q*4,h*2,s)
b=min(q*8,h*4,s*2,d)
print(min(a*n,a*(n%2)+b*(n//2)))

Verdicts: Runtime Error

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())
arr = [4*Q*N, 2*H*N, S*N]
if N % 2 == 0:
  arr.append(int(0.5*D*N))
elif:
  if N >= 3:
    arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q)))
    
print(min(arr))

Q, H, S, D = map(int, input().split())
N = int(input())
x = N % 2
y = N // 2
arr = [4*Q*x, 2*H*x, S*x]
arr1 = [8*Q*y, 4*H*y, 2*S*y, D*y]
#if N % 2 == 0:
#  arr.append(int(0.5*D*N))
#else:
#  arr.append(int(0.5*D*(N-1)+ min(S, 2*H, 4*Q)))
   
print(min(arr) + min(arr1))

Verdicts: Runtime Error

Accepted
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):
Q,H,S,D = map(int, input().split())
N = int(input())
if N >=2:
    if N%2 == 0:
        ans = N/min([8*Q,4*H,2*S,D])
    else:
        ans = (N-1)/min([8*Q,4*H,2*S,D]) + min([4*Q,2*H,S])
else:
    ans = min([4*Q,2*H,S])
print(ans)

Q,H,S,D = map(int, input().split())
N = int(input())
if N >=2:
    if N%2 == 0:
        ans = N//2*min([8*Q,4*H,2*S,D])
    else:
        ans = (N-1)//2*min([8*Q,4*H,2*S,D]) + min([4*Q,2*H,S])
else:
    ans = min([4*Q,2*H,S])
print(ans)

Verdicts: Wrong Answer

Accepted
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):
val = list(map(int, input().split()))
N = int(input())
price = [v / (2 ** i)  for i, v in enumerate(val)]
sortedIndex = []
sortedPrice = sorted(price)
price2 = price.copy()
for p in sortedPrice:
    sortedIndex.append(price2.index(p))
    price2[price2.index(p)] = -1

temp = 0
ans = 0
for i in sortedIndex:
    size  = (0.25 * (2 ** i))
    times = int(N / size)
    print (size, times)
    N -= size * times
    ans += val[i] * times

#     while N > temp:
#         if(N < temp + 0.25 * (2 ** i)):
#             break
#         temp += 0.25 * (2 ** i)
#         ans += val[i]

print (ans)


val = list(map(int, input().split()))
N = int(input())
price = [v / (2 ** i)  for i, v in enumerate(val)]
sortedIndex = []
sortedPrice = sorted(price)
price2 = price.copy()
for p in sortedPrice:
    sortedIndex.append(price2.index(p))
    price2[price2.index(p)] = -1

temp = 0
ans = 0
for i in sortedIndex:
    size  = (0.25 * (2 ** i))
    times = int(N / size)
    # print (size, times)
    N -= size * times
    ans += val[i] * times

#     while N > temp:
#         if(N < temp + 0.25 * (2 ** i)):
#             break
#         temp += 0.25 * (2 ** i)
#         ans += val[i]

print (ans)


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d = map(int,input().split())
n = int(input())

dic = {0.25:q*4, 0.5:h*2, 1:s, 2:d/2}
dic_sorted = sorted(dic.items(),key=lambda x:x[1])

temp1 = n//dic_sorted[0][0]
temp2 = n%dic_sorted[0][0]

cnt = temp2
ans = temp1 * dic_sorted[0][1]

while cnt != 0:
    for i in range(4):
        if dic_sorted[i][0] <= cnt:
            cnt -= dic_sorted[i][0]
            ans += dic_sorted[i][1] * dic_sorted[i][0]
            break
            
print(int(ans))
            

q,h,s,d = map(int,input().split())
n = int(input())

ans = (n//2) * min(q*8, h*4, s*2, d) + (n%2) * min(q*4, h*2,s)
print(ans)

Verdicts: Wrong Answer

Accepted
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):
a,b,c,d=map(int, input().split)
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, 4*a+2*b)

if n%2==0 :
               print(twoltr*n//2)
else :
               print(oneltr+twoltr*(n-1)//2)


a,b,c,d=map(int, input().split())
n=int(input())
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)

if n%2==0 :
               print(twoltr * (n//2))
else :
               print(oneltr+twoltr * ((n-1)//2))


Verdicts: Runtime Error

Accepted
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):
Q,H,S,D = map(int,input().split())
N = int(input())
c = 0

while N > 0:
    if N >= 2:
        c += D
        N -= 2
    if N >= 1:
        c += S
        N -= 1
    if N >= 0.5:
        c += H
        N -= 0.5
    if N >= 0.25:
        c += Q
        N -= 0.25

print(c)

q,h,s,d = map(int,input().split())
n = int(input())

z = min(q*4,h*2,s)

if n % 2 != 0:
    print(min((n//2)*d+z,n*z))
else:
    print(min((n//2)*d,n*z))


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d=map(int,input().split())
n=int(input())
#print(q,h,s,d)
cosp=[[q*16,1],[h*4,1],[s,1],[d/2,2]]
c=sorted(cosp,key=lambda x:x[0])
#print(c)
cost=0
for i in c:
    p,q=i[0],i[1]
    if n//q>0:
        cost+=(n//q)*p*q
        n-=(n//q)*q
print(int(cost))

q,h,s,d=map(int,input().split())
n=int(input())
#print(q,h,s,d)
cosp=[[q*4,0.25],[h*2,0.5],[s,1],[d/2,2]]
c=sorted(cosp,key=lambda x:x[0])
#print(c)
cost=0
for i in c:
    p,q=i[0],i[1]
    if n//q>0:
        cost+=(n//q)*p*q
        n-=(n//q)*q
print(cost)

q,h,s,d,n=map(int,open(0).read().split());m=min(4*q,2*h,s);print(n//2*min(d,2*m)+n%2*m)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
*l, n = map(int, open(0).read().split())
c = 0
for i, j in sorted([j*2**(2-i), 2**(i-2)] for i, j in enumerate(l)):
  t = n//j*j
  c += i*t
  n -= t
  if not n:
    print(c)
    exit()

q, h, s, d, n = map(int, open(0).read().split())
m = min(q*4, h*2, s)
print(min(n*m, n//2*d + n%2*m))

Verdicts: Wrong Answer

Accepted
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):
q, h, s, d = list(map(int, input().split()))
n = int(input())
t = min(4*q, 2*h, s)
if n%2==0:
  ans = min(n*t, n*(d/2))
else:
  ans = min((n-1)*t, (n-1)*(d/2))+t
print(ans)

q, h, s, d = list(map(int, input().split()))
n = int(input())
t1 = min(4*q, 2*h, s)
t2 = min(2*t1, d)
ans = t2*(n//2)
if n%2==1:
  ans += t1
print(ans)

Verdicts: Wrong Answer

Accepted
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):
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())


Q1,H1,S1 = 8*Q,4*H,2*S
S = min(Q1,H1,S1)


if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())


Q1,H1,S1 = 8*Q,4*H,2*S
S = min(Q1,H1,S1)

if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = N * S
print(int(pay))

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())


Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = (N//A) * S
print(int(pay))

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = a*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())


Q2,H2,S2,D2 = 8*Q,4*H,2*S,D
lis = [(0.25,Q2),(0.5,H2),(1,S2),(2,D)]
lis = sorted(lis,reverse = False,key = lambda x:x[1])

a,b,c,d = lis[0][1],lis[1][1],lis[2][1],lis[3][1]


A,B,C,D = lis[0][0],lis[1][0],lis[2][0],lis[3][0]
pay = 0

if A == 2:
    cnt_A = N//2
    cnt_B = N%2
    pay = D*cnt_A + cnt_B*(b/(2/B))
else:
    pay = (N//a) * (a/(2/A))
print(int(pay))

Q,H,S,D = map(int,input().split())
N = int(input())


Q2,H2,S2,D2 = 8*Q,4*H,2*S,D
lis = [(0.25,Q2),(0.5,H2),(1,S2),(2,D)]
lis = sorted(lis,reverse = False,key = lambda x:x[1])

a,b,c,d = lis[0][1],lis[1][1],lis[2][1],lis[3][1]


A,B,C,D = lis[0][0],lis[1][0],lis[2][0],lis[3][0]
print(lis)

pay = 0

cnt = (N//A)
N -= A*cnt
pay += (a/(2/A))*cnt

if N == 1:
    cnt = (N//B)
    N -= B*cnt
    pay += (b/(2/B))*cnt
print(int(pay))    

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = D*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
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):
q, h, s, d = map(int, input().split())
n = int(input())
ans = 0
q_per = q / 0.25
h_per = h / 0.5
s_per = s
d_per = d / 2
list = [q_per,h_per,s_per,d_per]
elif min(list) == d_per :
    if n%2 == 0:
        ans += d * (n //2)
    else :
        ans += n//2 * d
        n -= n//2
        list.remove(d_per)
        if min(list) == s_per :
            ans += s_per
        elif min(list) == h_per :
            ans += h * 2
        else :
            ans += q * 4
elif min(list) == s_per :
    ans += n * s
elif min(list) == h_per :
    ans += n * 2 * h
else :
    ans += n * 4 * q

print(int(ans))


q, h, s, d = map(int, input().split())
n = int(input())
ans = 0
q_per = q / 0.25
h_per = h / 0.5
s_per = s
d_per = d / 2
list = [q_per,h_per,s_per,d_per]
if min(list) == d_per :
    if n%2 == 0:
        ans += d * (n //2)
    else :
        ans += n//2 * d
        n -= n//2
        list.remove(d_per)
        if min(list) == s_per :
            ans += s_per
        elif min(list) == h_per :
            ans += h * 2
        else :
            ans += q * 4
elif min(list) == s_per :
    ans += n * s
elif min(list) == h_per :
    ans += n * 2 * h
else :
    ans += n * 4 * q

print(int(ans))


Verdicts: Runtime Error

Accepted
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):
A = list(input())
N = len(A)
uq_list = []
halfN = N // 2

count = 1
for i in range(0, N):
    tempstr = A[i]
    for j in range(i+1, N):
        if A[j] != tempstr:
            count += 1

print(count)

Q, H, S, D = input().split()
Q, H, S, D = int(Q), int(H), int(S), int(D) # price 0.25 0.5 1.0 2.0
N = int(input())

per_2l_price = [Q*8, H*4, S*2, D]
per_1l_price = [Q*4, H*2, S]
per_05_price = [Q*2, H]
per_025_price = [Q]
needtobuy_l = N
needtobuy_m = 0


def st_min(lt):
    min_num = 0
    min_ = 1000000000000000000000000
    for i in range(len(lt)):
        if lt[i] < min_:
            min_num = i
            min_ = lt[i]
    return min_num
st_min


if needtobuy_l >= 2.0:
    mn = st_min(per_2l_price)
    needtobuy_m += per_2l_price[mn] * (needtobuy_l // 2.0)
    needtobuy_l -= 2.0 * (needtobuy_l // 2.0)
print(needtobuy_l, needtobuy_m)
input()
if needtobuy_l >= 1.0:
    mn = st_min(per_1l_price)
    needtobuy_m += per_1l_price[mn] * (needtobuy_l // 1.0)
    needtobuy_l -= 1.0 * (needtobuy_l // 1.0)
print(needtobuy_l, needtobuy_m)
input()
if needtobuy_l >= 0.5:
    mn = st_min(per_05_price)
    needtobuy_m += per_05_price[mn] * (needtobuy_l // 0.5)
    needtobuy_l -= 0.5 * (needtobuy_l // 0.5)
print(needtobuy_l, needtobuy_m)
input()
if needtobuy_l >= 0.25:
    needtobuy_m += Q * (needtobuy_l // 0.25)
    needtobuy_l -= 0.25 * (needtobuy_l // 0.25)

print(int(needtobuy_m))


Q, H, S, D = input().split()
Q, H, S, D = int(Q), int(H), int(S), int(D)
N = int(input())

needtobuy_l = N
needtobuy_m = 0
per_2l_price = [D,
                S*2, S+H*2, S+H+Q*2,
                H*4, H*3+Q*2, H*2+Q*4, H+Q*6,
                Q*8]
per_1l_price = [S,
                H*2, H+Q*2,
                Q*4]

print(per_2l_price)
print(per_1l_price)
if needtobuy_l % 2 == 0:
    mincost = min(per_2l_price)
    needtobuy_m = mincost * (needtobuy_l // 2)
else:
    mincost = min(per_2l_price)
    needtobuy_m = mincost * (needtobuy_l // 2)
    mincost = min(per_1l_price)
    needtobuy_m += mincost * 1

print(needtobuy_m)

Q, H, S, D = input().split()
Q, H, S, D = int(Q), int(H), int(S), int(D)
N = int(input())

needtobuy_l = N
needtobuy_m = 0
per_2l_price = [D,
                S*2, S+H*2, S+H+Q*2,
                H*4, H*3+Q*2, H*2+Q*4, H+Q*6,
                Q*8]
per_1l_price = [S,
                H*2, H+Q*2,
                Q*4]

if needtobuy_l % 2 == 0:
    mincost = min(per_2l_price)
    needtobuy_m = mincost * (needtobuy_l // 2)
else:
    mincost = min(per_2l_price)
    needtobuy_m = mincost * (needtobuy_l // 2)
    mincost = min(per_1l_price)
    needtobuy_m += mincost * 1

print(needtobuy_m)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
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):

q, h, s, d = map(int, input().split())
n = int(input())
arr = [8 * q, 4 * h, 2 * s, d]
x = min(arr)
ans = (n // 2) * x
print(x, ans)
if n / 2 > 0:
    ans += min([4 * q, 2 * h, s])
print(ans)



q, h, s, d = map(int, input().split())
n = int(input())
arr = [8 * q, 4 * h, 2 * s, d]
x = min(arr)
if n % 2 == 0:
    print((n // 2) * x)
else:
    ans = (n // 2) * x
    ans += min([4 * q, 2 * h, s])
    print(ans)


Verdicts: Wrong Answer

Accepted
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):
VS = [(Y, Y*(2/q), q) for Y, q in ((int(input()), q) for q in (0.25, 0.5, 1, 2))]
N = int(input())
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=True):
  u = N // q
  N -= q * u
  tanka += Y * u
  if N <= 0:
    break

print(tanka)


VS = [(Y, Y*(2//q), q) for Y, q in zip(map(int, input().split()), (0.25, 0.5, 1, 2))]
N = int(input())
#print(VS)
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=False):
  u = N // q
  N -= q * u
  #print((q, u))
  tanka += Y * int(u)
  if N <= 0:
    break
 
print(tanka)

Verdicts: Runtime Error

Accepted
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):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    q, h, s, d = map(int, input().split())
    n = int(input())
    t = min(q * 4, h * 2, s)
    if n == 1:
        print(int(t))
    else:
        if n % 2 == 0:
            print(int(min(t * n, d * n // 2)))
        else:
            print(t * n, d * ((n - 1) // 2) + t)
            print(int(min(t * n, d * ((n - 1) // 2) + t)))


if __name__ == '__main__':
    resolve()


import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    q, h, s, d = map(int, input().split())
    n = int(input())
    t = min(q // 0.25, h // 0.5, s)

    if n == 1:
        print(t)
    else:
        if n % 2 == 0:
            print(min(t * n, d * n // 2))
        else:
            print(min(t * n, d * (n - 1) // 2 + t))


if __name__ == '__main__':
    resolve()


import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    q, h, s, d = map(int, input().split())
    n = int(input())
    t = min(q * 4, h * 2, s)

    if n == 1:
        print(int(t))
    else:
        if n % 2 == 0:
            print(int(min(t * n, d * n // 2)))
        else:
            print(int(min(t * n, d * ((n - 1) // 2) + t)))


if __name__ == '__main__':
    resolve()


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
A = input()
cand = set([A])
l = len(A)
for i in range(0, l - 1):
    for j in range(i + 1,l):
        p = A[i:j+1]
        cand.add((A[0:i] + p[::-1] + A[j + 1:l]))
print(len(cand))

A = input()
cand = set([A])
l = len(A)
for i in range(0, l - 1):
    for j in range(i + 1,l):
        p = A[i:j+1]
        cand.add((A[0:i] + p[::-1] + A[j + 1:l]))
print(len(cand))

if __name__ == '__main__':

    Q, H, S, D = map(int, input().split())
    N = int(input())

    
    amounts = {'Q' : 0.25, 'H' : 0.5, 'D' : 1.0, 'D' : 2.0}
    
    sizes = {'Q' : int(Q * 4.0), 'H' : int(H * 2.0), 'S' : S, 'D' : int(D * 0.5)}
    sizes = sorted(sizes.items(), key=lambda x: x[1])
    print(sizes)
    sum_price = 0

    while N > 0:
        for size in sizes:

            if size[0] != 'D':
                if N - 1 >= 0:
                    N -= 1
                    sum_price += size[1]
                else:
                    break
            else:
                if N - 2 >= 0:
                    N -= 2
                    sum_price += D
                else: break



    print(sum_price)

if __name__ == '__main__':
    Q, H, S, D = map(int, input().split())
    N = int(input())
    
    #amounts = {'Q' : 0.25, 'H' : 0.5, 'D' : 1.0, 'D' : 2.0}
    
    sizes = {'Q' : int(Q * 4.0), 'H' : int(H * 2.0), 'S' : S, 'D' : int(D * 0.5)}
    sizes = sorted(sizes.items(), key=lambda x: x[1])
    sum_price = 0
    while N > 0:
        for size in sizes:
            if size[0] != 'D':
                sum_price += size[1] * N
                N = 0
            else:
                num = int(N / 2)
                N -= 2 * num
                sum_price += D * num
    print(sum_price)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

Q,H,S,D = I()
N = i()
A = [[Q*8,0.25,Q],[H*4,0.5,H],[S*2,1,S],[D,2,D]]
A.sort()
ans = 0
for i in range(4):
    a,b,c = A.pop(0)
    if b <= N:
        ans += (N//b)*c
        N -= (N//b)*b
    if N == 0:
        print(ans)
        break


import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

Q,H,S,D = I()
N = i()
A = [[Q*8,0.25,Q],[H*4,0.5,H],[S*2,1,S],[D,2,D]]
A.sort()
ans = 0
for i in range(4):
    a,b,c = A.pop(0)
    if b <= N:
        ans += int((N//b)*c)
        N -= (N//b)*b
    if N == 0:
        print(ans)
        break

Verdicts: Wrong Answer

Accepted
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):
q, h, s, d = map(int, input().split())
n = int(input())

one = min(q * 4, h * 2, s)
two = min(one, d)

ans = (n // 2) * two + (n % 2) * one
print(ans)


q, h, s, d = map(int, input().split())
n = int(input())

one = min(q * 4, h * 2, s)
two = min(one * 2, d)

ans = (n // 2) * two + (n % 2) * one
print(ans)


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())
l = [q,h/2,s/4,d/8]
cost = 0
while n:
  now = l2.index(min(l))
  cost += n//r[now]
  n %= r[now]
  r.pop(now)
  l.pop(now)
print(cost)

q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())*4
l = [q,h/2,s/4,d/8]
v = [1,2,4,8]
cost = 0
while n:
  now = l2.index(min(l))
  cost += n//v[now] * r[now]
  n %= v[now]
  v.pop(now)
  r.pop(now)
  l.pop(now)
print(cost)


q,h,s,d = map(int,input().split())
r = [q,h,s,d]
n = int(input())*4
l = [q,h/2,s/4,d/8]
v = [1,2,4,8]
cost = 0
while n:
  now = l.index(min(l))
  cost += n//v[now] * r[now]
  n %= v[now]
  v.pop(now)
  r.pop(now)
  l.pop(now)
print(cost)

Verdicts: Runtime Error

Runtime Error

Accepted
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):
q,h,re,d = map(int,input().split())
n = int(input())
re = min(q*4, h*2,result)
print(min(result*n, n//2*d + (n%2)*re))

q,h,re,d = map(int,input().split())
n = int(input())
re = min(q*4, h*2,re)
print(min(re*n, n//2*d + (n%2)*re))

Verdicts: Runtime Error

Accepted
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):
price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans));



price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans);



Verdicts: Runtime Error

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())

most_bargain = min(8 * Q, 4 * H, 2 * S, D)
if most_bargain != D:
    print((most_bargain // 2) * N)
else:
    if N % 2 == 0:
        print((N // 2) * D)
    else:
        print((N // 2) * D + min(4 * Q, 2 * H, S))5410760474836152
1524157763907942

Q, H, S, D = map(int, input().split())
N = int(input())

most_bargain = min(8 * Q, 4 * H, 2 * S, D)
if most_bargain != D:
    print((most_bargain // 2) * N)
else:
    if N % 2 == 0:
        print((N // 2) * D)
    else:
        print((N // 2) * D + min(4 * Q, 2 * H, S))

Verdicts: Runtime Error

Accepted
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):
q,h,s,d=map(int,input().split())
n=int(input())
cperl=[q*4,h*2,s,d/2]
if n%2==0:
  print(n*min(cperl))
else:
  if min(cperl)==cperl[3]:
    print(cperl[3]*(n-1)+min(cperl[:3]))
  else:
    print(n*min(cperl))


q,h,s,d=map(int,input().split())
n=int(input())
cperl=[q*4,h*2,s,d//2]
if n%2==0:
  print(n*min(cperl))
else:
  if min(cperl)==cperl[3]:
    print(cperl[3]*(n//2)+min(cperl[:3]))
  else:
    print(n*min(cperl))

q,h,s,d=map(int,input().split())
n=int(input())
cperl=[q*8,h*4,s*2,d]
if n%2==0:
  print(int((n//2)*min(cperl)))
else:
  if min(cperl)==cperl[3]:
    print(int(cperl[3]*(n//2)+min(cperl[:3])//2))
  else:
    print(int(n*(min(cperl)//2)))


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
Q, H, S, D = map(int, input().split())  # 0.25, 0.5, 1, 2
N = int(input())
H = min(H, 2 * Q)   # 0.5
S = min(S, 2 * H)   # 1
if 2 * S <= D:
    print(S * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    else:
        print(D * N // 2 + S)

q, h, s, d, n = map(int, open(0).read().split())
s = min(q * 4, h * 2, s)
print(n // 2 * min(d, s * 2) + n % 2 * s)

Verdicts: Wrong Answer

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())

cQ = Q*4
cH = H*2
cS = S
cD = D / 2

m = min(cQ, cH, cS, cD)

if m == cQ:
    print(cQ * N)
elif m == cH:
    print(cH * N)
elif m == cS:
    print(cS * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    elif N == 1:
        print(min(cQ, cH, cS))
    else:
        c = (N-1)*cD
        print(c + min(cQ, cH, cS))

Q, H, S, D = map(int, input().split())
N = int(input())

cQ = Q*8
cH = H*4
cS = S*2
cD = D 

m = min(cQ, cH, cS, cD)

if m == cQ:
    print(Q * N * 4)
elif m == cH:
    print(H * N * 2)
elif m == cS:
    print(S * N)
else:
    if N % 2 == 0:
        print(D * N // 2)
    elif N == 1:
        print(min(Q * 4, H * 2, S))
    else:
        c = (N-1) // 2 * D
        print(c + min(Q * 4, H * 2, S))


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d = map(int,input().split())
n = int(input())
a = min(q*4,h*2,s)
if n % 2 == 0:
  print(min(n/(a*2),n/d))
else:
  print(min(n/(a*2)+d),n/d)
  
        

Q, T, S, D = map(int, input().split())
N = int(input())

for_1L = min(4*Q, 2*T, S)
for_2L = min(2*for_1L, D)

print((N//2)*for_2L + (N%2)*for_1L)


Verdicts: Runtime Error

Accepted
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):
q, h, s, d = map(int, input().split())
n = int(input())

s = min(q*4, h*2, s)

print(s*n if d<s*2 else d*(n//2)+s)




q, h, s, d = map(int, input().split())
n = int(input())

s = min(q*4, h*2, s)

print(s*n if d>s*2 else d*(n//2)+s*(n%2))




Verdicts: Wrong Answer

Accepted
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):
q, h, s, d = map(int, input().split())
n = int(input())
print((n/2) * min(8 * q, 4 * h, 2 * s, d) + (n % 2) * min(4 * q, 2 * h, s))

q, h, s, d = map(int, input().split())
n = int(input())
print((n//2) * min(8 * q, 4 * h, 2 * s, d) + (n % 2) * min(4 * q, 2 * h, s))

Verdicts: Wrong Answer

Accepted
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):
q,h,s,d=map(int,input().split())
N=int(input())
s=min(q*4,h*2,s)
print(min(s*N,d*(N//2)+a*(N%2)))

q,h,s,d=map(int,input().split())
N=int(input())
s=min(q*4,h*2,s)
print(min(s*N,d*(N//2)+s*(N%2)))

Verdicts: Runtime Error

Accepted
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):
l = [[0.25],[0.5],[1],[2]]
tmp = list(map(int,input().split()))
for i in range(4):
    l[i].append(tmp[i])

for i in range(4):
    l[i].append(l[i][1]*4//(l[i][0]*4))
print(l)

from operator import itemgetter
l = sorted(l, key=itemgetter(2))

ans = 0
n = int(input())
for i in range(4):
    tmp = n//l[i][0]
    if tmp > 0:
        ans += tmp * l[i][1]
        n -= tmp*l[i][0]

print(int(ans))

l = [[0.25],[0.5],[1],[2]]
tmp = list(map(int,input().split()))
for i in range(4):
    l[i].append(tmp[i])
print(l)
for i in range(4):
    l[i].append(l[i][1]*4/(l[i][0]*4))
print(l)

from operator import itemgetter
l = sorted(l, key=itemgetter(2))

ans = 0
n = int(input())
for i in range(4):
    tmp = n//l[i][0]
    if tmp > 0:
        ans += tmp * l[i][1]
        n -= tmp*l[i][0]

print(int(ans))

l = [[0.25],[0.5],[1],[2]]
tmp = list(map(int,input().split()))

for i in range(4):
    l[i].append(tmp[i])

for i in range(4):
    l[i].append(l[i][1]*4/(l[i][0]*4))

from operator import itemgetter
l = sorted(l, key=itemgetter(2))

ans = 0
n = 4*int(input())
for i in range(4):
    tmp = n//int(l[i][0]*4)
    if tmp >= 1:
        ans += tmp * l[i][1]
        n -= tmp*int(l[i][0]*4)

print(int(ans))


Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
al = list(map(int,input().split()))
bl = al[:]
n = int(input())

bl[0] = al[0] * 8
bl[1] = al[1] * 4
bl[2] = bl[2] * 2

import numpy as np

t = list(np.argsort(bl))
if t[3] == 0:
    idx = t.index(1)
    print(n//2 * bl[3] + (n%2) * bl[idx] / 2)
else:
    idx = t.index(0)
    print(n * bl[idx] / 2)



al = list(map(int,input().split()))
n = int(input())

bl = al[:]
bl[0] = bl[0] * 4
bl[1] = bl[1] * 2
bl[2] = bl[2] * 1
bl[3] = bl[3] / 2

idx = bl.index(min(bl))
idx2 = bl[:3].index(min(bl[:3]))
if idx == 3:
    print(n//2*al[idx] + (n%2) * bl[idx2])
else:
    print(bl[idx]*n)

Verdicts: Wrong Answer

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())

if N%2:
    if D/2 < min(Q*4, H*2, S):
        print(int(N//2*(D/2))+(N-N//2)*min(Q*4, H*2, S))
    else:
        print(N*min(Q*4, H*2, S))
else:
    print(int(N*min(Q*4, H*2, S, D/2)))

Q, H, S, D = map(int, input().split())
N = int(input())

if N%2:
    if D/2 < min(Q*4, H*2, S):
        print(N//2*S+(N-N//2)*min(Q*4, H*2, S))
    else:
        print(N*min(Q*4, H*2, S))
else:
    print(int(N*min(Q*4, H*2, S, D/2)))

Q, H, S, D = map(int, input().split())
N = int(input())
m1 = min(Q*4, H*2, S)

if N%2:
    print(N//2*D+m1 if D < 2*m1 else N*m1)
else:
    print(N*min(Q*8, H*4, S*2, D)//2)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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):
Q, H, S, D = map(int, input().split())
N = int(input())
if N%2 == 0:
  print((N//2)*min(8*Q,4*H,2*S,D))
else:
  m = min(4*Q,2*H,S)
  if 2*m <= D:
    print(m*N)
  else:
    print((D/2)*N+m)

Q, H, S, D = map(int, input().split())
N = int(input())
if N%2 == 0:
  print((N//2)*min(8*Q,4*H,2*S,D))
else:
  m = min(4*Q,2*H,S)
  if 2*m <= D:
    print(m*N)
  else:
    print(int((D/2)*N+m))

Q, H, S, D = map(int, input().split())
N = int(input())
if N%2 == 0:
  print(N * min(4*Q, 2*H, S, D/2))
else:
  print(min(4*Q*N, 2*H*N, S*N, N*D//2 + min(4*Q, 2*H, S)))

Q, H, S, D = map(int, input().split())
N = int(input())
if N%2 == 0:
  print((N//2)*min(8*Q,4*H,2*S,D))
else:
  m = min(4*Q,2*H,S)
  if 2*m <= D:
    print(m*N)
  else:
    print(int(D*(N//2)+m))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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):
#AtCoder Grand Contest 019 a
q,h,s,d=map(int,input().split())#0.25,0.5,1,2
d=min(d,s*2,h*4,q*8)
s=min(s,h*2,q*4)
h=min(h,q*2)
n=int(input())
ans=0
n-=n//d
ans+=n//d*d
n-=n//s
ans+=n//s*s
n-=n//h
ans+=n//h*h
n-=n//q
ans+=n//q*q
print(int(ans))


#AtCoder Grand Contest 019 a
q,h,s,d=map(int,input().split())#0.25,0.5,1,2
d=min(d,s*2,h*4,q*8)
s=min(s,h*2,q*4)

n=int(input())
if n%2==0:
    print(n//2*d)
else:
    print(n//2*d+s)


Verdicts: Wrong Answer

Accepted
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):
q,h,s,d = map(int,input().split())
n = int(input())
k = [
    [q*4,q,0.25],
    [h*2,h,0.5],
    [s,s,1],
    [d/2,d,2]
    ]
k.sort() 
cost = 0
for i in range(4):
    num = n // k[i][2] * k[i][1]
    cost += num
    n %= k[i][2]
print(cost)

q,h,s,d = map(int,input().split())
n = int(input())*4

k = [
    [q*8,q,1],
    [h*4,h,2],
    [s*2,s,4],
    [d,d,8]
    ]
k.sort() 
cost = 0
for i in range(4):
    num = n // k[i][2] * k[i][1]
    cost += num
    n %= k[i][2]
print(int(cost))


Verdicts: Wrong Answer

Accepted