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



Sample input:
2
2
2
100


Sample output:
2

Submission status: Accepted

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

Submission status: Accepted

Solution 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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

l = []
for i in range(0, A + 1):
    for j in range(0, B + 1):
        for k in range(0, C + 1):
            l.append([i, j, k])

ans = 0
for i in range(len(l)):
    if 500 * l[i][0] + 100 * l[i][1] + 50 * l[i][2] == X:
        ans += 1

print(ans)

Submission status: Accepted

Solution 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
            else:
                continue

print(count)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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):
            s = 500 * a + 100 * b + 50 * c
            ans += X == s
print(ans)

Submission status: Accepted

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

count = 0
for Ai in range(A+1):
  for Bi in range(B+1):
    for Ci in range(C+1):
      price = Ai*500 + Bi*100 + Ci*50
      if price == X:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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 == 500 * i + 100 * j + 50 * k:
                answer += 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C, X = [int(input()) for i in range(4)]
count = 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:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def tyoudo(a,b,c,x):
  ans=0
  for i in range(a+1):
    for ii in range(b+1):
      for iii in range(c+1):
        if x==500*i+100*ii+50*iii:
          ans+=1
  return ans
a=int(input())
b=int(input())
c=int(input())
x=int(input())
print(tyoudo(a,b,c,x))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = []
for a_ in range(a+1):
    for b_ in range(b+1):
        for c_ in range(c+1):
            cal = a_ * 500 + b_ * 100 + c_ * 50
            num.append(cal)
print(num.count(x))

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
A=x//500
B=x//100
for i in range(min(a+1,A+1)):
    rest=x-500*i
    for j in range(min(b+1,B+1)):
        rest1=rest-100*j
        if rest1/50<=c and rest1>=0:
            count+=1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def check_combination(a, b, c, x):
    ans = 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:
                    ans += 1
    return ans


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

