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 aa in range(a+1):
    ay = 500*aa
    if ay <= x:
        for bb in range(b+1):
            by = 100*bb
            if ay + by <= x:
                for cc in range(c+1):
                    cy = 50*cc
                    if ay + by + cy ==x:
                        count += 1
                        break
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:
count = 0
A, B, C, X = map(int, [input() for i in range(4)])
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:
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(len([1 for B in range(b+1) for C in range(c+1) if (x-(100*B)-(50*C))%500==0 and (x-(100*B)-(50*C))>=0 and (x-(100*B)-(50*C))<=500*a]))

Submission status: Accepted

Solution code:
import itertools

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

cnt=0

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

Submission status: Accepted

Solution code:
import itertools

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

res=[]

for a,b,c in itertools.product(A,B,C):
    res.append(500*a+100*b+50*c)
    
print(res.count(X))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input()) for i in range(4)]
print(sum(0<=(x-500*A-100*B)//50<=c for A in range(a+1) for B in range(b+1)))

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 i*500+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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
arr = [input() for i in range(4)]
 
count = 0
for fi in range(0, int(arr[0])+1):
    for hun in range(0, int(arr[1])+1):
        for fifty in range(0, int(arr[2])+1):
            sum = fi * 500 + hun * 100 + fifty * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Submission status: Accepted

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

count = 0
for fi in range(0, int(arr[0])+1):
    for hun in range(0, int(arr[1])+1):
        for fifty in range(0, int(arr[2])+1):
            sum = fi * 500 + hun * 100 + fifty * 50
            if sum == int(arr[3]):
                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 x == 500 * i + 100 * j + 50 * k:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0

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

print(cnt)

Submission status: Accepted

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

X = int(input())

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

print(ans)

Submission status: Accepted

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

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:
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())

counter = 0

for count_500 in range(coin_500 + 1):
    for count_100 in range(coin_100 + 1):
        for count_50 in range(coin_50 + 1):
            if count_500 * 500 + count_100 * 100 + count_50 * 50 == total:
                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)

Submission status: Accepted

Solution code:
import numpy as np

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


cnt=0
for i in np.arange(A+1)*500:
    for h in np.arange(B+1)*100:
        for t in np.arange(C+1)*50:
            if i+t+h==X:
                cnt+=1
                
print(cnt)

Submission status: Accepted

Solution code:
#ABC 087 B問題
L = [int(input()) for i in range(4)]
X=L[3]
counter=0
for a in range(L[0]+1):
    for b in range(L[1]+1):
        for c in range(L[2]+1):
            if 500*a+100*b+50*c==X:
                counter+=1
print(counter)

Submission status: Accepted

Solution code:
input_a = int(input())
input_b = int(input())
input_c = int(input())
input_total = int(input())
count = 0
for i in range(input_a + 1):
    for j in range(input_b + 1):
        for k in range(input_c + 1):
            if i * 500 + j * 100 + k * 50 == input_total:
                count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# ABC 087 B - Coins
# 整数の入力
a = int(input())
b = int(input())
c = int(input())
x = int(input())
t = 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 x == s:
                t = t +1
