qyliang/CodeNanoFix huggingface dataset:
Buggy code:
## ABC087B - Coins
import sys
input = sys.stdin.readline

a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

for i in range(min(a, a // 500) + 1):
    for j in range(min(b, (x - i * 500) // 100) + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 > x:
                break
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Fixed code:
## ABC087B - Coins
import sys
input = sys.stdin.readline

a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

for i in range(a + 1):
    if i * 500 > x:
        break
    for j in range(b + 1):
        if i * 500 + j * 100 > x:
            break
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 > x:
                break
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

res = 0

for i in range(a):
    for j in range(b):
        for k in range(c):
            sum = 500*i + 100*j + 50*k
            if sum == x:
                res += 1
print(res)


Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

res = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            sum = 500*i + 100*j + 50*k
            if sum == x:
                res += 1
print(res)
Buggy code:
x = int(input())
y = int(input())
z = int(input())

s = int(input())

a = 0
for i in range(x+1):
    for j in range(y+1):
        for k in range(z+1):
            if 500*x+100*y+50*z == s
                a = a+1


print(a)


Fixed code:
x = int(input())
y = int(input())
z = int(input())
s = int(input())
a = 0
for i in range(x+1):
    for j in range(y+1):
        for k in range(z+1):
            if 500*i+100*j+50*k == s:
                a = a+1
print(a)
Buggy code:
=int(input())
b=int(input())
c=int(input())
m=int(input())
s=0
for i in range(a+1):
  for j in range(b+1):
    x,y=divmod(m-i*500-j*100,50)
    if y==0 and 0<=x<=c:
      s+=1
print(s)

Fixed code:
a=int(input())
b=int(input())
c=int(input())
m=int(input())
s=0
for i in range(a+1):
  for j in range(b+1):
    x,y=divmod(m-i*500-j*100,50)
    if y==0 and 0<=x<=c:
      s+=1
print(s)
Buggy code:
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if a * 500 + b * 100 + c * 50 == x:
                ans += 1
print(ans)

Fixed code:
a, b, c, x = map(int, [input() for _ in range(4)])
n = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                n += 1
print(n)
Buggy code:
ans = 0
5hun = int(input())
hun = int(input())
fif = int(input())
money = int(input())
for i in range(5hun + 1):
  for j in range(hun + 1):
    for l in range(fif + 1):
      if (500 * i + 100 * j + 50 * l) == money:
        ans += 1
print(ans)

Fixed code:
ans = 0
fhun = int(input())
hun = int(input())
fif = int(input())
money = int(input())
for i in range(fhun + 1):
  for j in range(hun + 1):
    for l in range(fif + 1):
      if (500 * i + 100 * j + 50 * l) == money:
        ans += 1
print(ans)
Buggy code:
numof500 = int(input())
numof100 = int(input())
numof50  = int(input())
moneyneeded = int(input())

counter = 0
for i in range(numof500):
  for j in range(numof100):
  	for k in range(numof50):
      if 500 * i + 100 * j + 50 * k == moneyneeded:
        counter += 1

print(counter)

Fixed code:
numof500 = int(input())
numof100 = int(input())
numof50  = int(input())
moneyneeded = int(input())
 
counter = 0
for i in range(numof500 + 1):
  for j in range(numof100 + 1):
    for k in range(numof50 + 1):
      if 500 * i + 100 * j + 50 * k == moneyneeded:
        counter += 1
 
print(counter)
Buggy code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
for a in range(A):
    for b in range(B):
        for c in range(C):
            if 500*a+100*b+50*c==X:
                cnt=cnt+1
print(cnt)


Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a+100*b+50*c==X:
                cnt=cnt+1
print(cnt)
Buggy code:
a = input()
b = input()
c = input()
x = input()
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k=x:
        ans += 1
print(ans)

Fixed code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      sum = 500*i + 100*j + 50*k
      if sum==x:
        ans+=1
print(ans)
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

result = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*A + 100*B + 50*C == X:
                result += 1

print(result)


Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500+j*100+k*50 == X:
                count += 1

print(count)
Buggy code:
a,b,c,x = map(int,[input() for i in range(4)])
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if(100*a + 10*b + c == x):
                count += 1
print(count)

Fixed code:
a,b,c,x = map(int,[input() for i in range(4)])
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if(500*i + 100*j + 50*k == x):
                count += 1
print(count)
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

result = 0

sum = 0

for i in range(A):
    for j in range(B):
        for k in range(C):
            if 500*A + 100*B + 50*C == X:
                result += 1

print(result)


Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

result = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*ｊ + 50*k == X:
                result += 1

print(result)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a):
  s = 500 * a
  for j in range(b):
    t = 100 * b
    for k in range(c):
      u = 50 * c
      if s + t + u == x:
        count += 1

print(count)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a + 1):
  s = 500 * i
  for j in range(b + 1):
    t = 100 * j
    for k in range(c + 1):
      u = 50 * k
      if s + t + u == x:
        count += 1

print(count)
Buggy code:
a, b, c , x = (int(input()) i for range(4))
n = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        n += 1
print(n)

Fixed code:
a, b, c, x = [int(input()) for i in range(4)]
n = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        n += 1
print(n)
Buggy code:
a, b, c , x = [int(input()) i for range(4)]
n = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        n += 1
print(n)




Fixed code:
a,b,c,x = [int(input()) for _ in range(4)]
ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (500*i + 100*j + 50*k) == x:
                ans+=1

print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if (i+1)*500+(j+1)*100+(k+1)*50 == x:
        ans += 1

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(c+1):
    for j in range(b+1):
        for k in range(a+1):
            if k*500+j*100+i*50 == x:
                ans += 1
print(ans)
Buggy code:
A, B, C, X = int(input())
ans = 0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            sum = 500 * i + 100 * j + 50 * k
            if sum == X:
                ans += 1

print(ans)

Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1

print(ans)
Buggy code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())

l=0
for a in range(A+1):
    ax = X - a*50
    for b in range(B+1):
        bx =ax - b*100
        for c in range(C+1):
            if bx - c*500 == 0:
                l+=1
print(l)

Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())

