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())
cnt=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:
                cnt+=1
            else:
                continue
print(cnt)

Submission status: Accepted

Solution code:
A=int(input()) #500
B=int(input()) #100
C=int(input()) #50
X=int(input())
cnt=0
for i in range(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:
                cnt+=1
            else:
                continue
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

for use_500 in range(num_500 + 1):
    for use_100 in range(num_100 + 1):
        for use_50 in range(num_50 + 1):
            if use_500 * 500 + use_100 * 100 + use_50 * 50 == X:
                ans += 1

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A,B,C,X = [int(input()) for _ in range(4)]
 
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:
icase=0
if icase==0:
    a=int(input())
    b=int(input())
    c=int(input())
    x=int(input())
    icnt=0
    for na in range(a+1):
        for nb in range(b+1):
            r=x-500*na-100*nb
            if 0<=r and r<=c*50 and r%50==0:
                icnt=icnt+1
    print(icnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a = int(input())
b = int(input())
c = int(input())
x = int(input())

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

Submission status: Accepted

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = 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 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 i*500 + j*100 + k*50 == x:
                count += 1

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# solution
import io

n, m, l, h = map(int, [input() for i in range(4)])
counter = 0
for i in range(n+1):
  for j in range(m+1):
    for k in range(l+1):
      if i * 500 + j * 100 + k * 50 == h:
        counter += 1
print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

cache = {}

def d(a, b, c, r):
    if r == 0: return 1
    if r < 0: return 0
    if cache.has_key((a, b, c, r)): return cache[(a, b, c, r)]
    s = 0
    if a > 0: s += d(a - 1, b, c, r - 500)
    if b > 0: s += d(0, b - 1, c, r - 100)
    if c > 0: s += d(0, 0, c - 1, r - 50)
    cache[(a, b, c, r)] = s
    return s

print d(a, b, c, x)

Submission status: Accepted

Solution code:
x = int(input())
y = int(input())
z = int(input())
a = int(input())
c = a/50

count = 0
for i in range(0,x+1):
    for j in range(0,y+1):
        for k in range(0,z+1):
            if(((10*i)+(2*j)+(k)) == c):
                count+=1

print(count)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
y = int(input())
 #this is a comment
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == y:
                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())
y = int(input())
 
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == y:
                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:
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):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == 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 ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == 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:
#!/usr/bin/env python3
from itertools import product
import sys
 
 
def solve(AA: int, BB: int, CC: int, XX: int):
    print(sum(
        1
        for a, b, c in product(range(AA + 1), range(BB + 1), range(CC + 1))
        if a * 500 + b * 100 + c * 50 == XX
    ))
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(A, B, C, X)
 
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from itertools import product
import sys


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    solve(A, B, C, X)


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(min(a, x//500)+1):
  for j in range(min(b, (x-500*i)//100)+1):
    if 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())
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:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

import itertools
print(len([total for total in map(sum, itertools.product(
    [500 * i for i in range(A + 1)],
    [100 * i for i in range(B + 1)],
    [50 * i for i in range(C + 1)],
)) if total == X]))

Submission status: Accepted

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

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):
  x=X-500*i
  if x<0: break
  for t in range(B+1):
    if x<0: break
    elif 50*C>=x:
      s+=1
      x-=100
    else: x-=100
print(s)

Submission status: Accepted

Solution code:
A, B, C, X = [int(input()) for i 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 = 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):
      ttl = i * 500 + j * 100 + k * 50
      if(x==ttl):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import math

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for en500 in range(A+1):
    for en100 in range(B+1):
        for en50 in range(C+1):
            if en500*500 + en100*100 + en50*50 == X:
                ans += 1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(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 (i*500+j*100+k*50==x):
        ans+=1
        break
      elif (i*500+j*100+k*50>x):
        break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

# 全部最大値からスタートしたほうがシンプルな気がする

coins_number_list = [a,b,c]
buf_coins_number_list = [a,b,c]
all_patterns_list =[]


# コインの合計値を求める関数
def sum_coins(coins_list):
  return coins_list[0] * 500 + coins_list[1] * 100 + coins_list[2] * 50


while(True):
  while(True):
    while(True):
      all_patterns_list.append(list(buf_coins_number_list))
      buf_coins_number_list[2] = buf_coins_number_list[2] - 1
      if buf_coins_number_list[2] < 0:
        break

    buf_coins_number_list[2] = c
    buf_coins_number_list[1] = buf_coins_number_list[1] - 1
    if buf_coins_number_list[1] < 0:
      break
  buf_coins_number_list[1] = b
  buf_coins_number_list[0] = buf_coins_number_list[0] - 1
  if buf_coins_number_list[0] < 0:
    break



all_patterns_sum_list = list(map(sum_coins, all_patterns_list))


print(all_patterns_sum_list.count(x))

Submission status: Accepted

Solution code:
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = ii()
    B = ii()
    C = ii()
    X = ii()
    print(len([1 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]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

def resolve():
    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)



if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
# ABC 087: B – Coins
a, b, c, x = [int(input()) for _ in range(4)]
comb = 0

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

print(comb)

Submission status: Accepted

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

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

Submission status: Accepted

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

def myAnswer(A:int,B:int,C:int,X:int) -> int:
   counter = 0
   for a in range(0,A+1):
      a *= 500
      for b in range(0,B + 1):
         b *= 100
         for c in range(0,C + 1):
            if(a + b + c*50 == X):
               counter += 1
   return counter


def modelAnswer():
   tmp=1
def main():
   A = int(input())
   B = int(input())
   C = int(input())
   X = int(input())
   print(myAnswer(A,B,C,X))

if __name__ == '__main__':
   main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

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

b = 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:
                b += 1
            else:
                continue

print(b)

Submission status: Accepted

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

for n in range(a+1):
  for m in range(b+1):
    for l in range(c+1):
      if 500*n+100*m+50*l==x:
        flag += 1
print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
yen500 = int(input())
yen100 = int(input())
yen50 = int(input())
target = int(input())

match_count = 0
for i in range(yen500+1):
  for j in range(yen100+1):
    for k in range(yen50+1):
      if (i*500)+(j*100)+(k*50) == target:
        match_count += 1
      
print(match_count)

Submission status: Accepted

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

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):
            price = A * 500 + B * 100 + C * 50 
            if price == X:
                count += 1
            else:
                continue
print(count)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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 + 50*k:
                cnt+=1
print(cnt)

Submission status: Accepted

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

ans = 0
for a in range(0, A + 1):
    for b in range(0, B + 1):
        for c in range(0, C + 1):
            res = 500 * a + 100 * b + 50 * c
            if (X == res):
                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_500 in range(0,A+1):
    for b_100 in range(0,B+1):
        for c_50 in range(0,C+1):
            pay = 500*a_500 + 100*b_100 + 50*c_50
            if pay > 0:
                if X == pay:
                    cnt = cnt + 1
print(cnt)

Submission status: Accepted

Solution code:
# import sys
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(min(A+1, 1+X//500)):
    for k in range(min(B+1, 1+X//100)):
        for j in range(min(C+1, 1+X//50)):
            if X == 500*i+100*k+50*j:
                cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ans = 0
a_lim = min(a, x // 500) + 1
total = x
for i in range(a_lim):
    a_total = total - 500 * i
    b_lim = min(b, a_total // 100) + 1
    for j in range(b_lim):
        b_total = a_total - 100 * j
        if b_total // 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 + j * 100 + k * 50 == X:
                count += 1

print(count)

Submission status: Accepted

Solution code:
def append_list(num, yen):
    list = []
    while num>=0:
        list.append(num*yen)
        num-=1
    return list


y500 = int(input())
y100 = int(input())
y50 = int(input())
sum = int(input())
ans = 0

y500_list = append_list(y500, 500)
y100_list = append_list(y100, 100)
y50_list = append_list(y50, 50)

for i in y500_list:
    if i>sum:
        continue
    elif i==sum:
        ans+=1
        continue
    for j in y100_list:
        if i+j>sum:
            continue
        elif i+j==sum:
            ans+=1
            continue
        for k in y50_list:
            if i+j+k>sum:
                continue
            elif i+j+k==sum:
                ans+=1
                continue

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(pattern)

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
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):
            if 500*ai + 100*bi + 50*ci == X:
                ans += 1

print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
N = 0
for i in range(A+1):
	for n in range(B+1):
		for p in range(C+1):
			sum = 500*i + 100*n + 50*p
			if sum == X:
				N = N+1
print(N)

Submission status: Accepted

Solution code:

ipt = [int(input()) for i in range(4)]

def main():
    a = ipt[0] ## number of 500 yen
    b = ipt[1] ## number of 100 yen
    c = ipt[2] ## number of  50 yen
    x = ipt[3] ## pay x yen exactly

    cnt = 0;

    for ai in range(0, a + 1):
        for bi in range(0, b + 1):
            for ci in range(0, c + 1):
                if (amount(ai, bi, ci) == x):
                    cnt += 1
                    ## For debuging
                    ## print(ai, bi, ci, cnt)
                else:
                    ## For debuging
                    ## print(ai, bi, ci, cnt)
                    pass

    print(cnt)

def amount(a, b, c):
    return  (  (500 * a)
             + (100 * b)
             + ( 50 * c))

main()

Submission status: Accepted

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

Submission status: Accepted

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

for a in range(A+1):
    x = X - 500*a
    if x < 0:
        break
    for b in range(B+1):
        y = x - 100*b
        if y < 0:
            break
        else:
            if y/50 <= C:
                cnt += 1
print(cnt)