Problem:


Score : 300 points

Problem Statement

"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.

Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Constraints

1 ≤ A, B, C ≤ 5000

1 ≤ X, Y ≤ 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C X Y

Output

Print the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.

Sample Input 1

1500 2000 1600 3 2

Sample Output 1

7900

It is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.

Sample Input 2

1500 2000 1900 3 2

Sample Output 2

8500

It is optimal to directly buy three A-pizzas and two B-pizzas.

Sample Input 3

1500 2000 500 90000 100000

Sample Output 3

100000000

It is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.



Sample input:
1500 2000 1600 3 2


Sample output:
7900

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

a, b, c, x, y = map(int, input().split())

itr = max(x, y)*2+1

ans = sys.maxsize
for i in range(itr):
    tmpa = min(0, a*(x-i//2))
    tmpb = min(0, b*(y-i//2))
    tmpc = c*i
    tmp_cost = tmpa+tmpb+tmpc
    ans = min(ans, tmp_cost)

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

a, b, c, x, y = map(int, input().split())

itr = max(x, y)*2+1

ans = sys.maxsize
for i in range(itr):
    tmpa = a*(x-i//2)
    tmpb = b*(y-i//2)
    tmpc = c*i
    tmp_cost = tmpa+tmpb+tmpc
    ans = min(ans, tmp_cost)

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int, input().split()))

ans1 = 0
ans2 = 0
ans3 = 0

# 通常のケース
ans1 = A * X + B * Y

# 半分のケース
if X >= Y:
    ans2 = Y * 2 * C + (X - Y) * A
    if Y * 2 > X:
        ans3 = X * 2 * C
else:
    ans2 = X * 2 * C + (Y - X) * A
    if X * 2 > Y:
        ans3 = Y * 2 * C

print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int, input().split()))

# 通常のケース
ans1 = A * X + B * Y

# 半分のケース
if X >= Y:
    ans2 = Y * 2 * C + (X - Y) * A
    ans3 = X * 2 * C
else:
    ans2 = X * 2 * C + (Y - X) * A
    ans3 = Y * 2 * C

print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int,input().split())

if (a+b)//2 <= c and x != 0 and y != 0:
    print(x*a + y*b)
    exit()
    
ans = 0

ans += min(x,y) * c * 2

if x >= y:
    ans += min((x-y)*a, (x-y)*2*c)
else:
    ans += min((y-x)*b, (y-x)*2*c)
    
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int,input().split())

if (a+b)//2 <= c:
    print(x*a + y*b)
    exit()
    
ans = 0

ans += min(x,y) * c * 2

if x >= y:
    ans += min((x-y)*a, (x-y)*2*c)
else:
    ans += min((y-x)*b, (y-x)*2*c)
    
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
"""ans = a*x+b*y
for i in range(2*max(x,y)+1):#ABピザを買う枚数で全探索
  ans = min(ans,i*c+max(0,(x-(i//2)))*a+max(0,(y-(i//2)))*b)
"""
if a+b <= 2*c: print(a*x+b*y)
elif max(a,b) >= c*2:# 多い方の値段よりcが小さいなら
  print(max(x,y)*2*c)
else:#そうでないなら小さい方の値段までcを使って、あとはa,bで埋める
  if x>y:
    print(min(x,y)*2*c+abs(x-y)*a)
  else: print(min(x,y)*2*c+abs(x-y)*b)

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())
    d = [a, b]
    i, j = max(x, y), min(x, y)
    n = i // 2 * 2
    f = i == x
    if 2 * c * n > (a + b) * n:
        ans = a * x + b * y
    else:
        ans = c * 2 * n + (i % 2 == 1) * min(2 * c, d[not f])

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

if X > Y:
    many = A
else:
    many = B
    

if min(A, B) > 2 * C:
    ans = C * 2 * max(X, Y)
elif (A + B) / 2 < C:
    ans = A * X + B * Y
else:
    ans = min(X, Y) * 2 * C + (max(X, Y) - min(X, Y)) * many

print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

if X > Y:
    many = A
else:
    many = B
    

if min(A, B) > 2 * C:
    ans = C * 2 * max(X, Y)
elif (A + B) / 2 <= C:
    ans = A * X + B * Y
else:
    ans = min(X, Y) * 2 * C + (max(X, Y) - min(X, Y)) * many

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
count = 0
if A >= C*2 or B >= C*2:
    print(max(X,Y)*2*C)

