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

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(int(X/500) + 1 ):
    if i > A :continue
    remain_100 = X - 500 * i

    for j in range(int(remain_100/100) + 1):
        if j > B :continue
        remain_50 = remain_100 - (100 * j)

        if int(remain_50/50) > C:continue
        counter += 1

print(counter)

Submission status: Accepted

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

print(result)

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 ac * 500 + bc * 100 + cc * 50 == 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):
    total=500*i
    if total>x:
        break
    for j in range(b+1):
        total+=100*j
        if total>x:
            break
        if (x-total)%50==0 and (x-total)/50<=c:
            ans+=1
        total=500*i
    total=0
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())

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 i in range(min(x//500,a)+1):
  for j in range(min((x-500*i)//100,b)+1):
    if (x - 500*i-100*j) % 50 ==0  and (x - 500*i-100*j) / 50  <= c:
      count += 1
      continue
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a_num = int(input())
b_num = int(input())
c_num = int(input())
x = int(input())

count = 0

for a in range(a_num + 1):
	a *= 500
	if a == x:
		count += 1
		continue
    
	for b in range(b_num + 1):
		b *= 100
		if (a + b) == x:
			count+=1
			continue
      
		for c in range(c_num + 1):
			c *= 50
			if (a + b + c) == x:
				count+=1
				continue

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):
    Xi = X-500*i
    if Xi >= 0:
        for j in range(B+1):
            Xj = Xi - 100*j
            if Xj >= 0 and (Xj / 50) <= C:
                ans +=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=int(input());b=int(input());c=int(input());x=int(input())
print(sum(i*500+j*100+k*50==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,b,c,x = [int(input()) for i in range(4)]
x /= 50
result = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 10 * i + 2 * j + k == x:
                result += 1
print(result)

Submission status: Accepted

Solution code:
A = int(input()) #500円
B = int(input()) #100円
C = int(input()) #50円
X = int(input())

"""
A = 10C → C = 0.1A
B = 2C → C = 0.5B
"""
counter = 0

for a in range(A+1):
    tmpa = X - 500*a
    for b in range(B+1):
        tmpb = tmpa - 100*b
        for c in range(C+1):
            tmpc = tmpb - 50*c
            if tmpc == 0:
                counter += 1
                #print(a,b,c)

print(counter)

Submission status: Accepted

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

l = []
for _ in range(4):
  l.append(int(input()))

a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )

sum, cnt = [0] * 2  
for i in range(a_c + 1):
  sum = x - 500 * i
  if sum == 0:
    cnt += 1
  if sum <= 0:
    break
  for j in range(b_c + 1):
    sum = x - 500 * i - 100 * j
    if sum == 0:
      cnt += 1
    if sum <= 0:
      break
    for k in range(c_c + 1):
      sum = x - 500 * i - 100 * j - 50 * k
      if sum == 0:
        cnt += 1
      if sum <= 0:
        break
print(cnt)

Submission status: Accepted

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

l = []
for _ in range(4):
  l.append(int(input()))

a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )

i, j, k, sum, cnt = [0] * 5  
while (i <= a_c):
  sum = x - 500 * i
  if sum < 0:
    break
  if sum == 0:
    cnt += 1

  else:
    while (j <= b_c):
      sum = x - 500 * i - 100 * j
      if sum < 0:
        break
      if sum == 0:
        cnt += 1

      else:
        while (k <= c_c):
          sum = x - 500 * i - 100 * j - 50 * k
          if sum < 0:
            break
          if sum == 0:
            cnt += 1
          k += 1
        k = 0

      j += 1
    j = 0

  i += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = []
for i in range(3):
    li.append(int(input()))
X = int(input())

ans = 0

for i in range(li[0]+1):
    for j in range(li[1]+1):
        for k in range(li[2]+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())
kotae = 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:
        kotae += 1
print(kotae)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 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())
count = 0

req_500 = X//500
max_500 = min(req_500, A)

for i in range(0, max_500+1):
	X_sub500 = X - 500*i
	req_100 = X_sub500//100
	max_100 = min(req_100, B)
		
	for j in range(0, max_100+1):
		X_sub100 = X_sub500 - 100*j
		req_50 = X_sub100//50
		if req_50 <= C:
			count += 1

print(count)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A500 = int(inputs[0])
    B100 = int(inputs[1])
    C50 = int(inputs[2])
    X = int(inputs[3])

    count = 0
    for a in range(A500 + 1):
        for b in range(B100 + 1):
            for c in range(C50 + 1):
                m = a * 500 + b * 100 + c * 50
                if m == X:
                    count += 1
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(4))
    print(ret)

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

Submission status: Accepted

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

ans = [True 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(sum(ans))

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    a = int(input().rstrip('\n'))
    b = int(input().rstrip('\n'))
    c = int(input().rstrip('\n'))
    x = int(input().rstrip('\n'))
    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)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
list = [int(input()) for i in range(3)]
A,B,C =list[0],list[1],list[2]
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())

