ZhenlongDai/ACPR huggingface dataset:
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())

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

Failing test case input:
1500 2000 1343 3 3

Expected output:
8058


Actual output:
10500


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
cost = []

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

print(min(cost))

Failing test case input:
104 1 16 1 12

Expected output:
43


Actual output:
384


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
cost = []
 
cost += [A*X + B*Y]
if X >= Y:
    cost += [C*2*Y + A*(X-Y)]
    cost += [C*2*X]
else:
    cost += [C*2*X + B*(Y-X)]
    cost += [C*2*Y]

print(min(cost))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
if A+B < 2*C:
    print(A*X+B*Y)
else:
    low = min(X,Y)
    high = max(X,Y)
    if C*(high-low)<=A*(X-low)+B*(Y-low):
        print(C*high*2)
    else:
        print(C*low*2+A*(X-low)+B*(Y-low))

Failing test case input:
1500 2000 1166 3 2

Expected output:
6164


Actual output:
6996


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
if A+B < 2*C:
    print(A*X+B*Y)
else:
    low = min(X,Y)
    high = max(X,Y)
    if C*(high-low)*2<=A*(X-low)+B*(Y-low):
        print(C*high*2)
    else:
        print(C*low*2+A*(X-low)+B*(Y-low))

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  ans=A*X+B*Y
else:
  if X<=Y:
    ans=C*2*X
    if 2*C<=B:
      ans+=2*C*(Y-X)
    else:
      ans+=B*(Y-X)
  else:
    ans=C*2*Y
    if Y<=X:
      ans+=2*C*(X-Y)
    else:
      ans+=A*(Y-X)
print(ans)


Failing test case input:
1500 2000 1166 3 2

Expected output:
6164


Actual output:
6996


Fixed submission (verdict: Accepted):
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  ans=A*X+B*Y
else:
  if X<=Y:
    ans=C*2*X
    if 2*C<=B:
      ans+=2*C*(Y-X)
    else:
      ans+=B*(Y-X)
  else:
    ans=C*2*Y
    if 2*C<=A:
      ans+=2*C*(X-Y)
    else:
      ans+=A*(X-Y)
print(ans)
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y = map(int, input().split())
ret = 0
if 2 * c <= a + b:
  m = min(x, y)
  ret += m * c
  x -= m
  y -= m
ret += min(2 * c, a) * x
y -= x
ret += min(2 * c, b) * y
print(ret)


Failing test case input:
0 1 8 2 0

Expected output:
0


Actual output:
-2


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int, input().split())
ret = 0
if 2 * c <= a + b:
  m = min(x, y)
  ret += m * 2 * c
  x -= m
  y -= m
ret += min(2 * c, a) * x
ret += min(2 * c, b) * y
print(ret)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
result = []
if X >= Y:
    result.append(X * C * 2)
    result.append(Y * C * 2 + (X-Y)*A)
else:
    result.append(Y * C * 2)
    result.append(X * C * 2 + (Y-X)*A)
result.append(X*A+Y*B)
print(min(result))


Failing test case input:
97 2 26 1 17

Expected output:
84


Actual output:
131


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
result = []
if X >= Y:
    result.append(X * C * 2)
    result.append(Y * C * 2 + (X-Y)*A)
else:
    result.append(Y * C * 2)
    result.append(X * C * 2 + (Y-X)*B)
result.append(X*A+Y*B)
print(min(result))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())

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


Failing test case input:
104 2 16 1 12

Expected output:
54


Actual output:
384


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    A, B, C, X, Y = list(map(int, input().split()))
    if A + B < 2 * C:
        
        print(A * X + B * Y)
    else:
        if X == Y:
            
            print(C * 2 * X)
        elif X < Y:
            
            print(X * C * 2 + B * (Y - X))
        else:
            
            print(Y * C * 2 + A * (X - Y))


Failing test case input:
1908 8 144 5 3

Expected output:
1440


Actual output:
4680


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    A, B, C, X, Y = list(map(int, input().split()))
    if A + B <= 2 * C:
        
        print(A * X + B * Y)
    else:
        if X == Y:
            
            print(C * 2 * X)
        elif X < Y:
            
            print(min(X * C * 2 + B * (Y - X), C * 2 * Y))
        else:
            
            print(min(Y * C * 2 + A * (X - Y), C * 2 * X))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
104 1 16 1 12

Expected output:
43


Actual output:
384


Fixed submission (verdict: Accepted):
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 x > y:
            if a >= 2 * c:
                ans += 2 * c * (x-com)
            else:
                ans += a * (x-com)
        elif x < y:
            if b >= 2 * c:
                ans += 2 * c * (y-com)
            else:
                ans += b * (y-com)
    else:
        ans += a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Problem: p03371
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)