l=0
for a in range(A+1):
    ax = X - a*500
    for b in range(B+1):
        bx =ax - b*100
        for c in range(C+1):
            if bx - c*50 == 0:
                l+=1
print(l)
Buggy code:
def i():
  return int(input())
A = i()
B = i()
C = i()
X = i()
ans = 0
for i in range(A):
  for j in range(B):
    for k in range(C):
      if 500*i+100*j+50*k == X:
        ans += 1
print(ans)

Fixed code:
def i():
  return int(input())
A = i()
B = i()
C = i()
X = i()
ans = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k == X:
        ans += 1
print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())/50
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*10+j*2+k=x:
                ans+=1
print(ans)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())/50
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*10+j*2+k==x:
                ans+=1
print(ans)
Buggy code:
A = int(input()) # 500
B = int(input()) # 100
C = int(input()) # 50
X = int(input()) # target

ans = 0

for i in range(A+1):
  amount = 500* (i - 1)
  for j in range(B+1):
    amount += 100*(j - 1)
    for h in range(C+1):
      amount += 50*(h - 1)
      if amount == X:
        ans += 1
        
        
print(ans)

Fixed code:
A = int(input()) # 500
B = int(input()) # 100
C = int(input()) # 50
X = int(input()) # target
 
ans = 0
 
for i in range(A+1):
  for j in range(B+1):
    for h in range(C+1):
      amount = 500*i + 100 * j + 50 * h
      if amount == X:
        ans += 1

print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

rCnt = 0
ttla = 0
ttlb = 0

ia = 0
ib = 0
ic = 0

while ia <= a:
  ttla = 500 * ia
  ia = ia + 1
  while ib <= b:
    ttlb = 100 * ib
    ib = ib + 1
    while ic <= c:
      if ttla + ttlb + 50 * ic:
        rCnt = rCnt + 1
      ic = ic + 1

print(rCnt)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

rCnt = 0
ttla = 0
ttlb = 0

ia = 0

while ia <= a:
  ib = 0
  ic = 0
  ttla = 500 * ia
  ia = ia + 1
  while ib <= b:
    ic = 0
    ttlb = 100 * ib
    ib = ib + 1
    while ic <= c:
      if x == ttla + ttlb + 50 * ic:
        rCnt = rCnt + 1
      ic = ic + 1

print(rCnt)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

