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

combination = []
for A in range(a+1):
  for B in range(b+1):
    for C in range(c+1):
      total = A*500 + B*100 + C*50
      combination.append(total)

count = combination.count(x)
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:
e = input()
f = input()
g = input()
h = input()

a = int(e)
b = int(f)
c = int(g)
x = int(h)

answer = 0

arrays = []
for i in range(125001):
    arrays.append(0)

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

answer = arrays[x]
print(answer)

Submission status: Accepted

Solution code:
import math

a, b, c, x = [int(input()) for _ in range(4)]

ans = 0
a_min = max(0, math.ceil((x - 100 * b - 50 * c) / 500))
a_max = min(a, math.floor(x / 500))
for ai in range(a_min, a_max + 1):
    b_min = max(0, math.ceil((x - 500 * ai - 50 * c) / 100))
    b_max = min(b, math.floor((x - 500 * ai) / 100))
    ans += b_max - b_min + 1
print(ans)

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

Submission status: Accepted

Solution code:
five_h = int(input())
one_h = int(input())
f_m = int(input())
s = int(input())

count = 0

for i in range(0, five_h + 1):
    a = 500 * i
    b = 0
    for j in range(0, one_h + 1):
        b = 100 * j
        d = 0
        c = a + b
        for k in range(0, f_m + 1):
            d = 50 * k
            e = c + d
            if e == s:
                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, flush=True)

Submission status: Accepted

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

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_500 = int(input())
b_100 = int(input())
c_50 = int(input())
kadai = int(input())
sum_coin = 0
count = 0
sum_list = []

for n in range(a_500 + 1):
    for m in range(b_100 + 1):
        for l in range(c_50 + 1):
            sum_list.append((500*n) + (100*m) + (50*l))
print(sum_list.count(kadai))

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:
# -*- coding: utf-8 -*-

A, B, C, X = map(int, open(0).read().split())
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,B,C,X = map(int, open(0).read().split())

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

print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right
import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    a =getN()
    b=getN()
    c=getN()
    x=getN()
    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)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c500 = int(input())
c100 = int(input())
c50 = int(input())
x = int(input())
count = 0
 
for c500_n in range(c500+1):
  for c100_n in range(c100+1):
    for c50_n in range(c50+1):
      if c500_n*500 + c100_n*100 + c50_n*50 == x:
        count += 1
 
print(count)

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 = 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):
            price = i * 500 + j * 100 + k * 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())

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

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
mod = 1000000007
inf = float("INF")
def I(): return int(input().rstrip())
def IR(n): return [I() for _ in range(n)]
def LI(): return list(map(int, input().rstrip().split()))
def LIR(n): return [LI() for _ in range(n)]
def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))
def LIR_(n): return [LI_() for _ in range(n)]
def F(): return float(input().rstrip())
def FR(n): return [F() for _ in range(n)]
def LF(): return list(map(float, input().rstrip().split()))
def LFR(n): return [LI() for _ in range(n)]
def S(): return input().rstrip()
def SR(n): return [S() for _ in range(n)]
def LS(): return list(sys.stdin.readline().rstrip().split())
def LSR(n): return [LS() for _ in range(n)]
# ↑template↑
# ↓solution↑
a, b, c, x = IR(4)
res = 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:
                res += 1
print(res)

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:
ABC = [int(input()) for _ in range(3)]
X = int(input())

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

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

Submission status: Accepted

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

count = 0
for ia in range(0, a + 1):
    for ib in range(0, b + 1):
        for ic in range(0, c + 1):
            if 500 * ia + 100 * ib + 50 * ic == 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:
coin_500 = int(input()) + 1
coin_100 = int(input()) + 1
coin_50 = int(input()) + 1
total = int(input())

cnt = 0

for i in range(coin_500):
    for j in range(coin_100):
        for k in range(coin_50):
            if 500 * i + 100 * j + 50 * k == total:
                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) :
            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())

cnt = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a * 10 + b * 2 + c == X // 50:
                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):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                n+=1
print(n)

Submission status: Accepted

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

print(num)

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

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:
# -*- coding: utf-8 -*-

A = int(input()) # 500円
B = int(input()) # 100円
C = int(input()) # 50円
X = int(input()) # 金額

ans = 0
tmp_x = 0

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

print(ans)

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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

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

print(ans)

Submission status: Accepted

Solution code:
A,B,C,X = map(int,open(0).read().split())
ans = 0

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

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

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

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    A, B, C, X = ii(), ii(), ii(), ii()

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


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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
# a,b=map(int,input().split())
# l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
count=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:
                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())
x /= 50
cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 10*i + 2*j + k == x:
                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):
      total = 500*i + 100*j + 50*k
      if total == 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 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())

