qyliang/CodeNanoFix huggingface dataset:
Buggy code:
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)

Fixed code:
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)
Buggy 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])

Fixed 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([Y*2*C,X*2*C+(Y-X)*B,X*A+Y*B])
print(min([Y*2*C,X*2*C+(Y-X)*B,X*A+Y*B]))
Buggy 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)

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

ans = a*x + b*y

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)
Buggy 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()


Fixed code:
import sys


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

    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()
Buggy code:
[a,b,c,x,y] = [int(i) for i in input().split()]

ans = a * x + b * y
cnt = 1

while x != 0 or y != 0:
  x = max(x - 1, 0)
  y = max(y - 1, 0)
  ans = min(ans,a*x+b*y+c*2*cnt)
  cnt += 1
  print(ans)

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

ans = a * x + b * y
cnt = 1

while x != 0 or y != 0:
  x = max(x - 1, 0)
  y = max(y - 1, 0)
  ans = min(ans,a*x+b*y+c*2*cnt)
  cnt += 1
print(ans)
Buggy code:
A,B,C,X,Y=map(int,input().split())

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

Fixed code:
A,B,C,X,Y=map(int,input().split())
 
if A+B>2*C:
  if X>Y:
    print(min(A*abs(X-Y)+ min(X,Y)*C*2, max(X,Y)*C*2))
  else:
    print(min(B*abs(X-Y)+ min(X,Y)*C*2, max(X,Y)*C*2))
else:
  print(A*X+B*Y)
Buggy code:
A,B,C,X,Y = map(int,input().split())
l = []
for c in range(0,max(2*X,2*Y)+1,2):
    l.append(A*(X-c/2) + B*(Y-c/2) + C*c)
print(int(min(l)))

Fixed code:
A,B,C,X,Y = map(int,input().split())
l = []
for c in range(0,max(2*X,2*Y)+1,2):
    l.append(A*max(0,(X-c/2)) + B*max(0,(Y-c/2)) + C*c)
print(int(min(l)))
Buggy code:
A, B, C, X, Y = map(int, input().split(' '))

max_c = X+Y
if (X+Y)%2:
  max_c += 1

min_cost = float('inf')
for c in range(0, max_c+1, 2):
  a = max(0, X - c//2)
  b = max(0, Y - c//2)
  cost = A*a + B*b + C*c
  if cost < min_cost:
    min_cost = cost
    
print(min_cost)

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

max_c = max(2*X, 2*Y)

min_cost = float('inf')
for c in range(0, max_c+1, 2):
  a = max(0, X - c//2)
  b = max(0, Y - c//2)
  cost = A*a + B*b + C*c
  
  if cost < min_cost:
    min_cost = cost
    
    
print(min_cost)
Buggy 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)  

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

ans=10**12
for i in range(max(X,Y)+1):
    cnt=0
    cnt+=i*C*2
    cnt+=max(0,X-i)*A
    cnt+=max(0,Y-i)*B
    ans=min(ans,cnt)
print(ans)
Buggy 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)

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

input_line =input()
input_line = input_line.rstrip().split(" ")

a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
x = int(input_line[3])
y = int(input_line[4])

list1=[]
for i in range(max(x,y)+1):
    if x-i<=0:
        cost = b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    elif y-i<=0:
        cost = a*(x-i)+2*c*i
        list1.append(cost)
        i +=1
    else:
        cost = a*(x-i)+b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    

print(min(list1))


Fixed code:

input_line =input()
input_line = input_line.rstrip().split(" ")

a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
x = int(input_line[3])
y = int(input_line[4])

list1=[]
for i in range(max(x,y)+1):
    if x-i<=0 and y-i<=0:
        cost = 2*c*i
        list1.append(cost)
        i +=1
        
    elif x-i<=0:
        cost = b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
        
    elif y-i<=0:
        cost = a*(x-i)+2*c*i
        list1.append(cost)
        i +=1
    
    else:
        cost = a*(x-i)+b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    

print(min(list1))
Buggy code:
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
for i in range(1,max(x,y)+1):
  ab=i*2
  abc=ab*c+a*max(0,x-1)+b*max(0,y-1)
  ans = min(ans,abc)
print(ans)

Fixed code:
a,b,c,x,y=map(int,input().split())
ans=a*x+b*y
for i in range(1,max(x,y)+1):
  ab=i*2
  abc=ab*c+a*max(0,x-i)+b*max(0,y-i)
  ans = min(ans,abc)
print(ans)
Buggy 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)

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

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

res = 10 ** 10
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)
Buggy code:
A, B, C, X, Y = map(int, input().split())
ans = 0
if 2 * C < A + B:
    ans += min(X, Y) * 2 * C
    if X >= Y:
        ans += (X - Y) * A
    else:
        ans += (Y - X) * B
