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

A,B,C,X = map(int, [A,B,C,X])

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

print(pattern_count)

Submission status: Accepted

Solution code:
a = int(input()) # 500
b = int(input()) # 100
c = int(input()) # 50
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:
c500 = int(input())
c100 = int(input())
c50 = int(input())
n = int(input())
result = 0

for x in range(c500+1):
    for y in range(c100+1):
        for z in range(c50+1):
            if x * 500 + y *100 + z * 50 == n :
                result += 1
print(result)

Submission status: Accepted

Solution code:
info = [int(input()) for _ in range(4)]
ans = 0
for i in range(info[0] + 1):
  for j in range(info[1] + 1):
    k = (info[3] - (500*i + 100*j)) // 50
    if 0 <= k <= info[2]:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
a = int(input())
b = int(input())
c = int(input())
x = int(input())

from itertools import product
alim = min(a, x // 500)
blim = min(b, x // 100)
clim = min(c, x //  50)

count = 0
for anum, bnum, cnum in product(np.arange(alim + 1), np.arange(blim + 1), np.arange(clim + 1)):
    value = anum * 500 + bnum * 100 + cnum * 50
    if value == x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
lines = sys.stdin.readlines()
for n, line in enumerate(lines):
  if n == 0:
    A = int(line.strip())
  elif n == 1:
    B = int(line.strip())
  elif n == 2:
    C = int(line.strip())
  elif n == 3:
    X = int(line.strip())
  else:
    break

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

print(ans)

Submission status: Accepted

Solution code:
NUM_500 = int(input())
NUM_100 = int(input())
NUM_050 = int(input())
price = int(input())

num_500 = 0
pattern = 0
while num_500 <= NUM_500:
    num_100 = 0
    while num_100 <= NUM_100:
        num_050 = 0
        while num_050 <= NUM_050:
            if price == 500 * num_500 + 100 * num_100 + 50 * num_050:
                pattern += 1
            num_050 +=1
        num_100 += 1
    num_500 += 1
print(pattern)

Submission status: Accepted

Solution code:
num_500 = int(input())
num_100 = int(input())
num_050 = int(input())
price = int(input())

i_500 = 0
pattern = 0
while i_500 <= num_500:
    remaining_price = price - 500 * i_500
    if remaining_price < 0:
        i_500 += 1
        continue
    i_100 = 0
    while i_100 <= num_100:
        price_500 = remaining_price - 100 * i_100
        if price_500 < 0:
            i_100 += 1
            continue
        number = price_500 / 50
        if number <= num_050:
            pattern += 1
        i_100 += 1
    i_500 += 1
print(pattern)

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 - (500 * a + 100 * b + 50 * c) == 0:
                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:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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


cnt = sum(1 for a in range(A+1) if X - 500*a >=0 for b in range(B+1) if 0 <= X-500*a-100*b <= 50*C)
print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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


cnt = sum(0 <= X-500*a-100*b <= 50*C for a in range(A+1) if X - 500*a>=0 for b in range(B+1))
print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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


# cnt = sum(1 for a in range(A+1) if X - 500*a >=0 for b in range(B+1) if 0 <= X-500*a-100*b <= 50*C)
cnt = sum(0 <= X-500*a-100*b <= 50*C for a in range(A+1) if X - 500*a>=0 for b in range(B+1))
print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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

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

print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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

cnt = 0
for i in range(A+1):
    X1 = X - 500 * i
    if X1 >= 0:
        for j in range(B+1):
            X2 = X1 - 100 * j
            if X2 >= 0 and X2 <= 50 * C:
                cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

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

cnt = 0
for i in range(A+1):
    X1 = X - 500 * i
    if X1 == 0:
        cnt += 1
        continue
    for j in range(B+1):
        X2 = X1 - 100 * j
        if X2 == 0:
            cnt += 1
            continue
        for k in range(C+1):
            X3 = X2 - 50 * k
            if X3 == 0:
                cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
A = int(input()) + 1
B = int(input()) + 1
C = int(input()) + 1
X = int(input())
counter = 0
for a in range(A):
    for b in range(B):
        for c in range(C):
            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 + 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
ma = x // 500
mb = x // 100
mc = x // 50
na = min([a, ma])
nb = min([b, mb])
nc = min([c, mc])
for i500 in range(na+1):
  for i100 in range(nb+1):
      current = x-500*i500-100*i100
      if current >= 0 and current <= 50*nc:
          cnt += 1
          #print(i500,i100,cnt)
print(cnt)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
list = []
for j in range(A+1):
    for k in range(B+1):
        for l in range(C+1):
            TOTAL = j * 500 + k * 100 + l * 50
            list.append(TOTAL)
if X in list:
    print(list.count(X))
else:
    print(0)

Submission status: Accepted

Solution code:
a=int(input())+1
b=int(input())+1
c=int(input())+1
x=int(input())/10
s=0
for i in range(a):
    for j in range(b):
        for k in range(c):
            if 50*i+10*j+5*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 an in range(a+1):
    for bn in range(b+1):
        for cn in range(c+1):
            if x == 500*an+100*bn+50*cn:
                count = count + 1
print(count)

Submission status: Accepted

Solution code:
import sys

#コインの枚数と合計金額を入力
num_coins_500 = int(input())
num_coins_100 = int(input())
num_coins_50 = int(input())
total = int(input())

#確認
if not 0<=num_coins_50<=50 or not 0<=num_coins_100<=50 or not 0<=num_coins_500<=50 or not 50<=total<=20000:
    sys.exit()

#フラグ設定
flag = 0

#全探索
for i in range(0, num_coins_50+1, 1):
    for j in range(0, num_coins_100+1, 1):
        for k in range(0, num_coins_500+1, 1):
            
            #合計金額（total）と等しくなったらカウント
            if total ==  50*i + 100*j + 500*k:
                    
                flag += 1
                    
print(flag)

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

Submission status: Accepted

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

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

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

    print(n)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


abc087_b()

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 l in range(C+1):
            if 500*i + 100*j + 50*l == 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):
  s = 500 * i
  for j in range(b + 1):
    t = 100 * j
    for k in range(c + 1):
      u = 50 * k
      if s + t + u == 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 i*500+j*100+k*50==X:
                count+=1
                
print(count)

Submission status: Accepted

Solution code:
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    res = 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:
                    res += 1
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(4)]
#print(a)

cnt=0
for i in range(a[0]+1):
  for j in range(a[1]+1):
    for k in range(a[2]+1):
      if 500*i+100*j+50*k==a[3]:
        cnt+=1
        
print(cnt)

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest087-B
#  https://beta.atcoder.jp/contests/abc087/tasks/abc087_B

def  selectPattern(a500yen,b100yen,c50yen,total):
	a500yenRange = range(0,a500yen+1)
	b100yenRange = range(0,b100yen+1)
	c50yenRange = range(0,c50yen+1)
	nowPattern = 0
	for a in a500yenRange:
		thisTotal = 0
		for b in b100yenRange:
			for c in c50yenRange:
				thisTotal = a*500+b*100+c*50
				if thisTotal == total :
					nowPattern = nowPattern+1

	answer = nowPattern
	return answer


if __name__ == '__main__':
	a500yen = int(input())
	b100yen = int(input())
	c50yen = int(input())
	total = int(input())
	solution=selectPattern(a500yen,b100yen,c50yen,total)
	print(solution)

Submission status: Accepted

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

def enable_pay(target, coin, n):
    if 0 <= target // coin <= n:
        return True
    return False

count = 0
for a_n in range(0, a+1)[::-1]:
    for b_n in range(0, b+1)[::-1]:
        s = (500 * a_n) + (100 * b_n)
        if enable_pay(x-s, 50, c):
            count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 10^4程度なので愚直でOK
A = int(input())
B = int(input())
C = int(input())
X = int(input())

pattern = 0
for a500 in range(A+1) :
    for b100 in range(B+1) :
        for c50 in range(C+1) :
            if (a500 * 500 + b100 * 100 + c50 * 50 == X) :
                pattern += 1

print(pattern)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    COIN = (500, 100, 50)

    v = []
    for i in range(4):
        v.append( int(input()) )
    # v[0]:a, v[1]:b, v[2]:c, v[3]:X
    i, j, count = 0, 0, 0

    while i <= v[0] and i*COIN[0] <= v[3]:
        while j <= v[1] and j*COIN[1] <= (v[3]-i*COIN[0]):
            if v[2]*COIN[2] >= (v[3]-i*COIN[0]-j*COIN[1]):
                count += 1
            j += 1
        j = 0
        i += 1

    print(count)

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 * j + 50 * k == x:
                result += 1

print(result)

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

Submission status: Accepted

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

cnt = 0
tmp_x = X
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
        break
print(cnt)

Submission status: Accepted

Solution code:
import itertools


def main():
    A = int(input()) + 1
    B = int(input()) + 1
    C = int(input()) + 1
    X = int(input())

    cnt = 0
    for n_500, n_100, n_50 in itertools.product(range(A), range(B), range(C)):
        y = 500 * n_500 + 100 * n_100 + 50 * n_50
        if y == X:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np

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

# A = 2
# B = 2
# C = 2
# X = 100

count = 0

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

Submission status: Accepted

Solution code:


a = int(input())
b = int(input())
c = int(input())
d = 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+100*j+50*k==d):
				count = count + 1
	
