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

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

# ABピザを買わないと
x=A*X+B*Y
#ABピザをいくつか買う時
if X>=Y:
    y=C*2*Y+A*ceil((2*X-2*Y)/2)
else:
    y=C*2*X+B*ceil((2*Y-2*X)/2)
#ABピザのみで買う時
z=C*2*max(X,Y)
    
print(min(x,y,z))

Submission status: Accepted

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

if X>Y:
    A, B = B, A
    X, Y = Y, X
excessB = Y-X

ans = min(2*C, A+B)*X
ans += min(2*C, B)*excessB

print(ans)

Submission status: Accepted

Solution code:

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

    diff = abs(x - y)
    price1 = [(a + b) * min(x, y), 2 * c * min(x, y)][a + b >= c * 2] + diff * [a, b][x < y]
    print(min(price1, max(x, y) * c * 2))


abc095C()

Submission status: Accepted

Solution code:
import math

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

if A + B < C * 2:
    p = A * X + B * Y
else:
    if X > Y:
        p = Y * C * 2
        if A > C * 2:
            p += math.ceil((X - Y) * 2) * C
        else:
            p += (X - Y) * A
    else:
        p = X * C * 2
        if B > C * 2:
            p += math.ceil((Y - X) * 2) * C
        else:
            p += (Y - X) * B

print(p)

Submission status: Accepted

Solution code:
a,b,c,x,y = map(int,input().split())
ans = 0
d = a+b
if d>2*c:
    while min(x,y)>0:
        ans += 2*c
        x -= 1
        y -= 1
else:
    while min(x,y)>0:
        ans += d
        x -= 1
        y -= 1
        

if x == 0:
    sus = min(2*c,b)
    while y>0:
        ans += sus
        y -= 1

        