print(check_combination(a, b, c, x))

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
max_500 = min([A,X//500])
res = 0
for i in range(max_500+1):
    X_temp = X - (500*i)
    for j in range(min([B,X_temp//100])+1):
        if (X_temp - (100*j))//50 <= C:
            res += 1


print(res)

Submission status: Accepted

Solution code:
import sys
def p(s):
  sys.stderr.write(str(s)+"\n")

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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x = int(input())
count = 0
for a in range(a_500+1):
    for b in range(b_100+1):
        c_num = int((x-a*500-b*100)/50)
        if c_num in range(c_50+1):
            count += 1
print(count)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    a,b = LI()
    if not (a*b)%2:
        print("Even")
    else:
        print("Odd")
    return

#B
def B():
    s = S()
    print(s.count("1"))
    return

#C
def C():
    n = I()
    a = LI()
    f = 0
    for j in range(100000):
        for i in range(n):
            if a[i]%2:
                f = 1
                break
            a[i] //= 2
        if f:break
    print(j)
    return

#D
def D():
    a,b,c,x = IR(4)
    su = 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:su += 1
    print(su)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()

Submission status: Accepted

Solution code:
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x = int(input())
count = 0
for a in range(a_500+1):
    for b in range(b_100+1):
        for c in range(c_50+1):
            if a*500+b*100+c*50 == x:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
li = [[i, j, k] 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]
print(len(li))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
A = int(input())+1
B = int(input())+1
C = int(input())+1
X = int(input())
Y = []
for i in range(A):
  for j in range(B):
    for k in range(C):
      Y.append(500 *i + 100 *j + 50 *k)
print(Y.count(X))

Submission status: Accepted

Solution code:
#87
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    if 500*i<=x:
        for j in range(b+1):
            if 500*i+100*j<=x:
                for k in range(c+1):
                    if(500*i+100*j+50*k==x):
                        count += 1
                    
print(count)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for d in range(0,a+1):
    for e in range(0,b+1):
        for f in range(0,c+1):
            if ((500 * d) + (100 * e) + (50 * f)) == x:
                count += 1
print(count)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
count=0
for i in range(c+1):
    for j in range(b+1):
        for k in range(a+1):
            if i*50+j*100+k*500 == x:
                count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())

_500 = 500
_100 = 100
_50 = 50

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if X - (a*_500 + b*_100 + c*_50) == 0:
                count = count + 1

print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())

_500 = 500
_100 = 100
_50 = 50

count = 0

if A > 0:
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                if X - (a*_500 + b*_100 + c*_50) == 0:
                    count = count + 1
else:
    if B > 0:
        for b in range(B+1):
            for c in range(C+1):
                if X - (b*_100 + c*_50) == 0:
                    count = count + 1
    else:
        for c in range(C+1):
            if X - (c*_50) == 0:
                count = count + 1

print(count)

Submission status: Accepted

Solution code:
import itertools

A = int(input())
B = int(input())
C = int(input())
X = int(input())

available_prices = [500 * a + 100 * b + 50 * c for a, b, c in itertools.product(range(A+1), range(B+1), range(C+1))]
 
cnt = 0
for p in available_prices:
    if p == X:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
num_of_500yen = int(input())
num_of_100yen = int(input())
num_of_50yen = int(input())
total = int(input())
selection = 0

for n500 in range(num_of_500yen + 1):
    for n100 in range(num_of_100yen + 1):
        for n50 in range(num_of_50yen + 1):
            tmp_total = n500 * 500 + n100 * 100 + n50 * 50
            if tmp_total == total:
                selection += 1

print(selection)

Submission status: Accepted

Solution code:
a,b,c,x=int(input()),int(input()),int(input()),int(input())
def c500(n):
  global a
  if n%500==0 and n<=500*a:return 1
  return 0
def c100(n):
  global b;ans=0
  for i in range(min(n//100,b)+1):ans+=c500(n-100*i)
  return ans
def c50(n):
  global c;ans=0
  for i in range(min(n//50,c)+1):ans+=c100(n-50*i)
  return ans
print(c50(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

A = int(input())
B = int(input())
C = int(input())
X = int(input())


def solve(a, b, c):
    ans = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                temp = i * 500 + j * 100 + k * 50
                if temp == X:
                    ans += 1
    return ans


def main():
    ans = solve(A, B, C)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(counter)

Submission status: Accepted

Solution code:
def iine():
    a, b, c, x = [int(input()) for _ in range(4)]
    print([500 * i + 100 * j + 50 * k for i in range(a+1)
           for j in range(b + 1) for k in range(c + 1)].count(x))


iine()

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a+100*b+c*50==X:
                count+=1
            else:
                continue
print(count)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    if 500*a > X:
        continue
    for b in range(B+1):
        if 100*b > X-500*a:
            break
        for c in range(C+1):
            if 50*c > X-500*a-100*b:
                break
            if 50*c == X-500*a-100*b:
                count+=1
print(count)

Submission status: Accepted

Solution code:
def solve(string):
    a, b, c, x = map(int, string.split())
    ans = 0
    for i in range(a + 1):
        for j in range(b + 1):
            if 0 <= x - 500 * i - 100 * j <= 50 * c:
                ans += 1
    return str(ans)


if __name__ == '__main__':
    n = 4
    print(solve('\n'.join([input() for _ in range(n)])))

Submission status: Accepted

Solution code:
def solve(string):
    a, b, c, x = map(int, string.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
    return str(ans)


if __name__ == '__main__':
    n = 4
    print(solve('\n'.join([input() for _ in range(n)])))

Submission status: Accepted

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

#面倒なので全探索。50ぐらい間に合う
count = 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:
                count += 1
print(count)

Submission status: Accepted

Solution code:
coins_500 = int(input())
coins_100 = int(input())
coins_50 = int(input())
X = int(input())

cnt = 0
for coin_500 in range(0, coins_500+1):
  for coin_100 in range(0, coins_100+1):
    for coin_50 in range(0, coins_50+1):
      if coin_500 * 500 + coin_100 * 100 + coin_50 * 50 == X:
        cnt +=1

print(cnt)

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
n = int(x/500)
if n>a:
    n = a
for i in range(n+1):
    y = x - 500*i
    m = int(y/100)
    if m>b:
        m = b
    for j in range(m+1):
        z = y - 100*j
        if z%50==0 and z/50<=c:
            count += 1
print(count)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
z=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==z:
        ans+=1

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

answer =0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      #print(a,b,c,(500*a + 100*b + 50*c ==X))
      answer += (500*a + 100*b + 50*c ==X)
print(answer)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution 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):
        if C*50 + b*100 >= ax and ax - b*100 >=0:
            l+=1
print(l)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
# coding: utf-8
a = int(input())
b = int(input())
c = int(input())
x = int(input())
X = 0
for i in range(a+1):
  temp1 = x-500*i
  if temp1 < 0:
    break
  for j in range(b+1):
    temp2 = temp1-100*j
    if temp2 < 0:
      break
    for k in range(c+1):
      temp3 = temp2-50*k
      if temp3 < 0:
        break
      if temp3 ==0:
        X += 1
  
print(X)

Submission status: Accepted

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

count = 0

for i in range(A + 1):
    for j in range(B + 1):
        remain = X - 500 * i - 100 * j
        if 0 <= remain:
            if remain <= 50 * C:
                count += 1
            else:
                continue
        else:
            break

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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
				break
print(ans)

Submission status: Accepted

Solution 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)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for i in range(0, a + 1):
  for ii in range(0, b + 1):
    for iii in range(0, c + 1):
      sum = 500 * i + 100 * ii + 50 * iii
      if sum == x:
        count += 1

print(count)

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
b=0
c=0
count = 0
while a*500<=X and a<=A:
    while a*500+b*100<=X and b<=B:
        while a*500+b*100+c * 50 <=X and c<=C:
            if a*500+b*100+c*50==X:
                #print(a,b,c)
                count+=1
                break
            else:
                #print(a,a,b,c)
                c+=1
        c=0
        b+=1
        #print(b,c)
    a+=1
    b=0
    c=0
    #print(a,b,c)
print(count)

Submission status: Accepted

Solution code:
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 = count+1
print("{}".format(count))

Submission status: Accepted

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

count = set()

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if 500*ia+100*ib+50*ic == x:
                count.add(str(ia)+str(ib)+str(ic))

print(len(count))

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution 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):
        C = (x - 500 * A - 100 * B) // 50
        if 0 <= C <= c:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:


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):
#            print((ai,bi,ci))
            ans += 1 if x == 500*ai + 100*bi + 50*ci else 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

cnt = 0

for i in range (A+1):
    for p in range(B+1):
        for q in range(C+1):
            if i*500 + p*100 + q*50 == X:
                cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
y500 = int(input())
y100 = int(input())
y50 = int(input())
cost = int(input())

answer = 0

for i in range (y500 + 1) :
  for p in range (y100 + 1) :
    for q in range (y50 + 1) :
      if i * 500 + p * 100 + q * 50 == cost :
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()

A, B, C, X = [int(input()) for i in range(4)]

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)

Submission status: Accepted

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

count = 0

task1 = (x // 500) if (x // 500) < a else a
for i in range(task1 + 1):
    new_x = x - 500 * i
    task2 = (new_x // 100) if (new_x // 100) < b else b
    for i in range(task2 + 1):
        y = new_x - 100 * i
        if y <= 50 * c:
            count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def coins(A: int, B: int, C: int, X: int) -> int:
    count = 0
    for a in range(A + 1):
        if X < 500 * a:
            break
        for b in range(B + 1):
            c = (X - 500 * a - 100 * b) // 50

            if c < 0:
                break

            if 0 <= c and c <= C and 500 * a + 100 * b + 50 * c == X:
                count += 1

    return count


if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = coins(A, B, C, X)
    print(ans)