print(count)

Submission status: Accepted

Solution code:
f_h,h,f_t,total = map(int,[input() for _ in range(4)])
ans = 0
for i in range(f_h+1):
    for j in range(h+1):
        for k in range(f_t+1):
            if 500*i + 100*j + 50*k == total:
                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(count)

Submission status: Accepted

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

a, b, c = (0, 0, 0)

counter = 0

for a in range(A+1):
	
	'''
	if X == sum_c:
		counter += 1
		break
	elif sum_c > X:
		break
	'''
	for b in range(B+1):
	
		'''
		if X == sum_bc:
			counter += 1
			break
		elif sum_bc > X:
			break
		'''
		for c in range(C+1):
			if X == a * 500 + b * 100  + c * 50:
				counter += 1
				#break


print(counter)

Submission status: Accepted

Solution code:
x = [int(input()) for _ in range(4)]
print(len(['' for i in range(x[0]+1) for j in range(x[1]+1) for k in range(x[2]+1) if 500*i+100*j+50*k==x[3]]))

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
# Coins
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, 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 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:
				ans+=1
 
print(ans)

Submission status: Accepted

Solution code:
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
x = int(input())

ans = 0
for c1 in range(coin500 + 1):
    for c2 in range(coin100 + 1):
        for c3 in range(coin50 + 1):
            if 500 * c1 + 100 * c2 + 50 * c3 == x:
                ans += 1

