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:
a, b, c, x, y = map(int, input().split())
if a<c and b< c:
  print(a*x+b*y)
elif a< c and b>=c:
  if x<=y:
    print(c*2*y)
  else:
    print((x-y)*a+c*2*y)
elif a>=c and b<c:
  if y<=x:
    print(c*2*x)
  else:
    print((y-x)*b+c*2*x)
elif a>=c and b>=c:
  if x>=y:
    print(c*2*x)
  else:
    print(c*2*y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# ABピザを買うかA,Bピザを買うか
cNum = min(x // 2, y // 2) * 2
ans = min(a + b, c * 2) * cNum + (x-cNum) * min(a, c * 2) + (y-cNum) * min(b, c * 2)
print(ans)

Submission status: Wrong Answer

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

# ABピザを買うかA,Bピザを買うか
cNum = min(x // 2, y // 2) * 2
print(min(a + b, c * 2) * cNum + (x-cNum) *
      min(a, c * 2) + (y-cNum) * min(b, c * 2))
# print(cNum, x - cNum, y - cNum)
# print(min(a + b, c * 2) * cNum, x - cNum, y - cNum)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=[int(s) for s in input().split()]
if x<=y:
  A=a
  B=b
  C=c
  X=x
  Y=y
else:
  A=b
  B=a
  C=c
  X=y
  Y=x
print(min([Y*2*C,X*2*C+(Y-X)*B,X*A+(Y-X)*B]))

Submission status: Wrong Answer

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

minprice = 6 * 10 ** 8
XY_max = max(X,Y)

for i in range(XY_max + 1):
    nokori_X = max(X - i,0)
    nokori_Y = max(Y - i,0)

    tmp = i * 2 * C + nokori_X * A + nokori_Y * B
    minprice = min(tmp,minprice)

print(minprice)

Submission status: Wrong Answer

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

#一時的な値段
tmp = A * X + B * Y

#1単位ずつCに変えていって減るかを検証
counter = 0
XY_max = max(X,Y)
XY_min = min(X,Y)

for i in range(XY_max):
    if i <= XY_min-1:
        minprice = tmp - A - B + 2 * C
    else:
        minprice = tmp - max(A,B) + 2 * C
    tmp = min(tmp,minprice)

print(tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
ans = 0
if C*2 < A+B:
  ans += min(X,Y)*C*2
  if X == Y:
    pass
  elif X > Y:
    if A > C*2:
      ans += C*2*(X-Y)
    else:
      ans += A*(X-Y)
  else:
    if A > C*2:
      ans += C*2*(Y-X)
    else:
      ans += A*(Y-X)
else:
  ans = A*X + B*Y
print(ans)

Submission status: Wrong Answer

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

cNum = min(x // 2, y // 2) * 2
print(min(a + b, c * 2) * cNum + (x-cNum) *
      min(a, c * 2) + (y-cNum) * min(a, c * 2))

Submission status: Wrong Answer

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

# ABピザを買うかA,Bピザを買うか
cNum = min(x // 2, y // 2) * 2
print(min(a + b, c * 2) * cNum + (x-cNum) *
      min(a, c * 2) + (y-cNum) * min(a, c * 2))

Submission status: Wrong Answer

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

ans = 10 ** 9
for i in range(0,max(X,Y)*2,2):
  p = i * C + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0)
#  print (i,max(X - i // 2, 0),max(Y - i // 2, 0),p,ans)
  ans = min(ans, p)
print (ans)

Submission status: Wrong Answer

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

ans1 = min(x,y) * min(a + b,c*2) + abs(x-y) * z
ans2 = c * max(x,y)
print(min(ans1,ans2))

Submission status: Wrong Answer

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

print(min(x,y) * min(a + b,c*2) + abs(x-y) * z)

Submission status: Wrong Answer

Solution code:
A, B, AB, X, Y = map(int, input().split())
if max(A, B) >= AB * 2:
  print(max(X, Y) * 2 * AB)
elif A + B >= AB * 2:
  print(min(X, Y) * 2 * AB + (max(X, Y) - min(X, Y)) * (A, B)[X < Y])
else:
  print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
A, B, AB, X, Y = map(int, input().split())
if min(A, B) >= AB * 2:
  print(max(X, Y) * 2 * AB)
elif max(A, B) >= AB * 2:
  print(min(X, Y) * 2 * AB + (max(X, Y) - min(X, Y)) * AB * 2)
elif A + B >= AB * 2:
  print(min(X, Y) * 2 * AB + (max(X, Y) - min(X, Y)) * (A, B)[X < Y])
else:
  print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
A, B, AB, X, Y = map(int, input().split())
if min(A, B) >= AB * 2:
  print(max(X, Y) * 2 * AB)
elif A + B >= AB * 2:
  print(min(X, Y) * 2 * AB + (max(X, Y) - min(X, Y)) * (A, B)[X < Y])
else:
  print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
minprice = 10 ** 12
if x < y:
         for i in range(x+1):
                  if ((a * x + b * y) - (a + b - 2 * c)*i) < minprice:
                           minprice = ((a * x + b * y) - (a + b - 2 * c)*i)
else:
         for j in range(y+1):
                  if ((a * x + b * y) - (a + b - 2 * c)*j) < minprice:
                           minprice = ((a * x + b * y) - (a + b - 2 * c)*j)
print(minprice)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
ls = []
money = 0
for i in range(max(X,Y)):
    money = i*2*C+(max(0,X-i)*A)+(max(0,Y-i)*B)
    ls.append(money)
    money = 0
print(min(ls))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

candidates = []
candidates.append(a * x + b * y)
candidates.append(c * max(x, y) * 2)
candidates.append(c * min(x, y) * 2 + abs(a - b) * max(x, y))

print(min(candidates))

Submission status: Wrong Answer

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

candidates = []
candidates.append(a * x + b * y)
candidates.append(c * max(x, y) * 2)
candidates.append(c * min(x, y) * 2 + (max(a, b) - min(a, b)) * max(x, y))

print(min(candidates))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)+(2*c if min(x,y)%2==1 else 0)
  X=x-2*(min(x,y)//2)-(1 if min(x,y)%2==1 else 0)
  Y=y-2*(min(x,y)//2)-(1 if min(x,y)%2==1 else 0)
  print(val+X*a+Y*b)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)
  X=x-2*(min(x,y)//2)
  Y=y-2*(min(x,y)//2)
  print(min(val+4*c,val+X*a+Y*b))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)
  X=x-2*(min(x,y)//2)
  Y=y-2*(min(x,y)//2)
  print(min(val+(2*c),val+(X*a)+(Y*b)))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)
  X=x-2*(min(x,y)//2)
  Y=y-2*(min(x,y)//2)
  print(min(val+2*c,val+X*a+Y*b))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)
  X=x-2*(min(x,y)//2)
  Y=y-2*(min(x,y)//2)
  print(min(val+2*c,val+c+max(0,X-1)*a+max(0,Y-1)*b,val+X*a+Y*b))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if (a+b)<=2*c:
  print(a*x+b*y)
else:
  val=2*c*(min(x,y)//2)
  X=x-2*(min(x,y)//2)
  Y=y-2*(min(x,y)//2)
  print(min(val+2*c,val+c+(X-1)*a+(Y-1)*b,val+X*a+Y*b))

Submission status: Wrong Answer

Solution code:

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


if (a+b)/2 >=c and 2*c<=a and 2*c<=b:
    ans=max(x,y)*c*2
elif (a+b)/2 >=c and x>=y:
    ans=y*c*2+ a*(x-y)
elif (a+b)/2 >=c and x<=y:
    ans=x*c*2 + b*(y-x)
else:
    ans=a*x+b*y
print(ans)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X>Y:
        x = X
    else:
        x = Y
        
    #if X*A+Y*B < 2*C*x:
    #    print(X*A+Y*B)
    #    return
    if A+B < 2*C:
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < 2*C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    elif X<Y:
        if B < 2*C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)
    else:
        print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X>Y:
        x = X
    else:
        x = Y
        
    #if X*A+Y*B < 2*C*x:
    #    print(X*A+Y*B)
    #    return
    if A+B < 2*C:
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    elif X<Y:
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)
    else:
        print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X>Y:
        x = X
    else:
        x = Y
        
    #if X*A+Y*B < 2*C*x:
    #    print(X*A+Y*B)
    #    return
    if A+B < 2*C:
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    else:
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X>Y:
        x = X
    else:
        x = Y
    if X*A+Y*B < 2*C*x:
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    else:
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X*A+Y*B < 2*C*(X+Y):
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    else:
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if X*A+Y*B < 2*C*(A+B):
        print(X*A+Y*B)
        return
    
    if X>Y:
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    else:
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

Solution code:
def q61(A,B,C,X,Y):
    if A+B < 2*C:
        print(X*A+Y*B)
        return
    
    if X>Y:
        
        if A < C:
            print(2*C*(X-1) + A)
        else:
            print(2*C*X)
    else:
        
        if B < C:
            print(2*C*(Y-1) + B)
        else:
            print(2*C*Y)

A, B, C, X, Y = [int(i) for i in input().split()]

#print(A*X)
#print(B*Y)
q61(A,B,C,X,Y)

Submission status: Wrong Answer

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

# A ピザ p 枚、 B ピザ q 枚、 C ピザ r 枚　（c は偶数）
# p + r // 2 >= X
# q + r // 2 >= Y
# A * p + B * q + C * r を最小にする

# r を基準にしてループを回す

max_r = ((X + Y + 1) // 2) * 2 

cost = float('inf')

for r in range(0, max_r+2, 2):
  p = max(X - r // 2, 0)
  q = max(Y - r // 2, 0)
  tmp_cost = A * p + B * q + C * r
  # print(p, q, r, tmp_cost)
  cost = min(cost, tmp_cost)
  
print(cost)

Submission status: Wrong Answer

Solution code:
(a, b, c, wanted_a, wanted_b) = (int(tok) for tok in input().split())

res = wanted_a * a + wanted_b * b
for both in range(max(wanted_a, wanted_b) * 2):
  left_a = wanted_a - both // 2
  left_b = wanted_b - both // 2
  cost = both * c + max(0, left_a) * a + max(0, left_b) * b
  res = min(res, cost)

print(res)

Submission status: Wrong Answer

Solution code:

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

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

if a+b < ab*2:
    print(a*x + b*y)
else:
    price = 0
    if x > y:
        price += ab*2 * y
        x -= y
        if a*x > ab*2*x:
            price += ab*2*x
        else:
            price += a * x
    else:
        price += ab*2 * x
        y -= x
        if b*y > ab*2*y:
            price += ab*2*y
        else:
            price += b * x

    print(price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y =map(int,input().split())
ans = 0
if A+B>2*C:
    if X != Y:
        ans += C*2*min(X,Y)
        if min(X,Y) == X:
          ans += (Y-X)*B
          print(ans)
        else:
            ans += (X-Y)*A
            print(ans)
    else:
        ans += C*2*X
        print(ans)

Submission status: Wrong Answer

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

ans=0
if 2*c<a and 2*c<b:
  for i in range(0,2*max(x,y)):
    ans+=c
else:
  for i in range(0,2*min(x,y)):
    ans+=c
  if x>y:
    for i in range(0,x-y):
      ans+=a
  else:
    for i in range(0,y-x):
      ans+=b

print(ans)

Submission status: Wrong Answer

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

ans=0
if a+b>2*c:
  if 2*c<a and 2*c<b:
    for i in range(0,2*max(x,y)):
      ans+=c
  else:
    for i in range(0,2*min(x,y)):
      ans+=c
    if x>y:
      for i in range(0,x-y):
        ans+=a
    else:
      for i in range(0,y-x):
        ans+=b
else:
  for i in range(0,x):
    ans+=a
  for i in range(0,y):
    ans+=b
print(ans)

Submission status: Wrong Answer

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

ans=0
if a+b>2*c:
  if 2*c<a and 2*c<b:
    for i in range(1,2*max(x,y)+1):
      ans+=c
  else:
    for i in range(1,2*min(x,y)+1):
      ans+=c
    for i in range(1,max(x,y)-min(x,y)+1):
      if x>y:
        ans+=a
      else:
        ans+=b
else:
  for i in range(1,x+1):
    ans+=a
  for i in range(1,y+1):
    ans+=b
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
ans = 5000 * 10 ** 5
for i in range(max(x, y) + 1):
  ansa = max(x - i, 0)
  ansb = max(y - i, 0)
  sm = a * ansa + b * ansb + 2 * c * i 
  if ans > sm:
    ans = sm
print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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



main()

Submission status: Wrong Answer

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

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



main()

Submission status: Wrong Answer

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

AandB = X * A + Y * B
allC = max(X, Y) * 2 * C  # すべてAB

offset = min(X, Y) * 2  # 余らない最小個数
X -= min(X, Y)
Y -= min(X, Y)

comb = offset * C
if X > 0:
    comb += X * A
else:
    comb += Y * B

print(min(AandB, allC, comb))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x = x*2
y = y*2

if c < (a+b)/2:
    while min(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if c <= a/2 or c <= b/2:
    while max(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if a <= c or x > 0:
    while x > 0:
        ans += a
        x -= 2

if b <= c or y > 0:
    while y > 0:
        ans += b
        y -= 2

print(ans)

Submission status: Wrong Answer

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

x = x*2
y = y*2

if c < (a+b)/2:
    while min(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if c <= a and c <= b:
    while max(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if a <= c or x > 0:
    while x > 0:
        ans += a
        x -= 2

if b <= c or y > 0:
    while y > 0:
        ans += b
        y -= 2

print(ans)

Submission status: Wrong Answer

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

x = x*2
y = y*2

if c < (a+b)/2:
    while min(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if c < a and c < b:
    while max(x,y) > 0:
        ans += c
        x -= 1
        y -= 1

if a < c or x > 0:
    while x > 0:
        ans += a
        x -= 2

if b < c or y > 0:
    while y > 0:
        ans += b
        y -= 2

print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
ans = 0
ans1 = 0
flag = 0
if (a[0] > a[2])&(a[1] >a[2]):
    ans1 = (max(a[3],a[4]))*2*a[2]
    flag = 1
if (a[0]+a[1]) > 2*a[2]:
    ans += a[2]*(min(a[3],a[4]))*2
    if (a[3]-a[4]) < 0:
        ans += (a[4] - a[3])*a[1]
    else:
        ans += (a[3] - a[4])*a[0]
else:
    ans += a[0]*a[3] +a[1]*a[4]
if flag == 1:
    print(ans1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
ans=10000010000010000010000
for i in range(100000):
  t=2*C*i+max(X-i,0)*A+max(Y-i,0)*B
  if t<ans:
    ans=t
print(ans)

Submission status: Wrong Answer

Solution code:

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = 1 ** 29
for c_count in range(0, max(x,y)*2 + 2, 2):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

Submission status: Wrong Answer

Solution code:

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = 1 << 29
for c_count in range(0, max(x,y)*2 + 2):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

Submission status: Wrong Answer

Solution code:

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = 1 << 29
for c_count in range(0, max(x,y)*2 + 1):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

Submission status: Wrong Answer

Solution code:

def getint(): return int(input())
def getints(): return list(map(int, input().split()))

a,b,c,x,y=getints()

res = 1 << 29
for c_count in range(0, max(a,b)*2 + 1):
    x_need = max(0, x - c_count // 2)
    y_need = max(0, y - c_count // 2)
    tmp = x_need * a + y_need * b + c_count * c
    res = min(res, tmp)

print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(A: int, B: int, C: int, X: int, Y: int):
    mn = 1e9
    for i in range(0, 2*(max(X, Y)+1), 2):
        mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))
    print(mn)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(A, B, C, X, Y)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a, b, c, x, y = map(int, input().split())
c *= 2
f = [0]*2
g = 0
if a+b < c:
    ans = a*x + b*y
else:
    ans = min(x, y)*c
    if x > y:
        f[0] = x
        f[1] = a
        g = y
    elif y > x:
        f[0] = y
        f[1] = b
        g = x
    check = ans+(f[0]-g)*f[1]
    ans = f[0]*c
    if ans > check:
        ans = check
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

all_single = A * X + B * Y

all_Half = max(X, Y) * 2 * C

if (X - Y) >= 0:
    use_withHalf = C * Y * 2 + (A * (X - Y))
else:
    use_withHalf = C * X * 2 + (A * (Y - X))

# print(all_single)
# print(use_withHalf)
# print(all_Half)
# print("------")
print(min(all_single, use_withHalf, all_Half))

Submission status: Wrong Answer

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

if c<=max(a,b)/2:
    print(2*c*max(x,y))
elif max(a,b)/2<c<=(a+b)/2:
    if x>=y:
        print(2*c*y+(x-y)*a)
    else:
        print(2*c*x+(y-x)*b)
else:
    print(x*a+y*b)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if X == 0:
    ans += A * X
elif Y == 0:
    ans += B * Y

else:
    while X > 0 or Y > 0:

        if C*2 < A and C*2 < B:
            ans += C*2
            X -= 1
            Y -= 1

        elif C*2 < A + B:
            if X >= 1 and Y >= 1:
                ans += C*2
                X -= 1
                Y -= 1
            elif X >= 1 and Y == 0:
                ans += A * X
                X = 0
            elif Y >= 1 and X == 0:
                ans += B
                Y = 0
        else:
            if X >= 1 and Y >= 1:
                ans += A * X
                X = 0
                ans += B
                Y = 0
            elif Y == 0:
                ans += A * X
                X = 0
            elif X == 0:
                ans += B
                Y = 0


print(ans)

Submission status: Wrong Answer

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

if X == 0:
    ans += A * X
elif Y == 0:
    ans += B * Y

else:
    while X > 0 or Y > 0:

        if C*2 < A and C*2 < B:
            ans += C*2
            X -= 1
            Y -= 1

        elif C*2 < A + B:
            if X >= 1 and Y >= 1:
                ans += C*2
                X -= 1
                Y -= 1
            elif X >= 1 and Y == 0:
                ans += A
                X -= 1
            elif Y >= 1 and X == 0:
                ans += B
                Y -= 1
        else:
            if X >= 1 and Y >= 1:
                ans += A
                X -= 1
                ans += B
                Y -= 1
            elif Y == 0:
                X -= 1
                ans += A
            elif X == 0:
                Y -= 1
                ans += B


print(ans)

Submission status: Wrong Answer

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

while X > 0 or Y > 0:

    if X == 0:
        ans += A
        X -= 1

    elif Y == 0:
        ans += B
        Y -= 1

    elif C*2 < A and C*2 < B:
        ans += C*2
        X -= 1
        Y -= 1

    elif C*2 < A + B:
        if X >= 1 and Y >= 1:
            ans += C*2
            X -= 1
            Y -= 1
        elif X >= 1 and Y == 0:
            ans += A
            X -= 1
        elif Y >= 1 and X == 0:
            ans += B
            Y -= 1
    else:
        if X >= 1 and Y >= 1:
            ans += A
            X -= 1
            ans += B
            Y -= 1
        elif Y == 0:
            X -= 1
            ans += A
        elif X == 0:
            Y -= 1
            ans += B


print(ans)

Submission status: Wrong Answer

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

while X > 0 or Y > 0:
    if C*2 < A and C*2 < B:
        ans += C*2
        X -= 1
        Y -= 1

    if C*2 < A + B:
        if X >= 1 and Y >= 1:
            ans += C*2
            X -= 1
            Y -= 1
        elif X >= 1 and Y == 0:
            ans += A
            X -= 1
        elif Y >= 1 and X == 0:
            ans += B
            Y -= 1
    else:
        if X >= 1 and Y >= 1:
            ans += A
            X -= 1
            ans += B
            Y -= 1
        elif Y == 0:
            X -= 1
            ans += A
        elif X == 0:
            Y -= 1
            ans += B

print(ans)

Submission status: Wrong Answer

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

while X > 0 or Y > 0:
    if C*2 < A + B:
        if X >= 1 and Y >= 1:
            ans += C*2
            X -= 1
            Y -= 1
        elif X >= 1 and Y == 0:
            ans += A
            X -= 1
        elif Y >= 1 and X == 0:
            ans += B
            Y -= 1
    else:
        if X >= 1 and Y >= 1:
            ans += A
            X -= 1
            ans += B
            Y -= 1
        elif Y == 0:
            X -= 1
            ans += A
        elif X == 0:
            Y -= 1
            ans += B

print(ans)

Submission status: Wrong Answer

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

while X > 0 or Y > 0:
    if C*2 < A + B:
        if X >= 1 and Y >= 1:
            ans += C*2
            X -= 1
            Y -= 1
        elif X >= 1 and Y == 0:
            ans += A
            X -= 1
        elif Y >= 1 and X == 0:
            ans += B
            Y -= 1
    else:
        if X >= 1 and Y >= 1:
            ans += A
            X -= 1
            ans += B
            Y -= 1
        elif Y == 0:
            X -= 1
            ans += A
        elif X == 0:
            Y -= 1
            ans += B
print(X, Y)
print(ans)