Problem:
 Score : 200 points    Problem Statement You have A  500 -yen coins, B  100 -yen coins and C  50 -yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.      Constraints  0 \leq A, B, C \leq 50  A + B + C \geq 1  50 \leq X \leq 20  000  A , B and C are integers.  X is a multiple of 50 .         Input Input is given from Standard Input in the following format:  A  B  C  X       Output Print the number of ways to select coins.        Sample Input 1 2
2
2
100      Sample Output 1 2  There are two ways to satisfy the condition:   Select zero 500 -yen coins, one 100 -yen coin and zero 50 -yen coins.  Select zero 500 -yen coins, zero 100 -yen coins and two 50 -yen coins.        Sample Input 2 5
1
0
150      Sample Output 2 0  Note that the total must be exactly X yen.       Sample Input 3 30
40
50
6000      Sample Output 3 213

Solution (Python):
s = [int(input()) for i in range(4)]
x=0
a=0
b=0
c=0
for i in range(s[0]+1):
    for i in range(s[1]+1):
        for i in range(s[2]+1):
            if 500*a+100*b+50*c == s[3]:
                x=x+1
            c=c+1
        b=b+1
        c=0
    a=a+1
    b=0
    c=0
print(x)

Solution (Python):

import collections
import sys


def fast_input():
    return sys.stdin.readline()[:-1]


def solve(c_500: int, c_100: int, c_50: int, amount: int) -> int:
    amount_list = []
    for i_500 in range(c_500 + 1):
        for i_100 in range(c_100 + 1):
            for i_50 in range(c_50 + 1):
                amount_list.append(i_500 * 500 + i_100 * 100 + i_50 * 50)

    return amount_list.count(amount)


def main():
    c_500 = int(fast_input())
    c_100 = int(fast_input())
    c_50 = int(fast_input())
    amount = int(fast_input())
    result = solve(c_500, c_100, c_50, amount)
    print(result)


main()

Solution (Python):

import sys


def fast_input():
    return sys.stdin.readline()[:-1]


def solve(c_500: int, c_100: int, c_50: int, amount: int) -> int:
    combination_count = 0
    for i_500 in range(c_500 + 1):
        for i_100 in range(c_100 + 1):
            for i_50 in range(c_50 + 1):
                total_amount = i_500 * 500 + i_100 * 100 + i_50 * 50
                if total_amount == amount:
                    combination_count += 1
    return combination_count


def main():
    c_500 = int(fast_input())
    c_100 = int(fast_input())
    c_50 = int(fast_input())
    amount = int(fast_input())
    result = solve(c_500, c_100, c_50, amount)
    print(result)


main()

Solution (Python):
from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
y = 0

for p in range(a+1):
   if 500*p > x:
      break
   for q in range(b+1):
      if 500*p + 100*q > x:
         break
      for r in range(c+1):
         if 500*p + 100*q + 50*r > x:
            break
         if 500*p + 100*q + 50*r == x:
            y += 1

print(y)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 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:
                counts += 1

print(counts)

Solution (Python):


a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0
s = 0

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

print(counter)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

if A > 40:
	Amax = 40
else:
	Amax = A

ans = 0
for i in range(Amax+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)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=[]
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            s.append(500*i+100*j+50*k)
print(s.count(x))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

answer = 0
for coin1 in range(a+1):
    for coin2 in range(b+1):
        for coin3 in range(c+1):
            if x == 500 * coin1 + 100 * coin2 + 50 * coin3:
                answer += 1

print(answer)

Solution (Python):
a, b, c, x = map(int, open(0))
cnt = 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:
        cnt += 1
print(cnt)

Solution (Python):

A, B, C, X = [int(input()) for _ in range(4)]
cnt = 0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a+100*b+50*c == X:
                cnt += 1
print(cnt)

Solution (Python):
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)

