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:
ct = 0
A = int(input()) ##500円
B = int(input()) ##100円
C = int(input()) ##50円
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)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

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)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 x == i*500 + j*100 + k*50 :
                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):
            cost = 500 * a + 100 * b + 50 * c
            if cost == 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())

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

Submission status: Accepted

Solution code:
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):
    # print(500 * a_num + 100 * b_num + 50 * c_num)
    if x == 500 * a_num + 100 * b_num + 50 * c_num:
        ans += 1
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())
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())

cnt = 0
a_min = min( x//500 ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( rem_a//100 ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0 :
            cnt+=1
            break
        if (rem_b % 50 == 0 and rem_b // 50 <= c ):
            cnt+=1
            continue
print(cnt)

Submission status: Accepted

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

cnt = 0
a_min = min( int(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( int(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            cnt+=1
            break
        c_min = min( int(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                cnt+=1
                break

print(cnt)

Submission status: Accepted

Solution code:
import sys

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

cnt = 0
a_min = min( int(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( int(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            cnt+=1
            break
        c_min = min( int(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                cnt+=1
                break

print(cnt)

Submission status: Accepted

Solution code:
import sys
import math
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
a_min = min( math.floor(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        counter+=1
        break
    b_min = min( math.floor(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            counter+=1
            break
        c_min = min( math.floor(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                counter+=1
                break
print(counter)

Submission status: Accepted

Solution code:
import sys
import math

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

counter = 0

a_min = min( math.floor(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    # print("500円玉 * {} のパターン".format(ai))
    # print("残り {}".format(rem_a))

    if rem_a == 0:
        counter+=1
        break

    b_min = min( math.floor(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        # print("----100円玉 * {} のパターン".format(bi))
        # print("    残り {}".format(rem_b))

        if rem_b == 0:
            counter+=1
            break

        c_min = min( math.floor(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            # print("--------50円玉 * {} のパターン".format(ci))
            # print("        残り {}".format(rem_c))

            if rem_c == 0:
                counter+=1
                break

print(counter)

Submission status: Accepted

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

sum=[]
count=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
            if s==X:
                count+=1
                sum.append([a,b,c])

print(count)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for an in range(a + 1):
  for bn in range(b + 1):
    for cn in range(c + 1):
      total = an * 500 + bn * 100 + cn * 50
      if total == x:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    a = int(input().rstrip())
    b = int(input().rstrip())
    c = int(input().rstrip())
    x = int(input().rstrip())

    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__":
    resolve()

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, B, C, X = [int(input()) for i in range(4)]

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

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:
coin = [500,100,50]
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i_500 in range(a+1):
    for i_100 in range(b+1):
        for i_50 in range(c+1):
            if x==i_500*500+i_100*100+i_50*50:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

from typing import Tuple
from typing import Optional
from typing import List
from enum import Enum, auto

Result = Tuple[int, int, int]


class Coin(Enum):
    COIN_500 = auto()
    COIN_100 = auto()
    COIN_50 = auto()


def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    tempResult = minResult(X)
    if tempResult is None:
        print(0)
        return

    allResultList = set(parseResult(tempResult, Coin.COIN_500))
    resultList = list(
        filter(lambda x: x[0] <= A and x[1] <= B and x[2] <= C, allResultList)
    )
    print(len(resultList))


def minResult(value: int) -> Optional[Result]:
    remain = value
    minA = value // 500
    remain -= 500 * minA
    minB = remain // 100
    remain -= 100 * minB
    minC = remain // 50
    remain -= 50 * minC

    if remain == 0:
        return minA, minB, minC
    else:
        return None


def newResult(result: Result, target: Coin) -> Result:
    a, b, c = result
    if target == Coin.COIN_500:
        return a - 1, b + 5, c
    elif target == Coin.COIN_100:
        return a, b - 1, c + 2
    elif target == Coin.COIN_50:
        return result


def parseResult(result: Result, target: Coin) -> List[Result]:
    a, b, c = result
    resultList: List[Result] = []

    if target == Coin.COIN_500:
        resultList = resultList + parseResult(result, Coin.COIN_100)
        resultList = resultList + parseResult(result, Coin.COIN_50)
        if a > 0:
            new = newResult(result, target)
            resultList = resultList + parseResult(new, Coin.COIN_500)
            resultList = resultList + parseResult(new, Coin.COIN_100)
            resultList = resultList + parseResult(new, Coin.COIN_50)
    elif target == Coin.COIN_100:
        resultList = resultList + parseResult(result, Coin.COIN_50)
        if b > 0:
            new = newResult(result, target)
            resultList = resultList + parseResult(new, Coin.COIN_100)
            resultList = resultList + parseResult(new, Coin.COIN_50)
    elif target == Coin.COIN_50:
        resultList.append(result)

    return resultList


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = [input() for i in range(4)]
coin500 = int(s[0]) 
coin100 = int(s[1])
coin50 = int(s[2])

list = []
for i in range(coin500 + 1):
  for j in range(coin100 + 1):
    for k in range(coin50 + 1):
      list.append(500 * i + 100 * j + 50 * k)

import collections
c = collections.Counter(list)
if c.get(int(s[3])) == None:
    print("0")
else:
    print(c.get(int(s[3])))

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

print(cnt)

Submission status: Accepted

Solution code:
abc = [int(input()) for i in range(3)]
x = int(input())

count = 0

for i in range(abc[0] + 1):
    for j in range(abc[1] +1):
        for k in range(abc[2] +1):
            if 500*i + 100*j + 50*k == x:
                count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution 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 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())
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())
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:
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):
        if a*500+b*100 <= X:
            if (X -a*500-b*100)%50 == 0 and (X -a*500-b*100)//50 <= 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 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)
#これでよかったの!?TLEすると思った

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:
import math
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

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

print(str(count))

Submission status: Accepted

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

count = 0

for i in range(A + 1):
    Y = X - i*500

    for j in range(B + 1):
        Z = Y - j*100
        if Z >= 0 and Z/50 <= C:
            count += 1
            # print(str(i) +" " +  str(j) + " " + str(Z))

print(str(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):
#     x = X - a*500
#     for b in range(B+1):
#         x -= b*100
#         for c in range(C+1):
#             x -= c*50
#             print(a,b,c,x)
#             if x == 0:
#                 ans += 1

# これはOK
# 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


# こう書くとfor文一回省ける

for a in range(A+1):
    if 500 * a > X:
        break
    for b in range(B+1):
        if 500 * a + 100 * b > X:
            break
        x = X - 500*a -100*b
        if x%50 == 0:
            if x//50 <= 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 a in range(A+1):
#     x = X - a*500
#     for b in range(B+1):
#         x -= b*100
#         for c in range(C+1):
#             x -= c*50
#             print(a,b,c,x)
#             if x == 0:
#                 ans += 1

# これはOK
# 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


# こう書くとfor文一回省ける

for a in range(A+1):
    for b in range(B+1):
        x = X - 500*a -100*b

        if x%50 == 0 and x >=0:
            if x//50 <= 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 a in range(A+1):
#     x = X - a*500
#     for b in range(B+1):
#         x -= b*100
#         for c in range(C+1):
#             x -= c*50
#             print(a,b,c,x)
#             if x == 0:
#                 ans += 1


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)

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

Submission status: Accepted

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

  
if __name__ == "__main__":
  	main()

Submission status: Accepted

Solution code:
import sys
A,B,C,X=map(int,sys.stdin)

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

print(ans)

Submission status: Accepted

Solution code:
import sys
A,B,C,X=map(int,sys.stdin)

ans=0
for i in range(min(A,X//500)+1):
    ta=X-i*500
    for j in range(min(B,ta//100)+1):
        tb=ta-j*100
        if C*50>=tb:
            ans+=1

print(ans)

Submission status: Accepted

Solution code:
#B - Coins
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 i in range(a + 1):
    # 500円玉の枚数を1枚ずつ増やす

    if x < (i * 500) :
        break

    for j in range(b + 1):
        # 100円玉の枚数を1枚ずつ増やす

        if x < ((i * 500) + (j * 100)):
            break

        for k in range(c + 1):
            # 50円玉の枚数を1枚ずつ増やす

            # print("500円玉 : {0} 枚".format(i))
            # print("100円玉 : {0} 枚".format(j))
            # print("50円玉  : {0} 枚".format(k))

            if x < (i * 500) + (j * 100) + (k * 50):
                break

            if (i * 500) + (j * 100) + (k * 50) == x :
                ans += 1
                # print('OK')

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

print(ans)

Submission status: Accepted

Solution code:
import sys
a,b,c,x=map(int,sys.stdin.read().split())
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:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a = ri()
b = ri()
c = ri()
x = ri()
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)

Submission status: Accepted

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

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

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:
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())
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 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(str(ans))

Submission status: Accepted

Solution code:
coin500, coin100, coin50, total = map(int, [int(input()) for i in range(4)])
count = 0;
for i in range(coin500 + 1):
  for j in range(coin100 + 1):
    for z in range(coin50 + 1):
      if 500 * i + 100 * j + 50 * z == total:
        count += 1
print(count)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

l = []
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            l.append([i,j,k])


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
x = 0
ans = 0
y = 0
a = [i for i in range((A + 1)* (B + 1) * (C + 1))]
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            x = 500 * i + 100 * j + 50 * k
            a[y] = x
            y += 1
ans = a.count(X)
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):
  A=500*i
  if A>x:
    break
  for j in range(b+1):
    B=100*j
    k = (x - A - B)/50
    if 0<=k<=c and k%1==0:
      ans+=1
print(ans)