Failing test case input:
97 3 16 1 12

Expected output:
65


Actual output:
32


Fixed submission (verdict: Accepted):
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*y
    print(price)
else:
    print(a*x+b*y)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split(' '))
MIN = float('inf')

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


Failing test case input:
1928 3132 265 90000 100000

Expected output:
53000000


Actual output:
53002602


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split(' '))
MIN = float('inf')

for i in range(0,2*max(X,Y)):
  sum = C*2*i + max(0,X-i)*A + max(0,Y-i)*B
  MIN = min(MIN,sum)
print(MIN)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y = map(int, input().split())

ans = 10**5
for i in range(10**5):
    tmp = 2*c*i + (x-i)*a + (y-i)*b
    ans = min(ans, tmp)
    if i >= x or i >= y:
        break
print(ans)

Failing test case input:
1500 3132 574 90000 100000

Expected output:
114800000


Actual output:
100000


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int, input().split())

ans = 10**9
for i in range(10**5+1):
    tmp = 2*c*i + max((x-i), 0)*a + max((y-i), 0)*b
    if x < i and y < i:
            break
    ans = min(ans, tmp)
print(ans)
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y = map(int, input().split())

ans = 0

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

print(ans)

Failing test case input:
1500 2000 500 90000 100000

Expected output:
100000000

Actual output:
0


Fixed submission (verdict: Accepted):
a, b, c, x, y=map(int,input().split())
 
cnt = 10**9
for m in range(max(x,y)+1):
    price = (2*m*c) + max(0,(x-m))*a + max(0,y-m)*b
    cnt = min(cnt, price)

print(cnt)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
a,b,c,x,y=map(int,input().split())
val=0
if a+b<=2*c:
  print(a*x+b*y)
  sys.exit()
else:
  val+=min(x,y)*c*2
  x-=min(x,y)
  y-=min(x,y)
  if x==0:
    val+=min(b*y,y*2*c)
  if y==0:
    val+=min(a*x,x*2*c)
  print(val)
  sys.exit()


Failing test case input:
104 1 16 1 12

Expected output:
43


Actual output:
44


Fixed submission (verdict: Accepted):
import sys
a,b,c,x,y=map(int,input().split())
val=0
if a+b<=2*c:
  print(a*x+b*y)
  sys.exit()
else:
  m=min(x,y)
  val+=m*c*2
  x=x-m
  y=y-m
  if x==0:
    if y==0:
      print(val)
      sys.exit()
    val+=min(b*y,y*2*c)
  if y==0:
    val+=min(a*x,x*2*c)
  print(val)
  sys.exit()

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(a,b,c,x,y):
  l = []
  for i in range(5*(10**4)+1):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

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

Failing test case input:
1928 3132 265 90000 100000

Expected output:
53000000


Actual output:
260220000


Fixed submission (verdict: Accepted):
def solve(a,b,c,x,y):
  l = []
  for i in range(10**6):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
total = 0
ans = 10**10

for i in range(2, max(X, Y)*2, 2):
  total = A*(X-(i/2)) + B*(Y-(i/2)) + C*i
  ans = min(ans, total)
  
print(int(ans))

Failing test case input:
124 6 6 1 6

Expected output:
42


Actual output:
-430


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
total = 0
ans = 10**10

for i in range(0, max(X, Y)*2+2, 2):
  total = A*(max(X-(i/2),0)) + B*(max(Y-(i/2),0)) + C*i
  
  ans = min(ans, total)
  
print(int(ans))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y = map(int, input().split())

ab = c * 2

if ab < a and ab < b:
    print(max(x, y) * ab)
else:
    answer = min(a+b, ab) * min(x, y)
    rest = max(x, y) - min(x, y)
    rest = rest * a if x > y else rest * b
    print(answer + rest)

Failing test case input:
1500 3132 752 90000 100000

Expected output:
150400000


Actual output:
166680000


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int, input().split())

ab = c * 2

if ab < a and ab < b:
    print(max(x, y) * ab)
else:
    answer = min(a+b, ab) * min(x, y)

    if x > y:
        answer += min(a, ab) * (x - y)
    else:
        answer += min(b, ab) * (y - x)
    print(answer)

Problem: p03371
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())

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

Failing test case input:
97 2 21 1 8

Expected output:
56


Actual output:
113


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())

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

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
sum = 0

res = A*X + B*Y
for i in range(0,min_):
    sum += C * 2