print(t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while x>=0 and a>=0:
  while x>=0 and b>=0:
    if x//50<=c:
      n+=1
    b-=1
    bcount+=1
    x-=100
  x+=100*bcount
  b+=bcount
  bcount=0
  a-=1
  x-=500  
print(n)

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

Submission status: Accepted

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

workX = X

for i in range(A + 1):
    if workX > 500 * i:
        workX -= 500 * i
    elif workX == 500 * i:
        cnt += 1
        continue
    else:
        break

    for j in range(B + 1):
        if workX > 100 * j:
            workX -= 100 * j
        elif workX == 100 * j:
            cnt += 1
            break
        else:
            break

        if workX % 50 == 0 and workX <= 50 * C:
            cnt += 1
            workX += 100 * j
            continue
        else:
            workX += 100 * j

    workX = X


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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=map(int,open(0).read().split())

total=0
for a_ in range(0,a+1):
  for b_ in range(0,b+1):
    y=x-a_*500-b_*100
    if y%50==0 and 0<=y//50<=c:
      total+=1
print(total)

Submission status: Accepted

Solution code:
a,b,c,x=map(int,open(0).read().split())

total=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_+b_*100+c_*50 == x:
        total+=1
        break
print(total)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
counter=0
for i1 in range(0,a+1):
  for i2 in range(0,b+1):
    for i3 in range(0,c+1):
      if 500*i1+100*i2+50*i3==x:
        counter=counter+1
print(counter)

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 = int(X/50)
num = 0

if n >= 10:
  if X%2 != 0 and C == 0:
    num == 0
  else:
    if A == 0 and B != 0:
      for c in range(C+1):
        for b in range(B+1):
          if c*50 + b*100 == X:
            num += 1
    elif A != 0 and B == 0:
      for c in range(C+1):
        for a in range(A+1):
          if c*50 + a*500 == X:
            num += 1
    else:
      for c in range(C+1):
        for b in range(B+1):
          for a in range(A+1):
            if c*50 + b*100 + a*500 == X:
              num += 1
  
elif 10 > n >= 2:
  if X%2 != 0 and C == 0:
    num == 0
  else:
    for c in range(C+1):
      for b in range(B+1):
        if c*50 + b*100 == X:
          num += 1
      
else:
  if C != 0:
    num = 1
  else:
    num = 0

print(num)

Submission status: Accepted

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

k=0
for i in range(min([x//500+1,a+1])):
    for j in range(min([(x-500*i)//100+1,b+1])):
        if 500*i+100*j+50*c>=x:
            k+=1

print(k)

Submission status: Accepted

Solution code:
A,B,C,X=[int(input()) for _ in range(4)]
res=0
for a in range(A, -1, -1):
  a_500 = 500 * a
  if a_500 > X:
    continue
  elif a_500 == X:
    res += 1
    continue
  else:
    for b in range(B, -1, -1):
      b_100 = 100 * b
      if a_500 + b_100 > X:
        continue
      elif a_500 + b_100 == X:
        res += 1
      else:
        for c in range(C, -1, -1):
          c_50 = 50 * c
          if a_500 + b_100 + c_50 > X:
            continue
          elif a_500 + b_100 + c_50 == X:
            res += 1
            break
          else:
            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())
A=x//500
ans=0
for i in range(A+1):
  if(i>a):
    break
  B=(x-i*500)//100
  for j in range(B+1):
    if(j>b):
      break
    elif(0<=(x-i*500-j*100)<=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 500*i + 100*j + 50*k == x:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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:
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())# 500
b = int(input())# 100
c = int(input())# 50
x = int(input())# 合計

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for a_tmp in range(a+1):
    for b_tmp in range(b+1):
        for c_tmp in range(c+1):
            total = 500*a_tmp + 100*b_tmp + 50*c_tmp
            if total == x:
                count += 1
print(count)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

list_500 = list(range(A+1))
list_100 = list(range(B+1))
list_50 = list(range(C+1))

for fh in range(len(list_500)):
    for oh in range(len(list_100)):
      for f in range(len(list_50)):
        if list_500[fh] * 500 + list_100[oh] * 100 + list_50[f] * 50 == X:
          counter += 1

print(counter)

Submission status: Accepted

Solution code:
def main():
    a, b, c, x = map(int, open(0).read().split())
    l = [
        500*x + 100*y + 50*z
        for x in range(a+1)
            for y in range(b+1)
                for z in range(c+1)
    ]
    print(l.count(x))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

list_500 = list(range(A+1))
five_hundred_list = [n*500 for n in list_500]

list_100 = list(range(B+1))
one_hundred_list = [n*100 for n in list_100]

list_50 = list(range(C+1))
fifty_list = [n*50 for n in list_50]

for fh in range(len(five_hundred_list)):
    for oh in range(len(one_hundred_list)):
      for f in range(len(fifty_list)):
        if five_hundred_list[fh] + one_hundred_list[oh] + fifty_list[f] == X:
          counter += 1

print(counter)

Submission status: Accepted

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

cou = 0

for ai in range(a+1):
	for bi in range(b+1):
		for ci in range(c+1):
			if (500*ai) + (100*bi) + (50*ci) == x:
				cou = cou + 1
				
print(cou)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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,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:
import sys
num50 = input().rstrip()
num10 = input().rstrip()
num5 = input().rstrip()
num = input().rstrip()

num50 = int(num50)
num10 = int(num10)
num5 = int(num5)
num = int(num)

class TestClass(object):
    cnt = 0
    def __init__(self):
        cnt = 0
    def countMoney(self, n10,n2,n1,res,flag):
        if (res == num):
            self.cnt += 1
            return
        if (n10+1 <= num50 and res+500 <= num and flag >= 500):
            self.countMoney(n10+1,n2,n1,res+500,500)
        if (n2+1 <= num10 and res+100 <= num and flag >= 100):
            self.countMoney(n10,n2+1,n1,res+100,100)
        if (n1+1 <= num5 and res+50 <= num and flag >= 50):
            self.countMoney(n10,n2,n1+1,res+50,50)

tc1 = TestClass()
tc1.countMoney(0,0,0,0,500)

print(tc1.cnt)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
A, B, C, X = (int(input()) for _ in range(4))
L = [500 * x + 100 * y + 50 * z 
     for z in range(C + 1)
     for y in range(B + 1)
     for x in range(A + 1)
    ]
print (L.count(X))

Submission status: Accepted

Solution code:
import sys
Money_500 = int(input())
Money_100 = int(input())
Money_50  = int(input())
Amount    = int(input())
Count = 0

if Amount % 50 != 0 or Amount / 1 == 0 or Amount < 50 :
    print(Count)
    sys.exit()

for i in range(0,Money_500+1):
    if Amount < i * 500 :
        break

    for x in range(0,Money_100+1):
        if ( Amount - ( i * 500 )) - (x * 100) < 0 :
             break

        if ( Amount - (i * 500 ) - ( x * 100 )) / 50 <= Money_50 :
            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):
    I = i*500
    if X<i*500:
        break
        
    for j in range(B+1):
        J =I + j*100
        if X<J:
            break
        if X<=J + C*50:
            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):
            tmp = i * 500 + j * 100 + k * 50
            if tmp == x:
                ans += 1
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(4)]

cnt = 0
for c500 in range(l[0]+1):
  for c100 in range(l[1]+1):
    for c50 in range(l[2]+1):
      if c500 * 500 + c100 * 100 + c50 * 50 == l[3]:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(4)]

cnt = 0
for c500 in range(l[0]+1):
  sum = c500 * 500
  if sum == l[3]:
    cnt += 1
    next
  elif sum > l[3]:
    break
  else:
    for c100 in range(l[1]+1):
      sum = c500 * 500 + c100 * 100
      if sum == l[3]:
        cnt += 1
        next
      elif sum > l[3]:
        break
      else:
        for c50 in range(l[2]+1):
          sum = c500 * 500 + c100 * 100 + c50 * 50
          if sum == l[3]:
            cnt += 1
            next
          elif sum > l[3]:
            break

print(cnt)

Submission status: Accepted

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

    ans = 0
    kmax = c * 50

    for i in range(a+1):
        I = i*500
        if I > x:
            break
        for j in range(b+1):
            IJ = I + j*100
            if IJ > x:
                break
            if x <= IJ + kmax:
                ans +=1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

res = 0

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

Submission status: Accepted

Solution code:
def hantei(n, m, l, d ):
    if (n*500+m*100+l*50)==d:
#        print("GO n,m,l",n,m,l)
        return True
    return False

a = int(input()) #five
b = int(input()) #hund
c = int(input()) #fift
d = int(input()) #

n=m=l=0
result=0

while(n <= a):
    while(m <= b):
        while(l <= c):
            # print("n,m,l",n,m,l)
            if hantei(n,m,l,d)==True:
                result += 1
            l+=1
        l=0
        # if hantei(n,m,l,d)==True:
        #     result += 1
        m+=1
    # if hantei(n,m,l,d)==True:
    #     result += 1
    m=l=0
    n+=1

print(result)

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
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):
        rest = X-500*a-100*b
        if rest<0:
            continue
        if rest % 50 == 0 and rest // 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 ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if x == (500*ia + 100*ib + 50*ic):
                count+=1

print(count)

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:
def main():
    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):
                total = 500 * a + 100 * b + 50 * c
                if total == X:
                    cnt += 1

    print(cnt)




main()

Submission status: Accepted

Solution code:
cn500 = int(input())
cn100 = int(input())
cn50 = int(input())
g_amount = int(input())

counter = 0

for i in range(cn500+1):
    for j in range(cn100+1):
        for n in range(cn50+1):
            if g_amount == (500 * i + 100 * j + 50 * n):
                counter += 1
                break
            elif g_amount < (500 * i + 100 * j + 50 * n):
                break

print(counter)

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

Submission status: Accepted

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

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
input=sys.stdin.readline

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 i in range(4)]
v = 0
ans = 0

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

print(ans)

Submission status: Accepted

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

a = min(X//500, A)
b = min(X//100, B)
c = min(X//50, C)

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

num = 0
for i_a in range(a + 1):
  for j_b in range(b + 1):
    for k_c in range(c + 1):
      total = 500 * i_a + 100 * j_b + 50 * k_c
      if total == x:
        num += 1
print(num)