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

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

ans = 0
for n_500 in range(A+1):
	for n_100 in range(B+1):
		tmp = X - 500*n_500 - 100*n_100
		n_50 = tmp//50
		if 0 <= n_50 <= C:
			ans += 1

print(ans)

Submission status: Accepted

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

five_x = 0
hundred_x = 0
fifty_x = 0

five = []
hundred = []
fifty = []
five.append(0)
hundred.append(0)
fifty.append(0)

for i in range(A):
    five_x += 500
    five.append(five_x)
for i in range(B):
    hundred_x += 100
    hundred.append(hundred_x)
for i in range(C):
    fifty_x += 50
    fifty.append(fifty_x)
    
money = []

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            money.append(five[i]+hundred[j]+fifty[k])

cnt = 0

for i in range(len(money)):
    if money[i] == X:
        cnt += 1

print(cnt)

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

N = X // 500
min1 = min(A, N)
i = k = 0

while(i <= min1):
    M = X - (500 * i)
    L = M // 100
    min2 = min(B, L)
    j = 0
    while(j <= min2):
        P = M - (100 * j)
        Q = P / 50
        if Q <= C:
            k += 1
        j += 1
    i += 1

print(k)

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
XS = str(X)
hantei = False
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())
XS = str(X)
hantei = False
count = 0

if XS[-2] == "5":
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(1, C + 1, 2):
                if (500*a)+(100*b)+(50*c) == X:
                    count += 1
else:
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(0, C + 1, 2):
                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):
  res = X - i * 500
  if res < 0:
    break
  for j in range(B+1):
    res =  X - i * 500 - j * 100
    if res < 0:
      break
    if res % 50 == 0 and res / 50 <= C:
      ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(n_selection)

Submission status: Accepted

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

m=0
for s in range(A+1):
    for t in range(B+1):
        for u in range(C+1):
            if 500*s+100*t+50*u==X:
                m +=1
print(m)

Submission status: Accepted

Solution code:
A,B,C,X = int(input()),int(input()),int(input()),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:
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
total = int(input())

ans = 0
for i_500 in range(coin500 + 1):
    for i_100 in range(coin100 + 1):
        for i_50 in range(coin50 + 1):
            if 500 * i_500 + 100 * i_100 + 50 * i_50 == total:
                ans += 1
print(ans)

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

Submission status: Accepted

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

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:
c=0;
I,J,K,x=[int(input())for _ in[0]*4]
for i in range(I+1):
    for j in range(J+1):
        for k in range(K+1):
            c+=i*500+j*100+k*50==x;
print(c);

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

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())  # 500 yen
B = int(input())  # 100 yen
C = int(input())  # 50 yen
X = int(input())

# Aが最大で何枚使用できるかを考える
max_A = int(X/500)
max_A = min(A, max_A)

# カウント
count = 0

# ループ
for num_A in range(max_A + 1):
    # print("No. A: {}".format(num_A))
    left_BC = X
    left_BC -= num_A * 500

    max_B = int(left_BC / 100)
    max_B = min(B, max_B)

    for num_B in range(max_B + 1):
        # print("No. B: {}".format(num_B))
        left_C = left_BC
        left_C -= num_B * 100

        if left_C % 50 == 0:
            if C >= int(left_C/50):
                count += 1

        # print("=====")

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 初見分からず
# 考え方：個数の組み合わせを総当たりで全パターン試せばよい！
a, b, c, x = map(int, [input() for val in range(4)])

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

print(n_pattern)

Submission status: Accepted

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

t = 0
for i in range(0,a+1):
    if x < 500*i:
        break
    for j in range(0,b+1):
        if x < 500*i + 100*j:
            break
        if x - 500*i - 100*j <= 50* c:
            t = t + 1
print(t)

Submission status: Accepted