if(C<0.5*A and C< 0.5*B):
    sum += 2*C*(max_-min_)
elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))

Failing test case input:
251 8 117 6 3

Expected output:
1404


Actual output:
1455


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)

res = A*X + B*Y

m = 2 * C * max(X, Y);

sum = C * 2* min_

if(C<=0.5 * A and C <= 0.5 * B):
    sum += 2*C*(max_-min_)

elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(m,min(res,sum)))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y = map(int,input().split())

chp = min(a+b,c*2)
memo1 = min(x,y)
memo2 = max(x,y)-min(x,y)
if x>y:
    print(memo2*a+memo1*chp)
else:
    print(memo2*b+memo1*chp)

Failing test case input:
1626 165 681 5 3

Expected output:
6810


Actual output:
7338


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int,input().split())

chp = min(a+b,c*2)
memo1 = min(x,y)
memo2 = max(x,y)-min(x,y)
if x>y:
    a = min(a,c*2)
    print(memo2*a+memo1*chp)
else:
    b = min(b,c*2)
    print(memo2*b+memo1*chp)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
if 2*c>=a+b:
  print(a*x+b*y)
else:
  ans=min(x,y)*c*2
  if x<=y:
    ans+=(y-x)*min(b,c)
  else:
    ans+=(x-y)*min(a,c)
  print(ans)
      

Failing test case input:
1500 2000 1166 0 2

Expected output:
4000


Actual output:
2332


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
if 2*c>=a+b:
  print(a*x+b*y)
else:
  ans=min(x,y)*c*2
  if x<=y:
    ans+=(y-x)*min(b,2*c)
  else:
    ans+=(x-y)*min(a,2*c)
  print(ans)
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y  = map(int,input().split())
price_1=A*X+B*Y

if X>Y:
	price_2=C*2*Y+(X-Y)*A
	price_3=C*X*2
else:
	price_2=C*2*X+(Y-X)*A
	price_3=C*Y*2

cheapest=price_1
if price_2<cheapest:
	cheapest=price_2
if price_3<cheapest:
	cheapest=price_3
print(cheapest)

Failing test case input:
104 2 16 1 12

Expected output:
54


Actual output:
128


Fixed submission (verdict: Accepted):
A,B,C,X,Y  = map(int,input().split())
price_1=A*X+B*Y

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

cheapest=price_1
if price_2<cheapest:
	cheapest=price_2
if price_3<cheapest:
	cheapest=price_3
print(cheapest)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y=map(int,input().split())

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


Failing test case input:
1626 165 681 5 3

Expected output:
6810


Actual output:
7338


Fixed submission (verdict: Accepted):
A,B,C,X,Y=map(int,input().split())

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
a, b, c, x, y = [int(x) for x in stdin.readline().rstrip().split()]
print(min([i*2*c+max(0, x-i)*a+max(0, y-i)*b for i in range(10**5)]))

Failing test case input:
1500 2445 118 90000 100000

Expected output:
23600000


Actual output:
23602209


Fixed submission (verdict: Accepted):
from sys import stdin
a, b, c, x, y = [int(x) for x in stdin.readline().rstrip().split()]
print(min([i*2*c+max(0, x-i)*a+max(0, y-i)*b for i in range(10**5+1)]))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
1297 632 1708 5 3

Expected output:
8381


Actual output:
5124


Fixed submission (verdict: Accepted):
A,B,C,X,Y=map(int, input().split())
ans = 50000000000
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)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 10:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a))

Failing test case input:
1500 3132 574 90000 100000

Expected output:
114800000


Actual output:
448165160


Fixed submission (verdict: Accepted):
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 100000:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=list(map(int,input().split()))
mxy=min([x,y])
ans=0
if 2*c<a+b:
	ans+=2*c*mxy
	if x<y:
		ans+=b*(y-mxy)
	else:
		ans+=a*(x-mxy)
else:
	ans=a*x+b*y

print(ans)

Failing test case input:
1626 165 681 5 3

Expected output:
6810


Actual output:
7338


Fixed submission (verdict: Accepted):
a,b,c,x,y=list(map(int,input().split()))
mxy=min([x,y])
Mxy=max([x,y])
mab=min([a,b])
ans=0
if 2*c<a+b:
	ans+=2*c*mxy
	if x<y:
		ans+=b*(y-mxy)
	else:
		ans+=a*(x-mxy)
else:
	ans=a*x+b*y

if ans>2*c*Mxy:
	ans=2*c*Mxy

print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = list(map(int, input().split()))