counter = 0

for i in range(0, a + 1):
	if x - (500 * i) >= 0:
		x_f = x - (500 * i)

		if x_f == 0:
			counter += 1
			break

		for j in range(0, b + 1):
			if x_f - (100 * j) >= 0:
				x_s = x_f - (100 * j)

				if x_s == 0:
					counter += 1
					break

				for k in range(0, c + 1):
					if x_s - (50 * k) >= 0:
						x_t = x_s - (50 * k)

						if x_t == 0:
							counter += 1
							break


print(counter)

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

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

Submission status: Accepted

Solution code:
A, B, C, X = [int(input()) for _ in range(4)]
cnt = 0
for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            if 500 * l + 100 * m + 50 * n == X:
                cnt += 1
print(cnt)

Submission status: Accepted

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

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 = 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:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a=int(input())
b=int(input())
c=int(input())
x=int(input())

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

print(count)

Submission status: Accepted

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

    cnt = 0

    for d in range(0,a+1):
        for e in range(0,b+1):
            for f in range(0,c+1):
                g = 500*d + 100*e + 50*f
                if g == x:
                    cnt += 1
    print(cnt)

bb087()

Submission status: Accepted

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

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:
# https://atcoder.jp/contests/abc087/tasks/abc087_b
a, b, c, X = [int(input()) for i in range(4)]
n = 0
for i in range(X//500+1):
    if i > a:
        pass
    else:
        Y = X - 500 * i
        for j in range(Y // 100 + 1):
            if j > b:
                pass
            else:
                Z = Y - 100 * j
                for k in range(Z // 50 + 1):
                    if k > c:
                        pass
                    elif Z - 50 * k == 0:
                        n += 1
                    else:
                        pass

print(n)

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())#¥500
b = int(input())#¥100
c = int(input())#¥50
x = int(input())#price
#print(a,b,c,x)
cnt = 0
for i in range(c+1):
    for j in range(b+1):
        for k in range(a+1):
            if x == 50*i+100*j+500*k:
                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())
S=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:
        S=S+1
print(S)

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 = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for num_500 in range(0, a + 1):
    for num_100 in range(0, b + 1):
        for num_50 in range(0, c + 1):
            if num_500 * 500 + num_100 * 100 + num_50 * 50 == x:
                count += 1
                break
print(count)

Submission status: Accepted

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

count = 0
for num_500 in range(0, a + 1):
    for num_100 in range(0, b + 1):
        for num_50 in range(0, c + 1):
            if num_500 * 500 + num_100 * 100 + num_50 * 50 == x:
                count += 1
print(count)

Submission status: Accepted

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

count = 0
current_500 = 0
current_500_100 = 0

for num_500 in range(0, a + 1):
    current_500 = num_500 * 500
    if current_500 > x:
        break
    for num_100 in range(0, b + 1):
        current_500_100 = current_500 + num_100 * 100
        if current_500_100 > x:
            break
        for num_50 in range(0, c + 1):
            if current_500_100 + num_50 * 50 == x:
                count += 1
                break
print(count)

Submission status: Accepted

Solution code:
def calc_50(r, max_num_50):
    if r < 0:
        return 0
    elif r / 50 <= max_num_50:
        return 1
    else:
        return 0


def calc_100(r, max_num_100, max_num_50):
    count = 0
    for num_100 in range(0, max_num_100 + 1):
        count += calc_50(r - 100 * num_100, max_num_50)
    return count


def calc_500(r, max_num_500, max_num_100, max_num_50):
    count = 0
    for num_500 in range(0, max_num_500 + 1):
        count += calc_100(r - 500 * num_500, max_num_100, max_num_50)
    return count


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

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

Submission status: Accepted

Solution code:
a, b, c, X = [int(input()) for i in range(4)]
ans = [500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(X)
print(ans)

Submission status: Accepted

Solution code:
A,B,C,X = map(int,open(0).read().split())
a = 0
for i in range(A+1):
    for l in range(B+1):
        for q in range(C+1):
            if 500*i+100*l+50*q == X:
                a += 1
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = 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 and a + b + c > 0:
                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,b,c= map(int,[input() for i in range(3)])
X = int(input())
flag = 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:
        flag += 1
print(flag)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
L = [int(input()) for _ in range(4)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip

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

print(ans)

Submission status: Accepted

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

M=[]
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            V=500*i+100*j+k*50
            M.append(V)
print(M.count(X))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
n = 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 == n:
                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 i*500 + j*100 + k*50 == x:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=[int(input()) for _ in range(4)]
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,b,c,x = [int(input()) for _ in range(4)]
print([500*x+100*y+50*z for x in range(a+1) for y in range(b+1) for z in range(c+1)].count(x))

Submission status: Accepted

Solution code:
a,b,c,x=map(int,open(0))
cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x==500*i+100*j+50*k:
                cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
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):
            ans = 500*_a + 100*_b + 50*_c
            if ans == x:
                counter += 1

print(counter)

Submission status: Accepted

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

I = []
J = []
K = []
for i in range(A+1):
  if 500*i <= X:
    I.append(i)
for i in I:
  for j in range(B+1):
    if 100*j <= X-500*i:
      J.append([i,j])
for [i,j] in J:
  for k in range(C+1):
    if 50*k == X-500*i-100*j:
      K.append([i,j,k])

print(len(K))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#A,B,C,X=map(int,input().split()) #500,100,50, total
#X=500*a+100*b+50*c
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=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):
    fhy = i * 500
    for j in range(b+1):
        ohy = j * 100
        for k in range(c+1):
            fty = k * 50
            if fhy + ohy + fty == 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):
        z = x-(500*i+100*j)
        if(z < 0):
            break
        if(z/50 <= c):
            cnt += 1