elif A+B >= C*2:
    if X > Y:
        print(Y*2*C + (X-Y)*A)
    elif X < Y:
        print(X*2*C + (Y-X)*B)
    else:
        print(X*2*C)
else:
    print(X*A+Y*B)

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())

    total_min = a * x + b * y

    for i in range(2, max(x, y)+1):
        total = a * max(x - i, 0) + b * max(y - i, 0) + c * i * 2
        total_min = min(total, total_min)
    print(total_min)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
xx=x-x%2
yy=y-y%2
ans=0
if max(a,b)<c:
  ans+=a*xx+b*yy
elif a+b<=2*c<=2*b:
  ans+=(a+b)*min(xx,yy)+[2*c*(yy-xx),a*(xx-yy)][xx>yy]
elif a+b<=2*c<=2*a:
  ans+=(a+b)*min(xx,yy)+[2*c*(xx-yy),b*(yy-xx)][yy>xx]
elif 2*c<a+b<2*b:
  ans+=2*c*min(xx,yy)+[2*c*(yy-xx),a*(xx-yy)][xx>yy]
elif 2*c<a+b<2*a:
  ans+=2*c*min(xx,yy)+[2*c*(xx-yy),b*(yy-xx)][yy>xx]
else:
  ans+=2*c*max(xx,yy)
if xx<x and yy<y:
  ans+=[2*c,a+b][2*c>a+b]
elif xx<x:
  ans+=[2*c,a][2*c>a]
elif yy<y:
  ans+=[2*c,b][2*c>b]
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

xn, yn = 0, 0
price = 0

if (A+B) >= 2*C and A >= 1 and B >= 1:
    ammount = min(X, Y)
    price += C * ammount * 2
    xn += ammount
    yn += ammount

if A >= 2*C and X > xn:
    ammount = X - xn
    price += C * X * 2
    xn += X
    yn += X

if B >= 2*C and Y > yn:
    ammount = Y - yn
    price += C * ammount * 2
    xn += ammount
    yn += ammount

price += A * (X - xn)
price += B * (Y - yn)

print(price)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

xn, yn = 0, 0
price = 0

if (A+B) >= 2*C:
    ammount = min(X, Y)
    price += C * ammount * 2
    xn += ammount
    yn += ammount

if A >= 2*C and X > xn:
    ammount = X - xn
    price += C * X * 2
    xn += X
    yn += X

if B >= 2*C and Y > yn:
    ammount = Y - yn
    price += C * ammount * 2
    xn += ammount
    yn += ammount

price += A * (X - xn)
price += B * (Y - yn)

print(price)

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())
    ans = 0
    if a+b > 2*c:
        com = min(x, y)
        ans += 2*c*com
        if 2*c <= a or 2*c <= b:
            ans += max(x-com, y-com)*2*c
        else:
            ans += a*(x-com) + b*(y-com)
    else:
        ans += a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b > 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        else:
            ans += a*(x-com) + b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b >= 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b > 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b > 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b > 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += abs(x-y)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
ans = 0
if a+b<c*2:
    ans = a*x+b*y
elif a+b>c:
    ans = c*2*max(x,y)
else:
    ans = abs(x-y)
    if x<y:ans*=b
    else:ans*=a
    ans += c*2*min(x,y)
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, x, y = map(int, input().split())

    ans = a*x + b*y

    for i in range(x):
        num = a*i
        a_diff = x - i
        for j in range(y):
            c_max = max(a_diff, y-j)
            num += b*j + (c*2*c_max)
            ans = min(num, ans)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import numpy as np
a,b,c,x,y = map(int,input().split())
ans = min(a+b,c*2)*min(x,y)
if c*2 <= min(a,b):
    ans +=c*2*np.abs(x-y)
elif x > y:
    ans += a*(x-y)
else:
    ans += b*(y-x)
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
Xo=A*X+B*Y
if X>=Y:
 X1=A*(X-Y)+2*C*Y
else:
 X1=B*(Y-X)+2*C*Y
X2=2*C*max(X,Y)
print(min(Xo,X1,X2))

Submission status: Wrong Answer