Solution (Python):
[a,b,c,d]=[int(input()) for i in range(1,4+1)]
a1 = d // 500
b1 = d// 100
c1 = d// 50
coun = 0
for i in range(0,min([a+1,a1+1])):
    a = 500*i
    if a == d:
        coun = coun +1
        break
    for j in range(0,min([b+1,b1+1-5*i])):
        s = a + 100*j
        if s == d :
            coun = coun +1
            break
        for k in range(0,min([c+1,c1+1-10*i-2*j])):
            v = s + 50*k
            if v == d :
                coun = coun+1
                break
print(coun)

Solution (Python):
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)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 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:
                cnt += 1 
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())//50

ans = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 10*a + 2*b + c == X:
        ans += 1
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

s = 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:
                s += 1
    
print(s)

Solution (Python):
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)

Solution (Python):
a,b,c,x = [int(input()) for _ in range(4)]
cnt = 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:
                cnt += 1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 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:
                cnt += 1

print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i in range(a + 1):
    for j in range(b + 1):
        cc = x - i * 500 - j * 100

        if cc % 50 == 0 and 0 <= cc // 50 <= c:
            cnt += 1

print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count=0
tot = 0
for i in range(A+1):
  for j in range(B+1):
    tot = i*500 + j*100
    
    if (X-tot)%50==0 and C>=(X-tot)//50>=0:
      count+=1
      
print(count)

Solution (Python):
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)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())


def binary_search(x, c_nums):
    l = 0
    r = c
    while l + 1 != r and c != 0:
        m = (l + r) // 2
        if c_nums[m] == x:
            return 1
        elif c_nums[m] < x:
            l = m
        elif c_nums[m] > x:
            r = m
        m = (l + r) // 2
    if x == c_nums[l] or x == c_nums[r]:
        return 1
    else:
        return 0


c_nums = [50 * i for i in range(c + 1)]
res = 0
for i in range(a + 1):
    for j in range(b + 1):
        tmp = x - 500 * i - 100 * j
        res += binary_search(tmp, c_nums)

print(res)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

c_nums = set(50 * i for i in range(c + 1))
res = 0
for i in range(a + 1):
    for j in range(b + 1):
        tmp = x - 500 * i - 100 * j
        if tmp in c_nums:
            res += 1

print(res)

Solution (Python):
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 * j + 50 * k == x:
                res += 1

print(res)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=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:
        cnt+=1

print(cnt)

Solution (Python):
A, B, C, X = int(input()), int(input()), int(input()), int(input())
ans = 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 == X:
                ans += 1
print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

print(sum(500*a+100*b+50*c==X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cn = 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:
                cn = cn + 1

print(cn)

Solution (Python):
a,b,c,x = map(int,open(0).read().split())

ans = 0 
counta = 0

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

Solution (Python):
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)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())


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

print(ans)

Solution (Python):


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)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 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:
                count += 1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
answer = 0
for i in range(min(A, X // 500) + 1):
    for j in range(min(B, (X - i * 500) // 100) + 1):
        if X - 500 * i - 100 * j <= 50 * C:
            answer += 1
print(answer)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
result = 0
for a in range(0, A + 1):
    for b in range(0, B + 1):
        for c in range(0, C + 1):
            if 500 * a + 100 * b + 50 * c == X:
                result += 1
print(result)

Solution (Python):
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 X == 500 * a + 100 * b + 50 * c:
                cnt += 1
print(cnt)

Solution (Python):
a, b, c, x = map(int, open(0).read().split())
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)

Solution (Python):
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):
            tmp=i*500+j*100+k*50
            if tmp==x:
                res+=1
print(res)

Solution (Python):
a = int(input())  
b = int(input())  
c = int(input())  
x = int(input())  

counter = 0
for use_a in range(a + 1):
    if 500 * use_a > x:
        continue
    rest = x - 500 * use_a
    for use_b in range(b + 1):
        if 100 * use_b > rest:
            continue
        rest_c = rest - 100 * use_b
        for use_c in range(c + 1):
            if 50 * use_c != rest_c:
                continue
            counter += 1

print(counter)

Solution (Python):
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):
            tmp = 500*i+100*j+50*k
            if tmp==x:
                ans+=1

print(ans)

Solution (Python):
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)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, X: int):
    ans = 0
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                ans += (a * 500 + b * 100 + c * 50) == X
    return ans



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    print(solve(A, B, C, X))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):