ans = A*X + B*Y
c = min(X, Y)
ans = min(A*(X-c) + B*(Y-c) + c*C*2, ans)

print(ans)

Failing test case input:
1908 8 144 5 3

Expected output:
1440


Actual output:
4680


Fixed submission (verdict: Accepted):
A, B, C, X, Y = list(map(int, input().split()))

ans = A*X + B*Y
c = min(X, Y)
ans = min(A*(X-c) + B*(Y-c) + c*C*2, ans)
c = max(X, Y)
ans = min(c*C*2, ans)

print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y= map(int, input().split())

price = []
for i in range(10**5):
    price.append(i * 2*c + max(0,x-i) * a + max(0,y-i) * b)
print(min(price))

Failing test case input:
1500 3132 574 90000 100000

Expected output:
114800000


Actual output:
114801984


Fixed submission (verdict: Accepted):
a, b, c, x, y= map(int, input().split())

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y=map(int,input().split())

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

Failing test case input:
97 1 25 1 14

Expected output:
63


Actual output:
111


Fixed submission (verdict: Accepted):
A,B,C,X,Y=map(int,input().split())

M=max(2*X,2*Y)
ans=10**9
for i in range(0,M+2,2):
    temp=i*C+max(0,X-(i
    ans=min(ans,temp)
print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
ans = 0

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

print(ans)

Failing test case input:
542 2000 841 7 3

Expected output:
7214


Actual output:
5588


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
ans = 0

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

print(ans)
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split(' '))
MIN = float('inf')

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

Failing test case input:
1500 3132 752 90000 100000

Expected output:
150400000


Actual output:
150401628


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split(' '))
MIN = float('inf')

for i in range(0,2*max(X,Y)):
  sum = C*2*i + max(0,X-i)*A + max(0,Y-i)*B
  MIN = min(MIN,sum)
print(MIN)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, c, x, y = [int(elem) for elem in input().split()]

res = -1
for i in range(0, 10 ** 5):
  cand = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if res == -1:
    res = cand
  else:
    if res > cand:
      res = cand
print(res)

Failing test case input:
1500 2000 500 90000 100000

Expected output:
100000000

Actual output:
100001000


Fixed submission (verdict: Accepted):
a, b, c, x, y = [int(elem) for elem in input().split()]

res = -1
for i in range(0, 10 ** 5 + 1):
  cand = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if res == -1:
    res = cand
  else:
    if res > cand:
      res = cand
print(res)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 )

Failing test case input:
1908 8 144 5 3

Expected output:
1440


Actual output:
4680


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int,input().split())
can = []
mini = min(x,y)
maxi = max(x,y)
can.append( c * 2 * mini + a * (x-mini) + b * (y-mini) )
can.append( c * 2 * maxi )
can.append( a * x + b * y )
print(min(can))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
  print(a*x+b*y)
elif x>=y:
  print(min(y*2*c+(x-y)*a,x*2*c))
else:
  print(min(x*2*c+(y-x)*a,y*2*c))

Failing test case input:
124 6 6 1 6

Expected output:
42


Actual output:
72


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
  print(a*x+b*y)
elif x>=y:
  print(min(y*2*c+(x-y)*a,x*2*c))
else:
  print(min(x*2*c+(y-x)*b,y*2*c))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



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

Failing test case input:
251 8 117 6 3

Expected output:
1404


Actual output:
2106


Fixed submission (verdict: Accepted):



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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
ans=0
if a+b<2*c:
   ans+=a*x+b*y
else:
    if x>y:
        if c>a:
            ans+=c*2*y+a*(x-y)
        else:
            ans+=c*2*x
    else:
        if c>b:
            ans+=c*2*x+b*(y-x)
        else:
            ans+=c*2*y
print(ans)

Failing test case input:
1500 2000 1166 3 2

Expected output:
6164


Actual output:
6996


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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())

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

print(ans)


Failing test case input:
251 8 117 6 3

Expected output:
1404


Actual output:
702


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())

if A + B > 2 * C:
    z = min(X, Y)
    x, y = X - z, Y - z
    ans = 2 * C * z + min(A, 2 * C) * x + min(B, 2 * C) * y
else:
    ans = A * X + B * Y

print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
115 1 6 1 12

Expected output:
23


Actual output:
127


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int, input().split())

A = a * x + b * y
if x <= y: B = c * x * 2 + b * (y-x)
else: B = c * y * 2 + a * (x-y)
C = c * max(x, y) * 2

print(min(A, B, C))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())
if X >= Y:
    a = A*X+B*Y
    b = A*(X-Y)+2*C*Y
    c = 2*C*X
    print(min(a,b,c))