Solution code:
cost_a,cost_b,cost_ab,num_a,num_b = map(int,input().split())
if num_a > num_b:
  num_ab = num_b * 2
  need_a = num_a - (num_ab // 2)
  if need_a < 0:
    need_a = -need_a
  cost1 = need_a * cost_a + num_ab * cost_ab
elif num_a < num_b:
  num_ab = num_a * 2
  need_b = num_b - (num_ab // 2)
  if need_b < 0:
    need_b = -need_b
  cost1 = need_b * cost_b + num_ab * cost_ab
else:
  num_ab = num_b * 2  
  cost1 = num_ab * cost_ab
cost2 = cost_a * num_a + cost_b * num_b
if cost1 > cost2:
  print(cost2)
else:
  print(cost1)

Submission status: Wrong Answer

Solution code:
cost_a,cost_b,cost_ab,num_a,num_b = map(int,input().split())
num = max(num_a,num_b)
cost1 = num * 2 * cost_ab
cost2 = cost_a * num_a + cost_b * num_b
if cost1 > cost2:
  print(cost2)
else:
  print(cost1)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if (c*2>a or c*2>b) and (c>=a and x>=y) or (c>=b and y>x):
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if (c*2>a or c*2>b) or (c>=a and x>=y) or (c>=b and y>x):
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if (c*2>=a or c*2>=b)and(c<=a or c<=b):
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

TotalPrice = 5000 * 10**5
for i in range(max(X, Y) + 1):
    priceA = A * max(X - i, 0)
    priceB = B * max(Y - i, 0)
    TotalPrice = min(TotalPrice, 2 * C * i + priceA + priceB)

print(TotalPrice)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if (c*2>a or c*2>b)and(c<a or c<b):
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if c*2>a or c*2>b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if c*2>=a or c*2>=b or c>=a or c>=b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if c*2>=a or c*2>=b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  if (c>=a and x>=y) or (c>=b and y>x):
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  if c>=a or c>=b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1
    
if ans1>1 and ans1<ans:
  print(ans1)
  sys.exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

else:
  if c>=a or c>=b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

else:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  if c>=a or c>=b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  if c>a or c>b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  if c>a and c>b:
    while x>0 and y>0:
      ans+=c*2
      x-=1
      y-=1
  else:
    while x>0 or y>0:
      ans1+=c*2
      x-=1
      y-=1
    print(ans1)
    sys.exit()

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  while x>0 and y>0:
    ans+=c*2
    x-=1
    y-=1
  while x>0 or y>0:
    ans1+=c*2
    x-=1
    y-=1

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

if ans>ans1:
  print(ans1)
  sys.exit()
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  while x>0 and y>0:
    ans+=c*2
    x-=1
    y-=1

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*2*x+a*max(0,y-x))
ans.append(c*2*y+b*max(0,x-y))
print(min(ans))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+y*max(0,b-c))
ans.append(c*y+x*max(0,a-c))
print(min(ans))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+b*max(0,y-x))
ans.append(c*y+a*max(0,x-y))
print(min(ans))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
mini=float("inf")

for a in range(0,X+1):
  c_num = 2*(X-a)
  b_num = Y- (X-a)
  if b_num>=0:
    P= A*a + B*b_num + C*c_num
    #print(a,b_num,c_num,P)
    mini=min(mini,P)

print(mini)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c and b > 2 * c:
  print(2 * c * max(x,y))
elif a > 2 * c and x > y:
  print(x * 2 * c)
elif a > 2 * c and x < y:
  print(x * 2 * c + (y - x) * b)
elif b > 2 * c and x < y:
  print(y * 2 * c)
elif b > 2 * c and x > y:
  print(y * 2 * c + (x - y) * a)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c and b > 2 * c:
  print(2 * c * max(x,y))
elif a > 2 * c:
  print(x * 2 * c + (y - x) * b)
elif b > 2 * c:
  print(y * 2 * c + (x - y) * a)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c:
  print(x * 2 * c + (y - x) * b)
elif b > 2 * c:
  print(y * 2 * c + (x - y) * a)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c or b > 2 * c:
  print(max(x,y) * 2 * c)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
faceAB = (A + B) / 2
if faceAB <= C:
    print(X * A + Y * B)
elif 2 * C <= A and 2 * C <= B:
    print(2 * C * max(X, Y))
else:
    if X <= Y:
        print(2 * C * min(X, Y) + ((Y - X) * B))
    else:
        print(2 * C * min(X, Y) + ((X - Y) * A))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
faceAB = (A + B) / 2
if faceAB < C:
    print(X * A + Y * B)