print(cnt)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

Solution code:
def calc(a, b, c, x):
    r = 0
    for aa in range(a+1):
        for bb in range(b+1):
            for cc in range(c+1):
                if aa * 500 + bb * 100 + cc*50 == x:
                    r += 1
    return r


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

r = calc(a, b, c, x)
print(r)

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 sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
a = int(ns())
b = int(ns())
c = int(ns())
x = int(ns())

count = 0
for ai in range(a+1):
  if 500 * ai > x:
    break
  for bi in range(b+1):
    for ci in range(c+1):
      if 500 * ai + 100 * bi + 50 * ci == x:
        count += 1

print(count)

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

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



count=0

P=X
for i in range(A+1):
    X=P
    X-=500*i
    if X==0:
        count+=1
    elif X<0:
        pass
    else:
        Q=X
        for j in range(B+1):
            X=Q
            X-=100*j
            if X==0:
                count+=1
            elif X<0:
                pass

            else:
                R=X
                for k in range(C):
                    X=R
                    X-=50*(k+1)
                    if X==0:
                        count+=1
                    else:
                        pass

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(0, A + 1):
    for b in range(0, B + 1):
        for c in range(0, C + 1):
            if X == (500 * a) + (100 * b) + (50 * c):
                count += 1
            else:
                pass

print(count)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res = 0
# +1 しないと実際に input() から取得した値が range で処理できない
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:
                res += 1
print(res)

Submission status: Accepted

Solution code:
import numpy as np
import sys
a = int(input())
b = int(input())
c = int(input())
x = int(input())
value = [i*500 + j*100 + k*50 for i in range(a+1) for j in range(b+1) for k in range(c+1)]
print(value.count(x))

Submission status: Accepted

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

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

print(cnt)