else:
    a = A*X+B*Y
    b = 2*C*X+A*(Y-X)
    c = 2*C*Y
    print(min(a,b,c))

Failing test case input:
97 2 21 1 8

Expected output:
56


Actual output:
113


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())
a = A*X+B*Y
Z = max(X,Y)
z = min(X,Y)
b = 2*Z*C
if X >= Y:
    c = A*(X-Y)+2*C*Y
else:
    c = B*(Y-X)+2*C*X
print(min(a,b,c))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y = map(int,input().split())
ans=a*x+b*y
if x>y:
    e = c*2*y
    f = a*(x-y)
    ans=min(ans,e+y)
    g= 2*c*x
    ans=min(ans,g)
else:
    e = c*2*x
    f = b*(y-x)
    ans = min(ans,e+f)
    g = 2*c*x
    ans = min(ans,g)

print(ans)
    

Failing test case input:
1339 422 1600 0 4

Expected output:
1688


Actual output:
0


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int,input().split())
ans=a*x+b*y
if x>y:
    e = c*2*y
    f = a*(x-y)
    ans=min(ans,e+f)
    g= 2*c*x
    ans=min(ans,g)
else:
    e = c*2*x
    f = b*(y-x)
    ans = min(ans,e+f)
    g = 2*c*y
    ans = min(ans,g)

print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())

ans = 0

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

Failing test case input:
104 2 16 1 12

Expected output:
54


Actual output:
384


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())

ans = 0

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

Problem: p03371
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)

Failing test case input:
97 1 16 1 14

Expected output:
45


Actual output:
32


Fixed submission (verdict: Accepted):
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*y
    print(price)
else:
    print(a*x+b*y)
Problem: p03371
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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()

Failing test case input:
1500 2000 1166 3 2

Expected output:
6164


Actual output:
6664


Fixed submission (verdict: Accepted):
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) * A + C * 2 * Y, 2 * C * X, A * X + B * Y))



main()

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
value = float('inf')
D = max(A,B)
for i in range(D+1):
  valueX = 2*i*C+(X-i)*A+(Y-i)*B
  if valueX < value:
    value  = valueX
print(str(value))

Failing test case input:
97 2 26 1 17

Expected output:
84


Actual output:
-4428


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
value = float('inf')
D = max(X,Y)
for i in range(D+1):
  E = max((X-i)*A, 0)
  F = max((Y-i)*B, 0)
  valueX = 2*i*C+E+F
  if valueX < value:
    value  = valueX
print(str(value))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = list(map(int, input().split()))
ans = 10**20
for nc in range(0, max(X,Y)*2+1, 2):
    na = X-nc
    nb = Y-nc
    ans = min(ans, na*A+nb*B+nc*C)
print(ans)

Failing test case input:
115 1 6 1 12

Expected output:
23


Actual output:
-2513


Fixed submission (verdict: Accepted):
A, B, C, X, Y = list(map(int, input().split()))
ans = 10**20
for nc in range(0, max(X,Y)*2+1, 2):
    na = max(X-nc
    nb = max(Y-nc
    ans = min(ans, na*A+nb*B+nc*C)
print(ans)

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, x, y = map(int,input().split())
total = []

for i in range(1, max(x, y) + 1):
    c_price = i * 2 * c
    if x - i <= 0:
        a_price = 0
    else:
        a_price = (x - i) * a
    if y - i <= 0:
        b_price = 0
    else:
        b_price = (y - i) * b
    total.append(a_price + b_price + c_price)
print(min(total))


Failing test case input:
124 6 75 1 6

Expected output:
160


Actual output:
180


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int,input().split())
total = []

for i in range(0, max(x, y) + 1):
    c_price = i * 2 * c
    if x - i <= 0:
        a_price = 0
    else:
        a_price = (x - i) * a
    if y - i <= 0:
        b_price = 0
    else:
        b_price = (y - i) * b
    total.append(a_price + b_price + c_price)
print(min(total))
Problem: p03371
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a, b, c, x, y = [int(x) for x in input().split()]

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

Failing test case input:
251 8 117 6 3

Expected output:
1404


Actual output:
1455


Fixed submission (verdict: Accepted):
a, b, c, x, y = [int(x) for x in input().split()]

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

ans2 = x * a + y * b

ans3 = 2 * max(x, y) * c

print(min(ans1, ans2, ans3))

Problem: p03371
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
ans=100000
for i in range(1,100001):
    tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
    ans=min(ans,tmp)
print(ans)

Failing test case input:
1500 1572 1600 3 2

Expected output:
7644


Actual output:
7772


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
ans=1000000000000000000000000
for i in range(100001):
    tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
    ans=min(ans,tmp)
print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())