def main():
    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)


if __name__ == "__main__":
    main()

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
c=0
for i in range(0,A+1):
  Y=X-i*500
  for j in range(0,B+1):
    Y=Y-j*100
    for l in range(0,C+1):
      Y=Y-l*50
      if Y == 0:
        c += 1
        Y=Y+l*50
      else :
        Y = Y + l*50
    else :
      Y = Y+j*100
print(c)

Solution (Python):
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)

Solution (Python):
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+50*k==x:
                count+=1
print(count)

Solution (Python):


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):
      t = i * 500 + j * 100 + k * 50
      if x == t:
        count = count + 1

print(count)

Solution (Python):
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)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

total=0
cnt=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:
                cnt+=1

print(cnt)

Solution (Python):
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)

Solution (Python):
num_500 = int(input())
num_100 = int(input())
num_50 = int(input())
ans = int(input())

resultCnt = 0

for i in range(num_500+1):
  for j in range(num_100+1):
    for k in range(num_50+1):
      if 500*i + 100*j + 50*k == ans:
        resultCnt += 1

print(resultCnt)

Solution (Python):
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):
      num_500=500*i
      num_100=100*j
      num_50=50*k
      if num_500+num_100+num_50==x:
        ans+=1
        
print(ans)

Solution (Python):
A, B, C, X = [int(input()) for i 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)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0

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

Solution (Python):
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 += 1
print(cnt)

Solution (Python):
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)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0

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

print(count)

Solution (Python):

A = int(input())
B = int(input())
C = int(input())
X = int(input())
n = 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):
                n += 1
print(n)

Solution (Python):
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)

Solution (Python):
a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
    cnt=0
    n=0
    for h in range(r+1):
        for l in range(t+1):
            for o in range(y+1):
                if 500*h+100*l+50*o==u:
                    cnt+=1
    return cnt
print(countcourse(a,b,c,x))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
c = 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:
        c += 1
      else:
        continue
print(c)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

pattern=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:
                pattern += 1
print(pattern)

Solution (Python):
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):
      A=500*i+100*j+50*k
      if A==X:
        count+=1
print(count)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
print(
    sum(
        [
            X == 500 * a + 100 * b + 50 * c
            for a in range(A + 1)
            for b in range(B + 1)
            for c in range(C + 1)
        ]
    )
)

Solution (Python):
x=int(input())
c=0
y,z,d=int(input()),int(input()),int(input())
for i in range(x+1):
    for j in range(y+1):
        for k in range(z+1):
            f=500*i+100*j+50*k
            if(f==d):
                c+=1
print(c)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

print(cnt)

Solution (Python):
ct = 0
A = int(input()) 
B = int(input()) 
C = int(input()) 
X = int(input())
for i in range(A,-1,-1):
    for j in range(B,-1,-1):
        for k in range(C,-1,-1):
            if (500*i) + (100*j) + (50*k) == X:
                ct += 1

print(ct)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
y = x
x_500 = x // 500

for i in range(int(min([x_500+1, a+1]))):
    x = y - i*500
    x_100 = x // 100
    for j in range(int(min([x_100+1, b+1]))):
        x_50 = x // 50
        if x_50 <= c:
            cnt += 1
            x = x - 100
        else:
            x = x - 100
print(cnt)

Solution (Python):
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)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = 0
if 500*a <= x:
    for i in range(a+1):
        for h in range(b+1):
            for j in range(c+1):
                if 500*i+100*h+50*j == x:
                    num += 1