else:
    sus = min(a,2*c)
    while x>0:
        ans += sus
        x -= 1
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    min_price = 10**100

    for n_pizza_ab in range(0, 200001, 2):
        short_pizza_a = max(X - n_pizza_ab // 2, 0)
        short_pizza_b = max(Y - n_pizza_ab // 2, 0)

        price = short_pizza_a * A + short_pizza_b * B + n_pizza_ab * AB

        if price < min_price:
            min_price = price

    print(min_price)

main()

Submission status: Accepted

Solution code:
a, b, c, x, y = [int(i) for i in input().strip().split(" ")]

z = min(x, y)
total = 0

if (a+b) > c*2:
    total += c * 2 * z
else:
    total += a * z + b * z

if (a < c * 2):
    total += (x-z) * a
else:
    total += (x-z) * c * 2

if (b < c * 2):
    total += (y-z) * b
else:
    total += (y-z) * c * 2

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,x,y = [int(x) for x in input().split()]

#そのまま
aprice = a*x + b*y
#組み合わせ
if x > y:
    amari = a*(x-y)
elif x < y:
    amari = b*(y-x)
else:
    amari = 0
bprice = min(x,y)*c*2 + amari
#セットのみ
cprice = c*max(x, y)*2

#print(aprice,bprice,cprice)
print(min(aprice,bprice,cprice))

Submission status: Accepted

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

res = 0
tmp = 0
pair = False
if a // 2 + b // 2 < c:
    res = a+b
else:
    res = c*2

tmp = res * min(x, y)

if x > y:
    print(tmp + abs(x - y) * min(res, a))
else:
    print(tmp + abs(x - y) * min(res, b))

Submission status: Accepted

Solution code:
a,b,c,x,y = map(int, input().split(" "))
sum = 0
if a+b >= c*2:
    v = min(x, y)
    for i in range(v):
        sum += 2*c
    x -= v
    y -= v

if a < c*2:
    sum += a*x
if b < c*2:
    sum += b*y
if a >= c*2:
    sum += 2*c*x
if b >= c*2:
    sum += 2*c*y
print(sum)

Submission status: Accepted

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 B <= 2*C:
            print(X*2*C+(Y-X)*B)
        else:
            print(2*Y*C)
    elif X == Y:
        print(2*X*C)
    else:
        if A <= 2*C:
            print(Y*2*C+(X-Y)*A)
        else:
            print(2*X*C)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(A, B, C, X, Y):

  def cost(cnt):
    a, b, c = cnt
    return a * A + b * B + c * C

  def useAB(cnt):
    return [max(0, cnt[0] - 1),
            max(0, cnt[1] - 1),
            cnt[2] + 2]

  cnt = [X, Y, 0]
  while cost(cnt) > cost(useAB(cnt)):
    cnt = useAB(cnt)

  return cost(cnt)


if __name__ == '__main__':
  A, B, C, X, Y = map(int, input().split())
  print(solve(A, B, C, X, Y))

Submission status: Accepted

Solution code:
a,b,c,x,y=[int(i) for i in input().split()]

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

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

Submission status: Accepted

Solution code:
a,b,c,x,y=map(int,input().split())
price=0
z=min(x,y)
w=max(x,y)
if a+b>c*2:
    d=w*2*c
    e=z*c*2+(x-z)*a+(y-z)*b
    print(min(e,d))

else:
    print(a*x+b*y)

Submission status: Accepted

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

mincost=min(a+b,2*c)
ans=0
while (x>0 and y>0):
    ans+=mincost
    x-=1
    y-=1

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

Submission status: Accepted

Solution code:
import sys

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


cost=0
if 2*C<A+B:
	mini=min([X,Y])
	cost+=mini*C*2
	X-=mini
	Y-=mini
	if not X==0:
		if 2*C<A:
			cost+=2*C*X
			X=0
	elif not Y==0:
		if 2*C<B:
			cost+=2*C*Y
			Y=0



cost+=X*A+Y*B

print(cost)

Submission status: Accepted

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

ans1 = A*X + B*Y
ans2 = C*max(X,Y)

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

#print(ans1, ans2, ans3)
print(min(ans1, ans2, ans3))

Submission status: Accepted

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

Submission status: Accepted

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

m = min(X, Y)
X -= m
Y -= m

price = m * min(A + B, 2 * C)
price += min(A, 2 * C) * X + min(B, 2 * C) * Y
print(price)

Submission status: Accepted

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

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

print(cost)

Submission status: Accepted

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

ans = 0
numab = min(X, Y)
if C * 2 < A + B:
    ans += numab * C * 2
else:
    ans += numab * (A + B)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, x, y = map(int, input().split())
num = float("inf")
for i in range(max(x, y) + 1):
    num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
d= a*x+b*y
e= 2*c*x+b*max(0,y-x) #yが多い
f= 2*c*y+a*max(0,x-y) #xが多い
print(min(d,e,f))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

mast = max(x,y)
ans = max(a * x + b * y,c *2 *i)

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

Submission status: Runtime Error

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

mast = max(x,y)
ans =  c *2 *i

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

Submission status: Runtime Error

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

mast = max(x,y)
ans =  c *2 *i

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

Submission status: Runtime Error

Solution code:
import numpy as np

A, B, C, X, Y = [int(i) for i in input().split()]
DP = np.zeros((X+1, Y+1))

for i in range(0, X + 1):
  for j in range(0, Y + 1):
    if i < 1:
      DP[i][j] = min(B * j, C * j * 2)
      continue
    if j < 1:
      DP[i][j] = min(A * i, C * i * 2)
      continue
    DP[i][j] = min(DP[i-1][j] + A, DP[i][j-1] + B, DP[i-1][j-1] + C * 2)

print(int(DP[X][Y]))

Submission status: Runtime Error

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

ans = float("inf")

if X > Y:
    ab = 2 * X
    while ab > 0:
        a = X - (ab / 2)
        if ab / 2 < Y:
            b = int(Y - 2 * ab)
        else:
            b == 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
else:
    ab = 2 * Y
    while ab > 0:
        b = Y - (ab / 2)
        if ab / 2 < X:
            a = int(X - 2 * ab)
        else:
            a = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
print(int(ans))

Submission status: Runtime Error

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

#全部Cで買うとき
a = 2*C*min(X,Y) + 2*C*(max(X,Y)-min(X,Y))

#片方を全部Cで買うとき
if X > Y:
    b = 2*C*Y + (X-Y)*A
elif Y > X:
    b = 2*C*X + (Y-X)*A

#全部AとBで買うとき
c = A*X + B*Y

print(min(a,b,c))

Submission status: Runtime Error

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

def piz(a, b, cost):
    if a >= X and b >= Y:
        print(cost)
    
    if a < X and b >= Y:
        piz(a+1, b, cost+A)
    if a >= X and b < Y:
        piz(a, b+1, cost+B)
    if a < X and b < Y and A + B < C * 2:
        piz(a+1, b+1, cost+A+B)
    if a < X and b < Y and A + B >= C * 2:
        piz(a+1, b+1, cost+C*2)

piz(0, 0, 0)

Submission status: Runtime Error

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

l = []

#パターン１ AとBだけ作るとき
price1 = A * X + B * Y
l.append(price1)

#パターン2 AB分割とあまり調整
if X > Y:
    if A < C/2:
        price2 = 2 * Y * C + A * abs(X-Y)
        l.append(price2)
    else:
        price3 = 2 * Y * C + C * abs(X-Y) * 2
        l.append(price3)
elif X < Y:
    if B < C/2:
        price4 = 2 * X * C + B * abs(Y-X)
        l.append(price4)
    else:
        price5 = 2 * X * C + C * abs(Y-X) * 2
        l.append(price5)

elif x == Y:
    price6 = 2 * X * C
    l.append(price6)


print(min(l))

Submission status: Runtime Error

Solution code:
A,B,C,X,Y=map(int,input().split)
a=A*X+B*Y
b=max(X,Y)*C*2
p=B if X<Y else A
c=min(X,Y)*2*C+abs(X-Y)*p
print(min(a,b,c))

Submission status: Runtime Error

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

m=max(x,y)
ans=10**9+7
for e in range(m+1):
  ans=min(ans,2*e*c+a*max(0,x-e)+b*(0,y-e))
  
print(ans)

Submission status: Runtime Error

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

cost = [x*a + y*b]
for i in range(max(x, y)*2)+1:
    numofabpizza = i*2
    numofapizza = max(0, (x-numofabpizza))
    numofbpizza = max(0, (y-numofabpizza))
    
    cost.append(numofapizza*a + numofbpizza*b + (2*numofabpizza)*c)
print(min(cost))

Submission status: Runtime Error

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

    if ans > (i*c)+(xr*a)+(yr*b):
        ans = (i*c)+(xr*a)+(yr*B)

print(ans)

Submission status: Runtime Error

Solution code:
ab,c,x,y=map(int,input().split())
ans=10**12
for i in range(0,(max(x,y)*2)+1,2):
    xr=max(x-i//2,0)
    yr=max(0,y-i//2)

    if ans>(i*c)+(xr*a)+(yr*b):
        ans=(i*c)+(xr*a)+(yr*B)

print(ans)

Submission status: Runtime Error

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

if x > y:
    l += (x - y) * a
    p = y
elif x < y:
    l += (y - x) * b
    p = x
else:
    pass
l += p * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
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 k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
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)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

a,b,c,x,y = I()
p = []
for i in range(10**5+1):
    cash = 2*c*i+a*max(0,x-i)+b*max(0,y-i)
    c.append(cash)

print(min(p))

Submission status: Runtime Error

Solution code:
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 k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
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)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

a,b,c,x,y = I()
p = []
for i in range(10**5+1):
    cash = 2*c*i+a*max(0,x-i)+B*max(0,y-i)
    c.append(cash)

print(min(p))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a,b,c,x,y = map(int, input().split())
kei = 0
if c > a/2 + b/2:
    kei = a * x + b*y

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

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


print(kei)

Submission status: Runtime Error

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

P=X*A+B*Y
if X>Y:
    Q=C*2*Y+(X-Y)*A
    L=X*2*C
elif Y<X:
    Q=C*2*Y+(Y-X)*B
    L=Y*2*C
elif X==Y:
    Q=min(C*2*Y, C*2*X)
    L=min(X*2*C, Y*2*C)



print(min(P,Q,L))

Submission status: Runtime Error

Solution code:
import sys


def main():
    a, b, c, x, y = map(int, input())

    min_price = None

    for i in range(max(x, y) + 1):
        nc = i * 2
        na = x - i
        if na < 0:
            na = 0
        nb = y - i
        if nb < 0:
            nb = 0

        price = na * a + nb * b + nc * c
        if min_price is None or price < min_price:
            min_price = price

    print(min_price)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)

ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
ans4=float("inf")
for i in range(2,min(X, Y),2):
    ans4=min(ans4,C * i + A * (x- i) + B *(Y-i))
    
print(min(ans1,ans2,ans3,ans4))

Submission status: Runtime Error

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 :
    print(min(2*x*c+(y-x)*b,2*y*c)
  else :
    print(min(2*y*c+(x-y)*a,2*x*c)

Submission status: Runtime Error

Solution code:
a,b,c,x,y=map(int,input().split())
a_b_all=a*x+b*y
ab_all=(c*2)*max(x,y)
mix_a_all=(c*2)*x+b*(y-x)
mix_b_all=(c*2)*y+a*(x-y)
mix_all=max(mix_a_all,mix_b_all)
print(min(a_b_all,ab_all,mix_al))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=math.inf    

for i in range(0,max_pizza*2,2):#ABピザをi枚買う(iは偶数)
    
    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print(int(ans))

Submission status: Runtime Error

Solution code:
A, B, C, x, y = map(int, input().split())

if x > y:
    ans = min(A+B, 2*C) * y
    ans += min(A, 2*C) * (x-y)
elif x < y:
    ans = min(A+B, 2*C) * x
    ans += min(B, 2*C) * (y-x)
else:
    ans += min(A+B, 2*C) * x
print(ans)

Submission status: Runtime Error

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

if A + B >= AB * 2:
    min_price = min(AB * 2 * min_sheet + A(X - min_sheet) + B(Y - min_sheet), AB * 2 * max(X,Y))
else:
    min_price = A * X + B * Y
    
print(min_price)

Submission status: Runtime Error

Solution code:
A, B, AB, X, Y = map(int, input().split())
max_price = A * X + B * Y
flag = 1
mid_price = min((A + B) // 2, AB)
if A > mid_price and B > mid_price:
    min_sheet = max(X, Y)
elif A > mid_price:
    min_sheet = X
elif B > mid_price:
    min_sheet = Y

price = max_price + 1

while flag:
    flag = 0
    if A >= mid_price and B >= mid_price:
        price = min_sheet * AB * 2
        X -= min_sheet
        Y -= min_sheet
    if X < 1 and Y < 1:
        break
    elif X > 0:
        price += X * A
        if Y > 0:
            price += Y * B
    elif Y > 0:
        price += Y * B
        if X > 0:
            price += X * A

print(min(max_price, price))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
while(True):

    a, b, c, x, y = list(map(int, input().split()))
    res = a * x + b * y
    for i in range(1, max(x, y) + 1):
        res = min(res, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)
    print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B <= 2*C:
    print(A*X + B*Y)
  elif 2*C < A and 2*C < B:
    print(C*max(X,  Y)*2)
      print(A*X + B*Y)
  elif 2*C < A or 2*C < B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()

Submission status: Runtime Error

Solution code:
n = int(input())
a = 1
b = 1
mx = 10 ** 10
while (a <= b and a * a <= n):
    if n % a == 0:
        b = int(n / a)
        mx = min(mx, max(a, b))
    a += 1
print(len(str(mx)))

Submission status: Runtime Error

Solution code:
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

# only = A*X+B*Y
# only_mix = C*max(X,Y)*2
# comp = 0
# if X > Y:
#     comp = C*Y*2+A*(X-Y)
# elif X < Y:
#     comp = C*X*2+B*(Y-X)
# else:
#     comp = C*Y*2

# print(min(only,only_mix,comp))

ans = float('INF')
for i in range(max(X,Y)+1):
    price = A+max(X-i,0)+B*max(Y-i,0)+C*2*i
    ans = min(ans,price)

price(ans)

Submission status: Runtime Error

Solution code:
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

# only = A*X+B*Y
# only_mix = C*max(X,Y)*2
# comp = 0
# if X > Y:
#     comp = C*Y*2+A*(X-Y)
# elif X < Y:
#     comp = C*X*2+B*(Y-X)
# else:
#     comp = C*Y*2

# print(min(only,only_mix,comp))

ans = float('INF')
for i in range(max(X,Y)+1):
    price = A+max(X-i,0)+B*max(Y-i,0)+C*2*ians 
    ans = min(ans,price)

price(ans)

Submission status: Runtime Error

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

cost = 0

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

Submission status: Runtime Error

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

ans = 10**18
for c in range(10**5+1):
  a = X-c
  b = Y-c
  cost = C*c*2
  cost += max(a,0)*A
  cost += max(b,0)*B
  ans = min(ans,cost)
print(answer)

Submission status: Runtime Error

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

K = 2 * C - A - B
S = A*X + B*Y
t =-1 * S/K
z = min(X, Y)
Z = max(X, Y)

if K >= 0:
  print(S)
elif K < 0 and S >= Z*C*2:
  print(Z*C*2)
else:
  zz =min(z, int(t))
  P =S + K* zz
  print(P)

Submission status: Runtime Error

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

K = 2 * C - A - B
S = A*X + B*Y
t =(-1 * S )/ K
z = min(X, Y, int(t))
Z = max(X, Y)

if K >= 0:
  print(S)
elif S > Z*C*2:
  print(Z*C*2)
else:
  P =S + K* z
  print(P)

Submission status: Runtime Error

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

K = 2 * C - A - B
S = A*X + B*Y
t =(-1 * S )/ K
z = min(X, Y, t)
Z = max(X, Y)

if K >= 0:
  print(S)
elif S > Z*C*2:
  print(Z*C*2)
else:
  P =S + K* z
  print(P)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc095/tasks/arc096_a
A, B, C, X, Y = read_ints()

# もし組み合わせて買ったほうがいいなら限界まで組み合わせて買う
buyed = min(X, Y)
c1 = min(A + B, 2 * C) * buyed
X -= buyed
Y -= buyed

# 残りの枚数はどうする?
if X:  # もしまだAピザを買う必要があれば、
    c2 = min(A, 2 * C) * X

if Y:  # もしまだAピザを買う必要があれば、
    c2 = min(B, 2 * C) * Y

print(c1 + c2)

Submission status: Runtime Error

Solution code:
if boundary_value <= (min_value + max_value):
    if boundary_value <= min_value:
        print(boundary_value * max(x, y))
    elif (a == max_value and y <= x) or (b == max_value and x <= y):
        print(boundary_value * max(x, y))
    else:
        print(boundary_value * (max(x, y) - abs(x - y)) +
              min_value * abs(x - y))
elif (min_value + max_value) < boundary_value:
    print(a * x + b * y)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = float("inf")
for c in range(0, max(X, Y)*2+1, 2):
    ans = min(A*max(X-c//2, 0) + B*max(Y-c//2, 0) + C*c, ans) 

print(ans)