A_B = A * X + B * Y
all_C = max(X, Y) * 2 * C
part_C = min(X, Y) * 2 * C + (A < B) * (B - A) * X + (B < A) * (A - B) * Y

print(min(A_B, all_C, part_C))

Failing test case input:
251 8 144 5 2

Expected output:
1271


Actual output:
1062


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())

A_B = A * X + B * Y
all_C = max(X, Y) * 2 * C
part_C = min(X, Y) * 2 * C + (X < Y) * (Y - X) * B + (Y < X) * (X - Y) * A

print(min(A_B, all_C, part_C))

Problem: p03371
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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()

Failing test case input:
1500 2000 1615 3 2

Expected output:
7960


Actual output:
8460


Fixed submission (verdict: Accepted):
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) * A + C * 2 * Y, 2 * C * X, A * X + B * Y))



main()
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
104 1 16 1 12

Expected output:
43


Actual output:
384


Fixed submission (verdict: Accepted):
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 x > y:
            if a >= 2 * c:
                ans += 2 * c * (x-com)
            else:
                ans += a * (x-com)
        elif x < y:
            if b >= 2 * c:
                ans += 2 * c * (y-com)
            else:
                ans += b * (y-com)
    else:
        ans += a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y = map(int,input().split())
ans = 0
if a + b > c*2:
    if x > y and a < c*2 :
        ans += 2*c*y + (x-y)*a
    elif y > x and b < c*2:
        ans += 2*c*x+(y-x)*a
    else:
        ans += 2*c*max(x,y)
else:
    ans += a*x+b*y
print(ans)

Failing test case input:
97 2 26 1 17

Expected output:
84


Actual output:
1604


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int,input().split())
ans = 0
if a + b > c*2:
    if x > y and a < c*2 :
        ans += 2*c*y + (x-y)*a
    elif y > x and b < c*2:
        ans += 2*c*x+(y-x)*b
    else:
        ans += 2*c*max(x,y)
else:
    ans += a*x+b*y
print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = (int(i) for i in input().split())

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


common = max(X,Y) - abs(X-Y)
if (A+B)/2 < C:
    total = A*common + B*common
else:
    total = C*common*2

difference = abs(X-Y)
if bigger < C*2:
    total = total + bigger*difference
else:
    total = total + bigger*C*2


print(total)

Failing test case input:
1143 3132 1087 90000 100000

Expected output:
217400000


Actual output:
202468968


Fixed submission (verdict: Accepted):
A,B,C,X,Y = (int(i) for i in input().split())

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


common = max(X,Y) - abs(X-Y)
if (A+B)/2 < C:
    total = A*common + B*common
else:
    total = C*common*2

difference = abs(X-Y)
if bigger < C*2:
    total = total + bigger*difference
else:
    total = total + difference*C*2


print(total)
Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b, c, x, y = map(int, input().split())

count = a * x + b * y
for i in range(10 ** 5):
  num = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if(count > num):
    count = num

print(count)


Failing test case input:
1500 2445 500 90000 100000

Expected output:
100000000


Actual output:
100001445


Fixed submission (verdict: Accepted):
a, b, c, x, y = map(int, input().split())

count = a * x + b * y
for i in range(10 ** 6):
  num = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if(count > num):
    count = num

print(count)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y = map(int,input().split())

ans = 0

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


Failing test case input:
124 6 6 1 6

Expected output:
42


Actual output:
72


Fixed submission (verdict: Accepted):
A,B,C,X,Y = map(int,input().split())

ans = 0

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

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
if a+b<=2*c: print(a*x+b*y)
else:
    ans=min(x,y)*2*c
    print(ans)
    dif=abs(x-y)
    if x>y:
        if a>=2*c:
            ans+=2*dif*c
        else:
            ans+=a*dif
    else:
        if b>=2*c:
            ans+=2*dif*c
        else:
            ans+=b*dif
    print(ans)

Failing test case input:
1500 2000 1166 0 2

Expected output:
4000


Actual output:
0
4000


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
if a+b<=2*c: print(a*x+b*y)
else:
    ans=min(x,y)*2*c
    dif=abs(x-y)
    if x>y:
        if a>=2*c:
            ans+=2*dif*c
        else:
            ans+=a*dif
    else:
        if b>=2*c:
            ans+=2*dif*c
        else:
            ans+=b*dif
    print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
if A+B <= C*2 :
    print(A*X+B*Y)