else:
    for i in range((x//500)+1):
        for h in range(b+1):
            for j in range(c+1):
                if 500*i+100*h+50*j == x:
                    num += 1
print(num)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for ai in range(a+1):
  for bi in range(b+1):
    for ci in range(c+1):
      y=500*ai+100*bi+50*ci
      if x == y:
        ans+=1
      if y>x:
        break
print(ans)

Solution (Python):
c = [0] * 3
for i in range(3):
    c[i] = int(input())
x = int(input())
cnt = 0
for i in range(c[0] + 1):
    for j in range(c[1] + 1):
        req = x - (i * 500 + j * 100)
        if req >= 0 and req % 50 == 0 and req // 50 <= c[2]:
            cnt += 1
print(cnt)

Solution (Python):
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500*a+100*b+50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Solution (Python):
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)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=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:
                a+=1
print(a)

Solution (Python):
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)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for a in range(min([A,-(-X//500)])+1):
    _a = a*500
    for b in range(min([B,-(-X//100)])+1):
        _b = b*100 + _a
        if _b > X: break
        for c in range(min([C,-(-X//50)])+1):
            _c = c*50 + _b
            if _c > X: break
            if _c == X:
                cnt+=1
print(cnt)

Solution (Python):
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 (a*500 + b*100 + c*50) == X:
                cnt+=1
print(cnt)

Solution (Python):
A,B,C,X = [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 500*i + 100*j + 50*k ==X:
                ans+=1
print(ans)

Solution (Python):
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)

Solution (Python):
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) :
            if 500*a + 100 * b + 50 * c == X :
                ans += 1

print(ans)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]

ans = 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:
                ans += 1
else:
    print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 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:
                cnt += 1
print(cnt)

Solution (Python):
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)

Solution (Python):
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):
      sum = 500*i + 100*j + 50*k
      if X==sum:
        count+=1

print(str(count))

Solution (Python):
a = int(input())
b= int(input())
c = int(input())
x = int(input())

pattern = 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==0:
                pattern+=1

print(pattern)

Solution (Python):
A, B, C, X = [int(input()) for _ 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 = ans + 1
                
print(ans)

Solution (Python):
def resolve():
    '''
    code here
    '''
    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*j + 50*k == X:
                    res += 1
    print(res)

if __name__ == "__main__":
    resolve()

Solution (Python):
a,b,c,x = int(input()),int(input()),int(input()),int(input())
ans = 0
for i in range(min(a+1,41)):
    for j in range(min(b+1,201)):
        k = x-500*i-100*j
        if k >= 0 and k%50 == 0 and k//50 <= c:
            ans += 1
print(ans)

Solution (Python):
I=input
A,B,C,X,s=int(I()),int(I()),int(I()),int(I()),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:s+=1
print(s)

Solution (Python):
I=input
A,B,C,X,s=int(I()),int(I()),int(I()),int(I()),0
for i in range(A+1):
    for j in range(int(B)+1):
        for k in range(int(C)+1):
            if 500*i+100*j+50*k==int(X):s+=1
print(s)

Solution (Python):
def resolve():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    count = 0
    n = 0
    for i in range(a+1):
        ni = 500*i
        if ni > x:
            continue
        for j in range(b+1):
            nj = ni + 100*j
            if nj > x:
                continue
            for k in range(c+1):
                nk = nj + 50*k
                if nk != x:
                    continue
                elif nk == x:
                    count += 1
    print(count)
resolve()

Solution (Python):
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):
      total = 500 * i + 100 * j + 50 * k
      if total == X:
        answer += 1
print(str(answer))

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

Solution (Python):
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):
            cost = 500 * a + 100 * b + 50 * c
            if cost == X:
                ans += 1
print(ans)

Solution (Python):
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 (a*500+b*100+c*50) == X:
                cnt += 1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

pat_list = []
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
      pat_list.append(price)
print(pat_list.count(X))

Solution (Python):
import itertools
import pprint

a = int(input())
b = int(input())
c = int(input())
x = int(input())

a_list = [i for i in range(a + 1)]
b_list = [i for i in range(b + 1)]
c_list = [i for i in range(c + 1)]

ans = 0
for a_num, b_num, c_num in itertools.product(a_list, b_list, c_list):
    
    if x == 500 * a_num + 100 * b_num + 50 * c_num:
        ans += 1
print(ans)

Solution (Python):
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)