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

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):
        if(0 <= ((X-(500*i + 100*j))/50) <= C):
            count += 1
print(count)

Submission status: Accepted

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

ans = 0

for i in range(min(A, X//10) + 1):
    Y = X - 10*i
    for j in range(min(B, Y//2) + 1):
        ans += Y - 2*j <= C

print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc087/tasks/abc087_b

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

possible_values = [a * 500 + b * 100 + c * 50 for a in range(A+1) for b in range(B+1) for c in range(C+1)]
is_match = [1 for i in possible_values if i == X]
print(sum(is_match))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
kadai = int(input())
sum_coins = []

for a in range(0, a_500+1, 1):
    for b in range(0, b_100+1, 1):
        for c in range(0, c_50+1, 1):
            sum_coins.append((500*a)+(100*b)+(50*c))
print(sum_coins.count(kadai))

Submission status: Accepted

Solution code:
import itertools

A = range(int(input())+1)
B = range(int(input())+1)
C = range(int(input())+1)
X = int(input())

ans = 0
for coins in itertools.product(A, B, C):
    if (coins[0]*500+coins[1]*100+coins[2]*50) == X:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a = inint()
b = inint()
c = inint()
x = inint()

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, b, c, x = map(int, [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:
a500 = int(input())
b100 = int(input())
c50 = int(input())
x = int(input())
count = 0
for i in range(a500 + 1):
  for j in range(b100 + 1):
    for k in range(c50 +1 ):
      if 500*i + 100*j + 50*k == x:
        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 c in range(C+1):
    for b in range(B+1):
        for a in range(A+1):
            s = 500 * a + 100 * b + 50 * c
            if s == X:
                ans += 1
print(ans)

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:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a=ni()
b=ni()
c=ni()
x=ni()

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())
an = 0
for i in range(A+1):
    for t in range(B+1):
        for u in range(C+1):
         if 500*i + 100*t + 50*u == X:
             an += 1
print(an)

Submission status: Accepted

Solution code:
# 500yen
A = int(input())
# 100
B = int(input())
# 50
C = int(input())
# total amount and 50 multiple of 50
X = int(input())

res = 0
for c500 in range(A+1):
    for c100 in range(B+1):
        for c50 in range(C+1):
            total = 500*c500 + 100*c100 + 50*c50
            if ( X == total):
                res += 1

print(res)

Submission status: Accepted

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

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

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, C, X = map(int, read().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A_str=input()
B_str=input()
C_str=input()
X_str=input()
A=int(A_str)
B=int(B_str)
C=int(C_str)
X=int(X_str)
saisho=X
tori=0
for i in range(A+1):
  X=saisho

  X=X-500*i

  if X==0:
    tori=tori+1
  elif X>0:
    saishoB=X
    for j in range(B+1):
      X=saishoB

      X=X-100*j
      if X==0:
        tori=tori+1
      elif X>0:
        saishoC=X
        for k in range(C+1):
          X=saishoC

          X=X-50*k
          if X==0:
            tori=tori+1
print(str(tori))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())  # 500
b = int(input())  # 100
c = int(input())  # 50
x = int(input())  # 500 * A + 100 * B + 50 * C

result = []
for a_i in range(a+1):
  for b_i in range(b+1):
    for c_i in range(c+1):
      x_tmp = x - 500 * a_i - 100 * b_i - 50 * c_i
      if x_tmp == 0:
      	result.append([a_i, b_i, c_i])
print(len(result))

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

print(ans)

Submission status: Accepted

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

#  50**3で全列挙

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

print(res)

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
ab = 0
for a_count in range(a + 1):
    for b_count in range(b + 1):
        ab = a_count * 500 + b_count * 100
        if ab <= x <= (ab + c * 50):
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
# ABC_087_B_Coins
A = int(input())  # 500coins
B = int(input())  # 100coins
C = int(input())  # 50coins
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):
			sum = 500*a + 100*b + 50*c
			if sum == X:
				count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
a,b,c,x=map(int,sys.stdin.read().split())
cnt=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:
        cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
m,v = {i: int(raw_input()) for i in range(3)}, {0:500,1:100,2:50}
x = int(raw_input())

def dfs(x, i, m, v):
  	if x < 0: return 0
  	if x == 0 or i == 3: 
  		return 1 if x == 0 else 0   	
  	r = 0
  	for k in range(0, m[i] + 1): r += dfs(x - k * v[i], i + 1, m, v)
  	return r
print dfs(x,0,m,v)

Submission status: Accepted

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

def dfs(x, i, m, v):
  	if x < 0: return 0
  	if x == 0 or i == 3: 
  		return 1 if x == 0 else 0   	
  	r = 0
  	for k in range(0, m[i] + 1): r += dfs(x - k * v[i], i + 1, m, v)
  	return r
m,v = {0:a,1:b,2:c}, {0:500,1:100,2:50}
print dfs(x,0,m,v)

Submission status: Accepted

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

def dfs(x, i, a, b , c):
  	if x < 0:
  		return 0
  	if x == 0:
  		return 1
  	
  	if i == 3:
  		return 1 if x == 0 else 0
  	r = 0
  	m = {0:a,1:b,2:c}
  	v = {0:500,1:100,2:50}

  	for k in range(0, m[i] + 1):
  		r += dfs(x - k * v[i], i+1, a,b,c)
  	return r

print dfs(x,0,a,b,c)

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

Submission status: Accepted

Solution code:
#500円玉
a = int(input())
#100円玉
b = int(input())
#50円玉
c = int(input())
#50の倍数
x = int(input())

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

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:
A, B, C, D = [int(input()) for i in range(4)]
print(sum([500*a+100*b+50*c == D for a in range(A+1) for b in range(B+1) for c in range(C+1)]))

Submission status: Accepted

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

X //= 50

res = 0

for i in range(A+1):
  rem = X-10*i
  if rem < 0:
    break
  for j in range(B+1):
    if 0 <= rem-2*j <= C:
      res += 1
      
print(res)

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, C, X = map(int, read().decode("utf-8").split())

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

Submission status: Accepted

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

cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    l = []
    cnt = 0

    for i in range(C+1):
        for j in range(B+1):
            for k in range(A+1):
                if 50*i + 100*j + 500*k == X:
                    if not [i, j, k] in l:
                        cnt += 1
    print(cnt)
main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()

def main():
    A=int(input())
    B=int(input())
    C=int(input())
    X=int(input())
    arr=np.add.outer(np.arange(0,100*B+1,100).T,np.arange(0,500*A+1,500))
    arr= X-arr
    print(arr[(arr>=0) & (arr<=50*C)].size)

if __name__ == '__main__':
    main()

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:
A,B,C,X = (int(input()) for X in range(0,4))
Count = 0
for TA in range(0,A+1):
    for TB in range(0,B+1):
        for TC in range(0,C+1):
            if 500*TA+100*TB+50*TC==X:
                Count += 1
print(Count)

Submission status: Accepted

Solution code:
in_a = input()
in_b = input()
in_c = input()
in_x = input()

A = int(in_a)
B = int(in_b)
C = int(in_c)
X = int(in_x)

count = 0
for i in range(A+1):
    for j in range(B+1):
        k = ( X - 500*i - 100*j ) / 50
        # print(f'k：{k}')
        if k < 0:
            break;
        elif k.is_integer() and k <= C:
            count +=1
            # print('clear', k, count)

print(count)

Submission status: Accepted

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

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            sum_kozeni = i * 500 + j * 100 + k * 50  
            if sum_kozeni == total:
                count += 1
            elif sum_kozeni > total:
                break
print(count)

Submission status: Accepted

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

count=0

for k_a in range(A+1):
    for k_b in range(B+1):
        for k_c in range(C+1):
            if 500*k_a+100*k_b+50*k_c == X:
                count=count+1
print(count)

Submission status: Accepted

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

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

print(p)

Submission status: Accepted

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

res = 0
for i in range(a+1):
    rem = x
    rem -= 500 * i
    tempA = rem
    if rem == 0:
        res += 1
        continue
    for j in range(b+1):
        rem = tempA
        rem -= 100 * j
        tempB = rem
        if rem == 0:
            res += 1
            continue
        for k in range(c+1):
            rem = tempB
            rem -= 50 * k
            if rem == 0:
                res += 1
                break

print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
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:
m500 = int(input())
m100 = int(input())
m50 = int(input())
X = int(input())

count = 0

for i in range(m500+1):
    for j in range(m100+1):
        for k in range(m50+1):
            if X == i*500+j*100+k*50:
                count += 1

print(count)

Submission status: Accepted

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

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

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

print(count)

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):
            money = i*500+j*100+k*50
            if money == 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(0, A + 1):
    for j in range(0, B + 1):
        for k in range(0, C + 1):
            if 500 * i + 100 * j + 50 * k == X: ans += 1
print(ans)

Submission status: Accepted

Solution code:
inputlist = [input() for i in range(4)]

n = 0

A,B,C= inputlist[0],inputlist[1],inputlist[2]

for i in range(int(A)+1):

    X = inputlist[3] 

    X = int(X) - i*500

    for j in range(int(B)+1):

        X = X - j*100

        for k in range(int(C)+1):
            
            X = X -k*50

            if X == 0:
                n += 1
            X= X + k*50

        X = X + j*100

    X = X + i*500

print(n)

Submission status: Accepted

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

for i in range(int(A)+1):
    X = X_original
    X500 = X - i*500
    for j in range(int(B)+1):
        X100 = X500 - j*100
        for k in range(int(C)+1):
            X50 = X100-k*50
            if X50== 0:
                n += 1

print(n)

Submission status: Accepted

Solution code:
# L 500円　M 100円　S 50円 N 合計
L = int(input())  # 10
M = int(input())  # 2
S = int(input())  # 1
N = int(input())
count = 0


def sum(l=0, m=0, s=0):
    return 500 * l + 100 * m + 50 * s


for l in range(L + 1):
    if N == sum(l):
        count += 1
        break
    else:
        for m in range(M + 1):
            if N == sum(l, m):
                count += 1
                break
            else:
                for s in range(S + 1):
                    if N == sum(l, m, s):
                        count += 1
                        break
print(count)

Submission status: Accepted

Solution code:
*coins, X = [int(input()) for _ in range(4)]

price = [500, 100, 50]
payable = []

for a in range(coins[0]+1):
    for b in range(coins[1]+1):
        for c in range(coins[2]+1):
            payable.append(a*price[0] + b*price[1] + c*price[2])
            
print(payable.count(X))

Submission status: Accepted

Solution code:
from sys import stdin

a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())

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

print (count)

Submission status: Accepted

Solution code:
na = int(input())
nb = int(input())
nc = int(input())
xx = int(input())
counter = 0
for aa in range(na+1):
    for bb in range(nb+1):
        residue = xx-500*aa-100*bb
        if residue >= 0 and residue / 50 <= nc:
            counter += 1
print(counter)

Submission status: Accepted

Solution code:
a, b, c, x = (int(input()) for _ in range(4))
cnt = 0
for i in range(min(a, x // 500) + 1):
    for j in range(min(b, (x - 500 * i) // 100) + 1):
        if (x - 500 * i - 100 * j) // 50 <= c:
            cnt += 1
print(cnt)

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for ai in range(A+1):
    for bi in range(B+1):
        for ci in range(C+1):
            temp=ai*500+bi*100+ci*50
            if temp==X:
                ans+=1
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
pos = {}
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            v = a*500 + b*100 + c*50
            pos.setdefault(v,0)
            pos[v] += 1
            if v > X:
                break
print(pos.setdefault(X,0))

Submission status: Accepted

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

a = min(x//500, a)+1
b = min(x//100, b)+1
c = min(x//50, c)

cnt = 0

for i in range(a):
  for j in range(b):
    now = x-500*i-100*j
    if now>=0 and now//50 <= c:
      cnt +=1

print(cnt)

Submission status: Accepted

Solution code:
# import numpy as np

A_init = 500
B_init = 100
C_init = 50

A_n = int(input())
B_n = int(input())
C_n = int(input())

X = int(input())

cnt = 0
for a in range(A_n+1):
    if A_init * a <= X:
        for b in range(B_n+1):
            if (A_init * a + B_init * b) <= X:
                K = X - (A_init * a + B_init * b)
                if K % 50 == 0 and K / C_init <= C_n:
                    cnt += 1
            else:
                break
    else:
        break
# print(np.count_nonzero([k+[i for i in All_list] == X for k in All_list]))
print(cnt)

Submission status: Accepted

Solution code:
# import numpy as np

A_init = 500
B_init = 100
C_init = 50

A_n = int(input())
B_n = int(input())
C_n = int(input())

X = int(input())

cnt = 0
for a in range(A_n+1):
    if A_init * a <= X:
        for b in range(B_n+1):
            if (A_init * a + B_init * b) <= X:
                for c in range(C_n+1):
                    if (A_init * a + B_init * b + C_init * c) == X: cnt += 1
            else:
                break
    else:
        break
# print(np.count_nonzero([k+[i for i in All_list] == X for k in All_list]))
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

A_init = 500
B_init = 100
C_init = 50

A_n = int(input())
B_n = int(input())
C_n = int(input())

X = int(input())

cnt = 0
for a in range(A_n+1):
    if A_init * a <= X:
        for b in range(B_n+1):
            if (A_init * a + B_init * b) <= X:
                for c in range(C_n+1):
                    if (A_init * a + B_init * b + C_init * c) == X: cnt += 1
            else:
                break
    else:
        break
# print(np.count_nonzero([k+[i for i in All_list] == X for k in All_list]))
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

A_init = 500
B_init = 100
C_init = 50

A_n = int(input())
B_n = int(input())
C_n = int(input())

X = int(input())

cnt = 0
for a in range(A_n+1):
    for b in range(B_n+1):
        for c in range(C_n+1):
            if (A_init * a + B_init * b + C_init * c) == X: cnt += 1
# print(np.count_nonzero([k+[i for i in All_list] == X for k in All_list]))
print(cnt)

Submission status: Accepted

Solution code:
List = []
for i in range (3):
  List.append(int(input()))
X=int(input())
res = 0
c = 0
for i in range(List[0]+1):
  for j in range(List[1]+1):
    c = int(X/50) - 10 * i - 2 * j
    if 0<= c <= List[2]:
      res+=1
print(res)

Submission status: Accepted

Solution code:
def main(n500, n100, n50, price):
    count = 0
    for i in range(n500 + 1):
        if i * 500 <= price:
            for j in range(n100 + 1):
                if i * 500 + j * 100 <= price:
                    for k in range(n50 + 1):
                        p = i * 500 + j * 100 + k * 50
                        if p == price:
                            count += 1
    print(count)


if __name__ == "__main__":
    n500 = int(input())
    n100 = int(input())
    n50 = int(input())
    price = int(input())
    main(n500, n100, n50, price)

Submission status: Accepted

Solution code:
def main(n500, n100, n50, price):
    count = 0
    for i in range(n500 + 1):
        for j in range(n100 + 1):
            for k in range(n50 + 1):
                p = i * 500 + j * 100 + k * 50
                if p == price:
                    count += 1
    print(count)


if __name__ == "__main__":
    n500 = int(input())
    n100 = int(input())
    n50 = int(input())
    price = int(input())
    main(n500, n100, n50, price)

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):
        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())
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 ==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 + 1
count = 0
for i in range(n):
  if i <= A:
    m = (X-500*i)//100+1
    for j in range(m):
      if j <= B and (X-500*i - 100*j) % 50 == 0 and ((X-500*i - 100*j) / 50) <= C:
        if not (i==0 and j ==0 and ((X-500*i - 100*j) / 50)==0): 
          count += 1

print(count)

Submission status: Accepted

Solution code:

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

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

print(counter)

Submission status: Accepted

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