else:
    low = min(X,Y)
    high = max(X,Y)
    if C*(high-low)<=A*(X-low) + B*(Y-low):
        print(C*high*2)
    else:
        print(C*low*2+A*(X-low) + B*(Y-low))

Failing test case input:
1500 2000 1343 3 2

Expected output:
6872


Actual output:
8058


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
if A+B < 2*C:
    print(A*X+B*Y)
else:
    low = min(X,Y)
    high = max(X,Y)
    if C*(high-low)*2<=A*(X-low)+B*(Y-low):
        print(C*high*2)
    else:
        print(C*low*2+A*(X-low)+B*(Y-low))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

a, b, c, x, y = list(map(int, input().rstrip().split()))
ans = min(
    c * 2 * max(x, y),
    a * x + b * y,
    c * 2 * min(x, y) + a * abs(x - y),
    c * 2 * min(x, y) + b * abs(y - x),
)
print(ans)

Failing test case input:
251 8 117 6 3

Expected output:
1404


Actual output:
726


Fixed submission (verdict: Accepted):

a, b, c, x, y = list(map(int, input().rstrip().split()))
ans = min(
    c * 2 * max(x, y),
    a * x + b * y,
    c * 2 * y + a * max(0, x - y),
    c * 2 * x + b * max(0, y - x),
)
print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
case=[]
case.append(a*x+b*y)
if x>=y:
    case.append(c*x*2)
    case.append(((x-y)*a)+(c*y*2))
else:
    case.append(y*c*2)
    case.append(((y-x)*a)+(c*x*2))
print(min(case))

Failing test case input:
124 6 6 1 6

Expected output:
42


Actual output:
72


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
case=[]
c=c*2
case.append(a*x+b*y)
if x>=y:
    case.append(c*x)
    case.append(((x-y)*a)+(c*y))
else:
    case.append(y*c)
    case.append(((y-x)*b)+(c*x))
print(min(case))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y = map(int, input().split())

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

Failing test case input:
1908 8 144 5 3

Expected output:
1440


Actual output:
4680


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int, input().split())

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

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y = map(int, input().split())
if (a+b <= c*2):
    print(a*x+b*y)
else:
    if (x>=y):
        print(min(y*c*2+(x-y)*a,x*c*2))
    else:
        print(min(y*c*2+(y-x)*b,y*c*2))

Failing test case input:
115 1 9 1 12

Expected output:
29


Actual output:
216


Fixed submission (verdict: Accepted):
a,b,c,x,y = map(int, input().split())
if (a+b <= c*2):
    print(a*x+b*y)
else:
    if (x>=y):
        print(min(y*c*2+(x-y)*a,x*c*2))
    else:
        print(min(x*c*2+(y-x)*b,y*c*2))

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, AB, X, Y = map(int, input().split())

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

Failing test case input:
97 2 26 1 17

Expected output:
84


Actual output:
131


Fixed submission (verdict: Accepted):
A, B, AB, X, Y = map(int, input().split())

if X > Y:
	print(min(A*X+B*Y, A*(X-Y)+AB*2*Y, AB*2*X))
else:
	print(min(A*X+B*Y, AB*2*X+B*(Y-X), AB*2*Y))
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,C,X,Y=list(map(int,input().split()))
money=0
if min(A,B,2*C)==2*C:
    money+=2*C*max(X,Y)
elif A+B>2*C:
    money+=2*C*min(X,Y)
    if min(X,Y)==X:
        Y-=X
        money+=Y*B
    else:
        X-=Y
        money+=X*A
else:
    money+=A*X
    money+=B*Y
print(money)

Failing test case input:
1908 8 144 5 3

Expected output:
1440


Actual output:
4680


Fixed submission (verdict: Accepted):
A,B,C,X,Y=list(map(int,input().split()))
money=0
if min(A,B,2*C)==2*C:
    money+=2*C*max(X,Y)
elif A+B>=2*C:
    money+=2*C*min(X,Y)
    if min(X,Y)==X:
        Y -= X
        if B<2*C:
            money+=Y*B
        else:
            money+=Y*2*C
    else:
        X-=Y
        if A<2*C:
            money+=X*A
        else:
            money+=X*2*C
else:
    money+=A*X
    money+=B*Y
print(money)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a , b , c , x , y = map(int,input().split())
n = max(x,y)
kar = a*x + b*y
for i in range(1,n+1):
    if kar > a*(max(0,x-i)) + b*(max(0,y-i)) +c*i:
        kar = a*(max(0,x-i)) + b*(max(0,y-i)) +2*c*i
print(kar)