Solution code:
a, b, c, x = map(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)

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
s=sum([1 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(s)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
res=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if x==500*p+100*q+50*r:
                res+=1
print(res)

Submission status: Accepted

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

same_count = 0
for a_i in range(a+1):
    for b_i in range(b+1):
        for c_i in range(c+1):
            if 500*a_i + 100*b_i + 50*c_i == x:
                same_count += 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
coin=[int(input()) for i in range(3)]
x=int(input())
c=0
for i in range(coin[0]+1):
    if 500*i>x:break
    else:
        for j in range(coin[1]+1):
            if 500*i+100*j>x:break
            else:
                for k in range(coin[2]+1):
                    t=500*i+100*j+k*50
                    if t>x:break
                    elif t==x:c+=1
print(c)

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 n in range(A+1):
  for m in range(B+1):
    for l in range(C+1):
      if X==500*n+100*m+50*l:
        cnt+=1

print(cnt)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def solve():
    y500, y100, y50, n = [int(input()) for _ in [0]*4]

    ans = 0
    for i in range(y500+1):
        for j in range(y100+1):
            for k in range(y50+1):
                ans += [0,1][500*i+100*j+50*k==n]
    print(ans)

if __name__=="__main__":
    solve()

Submission status: Accepted

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

N = 0
a = b = c = 0

for c in range(C+1):
    if (X-50*c)%100 == 0:
        for b in range(B+1):
            if (X-50*c-100*b)%500 == 0:
                if 0<= int((X-50*c-100*b)/500) <= A:
                    N += 1

print(N)

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

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

if __name__ == '__main__':
    A = int(input()) # 500
    B = int(input()) # 100
    C = int(input()) # 50
    X = int(input())

    ans = 0
    for i_500 in range(A+1):
        sum500 = 500*i_500
        if sum500 > X: break
        for i_100 in range(B+1):
            sum500_100 = 500*i_500+100*i_100 
            if sum500_100 > X: break
            for i_50 in range(C+1):
                sum500_100_50 = 500*i_500 + 100*i_100 + 50*i_50
                if sum500_100_50 > X:
                    break
                if sum500_100_50 == X:
                    ans += 1
                    break
    print(ans)

Submission status: Accepted

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

count = 0

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

Submission status: Accepted

Solution code:
a = int(input(), 10)
b = int(input(), 10)
c = int(input(), 10)
x = int(input(), 10)
ptn = 0

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

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 n in range(b + 1):
        for k in range(c + 1):
            if i * 500 + n * 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
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:
                num += 1
print(num)

Submission status: Accepted

Solution code:
A = [int(input()) for _ 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 = i * 500 + j * 100 + k * 50
            if sum == A[3]:
                count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
#入力ABCX
A = input()
B = input()
C = input()
X = input()
#50円玉の取り得る場合の数
fifty = np.array([i for i in range(int(C)+1)])
#100円玉の取り得るお金と50円の取り得るお金の和(2次元)
hun = np.array([100 * i + 50 * fifty for i in range(int(B)+1)])
#100円玉の取り得るお金と50円の取り得るお金の和を(1次元)
hun_r = np.ravel(hun)
#500円玉の取り得るお金と100円玉の取り得るお金と50円の取り得るお金の和(2次元)
f_hun = np.array([500 * i + hun_r for i in range(int(A)+1)])
#条件に合う数
print(len(f_hun[f_hun == int(X)]))

Submission status: Accepted

Solution code:
"""a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=[]
#e=[]
#そもそも無理なパターン
#if 500*a+100*b+50*c<x or (x%100!=0 and c==0) or (x%500>100*b):
#    print(0)
#いけるかもしれないやつは、それぞれの枚数についてローラー
#else:
    #a枚を超える意味はないので、min(a,x//500)、以下も同様
    for i in range(min(a,x//500)+1):
        p=x-500*i
        for j in range(min(b,p//100)+1):
            q=p-100*j
            for k in range(min(c,q//50)+1):
                r=q-50*k
                if p*q*r==0 and not (p<0 or q<0 or r<0) :
                    #枚数の組み合わせを記録
                    d.append([i,j,k])
                    #金額の組み合わせを記録
                    #e.append([500*i,100*j,50*k])
    #print(d)
    #print(e)

    #もしelse文でできない場合はdの長さは0になる
    print(len(d))"""
#これでいけるんじゃね？
a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=[]
for i in range(min(a,x//500)+1):
        p=x-500*i
        for j in range(min(b,p//100)+1):
            q=p-100*j
            for k in range(min(c,q//50)+1):
                r=q-50*k
                if p*q*r==0 and not (p<0 or q<0 or r<0) :
                    #枚数の組み合わせを記録
                    d.append([i,j,k])
                    #金額の組み合わせを記録
                    #e.append([500*i,100*j,50*k])
    #print(d)
    #print(e)

    #もしできない場合はdの長さは0になる
print(len(d))

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())
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(0,A+1):
    for j in range (0,B+1):
        for k in range(0,C+1):
            tmp = i* 500 + j* 100 + k*50
            if tmp == 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 [a*500 for a in range(A+1)]:
    for b in [b*100 for b in range(B+1)]:
        for c in [c*50 for c in range(C+1)]:
            if a+b+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 [a*500 for a in range(A + 1)]:
    for b in [b*100 for b in range(B + 1)]:
        for c in [c*50 for c in range(C + 1)]:
            if a + b + 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 [a*500 for a in range(A + 1)]:
    for b in [b*100 for b in range(B + 1)]:
        for k in range(C + 1):
            if a + b + 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 a in [a*500 for a in range(A + 1)]:
    for j in range(B + 1):
        for k in range(C + 1):
            if a + 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  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 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())

cnt = 0
for ai in range(a + 1):
    for bi in range(b + 1):
        for ci in range(c + 1):
            if (500 * ai + 100 * bi + 50 * ci == 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

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

answer = 0
for i in range(a + 1):
    for j in range(b + 1):
        temp = x - 500 * i - 100 * j
        if 0 <= temp and temp <= 50 * c:
            answer += 1
print(answer)

Submission status: Accepted

Solution code:
five = int(input())
hund = int(input())
fif = int(input())

count = 0
total = int(input())

goukei = five + hund + fif 

lis = []
for f in range(five+1):
    for h in range(hund+1):
        for i in range(fif+1):
            lis.append(f*500+h*100+i*50)

# print(lis)
for li in lis:
    if total == li:
        count += 1
print(count)

Submission status: Accepted

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

can_count = 0

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

print(can_count)

Submission status: Accepted

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

cnt = 0
for c500 in range(a+1):
    for c100 in range(b+1):
        for c50 in range(c+1):
            if c500*500 + c100*100 + c50*50 == x:
                cnt += 1
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import product
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(len([True for a,b,c in product(range(A+1),range(B+1),range(C+1)) if 500*a + 100*b + 50*c == X]))

Submission status: Accepted

Solution code:
A=int(raw_input())
B=int(raw_input())
C=int(raw_input())
X=int(raw_input())
cnt = 0
for a in xrange(0,1+A):
  for b in xrange(0,1+B):
    for c in xrange(0,1+C):
      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())

result = 0
for n500 in range(A+1):
    for n100 in range(B+1):
        for n50 in range(C+1):
            if n500*500 + n100*100 + n50*50 == X:
                result += 1
print(result)

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

Submission status: Accepted

Solution code:
from itertools import product

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

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

Submission status: Accepted

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

count = 0

for ac in range(A+1):
    for bc in range(B+1):
        for cc in range(C+1):
            if 500*ac+100*bc+50*cc == 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 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:
                cnt += 1

print(cnt)

Submission status: Accepted

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

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

# a = 2
# b = 2
# c = 2
# x = 100

cnt = 0
for i1 in range(0,a+1):
    for i2 in range(0,b+1):
        for i3 in range(0,c+1):
            s = 500*i1+100*i2+50*i3
            if(s==x):
                cnt = cnt + 1
print(cnt)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = int(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:
# coding: utf-8
def calc_balance(balance, cost, num):
    now_balance = balance
    if ((now_balance - (cost * num)) >= 0):
        now_balance -= (cost * num)
    return now_balance


if __name__ == '__main__':

    a = {'coins': input(), 'value': 500}
    b = {'coins': input(), 'value': 100}
    c = {'coins': input(), 'value': 50}
    x = int(input())

    count = 0

    for i in range(0, int(c['coins']) + 1):
        balance_c = calc_balance(x, c['value'], i)
        if (balance_c == 0):
            count += 1
            break

        for j in range(0, int(b['coins']) + 1):
            balance_b = calc_balance(balance_c, b['value'], j)
            if (balance_b == 0):
                count += 1
                break

            for k in range(0, int(a['coins']) + 1):
                balance_a = calc_balance(balance_b, a['value'], k)
                if (balance_a == 0):
                    count += 1
                    break

    print(count)

Submission status: Accepted

Solution code:
A,B,C,X = tuple(int(input()) for i in range(4))
n = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            T = 500*a + 100*b + 50*c
            if T == X:
                n += 1
print(n)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=0
A=int(input())
B=int(input())
C=int(input())
X=int(input())
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:
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())
count = 0
for i_a in range(a+1):
    for j_b in range(b+1):
        for k_c in range(c+1):
            if(i_a * 500 + j_b * 100 + k_c * 50 == x):
                count = count + 1
if a == b == c == 0:
    count = count + 1
print(count)

Submission status: Accepted

Solution code:
import numpy
import re
import math

def calc_pattern_num(a, b, c, sum_target):
	"""
	硬貨のパターンからsumになるパターンを算出
	:param a:
	:param b:
	:param c:
	:param sum:
	:return:
	"""
	count = 0
	for i in range(0, a+1):
		for j in range(0, b + 1):
			for k in range(0, c + 1):
				sum = 500 * i + 100 * j + 50 * k
				if sum == sum_target:
					count += 1
	return count

def main():
	"""
	テストコード実行
	:return:
	"""
	a = int(input())
	b = int(input())
	c = int(input())
	sum = int(input())
	print(calc_pattern_num(a, b, c, sum))

if __name__ == '__main__':
	main()