elif 2 * C < A and 2 * C < B:
    print(2 * C * max(X, Y))
else:
    if X < Y:
        print(2 * C * min(X, Y) + ((Y - X) * B))
    else:
        print(2 * C * min(X, Y) + ((X - Y) * A))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())

if a//2 + b//2 > c:
    buf = min(x,y) * c * 2
    buf2 = max(x,y) * c * 2
    if min(x,y) == y:
        tmp = buf + abs(x-y) * a
    else:
        tmp = buf + abs(x-y) * b
    ans = min(buf2,tmp)
else:
    ans = x * a + y * b

print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = 1500, 2000, 1600, 3, 2
#na, nb, nc = x, y, 0
mx = 10**18
for i in range(0, (x+y+1)):
  if i%2==1: continue
  total = a*(x-i//2) + b*(y-i//2) + c*i
  if total<mx:
    mx=total

print(mx)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())

na, nb, nc = x, y, 0
mx = 10**18
for i in range(max(x,y)):
  if i%2==1: continue
  total = a*(na-i//2) + b*(nb-i//2) + c*i
  if total<mx:
    mx=total

print(mx)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

A, B, C, X, Y = map(int, input().split(' '))

ans = 10**5 * 5000
for i in range(10**5+1):
    price = 2*C*i + A*max(0, X-i) + B*max(0, Y-i)
    ans = min(ans, price)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = [int(i) for i in input().split()]
if a>2*c and b>2*c:
        m = max(x,y)*2*c
elif a>2*c:
        if x>=y:
            m = x*2*c
        else:
            m=x*2*c+(y-x)*b
elif b>2*c:
        if y>=x:
            m=y*2*c
        else:
            m=y*2*c +(x-y)*a
else:
    m = x*a + y*b
print(m)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
mini = 10000000000
if x < y: temp = x
else: temp = y
for i in range(0, temp * 2 + 1, 2):
    # print(x - i/2, y - i/2, i)
    price = a * (x - int(i/2)) + b * (y - int(i/2)) + c * i
    if price < mini:
        mini = price
print(mini)

Submission status: Wrong Answer

Solution code:
import math 
import bisect
import heapq
from collections import deque

a,b,c,x,y = map(int,input().split())
ans = 0
if (a+b) // 2 > c:
    if x > y:
        ans = 2 * y * c + a * (x-y)
    else: ans = 2 * x * c + b * (y-x)

else:
    if a > b:
        ans = b * y + min(a * x, 2 * c * x)
    else:
        ans = a * x + min(b * y, 2 * c * y)
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input().split(" ")

A = int(S[0])
B = int(S[1])
C = int(S[2])
X = int(S[3])
Y = int(S[4])



def calculate(a,b,c,x,y):
    s1 = a * x + b * y

    base = min([x,y])

    values = [s1]
    for i in range(base):
        index = (i + 1)
        tmp = s1 - (A + B) * index + 2 * C * index
        values.append(tmp)
    print(min(values))

calculate(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
S = input().split(" ")

A = int(S[0])
B = int(S[1])
C = int(S[2])
X = int(S[3])
Y = int(S[4])



def calculate(a,b,c,x,y):
    s1 = a * x + b * y

    base = min([x,y])

    if base % 2 == 1:
        base = base - 1


    values = [s1]
    for i in range(base):
        index = (i + 1)
        tmp = s1 - (A + B) * index + 2 * C * index
        values.append(tmp)



    print(min(values))


calculate(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y= map(int, input().split())

if x==y:
    ans=min(c*2*x,a*x+b*x)

else:
    if x>y:
        ans=min(x*c*2,a*x+b*y,y*c*2+(x-y)*a)
    else:
        ans=min(y*c*2,a*x+b*y,x*c*2+(y-x)*a)

print(ans)

Submission status: Wrong Answer

Solution code:
#pattern1:Only A-pizza/B-pizza
#pattern2:Only C-pizza
#pattern2:C-pizza & A or B-pizza

a,b,c,x,y = map(int, input().split())

min_price = 1000000000000
for i in range(1, 10**5 + 1):
    price = i*2*c + max(0, x-i)*a + max(0, y-i)*b
    min_price = min(min_price, price)

print(min_price)

Submission status: Wrong Answer

Solution code:
#pattern1:Only A-pizza/B-pizza
#pattern2:Only C-pizza
#pattern2:C-pizza & A or B-pizza

a,b,c,x,y = map(int, input().split())

price1 = x*a + y*b
price2 = max(x, y)*2*c
if x<=y:
  price3 = x*2*c
  price3 += (y-x)*b
else:
  price3 = y*2*c
  price3 += (y-x)*a

print(min(price1, price2, price3))

Submission status: Wrong Answer

Solution code:
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**5)
for c in range(1+max([2*x,2*y])):
    a=0
    b=0
    if x>c/2:
        a=math.ceil(x-(c/2))
    if y>c/2:
        b=math.ceil(y-(c/2))
    if A*a+B*b+C*c<price:
        price=A*a+B*b+C*c
print(price)

Submission status: Wrong Answer

Solution code:
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**5)
for c in range(1+max([2*x,2*y])):
    a=0
    b=0
    if x>c/2:
        a=math.ceil(x-c/2)
    if y>c/2:
        b=math.ceil(y-c/2)
    if A*a+B*b+C*c<price:
        price=A*a+B*b+C*c
print(price)

Submission status: Wrong Answer

Solution code:
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**5)
for a in range(x+1):
    c=(x-a)*2
    b=math.ceil(y-c/2)
    if c<0 or b<0:
        continue
    if A*a+B*b+C*c<price:
        price=A*a+B*b+C*c