Failing test case input:
542 2000 841 5 3

Expected output:
6130


Actual output:
8410


Fixed submission (verdict: Accepted):
a , b , c , x , y = map(int,input().split())
n = max(x,y)
kar = a*x + b*y
for i in range(1,n+1):
    if kar > a*(max(0,x-i)) + b*(max(0,y-i)) +2*c*i:
        kar = a*(max(0,x-i)) + b*(max(0,y-i)) +2*c*i
print(kar)

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A, B, C, X, Y = map(int, input().split())
ans = 1e1000
for i in range(0, 2*min(X, Y)+1, 2):
  ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))
print(ans)


Failing test case input:
1500 2445 500 90000 100000

Expected output:
100000000


Actual output:
114450000


Fixed submission (verdict: Accepted):
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for i in range(0, 2*max(X, Y)+1, 2):
  ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))
print(ans)

Problem: p03371
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B,C,X,Y=map(int,input().split())
if 2*C <= A+B:
  price= 2*C
else:
  price = A+B
maxN = max(X,Y)
miniN = min(X,Y)
res = miniN * price
residue = maxN - miniN
if residue == 0:
  print(res)
elif X > Y:
  res+= min(residue*A, residue*2*C)
  print(res)
elif Y < X:
  res +=  min(residue*B, residue*2*C)
  print(res)

Failing test case input:
2595 290 1999 1 4

Expected output:
3755


Actual output:

Fixed submission (verdict: Accepted):
A,B,C,X,Y=map(int,input().split())
if 2*C <= A+B:
  price= 2*C
else:
  price = A+B
maxN = max(X,Y)
miniN = min(X,Y)
res = miniN * price
residue = maxN - miniN
if residue == 0:
  print(res)
elif X > Y:
  res+= min(residue*A, residue*2*C)
  print(res)
elif Y > X:
  res +=  min(residue*B, residue*2*C)
  print(res)
Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
ans=float("inf")
for i in range(max(x,y)-1):
    t=a*(x-min(x,i))+b*(y-min(y,i))+2*c*i
    ans=min(ans,t)
print(ans)

Failing test case input:
1500 2445 500 90000 100000

Expected output:
100000000


Actual output:
100002890


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
ans=float("inf")
for i in range(max(x,y)+1):
    t=a*max(0,x-i)+b*max(0,y-i)+2*c*i
    ans=min(ans,t)
print(ans)

Problem: p03371
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
if x>y:
    p=2*y*c+(x-y)*min(a,2*c)
    ans=min(ans,p)
if x<y:
    p=2*x*c+(y-x)*min(b,2*c)
    ans=min(ans,p)
print(ans)



Failing test case input:
1500 2000 1343 3 3

Expected output:
8058


Actual output:
10500


Fixed submission (verdict: Accepted):
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
if x>y:
    p=2*y*c+(x-y)*min(a,2*c)
    ans=min(ans,p)
if x<=y:
    p=2*x*c+(y-x)*min(b,2*c)
    ans=min(ans,p)
print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




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


case1 = a * x + b * y
case2 = x * 2 * c + max(0, (x * 2 - y) * b)
case3 = max(0, (y * 2 - x) * a) +  y * 2 * c
case4 = max(x, y) * 2 * c

ans = min(case1, case2, case3, case4)


print(ans)


Failing test case input:
97 2 26 1 17

Expected output:
84


Actual output:
52


Fixed submission (verdict: Accepted):




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


case1 = a * x + b * y
case2 = x * 2 * c + max(0, (y - x) * b)
case3 = max(0, (x - y) * a) +  y * 2 * c
case4 = max(x, y) * 2 * c

ans = min(case1, case2, case3, case4)


print(ans)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
1500 2000 1343 3 3

Expected output:
8058


Actual output:

Fixed submission (verdict: Accepted):
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:
    print(C*X*2)
elif C > B/2:
    print(C*X*2+B*(Y-X))
else:
    print(C*Y*2)

Problem: p03371
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,ab,x,y=map(int, input().split())
ans = 10**10
yen=0
for i in range(10**5):
    yen = i*2*ab + max(0, x-i)*a + max(0,y-i)*b
    ans = min(ans,yen)
print(ans)

Failing test case input:
1500 2445 500 90000 100000

Expected output:
100000000


Actual output:
100001445


Fixed submission (verdict: Accepted):
a,b,ab,x,y=map(int, input().split())
ans = 10**10
yen=0
for i in range(10**5+1):
    yen = i*2*ab + max(0, x-i)*a + max(0,y-i)*b
    ans = min(ans,yen)
print(ans)