qyliang/CodeNanoFix huggingface dataset:
Buggy code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
aa = inpl()
MIN = min(aa)
MAX = max(aa)

if MAX-MIN > 1:
	print('No')
elif MAX == MIN:
	if MAX == N-1:
		print('Yes')
	elif MAX <= N//2:
		print('Yes')
	else:
		print('No')
else: #MAX-MIN == 1
	n_MIN = n_MAX = 0
	for a in aa:
		if a == MIN: n_MIN += 1
		if a == MAX: n_MAX += 1
	print(n_MIN,n_MAX)
	x_min = n_MIN + 1
	x_max = n_MIN + n_MAX//2
	if x_min <= MAX <= x_max:
		print('Yes')
	else:
		print('No')


Fixed code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
aa = inpl()
MIN = min(aa)
MAX = max(aa)

if MAX-MIN > 1:
	print('No')
elif MAX == MIN:
	if MAX == N-1:
		print('Yes')
	elif MAX <= N//2:
		print('Yes')
	else:
		print('No')
else: #MAX-MIN == 1
	n_MIN = n_MAX = 0
	for a in aa:
		if a == MIN: n_MIN += 1
		if a == MAX: n_MAX += 1
	x_min = n_MIN + 1
	x_max = n_MIN + n_MAX//2
	if x_min <= MAX <= x_max:
		print('Yes')
	else:
		print('No')
Buggy code:
n = int(input())
a = list(map(int, input().split()))
Min = min(a)
Max = max(a)
if Max - Min > 1:
	print("No")
elif Max == Min:
	if a[0] == n - 1 or a[0] <= n // 2:
		print("Yes")
	else:
		print("No")
else:
	c_M = a.count(Max)
	c_m = n - c_M
	if c_m < Max <= c_m + c_M // 2:
		print("Yes")
	else:
		print("NO")

Fixed code:
n = int(input())
a = list(map(int, input().split()))
Min = min(a)
Max = max(a)
if Max - Min > 1:
	print("No")
elif Max == Min:
	if a[0] == n - 1 or a[0] <= n // 2:
		print("Yes")
	else:
		print("No")
else:
	c_M = a.count(Max)
	c_m = n - c_M
	if c_m < Max <= c_m + c_M // 2:
		print("Yes")
	else:
		print("No")
Buggy code:
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
l.sort()
if l[0]==l[-1]:
    if 1<=l[0]<=n//2:
        print("Yes")
    else:
        print("No")
elif l[-1]-l[0]>1:
    print("No")
else:
    a=l.count(l[0])
    b=l.count(l[-1])
    if a+1<=l[-1]<=a+b//2:
        print("Yes")
    else:
        print("No")


Fixed code:
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
l.sort()
if l[0]==l[-1]:
    if l[0]<=n//2 or l[0]==n-1:
        print("Yes")
    else:
        print("No")
elif l[-1]-l[0]>1:
    print("No")
else:
    a=l.count(l[0])
    b=l.count(l[-1])
    if a+1<=l[-1]<=a+b//2:
        print("Yes")
    else:
        print("No")
Buggy code:
n = int(input())
cats = list(map(int,input().split()))
flag = True
p, q = max(cats), min(cats)
x = cats.count(p)
y = cats.count(q)
if p > q + 1:
    flag = False
elif p == q:
    if n - p > 1 and p * 2 > n:
        flag = False
else:
    if x >= p or (p-x) * 2 > y:
        flag = False

if flag:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
cats = list(map(int,input().split()))
flag = True
p, q = max(cats), min(cats)
x = cats.count(p)
y = cats.count(q)
if p - q >= 2:
    flag = False
elif p == q:
    if p != n - 1 and p * 2 > n:
        flag = False
else:
    if y >= p or (p-y) * 2 > x:
        flag = False

if flag:
    print("Yes")
else:
    print("No")
Buggy code:
from collections import Counter