print(price)

Submission status: Wrong Answer

Solution code:
#095_C
a,b,c,x,y=map(int,input().split())
ans=10**10

for ab in range(0,max(a,b)+1,2):
    tmp=max(0,x-ab//2)*a+max(0,y-ab//2)*b+ab*c
    ans=min(ans,tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int, input().split())
ans = 500000000
for i in range( max(X,Y)+1 ):
  ans = min(ans, C*i*2 + A*(max(0,(X-i)))+B*(max(0,(Y-i))))
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int, input().split())
ans = 500000000
ans = min(ans, A*X+B*Y)
ans = min(ans, C*min(X,Y))
ans = min(ans, (A+B)*min(X,Y)+C*(abs(X-Y)))
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())

if C > (A+B)/2:
    print(A*X+B*Y)
elif X > Y and C > A/2:
    print(C*Y*2+A*(X-Y))
elif X > Y and C < A/2:
    print(C*X*2)
elif X < Y and C > B/2:
    print(C*X*2+B*(Y-X))
elif X < Y and C < B/2:
    print(C*Y*2)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
ans = 0


if a + b  > c * 2:
    ans += (c * 2) * min(x,y)
    if x > y:
        ans += a * (x-y)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)
    elif y > x:
        ans += b * (y-x)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)

elif a + b < c * 2:
    ans = (a * x) + (b * y)


print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
ans = 0


if a + b  > c * 2:
    ans += (c * 2) * min(x,y)
    if x > y:
        ans += a * (x-y)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)
    elif y > x:
        ans += b * (y-x)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)

elif a + b < c * 2:
    ans += (a * x) + (b * y)


print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
ans = 10**20
for i in range(min(x,y)*2+1):
    ans = min(ans,c*i+a*max(0,x-i//2)+b*max(0,y-i//2))

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

A, B, C, X, Y = map(int, input().split())

if (A + B) / 2 > C:
    print("(A + B) / 2 > C")
    # A, B どちらかが十分な枚数になるまでABを買い、残ったものを単品で買う方が特
    if A >= B:
        print("A >= B")
        total = C * X * 2 + A * (Y - X)
    else:
        print("A < B")
        total = C * Y * 2 + A * (X - Y)
else:
    # A, B それぞれ単品で買う方が得
    total = A * X + B * Y

print(total)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(x) for x in input().split(' ')]
if (A + B) / 2 > C:
  p = 10**6
  for i in range(min(X, Y), max(X, Y)+1):
    p = min(p, A * max(0, X-i) + B * max(0, Y-i) + C * i * 2)
  print(p)
else:
  print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())

A = a * x + b * y
B = c * min(x, y) * 2 + a * abs(x - y)
C = c * max(x, y) * 2

print(min(A, B, C))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

ans = A*X + B*Y

i = 1
while True:
    if X-i < 0 or Y-i < 0:
        break
    cost = A*(X-i) + B*(Y-i) + 2*C*i
    if cost > ans:
        break
    ans = min(cost, ans)
    i += 1

print(ans)