else:
    ans = X * A + Y * B
print(ans)


Fixed code:
A, B, C, X, Y = map(int, input().split())
ans = 0
if 2 * C < A + B:
    ans += min(X, Y) * 2 * C
    if X >= Y:
        ans += (X - Y) * min(A, 2 * C)
    else:
        ans += (Y - X) * min(B, 2 * C)
else:
    ans = X * A + Y * B
print(ans)
Buggy code:
# ABC95_C
a,b,c,x,y = map(int,input().split())

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

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

ans = 0
if c * 2 > a + b:
    ans += a * x + b * y
else:
    if x > y:
        ans += c * 2 * y
        if a > c * 2:
            ans += (x - y) * c * 2
        else:
            ans += (x - y) * a
    else:
        ans += c * 2 * x
        if b > c * 2:
            ans += (y - x) * c * 2
        else:
            ans += (y - x) * b
        
print(ans)
Buggy code:
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)

Fixed code:
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)
Buggy code:
# AtCoder Beginner Contest 095 C - Half and Half
import sys

A, B, C, X, Y = map(int, sys.stdin.readline().strip().split())

ans = A * X + B * Y
for z in range(2, 10 ** 5 + 1, 2):
    x = max(X - int(z / 2), 0)
    y = max(Y - int(z / 2), 0)

    price = A * x + B * y + C * z
    ans = min(price, ans)

print(ans)


Fixed code:
# AtCoder Beginner Contest 095 C - Half and Half
import sys

A, B, C, X, Y = map(int, sys.stdin.readline().strip().split())

ans = A * X + B * Y
for z in range(2, 2 * 10 ** 5 + 1, 2):
    x = max(X - int(z / 2), 0)
    y = max(Y - int(z / 2), 0)

    price = A * x + B * y + C * z
    ans = min(price, ans)

print(ans)
Buggy 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)

Fixed 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*y
    x -= y
    s += min(2*c,a)*x
    print(s)
  else:
    s += 2*c*x
    y -= x
    s += min(2*c,b)*y
    print(s)
Buggy code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**6
for i in range(10**5+1):
  cost=2*c*i
  cost+=max(0,x-i)*a
  cost+=max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)


Fixed code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**10
for i in range(10**5+1):
  cost=2*i*c+max(0,x-i)*a+max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)
Buggy 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 < a+ b:
    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)

Fixed 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 x > y:
    kei += c * (min(x,y)*2)
    kei += c * ((x - y)*2)

elif c*2 <= a+ b and b >= c * 2 and x < y:
    kei += c * (min(x,y)*2)
    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)
Buggy 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)

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

if 2 * c == min(2 * c, a, b):
    print(c * 2 * max(x, y))
elif 2 * c <= max(a, b) and a == max(a, b):
    print(c * 2 * x + b * max(y - x, 0))
elif 2 * c <= max(a, b) and b == max(a, b):
    print(c * 2 * y + a * max(x - y, 0))
elif 2 * c <= a + b and x <= y:
    print(c * 2 * x + b * (y - x))
elif 2 * c <= a + b and x > y:
    print(c * 2 * y + a * (x - y))
else:
    print(a * x + b * y)
Buggy code:
a,b,c,x,y=map(int, input().split())
max_=max(x,y)
cost=0
for i in range(max_):
  cost_=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  cost=max(cost_,cost)
print(cost)

Fixed code:
a,b,c,x,y=map(int, input().split())
max_=max(x,y)
cost=100000000000
for i in range(max_+1):
  cost_=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  cost=min(cost_,cost)
print(cost)
Buggy code:
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)
      

Fixed code:
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)
Buggy code:
A,B,C,X,Y = map(int,input().split())

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

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

else:
    sum = X*A + Y*B

print(sum)

Fixed code:
A,B,C,X,Y = map(int,input().split())
 
sum = 0
 
if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])
 
elif (A+B > 2*C):
    sum = min([X,Y])*2*C
    if(X<Y):
        if(B > 2*C):
            sum = sum + (Y-X)*2*C
        else:
            sum = sum + (Y-X)*B
    else:
        if(A > 2*C):
            sum = sum + (X-Y)*2*C
        else:
            sum = sum + (X-Y)*A
else:
    sum = X*A + Y*B
 
print(sum)
Buggy code:
sum = 0
A,B,C,X,Y = map(int,input().split())
AB = C*2
ans = float("inf")

for i in range(10**5+1):
    sum = AB*i + A*min(0,X-i) + B*min(0,Y-i)
    if sum < ans:
        ans = sum