def solve(n, cnt):
    if len(cnt) == 1:
        a = next(iter(cnt))
        return (a == n - 1) or (1 <= a <= n // 2)
    a1, a2 = min(cnt), max(cnt)
    if a2 - a1 > 1:
        return False
    c1, c2 = cnt[a1], cnt[a2]
    return c1 + (c2 + 1) // 2 <= a2


n = int(input())
cnt = Counter(map(int, input().split()))

print('Yes' if solve(n, cnt) else 'No')


Fixed code:
from collections import Counter


def solve(n, cnt):
    if len(cnt) == 1:
        a = next(iter(cnt))
        return (a == n - 1) or (1 <= a <= n // 2)
    a1, a2 = min(cnt), max(cnt)
    if a2 - a1 > 1:
        return False
    c1, c2 = cnt[a1], cnt[a2]
    return c1 < a2 and a2 - c1 <= c2 // 2


n = int(input())
cnt = Counter(map(int, input().split()))

print('Yes' if solve(n, cnt) else 'No')
Buggy code:
import sys
if __name__ == "__main__":
    N = int(input())
    evidences = list(map(int, input().split()))
    evidences = list(sorted(evidences))
    unique_evidence = set(evidences)
    if (evidences[-1] - evidences[0] > 1):
        print ("No")
        sys.exit()
    if (len(unique_evidence) == 1):
        group = evidences[0];
        # all unique
        if (group == N - 1):
            print ("Yes")
            sys.exit()
        if (N - 2 * group < 0):
            print ("No")
            sys.exit()
        print ("Yes")
        sys.exit()
    # evidences[-1] - evidences[0] > 1
    min_val = min(evidences)
    max_val = max(evidences)

    min_val_cnt = 0
    max_val_cnt = 0
    for val in evidences:
        if (val == min_val):
            min_val_cnt += 1
        else:
            max_val_cnt += 1
    # violate not unique
    if (max_val_cnt <= 1):
        print ("No")
        sys.exit()
    #rest cat
    rest = N
    rest -= min_val_cnt

    min_group = min_val_cnt + 1
    max_group = min_val_cnt + (max_val_cnt // 2)
    if min_group <= evidences[-1] and evidences <= max_group:
        print ("Yes")
        sys.exit()
    print ("No")


Fixed code:
import sys
if __name__ == "__main__":
    N = int(input())
    evidences = list(map(int, input().split()))
    evidences = list(sorted(evidences))
    unique_evidence = set(evidences)
    if (evidences[-1] - evidences[0] > 1):
        print ("No")
        sys.exit()
    if (len(unique_evidence) == 1):
        group = evidences[0];
        # all unique
        if (group == N - 1):
            print ("Yes")
            sys.exit()
        if (N - 2 * group < 0):
            print ("No")
            sys.exit()
        print ("Yes")
        sys.exit()
    # evidences[-1] - evidences[0] > 1
    min_val = min(evidences)
    max_val = max(evidences)

    min_val_cnt = 0
    max_val_cnt = 0
    for val in evidences:
        if (val == min_val):
            min_val_cnt += 1
        else:
            max_val_cnt += 1
    # violate not unique
    if (max_val_cnt <= 1):
        print ("No")
        sys.exit()
    #rest cat
    rest = N
    rest -= min_val_cnt

    min_group = min_val_cnt + 1
    max_group = min_val_cnt + (max_val_cnt // 2)
    if min_group <= evidences[-1] and evidences[-1] <= max_group:
        print ("Yes")
        sys.exit()
    print ("No")
Buggy code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = LI()
    d = collections.defaultdict(int)
    for c in a:
        d[c] += 1
    t = sorted(list(d.keys()))
    if t[-1] - t[0] > 1:
        return 'No'
    if len(t) == 1:
        if t[0] > n / 2.0:
            return 'No'
        return 'Yes'
    b = t[1] - d[t[0]]
    n2 = d[t[1]]
    if n2 == 2 and b == n2 -1:
        return 'Yes'
    if b < 1:
        return 'No'
    if b >= n2 - 2:
        return 'No'

    return 'Yes'


print(main())


Fixed code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = LI()
    d = collections.defaultdict(int)
    for c in a:
        d[c] += 1
    t = sorted(list(d.keys()))
    if t[-1] - t[0] > 1:
        return 'No'
    if len(t) == 1:
        if t[0] == n - 1:
            return 'Yes'
        if t[0] > n / 2.0:
            return 'No'
        return 'Yes'
    b = t[1] - d[t[0]]
    n2 = d[t[1]]
    if n2 == 2 and b == n2 - 1:
        return 'Yes'
    if b < 1:
        return 'No'
    if b >= n2 - 2:
        return 'No'
    if b > n2 / 2.0:
        return 'No'

    return 'Yes'


print(main())
Buggy code:
length = int(input())
target = [int(n) for n in input().split(" ")]
if max(target) - min(target) > 1:
    print("No")
elif max(target) >= length:
    print("No")
elif max(target) - min(target) == 1 and (target.count(min(target)) == min(target) and target.count(max(target)) > 1 or (target.count(min(target)) <= min(target) and target.count(max(target)) // 2 <= min(target) )  ):
    print("Yes")
elif max(target) - min(target) == 0 and ( (length % 2 == 0 and min(target) * 2 <= length) or (length % 2 == 1 and 2 * (min(target) - 1) + 3 <= length)  or min(target) + 1 == length):
    print("Yes")
else:
    print("No")

Fixed code:
length = int(input())
target = [int(n) for n in input().split(" ")]
if max(target) - min(target) > 1:
    print("No")
elif max(target) >= length:
    print("No")
elif max(target) - min(target) == 1 and (target.count(min(target)) == min(target) and target.count(max(target)) > 1 or (target.count(min(target)) <= min(target) and target.count(max(target)) // 2 >= max(target) - target.count(min(target)) )  ):
    print("Yes")
elif max(target) - min(target) == 0 and ( (length % 2 == 0 and min(target) * 2 <= length) or (length % 2 == 1 and 2 * (min(target) - 1) + 3 <= length)  or min(target) + 1 == length):
    print("Yes")
else:
    print("No")
Buggy code:
import sys
from collections import Counter

sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


yes, no = 'Yes', 'No'


def solve(n, a):
    s = set(a)
    c = Counter(a)
    if len(s) == 1:
        a = list(s)[0]
        n_colors = a + 1
        if n_colors == n:
            return yes
        n_colors = a
        if 2 * n_colors <= n:
            return yes
    if len(s) == 2:
        a, b = sorted(s)
        if a + 1 == b:
            n_colors = b
            appear_once = c[a]
            appear_twice_or_more = n_colors - appear_once
            if appear_once < n_colors:
                if c[b] >= 2 * appear_twice_or_more:
                    return yes
    return no

n = read_int()
a = read_int_list()
res = solve(n, a)
print(res)



Fixed code:
import sys
from collections import Counter

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


yes, no = 'Yes', 'No'


def solve(n, a):
    s = set(a)
    c = Counter(a)
    if len(s) == 1:
        a = list(s)[0]
        n_colors = a + 1
        if n_colors == n:
            return yes
        n_colors = a
        if 2 * n_colors <= n:
            return yes
    if len(s) == 2:
        a, b = sorted(s)
        if a + 1 == b:
            n_colors = b
            appear_once = c[a]
            appear_twice_or_more = n_colors - appear_once
            if appear_once < n_colors:
                if c[b] >= 2 * appear_twice_or_more:
                    return yes
    return no

n = read_int()
a = read_int_list()
res = solve(n, a)
print(res)
Buggy code:
n = int(input())
array = [int(x) for x in input().split(' ')]
maxa = max(array)
mina = min(array)
if maxa - mina > 1:
    print('No')
elif maxa == mina:
    if n/2 >= maxa:
        print('Yes')
    else:
        print('No')
else:
    sum = 0
    for j in array:
        if j == mina:
            sum += 1
    if sum >= maxa:
        print('No')
        exit()
    if 2*(maxa - sum) <= n - sum:
        print('Yes')
    else:
        print('No')


Fixed code:
n = int(input())
array = [int(x) for x in input().split(' ')]
maxa = max(array)
mina = min(array)
if maxa - mina > 1:
    print('No')
elif maxa == mina:
    if n >= 2 * maxa:
        print('Yes')
    elif maxa == n-1:
        print('Yes')
    else:
        print('No')
else:
    sum = 0
    for j in array:
        if j == mina:
            sum += 1
    if sum >= maxa:
        print('No')
        exit()
    if 2*(maxa - sum) <= n - sum:
        print('Yes')
    else:
        print('No')
Buggy code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

res = 0

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

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

res = 0

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

print(res)
Buggy 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):
      if 500*i + 100*B + 50*C == X:
        res += 1

print(res)
  

Fixed code:
A = int(input()) + 1
B = int(input()) + 1
C = int(input()) + 1
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)
Buggy code:

def coins():
    fivehund = int(input())
    onehund = int(input())
    fifty = int(input())
    target = int(input())
    result_count = 0

    for count500 in range(0,fivehund):
        for count100 in range(0,onehund):
            for count50 in range(0,fifty):
                 current = 500*count500 + 100*count100 + 50*count50
                 if target == current:
                     result_count += 1
    
    print(result_count)

if __name__ == '__main__':
    coins()

Fixed code:

def coins():
    fivehund = int(input())
    onehund = int(input())
    fifty = int(input())
    target = int(input())
    result_count = 0

    for count500 in range(0,fivehund+1):
        for count100 in range(0,onehund+1):
            for count50 in range(0,fifty+1):
                 current = 500*count500 + 100*count100 + 50*count50
                 if target == current:
                     result_count += 1
    
    print(result_count)

if __name__ == '__main__':
    coins()
Buggy code:
l = [int(input()) for _ in range(4)]
ans = 0
for i in range(l[0]):
  for j in range(l[1]):
    for k in range(l[2]):
      if 500 * i + 100 * j + 50 * k == l[3]:
        ans += 1
print(ans)

Fixed code:
l = [int(input()) for _ in range(4)]
ans = 0
for i in range(l[0] + 1):
  for j in range(l[1] + 1):
    for k in range(l[2] + 1):
      if 500 * i + 100 * j + 50 * k == l[3]:
        ans += 1
print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
answer_values = []

for c_value in range(c):
    for b_value in range(b):
        for a_value in range(a):
            answer_values.append(c_value * 500 + b_value * 100 + a_value * 50)

print(answer_values.count(x))


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

for a_value in range(a + 1):
    for b_value in range(b+1):
        for c_value in range(c+1):
            answer_values.append(a_value * 500 + b_value * 100 + c_value * 50)

print(answer_values.count(x))
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0

for aa in range(0, a+1):
  for bb in range(0, b+1):
    for cc in range(0, c+1):
      if aa**500+bb*100+cc*50 == x:
        counter += 1
print(counter)

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

counter = 0

for aa in range(0, a+1):
  for bb in range(0, b+1):
    for cc in range(0, c+1):
      if aa*500+bb*100+cc*50 == x:
        counter += 1
print(counter)
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 x == i*500 + j*100 + k*50:
                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 x == 500 * i + 100 * j + 50 * k:
                ans += 1
print(ans)
Buggy code:
a,b,c,x=map(int,[input() for i in range(4)])

ans=0
for p in range(a+1): 
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r=x:
                ans=ans+1
print(ans)


Fixed code:
a,b,c,x=map(int,[input() for i in range(4)])

ans=0
for p in range(a+1): 
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                ans=ans+1
print(ans)
Buggy code:
A,B,C,X= [int(input()) for x in range(4)] 
ans = 0
for a in range(1<<A):
	for b in range(1<<B):
		for c in range(1<<C):
			if 500*a+100*b+50*c == X:
				ans += 1
print(ans)

Fixed code:
A,B,C,X= [int(input()) for x in range(4)] 
ans = 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:
				ans += 1
print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(0, a):
    for j in range(0,b):
        for k in range(0,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())
way=0
for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      if(i*500+j*100+k*50==x):
        way+=1
print(way)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(1,a+1):
  for j in range(1,b+1):
    for k in range(1,c+1):
      if i*500+j*100+k*50==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 i*500+j*100+k*50==x:
        ans+=1

print(ans)
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 i*500+j*100+k*50==X:
        ans+=1
print(ans)        
      

Fixed 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 i*500+j*100+k*50==X:
        ans+=1
print(ans)
Buggy code:
A,B,C,X = map(int,open(0).read().split())
a = 0
for i in range(1,A+1):
    for l in range(1,B+1):
        for q in range(1,C+1):
            if 500*i+100*B+50*C == X:
                a += 1
print(a)

Fixed code:
A,B,C,X = map(int,open(0).read().split())
a = 0
for i in range(A+1):
    for l in range(B+1):
        for q in range(C+1):
            if 500*i+100*l+50*q == X:
                a += 1
print(a)
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*i)+(100*j)+(50*k))==0:
                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())
count = 0
ans = []
ans.append(min(X//500,A))
ans.append(min(X//100,B))
ans.append(min(X//50,C))
for i in range(ans[0]):
    for j in range(ans[1]):
        for k in range(ans[2]):
            p = i * 500 + j * 100 + k * 50
            if p == X:
                count += 1
print(count)

Fixed code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
ans = []
ans.append(min(X//500,A))
ans.append(min(X//100,B))
ans.append(min(X//50,C))
for i in range(ans[0]+1):
    for j in range(ans[1]+1):
        for k in range(ans[2]+1):
            p = i * 500 + j * 100 + k * 50
            if p == 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*i)+(100*j)+(50*k))==0:
                count+=1

print(count)

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

re =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:
                re += 1
                
print(re)
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):
            total = 500 * a + 100 * b + 50 * c
            if total == x:
                count = count + 1
print(count)



Fixed 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 i*500+j*100+k*50==x:
        ans += 1
print(ans)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
x = int(input()) 
ans = 0
        
for ia in range(a):
    for ib in range(b):
        for ic in range(c):
            num = 500*ia+100*ib+50*ic
            if num==x:
                ans+=1

print(ans)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
x = int(input()) 
ans = 0
        
for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            num = 500*ia+100*ib+50*ic
            if num==x:
                ans+=1

print(ans)
Buggy code:
a500 = int(input())
b100 = int(input())
c50 = int(input())
_x = int(input())
answer = 0
for c in range(c50+1):
    for b in range( b100+1):
        for a in range(a500+1):
            print (a,b,c)
            if a*500 + b*100 + c*50 == _x:
                answer += 1
print (answer)


Fixed code:
a500 = int(input())
b100 = int(input())
c50 = int(input())
_x = int(input())
answer = 0
for c in range(c50+1):
    for b in range( b100+1):
        for a in range(a500+1):
            #print (a,b,c)
            if a*500 + b*100 + c*50 == _x:
                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 X == 500 * i + 100 * j + 50 * k:
        ans += 1

print(ans)        

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())
count = 0
for i in range(1,a+1):
    x = 500 * i
    for j in range(1,b+1):
        y = 100 * j
        for k in range(1,c+1):
            z = 50 * k
            if x+y+z == 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):
    x = 500 * i
    for j in range(b+1):
        y = 100 * j
        for k in range(c+1):
            z = 50 * k
            if x+y+z == X :
                count += 1
print(count)