qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N, X = map(int, input().split())
m = [int(input(i)) for i in range(N)]
XX -= sum(m)
ans = N + XX // min(m)
print(ans)

Fixed code:
N, X = map(int, input().split())
m = [int(input()) for i in range(N)]
XX = X - sum(m)
ans = N + XX // min(m)
print(ans)
Buggy code:
N, X = map(int, input().split())
m = sorted([int(input()) for i in range(N)])
for i in range(N):
    X -= m[i]
print(3 + X//m[0])

Fixed code:
N, X = map(int, input().split())
m = sorted([int(input()) for i in range(N)])
for i in range(N):
    X -= m[i]
print(N + X//m[0])
Buggy code:
n, x = input().split()
n = int(n)
x = int(x)
m = []
m_min = 1000
gokei = 0
for i in range(n):
  m.append(int(intput()))
  gokei += m[i]
  if m_min > m[i]:
    m_min = m[i]
x -= gokei
print((x//m_min) + n)

Fixed code:
n, x = input().split()
n = int(n)
x = int(x)
m = []
m_min = 1000
gokei = 0
for i in range(n):
  m.append(int(input()))
  gokei += m[i]
  if m_min > m[i]:
    m_min = m[i]
x -= gokei
print((x//m_min) + n)
Buggy code:
n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]

print(sum(m) + min(m)*(x-n))


Fixed code:
n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]
print((x - sum(m)) // min(m) + n)
Buggy code:
n, x = map(int,input().split())
m = []
ans = len(n)
for i in range(n):
    m.append(int(input()))
x -= sum(m)
ans+=(x//min(m))

Fixed code:
n, x = map(int,input().split())
m = []
ans = n
for i in range(n):
    m.append(int(input()))
x -= sum(m)
ans+=(x//min(m))
print(ans)
Buggy code:
n,x=map(input().split())
M=[int(input()) for i in range(n)]
print(n+(x-sum(M))//min(M))

Fixed code:
n,x=map(int,input().split())
M=[int(input()) for i in range(n)]
print(n+(x-sum(M))//min(M))
Buggy code:
n, x = map(int, input().split())
m = []
sum = 0
for i in range(n):
    a = int(input())
    m.append(a)
    sum += a
m = sorted(m)
#print(m)
x -= sum

#cnt = n
#while x >= m[0]:
#    cnt += 1
#    x -= m[0]
cnt x // m[0]

print(cnt)


Fixed code:
n, x = map(int, input().split())
m = []
sum = 0
for i in range(n):
    a = int(input())
    m.append(a)
    sum += a
m = sorted(m)
#print(m)
x -= sum

#cnt = n
#while x >= m[0]:
#    cnt += 1
#    x -= m[0]
cnt = n + x // m[0]

print(cnt)
Buggy code:
import math
# a=int(input())
# b=input()
# c=[]
# for i in b:
#     c.append(i)
e = list(map(int,input().split()))
#f = list(map(int,input().split()))
j = [int(input()) for _ in range(e[0])]
a = sum(j)
count=e[0]
if a==e[1]:
    count+=1
else:
    count+=(e[1]-a)//min(j)
print(count)

Fixed code:
import math
# a=int(input())
# b=input()
# c=[]
# for i in b:
#     c.append(i)
e = list(map(int,input().split()))
#f = list(map(int,input().split()))
j = [int(input()) for _ in range(e[0])]
a = sum(j)
count=e[0]
if a==e[1]:
    count+=0
else:
    count+=(e[1]-a)//min(j)
print(count)
Buggy code:
n,x=map(int,input().split())
m=[int(input) for _ in range(n)]
m.sort()
num=x-sum(m)
print(n+(num//min(m)))


Fixed code:
n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
m.sort()
num=x-sum(m)
print(n+(num//(min(m))))
Buggy code:
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(consts))


Fixed code:
n, x = map(int, input().split())
costs = [int(input()) for _ in range(n)]
print(len(costs) + (x - sum(costs)) // min(costs))
Buggy code:
n,x = map(int,input().split())
a=[]
for _ in [0]*n:
  a += [int(input())]
print(n+(n-sum(a))//min(a))

Fixed code:
n,x = map(int,input().split())
a=[]
for _ in [0]*n:
  a += [int(input())]
print(n+(x-sum(a))//min(a))
Buggy code:
N, X = [int(nx) for nx in input().split()]
M = []
for n in range(N):
  M.append(int(input()))
X -= sum(M)
ans = 3 + X//min(M)
print(ans)

Fixed code:
N, X = [int(nx) for nx in input().split()]
M = []
for n in range(N):
  M.append(int(input()))
X -= sum(M)
ans = N + X//min(M)
print(ans)
Buggy code:
a,b,c,x,y=map(int,input().split())
cost=[]
cm=0
while cm<=max(x,y):
    am=x-cm//2    
    bm=y-cm//2
    if am>=0 and bm>=0:
        cost.append(am*a+bm*b+cm*c)
    cm+=2
print(min(cost))

Fixed code:
a,b,c,x,y=map(int,input().split())
cost=[]
cm=0
while cm<=2*max(x,y):
    am=x-cm//2    
    bm=y-cm//2
    if am>=0 and bm>=0: cost.append(am*a+bm*b+cm*c)
    elif am>=0 and bm<=0: cost.append(am*a+cm*c)
    elif am<=0 and bm>=0: cost.append(bm*b+cm*c)
    elif am<=0 and bm<=0: cost.append(cm*c)
    cm+=2
print(min(cost))
Buggy code:
a, b, ab, xa, yb = map(int, input().split())
price = []
for i in range(1, 100001):
    price.append(i * 2 * ab + max(xa - i, 0) * a + max(yb - i, 0) * b)

idx = price.index(min(price))

print(min(price))


Fixed code:
a, b, ab, xa, yb = map(int, input().split())
price = []
for i in range(100001):
    price.append(i * 2 * ab + max(xa - i, 0) * a + max(yb - i, 0) * b)

idx = price.index(min(price))

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

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

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

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

Fixed 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)
Buggy code:
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+=B*(Y-X)
print(ans)

Fixed code:
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)
Buggy code:
#095_C
a,b,c,x,y=map(int,input().split())
ans=10**10

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

print(ans)

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

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

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

ans = A*X + B*Y

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

print(ans)


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

ans = A*X + B*Y

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

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

Fixed code:
a,b,c,x,y = map(int,input().split())
if a+b > c*2:
  if x >= y:
    print(min(c*2*y+a*(x-y),c*2*x))
  else:
    print(min(c*2*x+b*(y-x),c*2*y))
else:
  print(a*x+b*y)
Buggy code:
if __name__ == '__main__':
    A, B, C, X, Y = map(int, input().split())
    min_cost = C*2*max(X, Y) 
    for c in range(-1, 2*pow(10, 5)+2, 2):
        a = X-c//2
        b = Y-c//2
        if a==100000 and b==100000:
            print("ans")
        if a>=0 and b>=0:
            cost = A*a+b*B+C*c
            min_cost = min(cost, min_cost)
    print(min_cost)


Fixed code:
if __name__ == '__main__':
    A, B, C, X, Y = map(int, input().split())
    min_cost = 2*max(X, Y)*C
    for c in range(0, 2*pow(10, 5)+2, 2):
        a = X-c//2
        b = Y-c//2
        if a>=0 and b>=0:
            cost = A*a+b*B+C*c
            min_cost = min(cost, min_cost)
    print(min_cost)
Buggy code:
a,b,c,x,y = map(int, input().split())

costs = 0

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

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

costs = 0

while x>0 and y>0:
  if a+b>2*c:
    costs += 2*c
  else:
    costs += a+b
  x -= 1
  y -= 1
  
if x>0:
  if a<=2*c:
    costs += x*a
  else:
    costs += x*2*c
    
if y>0:
  if b<=2*c:
    costs += y*b
  else:
    costs += y*2*c
  
print(costs)
Buggy code:
import sys
input = sys.stdin.readline
a,b,c,x,y=map(int,input().split())

c1=a*x+b*y
if x>=y:
    c2=2*y*c+(x-y)*x
else:
    c2=2*x*c+(y-x)*y
c3=2*max(x,y)*c
print(min(c1,c2,c3))


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

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

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

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

ans1 = min(x,y) * min(a + b,c*2) + abs(x-y) * z
ans2 = c * max(x,y) * 2
print(min(ans1,ans2))
Buggy code:
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)+C*Y
else:
    c = B*(Y-X)+C*X
print(min(a,b,c))

Fixed code:
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))
Buggy code:
A, B, C, X, Y = map(int, input().split(" "))
p1 = A * X + B * Y
p2 = C * min(X, Y)
p3 = p2
if X > Y:
    p3 += (X - Y) * A
else:
    p3 += (Y - X) * B
print(min(p1, p2, p3))

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

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

Fixed code:
a, b, c, x, y = map(int, input().split())
ans = 0
if c * 2 <= a + b:
    ans += min(x, y) * c * 2
    if x >= y:
        ans += min(c * 2 * (x - y), a * (x - y))
    else:
        ans += min(c * 2 * (y - x), b * (y - x))
else:
    ans = a * x + b * y
print(ans)
Buggy code:
a,b,c,x,y=[int(i)  for i in input().split()]
ans=1000000
for k in range(10**5):
	money=2*c*k + max(x-k,0)*a + max(y-k,0)*b
	if(ans>money):
		ans=money
print(ans)




Fixed code:
a,b,c,x,y=[int(i)  for i in input().split()]
ans=1000000000
for k in range(10**5+1):
	money=2*c*k + max(x-k,0)*a + max(y-k,0)*b
	if(ans>money):
		ans=money
print(ans)
Buggy code:
# -*- coding: utf-8 -*-
a, b, c, x, y = map(int, input().split())

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


Fixed code:
# -*- coding: utf-8 -*-
a, b, c, x, y = map(int, input().split())

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


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

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

if a>= c*2 and b >= c*2:
    print(max(x,y)*c*2)

elif a>= c*2 and x>=y :
    print(x*c*2)

elif b >= c*2 and y>=x:
    print(y*c*2)

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

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

Fixed code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)+1):
    m = 0
    m += (a*(max(0,x-i)))+(b*(max(0,y-i)))+(c*i)
    ans = min(ans,m)
print(ans)
Buggy code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 5
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)

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

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

Fixed code:
a,b,c,x,y  = map(int,input().split())
if a+b > c*2:
    mmm = min(x,y)
    aaa = max(x,y)
    if (x > y and a<=2*c):
        print(c*2*mmm + a*(aaa-mmm))
    elif (x > y and a>2*c):
        print(c*2*aaa)
    elif (x <= y and b<=2*c):
        print(c*2*mmm + b*(aaa-mmm))
    elif (x <= y and b>2*c):
        print(c*2*aaa)
else:
    print(a*x + b*y)
Buggy code:
#C
a, b, c, x, y = map(int,input().split())
ans = 0
if a + b <= 2*c:
    print(a*x + b*y)
else:
    ans = min(x,y) * 2*c
    r = max(x,y) - min(x,y)
    if max(x,y) == x:
        if a <= 2*c:
            ans += a*r
        else:
            ans += 2*c*r
    else:
        if b <= 2*c:
            ans += c*r
        else:
            ans += 2*c*r
print(ans)

Fixed code:
#C
import sys
a, b, c, x, y = map(int,input().split())
ans = 0
if a + b <= 2*c:
    print(a*x + b*y)
else:
    ans += min(x,y) * 2*c
    r = max(x,y) - min(x,y)
    if max(x,y) == x:
        if a <= 2*c:
            ans += a*r
        else:
            ans += 2*c*r
    else:
        if b <= 2*c:
            ans += b*r
        else:
            ans += 2*c*r
    print(ans)
Buggy code:
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)]))

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

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:
        amari = x - y
        if a > 2*c:
            print(2*c*y + amari*2*c)
        else:
            print(2*c*y + amari*a)
    else:
        amari = y - x
        if b > 2*c:
            print(2*c*x + amari*2*c)
        else:
            print(2*c*x + amari*b)
Buggy code:
a, b, c, x, y = map(int, input().split())
ans = float('inf')
for i in range(1, 100001):
    ans = min(ans, c * 2 * i + max(x - i, 0) * a + max(y - i, 0) * b)
print(ans)

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

def best_pizza_cost(ln, hn):
    if ln == X: lp = A
    else: lp = B

    if hn == Y: hp = B
    else: hp = A

    fnp = lp * ln + hp * ln
    fhp = C * ln * 2

    left = hn-ln
    snp = hp * left
    shp = C * left * 2
    print(fnp, fhp, snp, shp)
    return min(fnp, fhp) + min(snp, shp)

print(best_pizza_cost(min(X, Y), max(X, Y)))

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

def best_pizza_cost(ln, hn):
    if ln == X: lp = A
    else: lp = B

    if hn == Y: hp = B
    else: hp = A

    fnp = lp * ln + hp * ln
    fhp = C * ln * 2

    left = hn-ln
    snp = hp * left
    shp = C * left * 2
    #print(fnp, fhp, snp, shp)
    return min(fnp, fhp) + min(snp, shp)

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

print(a)

Fixed code:
a,b,c,x,y=map(int,input().split())
s=0
c*=2
if(x>y):
    s=min((a*x+b*y),((x-y)*a+y*c),c*max(x,y))
else:
    s=min((a*x+b*y),((y-x)*b+x*c),c*max(x,y))
print(s)
Buggy code:
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b,c,x,y = mi()
    ans = 1<<60
    for i in range(max(x,y)):
        ans = min(max(x-i,0)*a+max(y-i,0)*b+2*i*c,ans)
    print(ans)


main()




Fixed code:
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b,c,x,y = mi()
    ans = 1<<60
    for i in range(max(x,y)+1):
        ans = min(max(x-i,0)*a+max(y-i,0)*b+2*i*c,ans)
    print(ans)


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

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



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

price = a * x + b * y


for i in range(max(a,b) + 1):
    ab = 2 * i
    cand = ab * c + a * max(0, x - i) + b * max(0, y-i)

    price = min(price, cand)

print(price)
  


Fixed code:



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

price = a * x + b * y


for i in range(max(x,y) + 1):
    ab = 2 * i
    cand = ab * c + a * max(0, x - i) + b * max(0, y-i)

    price = min(price, cand)

print(price)
Buggy code:
import math

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

for c in range(max(X, Y) * 2 + 1):
    a = math.ceil(X - 0.5 * c) if X - 0.5 * c >= 0 else 0
    b = math.ceil(Y - 0.5 * c) if Y - 0.5 * c >= 0 else 0
    m = min(a * A + b * B + c * C, m)
    print(a, b, c)

print(m)

Fixed code:
import math

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

for c in range(max(X, Y) * 2 + 1):
    a = math.ceil(X - 0.5 * c) if X - 0.5 * c >= 0 else 0
    b = math.ceil(Y - 0.5 * c) if Y - 0.5 * c >= 0 else 0
    m = min(a * A + b * B + c * C, m)

print(m)
Buggy code:
a,b,c,x,y = map(int,input().split())
m=[]
for i in range(10**5):
  m.append(2*c*i + a*max(0,x-i) + b*max(0,y-i))
print(min(m))

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

pay = []

for i in range(max(X,Y)):
    pay.append(i*2*C + max(0,X-i)*A + max(0,Y-i)*B)
    
print(min(pay))

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

pay = []

for i in range(max(X,Y)+1):
    pay.append(i*2*C + max(0,X-i)*A + max(0,Y-i)*B)
    
print(min(pay))
Buggy code:
a,b,c,x,y = map(int,input().split())
if (a+b <= 2*c) :
  print(a*x+b*y)
if (a+b > 2*c) :
  if (x == y) :
    print(2*c*(x+y))
  if (x > y) :
    print(2*c*y + a*(x-y))
  if (x < y) :
    print(2*c*x + b*(y-x))


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

ans=int(5000*(10**5))

for i in range(10**5):
    a_cnt=max(0,x-i)
    b_cnt=max(0,y-i)
    
    total=i*2*c+a_cnt*a+b_cnt*b
    ans=min(ans,total)

print(ans)

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

ans=10**10

for i in range(10**5+1):
    a_cnt=max(0,x-i)
    b_cnt=max(0,y-i)
    
    total=i*2*c+a_cnt*a+b_cnt*b
    ans=min(ans,total)

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

ans1 = a*x + b*y

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


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

ans1 = a*x + b*y

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

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


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

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

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

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

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