a = min(a, 20000 // 500 + 1)
b = min(b, 20000 // 100 + 1)
ans = 0

for i in range(a):
    for j in range(b):
        res = x - (500 * i + 100 * j)
        # print(i, j, res)
        if res >= 0 and res % 50 == 0 and res // 50 <= c:
            ans += 1

print(ans)


Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a + 1):
    for j in range(b + 1):
        res = x - (500 * i + 100 * j)
        # print(i, j, res)
        if res >= 0 and res % 50 == 0 and res // 50 <= c:
            ans += 1

print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if 500*i+100*j+50*c == x:
        ans += 1

print(ans)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k == x:
        ans += 1

print(ans)
Buggy code:
X = int(input())
A = int(input())
B = int(input())
C = int(input())

count = 0


for i in range(A + 1):
    for j in range(B + 1):
        for l in range(C + 1):
            if (500*i + 100*j + 50*l) == X:
                count += 1
              
print(count)

Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50 * k == X:
                count += 1


print(count)
Buggy code:
a = [int(input()) for i in range(4)]
count = 0

for (i = 0; i <= a[0]; i++) :
  for (j = 0; j <= a[1]; j++) :
    for (k = 0; k <= a[2]; k++) :
      sum = 500*i + 100*j + 50*k
      if sum == a[3] :
        count += 1
print(count)

Fixed code:
a = [int(input()) for i in range(4)]
count = 0

for i in range(a[0]+1) :
  for j in range(a[1]+1) :
    for k in range(a[2]+1) :
      sum = 500*i + 100*j + 50*k
      if sum == a[3] :
        count += 1
print(count)
Buggy code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count=0

for i in range(A):
    for j in range(B):
        for k in range(C):
            if 500*A+100*B+50*C==X:
                count+=1
            else:
                pass
print(count)

Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                count+=1
            else:
                pass

print(count)
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      price = 500*a + 100*b + 50*c
      if price == X:
        ans += 1

Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      price = 500*a + 100*b + 50*c
      if price == X:
        ans += 1
print(ans)
Buggy code:
a=int(input())
b=int(input())
c=int(input())
n=int(input())
ans=0
for i in range(a):
  for j in range(b):
    if 500*i+100*j>n:
      break
    else:
      (n-500*i-100*j)%50==0 and (n-500*i-100*j)//50<=c:
        ans+=1
  if 500*i>n:
    break
print(ans)

Fixed code:
a=int(input())
b=int(input())
c=int(input())
n=int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    if 500*i+100*j>n:
      break
    else:
      if(n-500*i-100*j)%50==0 and (n-500*i-100*j)//50<=c:
        ans+=1
  if 500*i>n:
    break
print(ans)
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(A):
    for j in range(B):
        for k in range(C):
            if i * 500 + j * 100 + k * 50 == X:
                cnt += 1
print(cnt)

Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
answer = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            if X == i*500+j*100+k*50 :
                answer += 1
print(answer)
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(A):
    for j in range(B):
        for k in range(C):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1

print(ans)


Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500 * i + 100 * j + 50 * k) == X:
                ans += 1

print(ans)
Buggy code:
A, B, C, X = [int(input()) for i in range(4)]
count = 0

for i in range(A):
    for j in range(B):
        for k in range(C):
            if (i * 500) + (j * 100) + (k * 50) == X:
                count += 1
print(count)

Fixed code:
A, B, C, X = [int(input()) for i in range(4)]
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (i * 500) + (j * 100) + (k * 50) == X:
                count += 1
print(count)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*a + 100*b + 50*c == x:
        count += 1
print(count)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total = 500 * i + 100 * j + 50 * k
            if total == x:
                count = count + 1

print(count)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
    if i*500 <= x:
        for k in range(b+1):
            if k*100 <= (x-i*500):
                if (x-i*500-k*100)/50 <= c:
                    print(i,k,(x-i*500-k*100)/50)
                    ans += 1
print(ans)	

