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:
ans=0
a,s,d,x=[int(input()) for i in range(4)]
for i in range(1+a):
    for j in range(1+s):
        for k in range(1+d):
            if 500*i+j*100+50*k==x:ans+=1
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
ans = []
ans.append(min(X//500,A))
ans.append(min(X//100,B))
ans.append(min(X//50,C))
for i in range(ans[0]+1):
    for j in range(ans[1]+1):
        for k in range(ans[2]+1):
            p = i * 500 + j * 100 + k * 50
            if p == X:
                count += 1
print(count)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    x = int(X/50)
    a = min(int(x/10),A) + 1 # 500 の個数
    b = min(int(x/2),B) + 1 # 100 の個数
    c = min(x,C) + 1 # 50 の個数

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

# コインの組み合わせを手持ちのもので組める限りすべて探索する
ans = 0
for i in range(A + 1):  # 実は、range関数は　0から引数-1まで　の値を格納したリスト
    for j in range(B + 1):
        for k in range(C + 1):
            x = 500*i + 100*j + 50*k
            if x == 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:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 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:
                counts += 1

print(counts)

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

Submission status: Accepted

Solution code:
import sys


lines = 4
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())

n500 = int(inp[0])
n100 = int(inp[1])
n50 = int(inp[2])
total = int(inp[3])

pattern = 0

i = 0
while i * 500 <= total and i <= n500:
    j = 0
    while j * 100 <= total and j <= n100:
        k = 0
        while k * 50 <= total and k <= n50:
            if i * 500 + j * 100 + k * 50 == total:
                pattern += 1
            k += 1
        j += 1
    i += 1

print(pattern)

Submission status: Accepted

Solution code:
A, B, C, D = [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):
            tmp = i * 500 + j * 100 +50 *k
            if(tmp == D):
                ans += 1
print(ans)

Submission status: Accepted

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

max500=min(a,x//500)
max100=min(b,(x-max500*500)//100)
max50=min(c,(x-max500*500-max100*100)//50)
count=0

# print(max500,max100,max50)
for num500 in range(a+1):
    for num100 in range(b+1):
        remain=x-num500*500-num100*100
        if remain>=0:
            if remain//50<=c:
#                 print(num500,num100,remain//50)
                count+=1
print(count)

Submission status: Accepted

Solution code:
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())

goal_money = int(input())

count = 0

if goal_money < 100:
    count = 1 if coin_50 else 0
elif goal_money < 500:
    for n_50 in range(coin_50+1):
        for n_100 in range(coin_100+1):
            sum_money = 50 * n_50 + 100 * n_100

            if sum_money == goal_money:
                count += 1
else:
    for n_50 in range(coin_50+1):
        for n_100 in range(coin_100+1):
            for n_500 in range(coin_500+1):
                sum_money = 50 * n_50 + 100 * n_100 + 500 * n_500

                if sum_money == goal_money:
                    count += 1
print(count)

Submission status: Accepted

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

X = int(input())

an = 0
#500
for i in range(A+1):
    if 500*(A-i) <= X:
        a = X - 500*(A-i)

        for j in range(B+1):
            if 100*(B-j) <= a:
                b = a - 100*(B-j)

                for k in range(C+1):
                    if 50*(C-k) <= b:
                        c = b - 50*(C-k)

                        if c == 0:
                            an += 1

print(an)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
a, b, c, x = int(input()), int(input()), int(input()), int(input())
i = 500 * np.arange(a+1)
j = 100 * np.arange(b+1)
k = 50 * np.arange(c+1)
product = i[:, None, None]+j[None, :, None]+k[None, None, :]
print(np.count_nonzero(product==x))

Submission status: Accepted

Solution code:
from itertools import product
a, b, c, x = int(input()), int(input()), int(input()), int(input())
print(sum(500*i+100*j+50*k==x for i, j, k in product(range(a+1), range(b+1), range(c+1))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def t():return range(int(input())+1)
from itertools import product as p
a=0;s=p(t(),t(),t());x=int(input())
for i,j,k in s:
  if i*500+j*100+k*50==x:a+=1
print(a)

Submission status: Accepted

Solution code:
def t(): return range(int(input())+1)

from itertools import product as p

a = 0
s = p(t(),t(),t())
x = int(input())

for i, j, k in s:
    if i*500 + j*100 + k*50 == x:
        a += 1
print(a)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for y500 in range(a + 1):
    for y100 in range(b + 1):
        for y50 in range(c + 1):
            if 500 * y500 + 100 * y100 + 50 * y50 == 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 xx in range(a+1):
    A = 500*xx
    for y in range(b+1):
        B = 100*y
        for z in range(c+1):
            C = 50*z
            if x == A+B+C:
                ans += 1
            else:
                continue


print(ans)

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

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

print(cnt)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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())

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

Submission status: Accepted

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

judg = 0

for i in range(A+1):
    a = 500 * i
    for ii in range(B+1):
        b = 100 * ii
        for iii in range(C+1):
            c =  50 * iii
            if a + b + c == X:
                judg += 1
            sum = 0

print(judg)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == (500 * i + 100 * j + 50 * k):
                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 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:
url = "https://atcoder.jp/contests/abc087/tasks/abc087_b"

def main():
    coins = [int(input()) for v in range(3)]
    che = int(input())
    count = 0
    for i in range(0, coins[0] + 1):
        for j in range(0, coins[1] + 1):
            for k in range(0, coins[2] + 1):
                if che == (500 * i) + (100 * j) + (50 * k):
                    count += 1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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)]
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k == X:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input()) #500
B = int(input()) #100
C = int(input()) #50
X = int(input()) #合計金額

count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def nyu():
    num1= input()
    num2= input()
    num3= input()
    num4= input()

    num1 = int(num1)
    num2 = int(num2)
    num3 = int(num3)
    num4 = int(num4)

    #num2 = list(map(int,input().split()))
    #num2 = int(num2)
    return num1,num2,num3,num4


def check(A,B,C,X):
    cnt = 0

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

A,B,C,X = nyu()
check(A,B,C,X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A500 = int(input())  # ここで標準入力
B100 = int(input()) #ここで標準入力
C50 = int(input()) #ここで標準入力
X = int(input()) #ここで標準入力
out = 0

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

print(out)

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, B, C, X = [int(input()) for i in range(4)]
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:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a = int(input())
  b = int(input())
  c = int(input())
  x = int(input())
  cnt = 0
  """for i in range(x//500 +1):
    m500 = 0
    mob = x
    if x//500 != 0:
      m500 += mob//500
      mob -=m500 * 500
    else:
      pass
    for j in range(mob//100 + 1):
      m100 = 0
      mob = x - m500 * 500
      if mob//100 != 0:
        m100 += mob//100
        mob -=m100*100
      else:
        pass
      # c = x - a - b
      mob = x - m100*100 - m500*500
      m50 = mob//50
      
      if 0 <= m500 <= a and 0 <= m100 <= b and 0 <= m50 <= c:
        cnt += 1"""
  for i in range(a+1):
    for j in range(b+1):
      for k in range(c+1):
        sum = 500 * i + 100 * j + 50 * k
        if sum == x:
          cnt += 1
  print(cnt)
if __name__ == '__main__':
  main()

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
from itertools import product


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

    print(ans)


if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    main(a, b, c, x)

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:
z = [input() for i in range(4)]
a = z[0]+1
b = z[1]+1
c = z[2]+1
x = z[3]
p = 0
for i in range(a):
    for j in range(b):
        for k in range(c):
            total = (500*i) + (100*j) + (50*k)
            if total == x: p+=1
print p

Submission status: Accepted

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


counter = 0
for aa in range(0,int(a)+1):
    for bb in range(0,int(b)+1):
        for cc in range(0, int(c)+1):
            sumx = 500 * aa + 100 * bb + 50 * cc
            if int(x) == sumx and int(x) % 50 == 0 and 50 <= int(x) <= 20000:
                counter += 1
print(counter)

Submission status: Accepted

Solution code:
# ABC087 B

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

    result = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

INF = float('inf')


def main():
    A = int(input())  # 500 Yen
    B = int(input())  # 100 Yen
    C = int(input())  # 50 Yen
    X = int(input())

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

    print(counter)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8

A = int(input()) #500円玉の枚数
B = int(input()) #100円玉の枚数
C = int(input()) #50円玉の枚数
X = int(input()) #50の倍数

X = X / 50

num = 0 #条件を満たす通り数

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if X == i * 10 + j * 2 + k:
                num += 1

print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

a = b = c = 0
count = 0
max_val = 500*a_num + 100*b_num + 50*c_num

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

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import numpy as np
import collections

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(min(a + 1, x // 500 + 1)):
    rest1 = x - 500 * i
    for j in range(min(b + 1, rest1 // 100 + 1)):
        rest2 = rest1 - 100 * j
        if 50 * c >= rest2:
            ans = ans + 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,x=int(input()),int(input()),int(input()),int(input())
x//=50
ans=0
for i in range(x//10+1):
    k=x-i*10
    for j in range(k//2+1):
        l=k-j*2
        ans+=(0<=i<=a and 0<=j<=b and 0<=l<=c)
print(ans)

Submission status: Accepted

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

cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
k = [int(input()) for i in range(4)]
p = 0

#どの硬貨も高々50枚
for a in range(k[0]+1):
    for b in range(k[1]+1):
        for c in range(k[2]+1):
            if 500*a + 100*b + 50*c == k[3]:
                p += 1

print(p)

Submission status: Accepted

Solution code:
numof500 = int(input())
numof100 = int(input())
numof50  = int(input())
moneyneeded = int(input())
 
counter = 0
for i in range(numof500 + 1):
  for j in range(numof100 + 1):
    for k in range(numof50 + 1):
      if 500 * i + 100 * j + 50 * k == moneyneeded:
        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 + j * 100 + k * 50 == x:
                count += 1
print(count)

Submission status: Accepted

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

total = 0
n = 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:
                n += 1

print (n)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    r = 0
    for ia in range(a + 1):
        for ib in range(min(b + 1, (x - ia * 500)//100 + 1)):
            r +=  (x - ia * 500 - ib * 100) // 50 <= c

    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    r = 0
    for ia in range(a + 1):
        for ib in range(min(b + 1, (x - ia * 500)//100 + 1)):
            for ic in range(min(c + 1, (x - ia * 500 - ib * 100)//50 + 1)):
                r +=  ia * 500 + ib * 100 + ic * 50 == x


    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# B: Coins
# モジュールのインポート
import itertools

# 定数の定義
A_YEN = 500
B_YEN = 100
C_YEN = 50

# 標準入力の取得
A = int(input())
B = int(input())
C = int(input())
X = int(input())

# 全探索を行い、パターン数を求める
A_pattern_list = range(A+1)
B_pattern_list = range(B+1)
C_pattern_list = range(C+1)

answer = 0
for A_pattern,B_pattern,C_pattern in itertools.product(A_pattern_list, B_pattern_list, C_pattern_list):
    amount = A_YEN*A_pattern + B_YEN*B_pattern + C_YEN*C_pattern
    if amount == X:
        answer +=1

print(answer)

Submission status: Accepted

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

total=0
count=0

for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            total=500*l + 100*m + 50*n
            if(total==X): count += 1
                
print(count)

Submission status: Accepted

Solution code:
import numpy as np
fft = np.fft.rfft
ifft = np.fft.irfft

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

U = 20000
U = 1 << U.bit_length()


def conv(x, y):
    return (ifft(fft(x, U) * fft(y, U)) + 0.5).astype(np.int64)


fA = np.zeros(U, dtype=int)
fB = np.zeros(U, dtype=int)
fC = np.zeros(U, dtype=int)

fA[np.arange(A + 1) * 500] = 1
fB[np.arange(B + 1) * 100] = 1
fC[np.arange(C + 1) * 50] = 1

fABC = conv(conv(fA, fB), fC)
ans = fABC[X]
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())
Y = 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:
        Y = Y+1

print(Y)

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:
a = int(input())
b = int(input())
c = int(input())
d = 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 == d:
                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)