print(ans)


Fixed code:
sum = 0
A,B,C,X,Y = map(int,input().split())
AB = C*2
ans = float("inf")

for i in range(10**5+1):
    sum = AB*i + A*max(0,X-i) + B*max(0,Y-i)
    if sum < ans:
        ans = sum

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

Fixed code:
a,b,c,x,y=map(int,input().split())
ans=10000000000
for i in range(0,(max(x,y)+1)):
  k=c*2*i+a*max(0,(x-i))+max(0,b*(y-i))
  ans=min(ans,k)
print(ans)
Buggy code:
A, B, C, X, Y = map(int, input().split())
C * 2 * min(X,Y) + max(A * (X - Y), B * (Y - X))

Fixed code:
A, B, C, X, Y = map(int, input().split())
print(min(A * X + B * Y, C * 2 * max(X,Y), C * 2 * min(X,Y) + max(A * (X - Y), B * (Y - X))))
Buggy code:
def C():
    A, B, C, nA, nB = map(int, input().split())
    minAB = min(nA, nB)
    # 3, 2 --> 1, 0
    ns = [nA - minAB, nB - minAB]
    print(ns)
    amounts = [
        A * nA + B * nB,
        minAB * 2 * C + ns[0] * A + ns[1] * B,
        max(nA, nB) * 2 * C
    ]
    return min(amounts)

print(C())

Fixed code:
def C():
    A, B, C, nA, nB = map(int, input().split())
    minAB = min(nA, nB)
    # 3, 2 --> 1, 0
    ns = [nA - minAB, nB - minAB]
    amounts = [
        A * nA + B * nB,
        minAB * 2 * C + ns[0] * A + ns[1] * B,
        max(nA, nB) * 2 * C
    ]
    return min(amounts)

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

Fixed code:
a,b,c,x,y=map(int,input().split())
c=c*2
print(min(c*max(x,y),y*c+max(x-y,0)*a,x*c+max(y-x,0)*b,a*x+b*y))
Buggy code:
A,B,C,X,Y = map(int,input().split())
if A + B >= C * 2:
    price = min(X,Y) * C * 2
    X = X - min(X,Y)
    Y = Y - min(X,Y)
    if A * X < C * X * 2:
        price += A * X
        X -= X
    if B * Y < C * Y * 2:
        price += B * Y
        Y -= Y
    price += C * 2 * max(X,Y)
    print(price)
    
else:
    print(A * X + B * Y)

Fixed code:
A, B, C, X, Y = map(int, input().split())
if A + B >= C * 2:
    price = min(X, Y) * C * 2
    tmp = min(X,Y)
    X = X - tmp
    Y = Y - tmp
    if A * X < C * X * 2:
        price += A * X
        X -= X
    if B * Y < C * Y * 2:
        price += B * Y
        Y -= Y
    price += C * 2 * max(X, Y)
    print(price)

else:
    print(A * X + B * Y)
Buggy 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))

Fixed 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_all))
Buggy 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)

Fixed 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)
Buggy 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))

Fixed code:
A, B, C, X, Y = map(int, input().split())
price = [0]*(max(X, Y)+1)
price[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))
Buggy code:
a, b, c, x, y = map(int, input().split())
if a+b > c:
    if x<=y:
        print(x*2*c+(y-x)*b)
    else:
        print(y*2*c+(x-y)*a)
else:
    print(a*x+b*y)

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

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

Fixed code:
a,b,c,x,y = map(int, input().split())
if x<y:
  x,y = y,x
  a,b = b,a
d = min(2*c, a+b)
a = min(a, 2*c)
print(y*d+(x-y)*a)
Buggy code:
A,B,C,X,Y=map(int,input().split())
ans= min(A+B,C)*min(X,Y)
if X>Y:
  ans+=min(A,C)*(X-Y)
else:
  ans+=min(B,C)*(Y-X)
print(ans)



  

Fixed code:
A,B,C,X,Y=map(int,input().split())
ans= min(A+B,2*C)*min(X,Y)
if X>Y:
  ans+=min(A,2*C)*(X-Y)
else:
  ans+=min(B,2*C)*(Y-X)
print(ans)
Buggy code:
A, B, C, X, Y = [int(_) for _ in input().split()]
M = max(X, Y)
print(min(2 * C * M, 2 * C * (X + Y - M) + A * (M - X) + B * (M - Y), A * X + B * Y))

Fixed code:
A, B, C, X, Y = [int(_) for _ in input().split()]
M = max(X, Y)
print(min(2 * C * M, 2 * C * (X + Y - M) + A *
          (M - Y) + B * (M - X), A * X + B * Y))