Fixed code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0
for i in range(0,x//500+1):
    if i<=a:
        for j in range((x-500*i)//100+1):
            if j<=b:
                for k in range((x-500*i-100*j)//50+1):
                    if k<=c:
                        if (500*i+100*j+50*k)==x:
                            cnt+=1
print(cnt)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
total = int(input())

max_a = total // 500
max_b = total // 100
max_c = total // 50
ans = 0
for i in range(0, max_a):
  for j in range(0, max_b):
    for k in range(0, max_c):
      sum = 500 * i + 100 * j + 50 * k
      if (sum == total) :
        ans += 1
print(ans)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
total = int(input())

max_a = a if total // 500 > a else total // 500
max_b = b if total // 100 > b else total // 100
max_c = c if total // 50 > c else total // 50
ans = 0
for i in range(0, max_a + 1):
  for j in range(0, max_b + 1):
    for k in range(0, max_c + 1):
      sum = 500 * i + 100 * j + 50 * k
      if (sum == total) :
        ans += 1
print(ans)
Buggy code:
A=input()
B=input()
C=input()
X=input()
total = 0
cnt = 0
 
for a in A+1:
  for b in B+1:
    for c in C+1:
      total = 500*a+100*b+50*c
      if total=X:
        cnt +=1
        
        
print(cnt)

Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
total = 0
cnt = 0
 
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      total = 500*a+100*b+50*c
      if total==X:
        cnt +=1
             
print(cnt)
Buggy code:
a=int(input())
b=int(input())
c=int(input())
x = int(input())

count = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if (500*a+100*b+50*c) == x:
        count += 1

print(count)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1

print(count)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0

for i in range(a):
    for j in range(b):
        for k in range(c):
                total = i*500 + j*100 + k*50
                if total == x:
                    res += 1

print(res) 

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
                total = i*500 + j*100 + k*50
                if total == x:
                    res += 1

print(res)
Buggy code:
coin500 = int(input())
coin100 = int(input())
coin050 = int(input())
target = int(input())
x = 0

for a in range(coin500):
  for b in range(coin100):
    for c in range (coin050):
     if target == a * 500 + b * 100 + c * 50:x += 1
print(x)

Fixed code:
coin500 = int(input())
coin100 = int(input())
coin050 = int(input())
target = int(input())
x = 0
 
for a in range(coin500+1):
  for b in range(coin100+1):
    for c in range (coin050+1):
     if target == a * 500 + b * 100 + c * 50:x += 1
print(x)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
total = int(input())
pattern_num = 0
for i in range(0, a):
    for j in range(0, b):
        for k in range(0, c):
            if i*500+j*100+k*50 == total:
                pattern_num += 1
print (pattern_num)


Fixed code:
a = int(input()) + 1
b = int(input()) + 1
c = int(input()) + 1
total = int(input())
pattern_num = 0
for i in range(0, a):
    for j in range(0, b):
        for k in range(0, c):
            if i*500+j*100+k*50 == total:
                pattern_num += 1
print (pattern_num)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(min(x//500 + 1,a)):
    for j in range(min((x-i*500)//100 + 1,b)):
        if (x-i*500-j*100)%50==0 and (x-i*500-j*100)//50 <= c:
            count += 1

print(count)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(min(x//500 + 1,a + 1)):
    for j in range(min((x-i*500)//100 + 1,b + 1)):
        if (x-i*500-j*100)%50==0 and (x-i*500-j*100)//50 <= c:
            count += 1

print(count)
Buggy code:
#087_B
a,b,c,x=[int(input()) for i in range(4)]
print(sum([500*p+100*q+10*r==x for p in range(a+1) for q in range(b+1) for r in range(c+1)]))

Fixed code:
#087_B
a,b,c,x=[int(input()) for i in range(4)]
print(sum([500*p+100*q+50*r==x for p in range(a+1) for q in range(b+1) for r in range(c+1)]))
Buggy code:
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1
            else if list[3] < 500 * ii + 100 * jj + 50 * kk:
                break

print(count)


Fixed code:
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1

print(count)
Buggy code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
i=0
j=0
k=0
while i <= A:
  while j <= B:
    while k <= C:
      sum=500*i+100*j+50*k
      print(sum)
      if sum== X:
        cnt+=1
      k+=1
    j+=1
    k=0
  i+=1
  j=0
  k=0
print(cnt)

Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
i=0
j=0
k=0
while i <= A:
  while j <= B:
    while k <= C:
      sum=500*i+100*j+50*k
      if sum== X:
        cnt+=1
      k+=1
    j+=1
    k=0
  i+=1
  j=0
  k=0
print(cnt)
Buggy code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
counti = 0

for a in range(A)+1:
  for b in range(B)+1:
    for c in range(C)+1:
      if 500*a + 100*b + 50*c == X:
        counti += 1

print(counti)

Fixed code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
counti = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 500*a + 100*b + 50*c == X:
        counti += 1

print(counti)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
n = int(input())
co = 0
for i in range(a):
    for j in range(b):
        for k in range(c):
            if 500*a + 100*b + 50* c == n:
                co += 1
print(co)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
n = int(input())
co = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50* k == n:
                co += 1
print(co)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a):
  for j in range(b):
    for k in range(c):
      if 500*i+100*j+50*k == x:
        ans +=1
        
print(ans)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total = i*500 + j*100 + k*50
            if total == x:
                ans += 1
print(ans)