A = min(A, X // A) if A > 0 else 0
B = min(B, X // B) if B > 0 else 0
C = min(C, X // C) if C > 0 else 0
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:
import sys
input = sys.stdin.readline

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

ans = 0
for ia in range(A+1):
    for ib in range(B+1):
        for ic in range(C+1):
            if 500*ia+100*ib+50*ic == X:
                ans +=1
print(ans)

Submission status: Accepted

Solution code:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def fiveh_num(n):
    return n*500
def oneh_num(n):
    return n*100
def fif_num(n):
    return n*50

count = 0
flag_1 = 0
a = input()
b = input()
c = input()
x = input()
while flag_1==0:
    while int(a)<0 and int(a)>50 and is_integer(a):
        print('a is failed')
        a = input()
    while int(b)<0 and int(b)>50 and is_integer(b):
        print('b is failed')
        b = input()
    while int(c)<0 and int(c)>50 and is_integer(c):
        print('c is failed')
        c = input()
    if int(a)+int(c)+int(c) < 1:
        print('a or b or c is failed ')
        a = input()
        b = input()
        c = input()
    else:
        flag_1 = 1
while is_integer(x) and int(x)<50 and int(x)>20000 and int(x)%50!=0:
    print('x is failed')
    x = input()

a_num = int(a)
b_num = int(b)
c_num = int(c)
x_num = int(x)

while 1:
    if a_num*500 > x_num:
        a_num -= 1
    elif a_num*500 == x_num:
        a_num -= 1
        count += 1
    elif a_num*500 < x_num:
        while 1:
            if a_num*500 + b_num*100 > x_num:
                b_num -= 1
            elif a_num*500 + b_num*100 == x_num:
                b_num -= 1
                count += 1
            elif a_num*500 + b_num*100 < x_num:
                while 1:
                    if a_num*500 + b_num*100 + c_num*50 > x_num:
                        c_num -= 1
                    elif a_num*500 + b_num*100 + c_num*50 == x_num:
                        c_num -= 1
                        count += 1
                    elif a_num*500 + b_num*100 + c_num*50 < x_num:
                        c_num = int(c)
                        break
                b_num -= 1
            if b_num < 0:
                b_num = int(b)
                break
        a_num -= 1
    if a_num < 0:
        break

print('{}'.format(count))

Submission status: Accepted

Solution code:
a=range(int(input())+1)
b=range(int(input())+1)
c=range(int(input())+1)
x=int(input())
res=0
import itertools
p=itertools.product(a,b,c)
for i in p:
    ans =500*i[0]+100*i[1]+50*i[2]
    if ans==x:res+=1
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a,b,c,x=map(int,open(0).read().split())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        if c*50 >= x - 500*i -100*j >= 0:
            ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(4)]
ans = 0
for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):        
            if 500*i+100*j+50*k == a[3]:
                ans += 1
print(ans)

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 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())
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 () )
o = 0
a = A
while a >= 0:
    b = B
    while b >= 0:
        c = C
        while c >= 0:
            m = 500*a + 100*b + 50*c
            if x == m:
                o += 1
            c -= 1
        b -= 1
    a -= 1
print (o)

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

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

Submission status: Accepted

Solution code:
int_list = [int(input()) for i in range(4)]
s = 0
for i in range(int_list[0]+1):
    if int_list[3] - (500 * i) > 0:
        for j in range(int_list[1]+ 1):
            if (int_list[3] - (500 * i) ) - (100 * j) == 0:
                s += 1
            else:
                for k in range(int_list[2] + 1):
                    if  (int_list[3] - (500 * i) ) - (100 * j) - (50 * k) == 0:
                        s += 1 
                        break
                    else:
                        continue
    elif int_list[3] - (500 * i) == 0:
            s += 1
print(s)

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:
from itertools import product


def main():
    c500 = int(input())
    c100 = int(input())
    c50 = int(input())
    target = int(input())

    count = 0
    for n_c500, n_c100, n_c50 in product(range(c500+1), range(c100+1),  range(c50+1)):
        if (n_c500*500+n_c100*100+n_c50*50 == target): count += 1
    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b,c,d = map(int, open(0))
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
a = int(input())#500y
b = int(input())#100y
c = int(input())#50y
x = int(input())

ans = 0

for i in range(a + 1):
    for j in range(b + 1):
        d = (x - (i * 500) - (j * 100)) // 50

        if d >= 0 and d <= c:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
A,B,C,X = map(int, open(0).read().split())

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for a_value in range(a + 1):
    for b_value in range(b+1):
        for c_value in range(c+1):
            answer_values.append(a_value * 500 + b_value * 100 + c_value * 50)

print(answer_values.count(x))

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

Submission status: Accepted

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

c = 0
for i in range(A + 1):
    if 500 * i > X:
        break
    for j in range(B + 1):
        if 500 * i + 100 * j > X:
            break
        K = X - 500 * i - 100 * j
        if K % 50 == 0:
            k = K / 50
            if k <= C:
                c += 1
print(c)

Submission status: Accepted

Solution code:
import math
def main():
  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+50*k==x:
          ans+=1
  print(ans)
  
main()

Submission status: Accepted

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

Submission status: Accepted

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