print(ans)

Submission status: Accepted

Solution code:
A, B, C, X = int(input()), int(input()), int(input()), int(input())
cnt = 0
for n_500 in range(A + 1):
    for n_100 in range(B + 1):
        for n_50 in range(C + 1):
            if n_500 * 500 + n_100 * 100 + n_50 * 50 == 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 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:
# Coins

'''
問題：
    あなたは500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。
    これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。

    同じ種類の硬貨同士は区別できない。
    2通りの硬貨の選び方は、ある種類の硬貨についてその硬貨を選ぶ枚数が異なる時区別される。

制約：
    0 <= A,B,C <= 50
    A+B+C >= 1
    50 <= X <= 20,000
    A, B, C は整数である。
    Xは50の倍数である。

入力：
    入力は以下の形式で標準入力から与えられる。

    A
    B
    C
    X

出力：
    硬貨を選ぶ方法の個数を出力せよ。
'''

# for文を3周回してゴリゴリとく

# 入力した値を変数に入れる
five = int(input()) # 500
hundred = int(input()) # 100
fifty = int(input()) # 50
total = int(input()) # 求める合計

# 何枚使用しているかカウントする。
used50 = 0
used100 = 0
used500 = 0
usedTotal = 0
ways = 0

while used500 <= five:
    while used100 <= hundred:
        while used50 <= fifty:
            usedTotal = 50 * used50 + 100 * used100 + 500 * used500
#            print(usedTotal)
            if total == usedTotal:
                ways += 1
            used50 += 1
        used50 = 0
        used100 += 1
#        print("a")
    used50 = 0
    used100 = 0
    used500 += 1

# 2
# 2
# 2
# 100

print(ways)

Submission status: Accepted

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

for i in range(min(int(X/500)+1, A+1)):
    for n in range(min(int((X-500*i)/100)+1, B+1)):
        if C >= int((X-500*i-100*n)/50):
            count += 1
    

print(count)

Submission status: Accepted

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

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

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):
        if 0 <= x - (500*i) - (100*j) <= (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)

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

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

    print(count)

Submission status: Accepted

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

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

print(k)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = int(input()) #500
b = int(input()) #100
c = int(input()) #50
x = int(input())

cnt = 0

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

print(cnt)

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):
        xij = x - 500 * i - 100 * j
        if xij >= 0 and xij // 50 <= c and xij % 50 == 0:
            ans += 1
print(ans)

Submission status: Accepted

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

res = 0

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

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())
l=[]
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			l.append(500*i+100*j+50*k)
print(l.count(x))

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

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

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
b=0
Counter=0
while a<=A:
  while b<=B:
    if 0<=X-500*a-100*b<=50*C:
      Counter+=1
    b+=1
  b=0  
  a+=1
print(Counter)

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

print(count)

Submission status: Accepted

Solution code:
abcx = []
for i in range(4):
  abcx.append(int(input()))

  
x = abcx[3]
count = 0
for a in range(abcx[0]+1):
  for b in range(abcx[1]+1):
    for c in range(abcx[2]+1):
      if 500*a + 100*b + 50*c == x:
        count += 1
print(str(count))

Submission status: Accepted

Solution code:
five_hun = int(input())
hun = int(input())
fifty = int(input())
yen = int(input())
count = 0

for i in range(five_hun + 1):
    for j in range(hun + 1):
        for k in range(fifty + 1):
            if i * 500 + j * 100 + k * 50 == yen:
                count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

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 X == 500*a+100*b+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 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:
                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(0, A+1):
    xi = X - 500 * i
    if xi < 0: break
    for j in range(0, B+1):
        xj = xi - 100 * j
        if xj < 0: break
        for k in range(0, C+1):
            xk = xj - 50 * k
            # print('{} {} {} {}'.format(i,j,k,xk))
            if xk == 0: ans += 1
            if xk < 0: break

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%50==0 and sum == x):
				count+=1

print(count)

Submission status: Accepted

Solution code:
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][0] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

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):
        xx = x - (500 * i + 100 * j)
        if xx >= 0 and xx % 50 == 0 and xx // 50 <= c:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
#n = int(input())

#values = [int(i) for i in input('Enter some values: ').split()]   
all = []

for i in range(4):
    all.append(input())
    
a, b, c  = all[:-1]

X = all[-1]

result = 0
for i in range(int(a)+1):
    for j in range(int(b)+1):
        for k in range(int(c)+1):
          total = i*500 + j*100 + k*50          
          if(total==int(X)):
              result+=1
            
            
print(result)

Submission status: Accepted

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