Buggy code:
A, B, C, X, Y = [int(_) for _ in input().split()]
ans = A * X + B * Y
for i in range(max(X, Y)):
    cost = 2 * C * i
    if X > i:
        cost += A * (X - i)
    if Y > i:
        cost += B * (Y - i)
    ans = min(ans, cost)
print(ans)

Fixed code:
A, B, C, X, Y = [int(_) for _ in input().split()]
ans = A * X + B * Y
for i in range(max(X, Y) + 1):
    cost = 2 * C * i
    if X > i:
        cost += A * (X - i)
    if Y > i:
        cost += B * (Y - i)
    ans = min(ans, cost)
print(ans)
Buggy code:
a, b, c, x, y = [int(i) for i in input().split()]
ans = 10**18
for i in range(min(x, y) + 1):
    ans = min(ans, c * i*2 + (x - i) * a + (y - i) * b)
print(ans)


Fixed code:
a, b, c, x, y = [int(i) for i in input().split()]
ans = 10**18
for i in range(max(x, y)*2 + 1):
    ans = min(ans, c * i + max(0,(x - i//2)) * a + max(0,(y - i//2)) * b)
print(ans)
Buggy 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(Y*2*C + (X-Y)*C)
        else:
            print(Y*2*C + (X-Y)*A)
    elif Y >= X:
        if B >= 2*C:
            print(X*2*C + (Y-X)*C)
        else:
            print(X*2*C + (Y-X)*B)

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

Fixed code:
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)
Buggy code:
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)

Fixed code:
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)
Buggy code:
from sys import stdin


def main():
    A, B, C, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
    if A + B <= C * 2:
        print(A * X + B * Y)
    elif X < Y:
        a = C * 2 * X
        print(B * (Y - X) + a)
    else:
        a = C * 2 * Y
        print(A * (X - Y) + a)


if __name__ == '__main__':
    main()


Fixed code:
from sys import stdin


def main():
    A, B, C, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
    if A + B <= C * 2:
        print(A * X + B * Y)
    elif X < Y:
        spam = C * 2 * X
        if B < C * 2:
            print(B * (Y - X) + spam)
        else:
            print(C * 2 * (Y - X) + spam)
    else:
        spam = C * 2 * Y
        if A < C * 2:
            print(A * (X - Y) + spam)
        else:
            print(C * 2 * (X - Y) + spam)


if __name__ == '__main__':
    main()
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A,B,C,X,Y = map(int,readline().split())
AB = 2*max(X,Y)
price = float('inf')
for i in range(0,AB,2):
  total = A * max(0,X-i//2)+ B * max(0,Y-i//2) + C * i 
  price = min(price,total)
print(price)

Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A,B,C,X,Y = map(int,readline().split())
AB = 2*max(X,Y)
price = float('inf')
for i in range(0,AB+1,2):
  total = A * max(0,X-i//2)+ B * max(0,Y-i//2) + C * i 
  price = min(price,total)
print(price)
Buggy code:
A, B, C, X, Y = map(int, input().split())
res = float('Inf')
for Z in range(10**5):
    total = 2*Z*C + max(0, X - Z)*A + max(0, Y - Z)*B
    if res > total:
        res = total
print(res)

Fixed code:
A, B, C, X, Y = map(int, input().split())
res = float('Inf')
for Z in range(10**5+1):
    total = 2*Z*C + max(0, X - Z)*A + max(0, Y - Z)*B
    if res > total:
        res = total
print(res)
Buggy code:
a,b,c,x,y = map(int,input().split())
mo=[a,b]
if(a+b>2*c):
    sum=2*min(x,y)*c+max(x-y,y-x)*min(2*c,mo[x>y],mo[y<x])
else:
    sum=a*x+b*y
print(sum)

Fixed code:
a,b,c,x,y = map(int,input().split())
mo=[a,b]
if(a+b>2*c):
    sum=2*min(x,y)*c+max(x-y,y-x)*min(2*c,mo[x<=y])
else:
    sum=a*x+b*y
print(sum)
Buggy code:
a,b,c,x,y=map(int,input().split())
p1=a*x+b*y
min=10**9
for i in range(10**5+1):
    p2=2*i*c+max(0,x-i)*a+max(0,y-i)*b
    if p2<min:
        min=p2
if p2<p1:
    print(p2)
else:
    print(p1)

Fixed code:
a,b,c,x,y=map(int,input().split())
p1=a*x+b*y
min=10**9
for i in range(10**5+1):
    p2=2*i*c+max(0,x-i)*a+max(0,y-i)*b
    if p2<min:
        min=p2
if min<p1:
    print(min)
else:
    print(p1)