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

Submission status: Accepted

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

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 = cnt + 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


A = I()
B = I()
C = I()
X = I()
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:
def main():
    a = int(input())                    
    b = int(input())
    c = int(input())
    x = int(input())

    money = 0
    ans = 0

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

import itertools as it
ans = 0
for a,b,c in it.product(range(A+1), range(B+1), 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()) 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 500*a + 100*b + 50*c == x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

Solution code:
n =[]

for _ in range(4):
  n += map(int, input().split())

num = 0
  
for i in range(n[0]+1):
  for j in range(n[1]+1):
    for k in range(n[2]+1):
      total = 50*k + 100*j + 500*i
      if total == n[3]:
        num += 1
        
print(num)

Submission status: Accepted

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


def read():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    return A, B, C, X

def solve(A, B, C, X, XMAX=20001):
    dp = [[0 for j in range(XMAX)] for i in range(4)]
    dp[0][0] = 1
    for i, (v, c) in enumerate(zip([500, 100, 50], [A, B, C])):
        for x in range(XMAX):
            for j in range(c+1):
                if x - j * v >= 0:
                    dp[i+1][x] += dp[i][x - j * v]
    return dp[3][X]


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
A,B,C,X = [int(input()) for _ in range(4)]
print(sum([1 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]))

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())
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:
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/08
# Filename: main 
# Author: acto_mini

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())

target = int(input())

counter = 0


for i_500 in range(coin_500 + 1):
    # print('======= loop 500 =======')
    if i_500 * 500 > target:
        break

    for i_100 in range(coin_100 + 1):
        # print('-------- loop 100 ---------')
        if i_500 * 500 + i_100 * 100 > target:
            break

        for i_50 in range(coin_50 + 1):
            # print('........... loop 50 ..........')
            if i_500 * 500 + i_100 * 100 + i_50 * 50 == target:
                # print('match: ', i_500, i_100, i_50)
                counter += 1

print(counter)

Submission status: Accepted

Solution code:
def resolve():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = []
    for a in range(A + 1):
        for b in range(B + 1):
            c = (X - 500 * a - 100 * b) / 50
            if c <= C and c >= 0:
                ans.append((a, b, c))

    print((len(set(ans))))

    return

resolve()

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
su = int(input())
su_store = su
cnt =0
cnt4 =0
for a_ in range(a+1):
  if cnt4 ==0:
    su = su_store
    su -= 500*a_
   
    if su ==0:
      cnt +=1
      cnt4 +=1
    if su >0:
      cnt3 =0
      for b_ in range(b+1):      
        if cnt3 ==0:
          su -=100*b_
          if su ==0:
            cnt +=1
           
            cnt3 +=1
          if su >0:
            cnt2 = 0
            for c_ in range(c+1):
              if cnt2 ==0:
                su -=50*c_
                
                if su ==0:
                  cnt +=1
                  cnt2 +=1
                su +=50*c_
          su +=100*b_
print(cnt)

Submission status: Accepted

Solution code:
five = int(input()) + 1
hand = int(input()) + 1
fives = int(input()) + 1
ans = int(input()) 
tmp = 0
 
for i in range(five):
  for j in range(hand):
    for k in range(fives):
      ask = 500 * i + 100 * j + 50 * k
      if ans == ask:
        tmp = tmp + 1

print(tmp)

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())
c = 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:
                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):
        nomore = False
        for k in range(c+1):
            s = 500*i + 100*j + 50*k
            if s == x:
                ans += 1
            elif s > x:
                break
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:
import sys
input = sys.stdin.readline

coin_count = [int(input()) for _ in range(3)]
X = int(input())

result = 0
for i in range(min(X//500, coin_count[0]) + 1):
    for j in range(min((X - 500*i)//100, coin_count[1]) + 1):
        if 500 * i + 100 * j + 50 * coin_count[2] >= X:
            result += 1
print(result)

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = i()
b = i()
c = i()
x = i()

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

Submission status: Accepted

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

def cal(p,q,r):
  s=500*p+100*q+50*r
  return s

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      d=cal(i,j,k)
      if(d==x):
        ctr+=1

print(ctr)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[20]:


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


# In[22]:


ans = 0
for a in range(min(X//500+1, A+1)):
    for b in range(min((X-500*a)//100+1, B+1)):
        c = (X-500*a-100*b)//50
#         print(a,b,c)
        if c <= C:
            ans += 1
print(ans)


# In[ ]:

Submission status: Accepted

Solution code:
#ABC087-B
a = int(input())
b = int(input())
c = int(input())
x = int(input())

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

Submission status: Accepted

Solution code:
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
price = int(input())

count = 0

i = 0
while i <= coin500:
    j = 0
    while j <= coin100:
        k = 0
        while k <= coin50:
            if i * 500 + j * 100 + k * 50 == price:
                count += 1
            k += 1
        j += 1
    i += 1

print(count)

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

import bisect

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

def isInt(n):
	if isinstance(n, int):
		return True
	else:
		return n.is_integer()

a = readInt()
b = readInt()
c = readInt()
x = readInt()

ans = 0

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

ans = 0
for ai in range(A+1):
  for bi in range(B+1):
    for ci in range(C+1):
      if 10*ai + 2*bi + ci == X:
        ans += 1
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for i in range(a+1):
  for j in range(b+1):
    if i==0 and j==0:
      for k in range(c):
        if (x/50)-(10*i+2*j+(k+1))==0:
          ans += 1
    else:
      for k in range(c+1):
        if (x/50)-(10*i+2*j+k)==0:
          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 d == 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())/50
ans=0
for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      if x==10*i+2*j+k:
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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):
            Yen = 500 * a + 100 * b + 50 * c
            if (X == Yen):
                ans += 1

print(ans)

Submission status: Accepted

Solution code:
# n = int(input())
# a = map(int,input().split())
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:
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    xa = 500
    xb = 100
    xc = 50

    Count = 0

    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
              if (xa * i + xb * j + xc * k) == X:
                  Count += 1
    print(Count)

main()

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

Submission status: Accepted

Solution code:
def main():
    coin_a = int(input())
    coin_b = int(input())
    coin_c = int(input())
    total_money = int(input())
    result_count = 0

    for i in range(coin_a+1):
        for j in range(coin_b+1):
            for k in range(coin_c+1):
                if i * 500 + j * 100 + k * 50 == total_money:
                    result_count += 1

    print(result_count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def check_money(a, b, c, total, results):
    if a * 500 + b * 100 + c * 50 == total:
        check = str(a) + ',' + str(b) + ',' + str(c)
        for result in results:
            if check in result:
                break
        else:
            results.append(check)
        return results
    else:
        return results


def main():
    coin_a = int(input())
    coin_b = int(input())
    coin_c = int(input())
    total_money = int(input())
    result = list()

    for coin_a_count in range(coin_a+1):
        if coin_a_count <= coin_a:
            for coin_b_count in range(coin_b+1):
                if coin_b_count <= coin_b:
                    for coin_c_count in range(coin_c+1):
                        if coin_c_count <= coin_c:
                            result = check_money(coin_a_count, coin_b_count, coin_c_count, total_money, result)

    print(result.__len__())


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import deque

a, b, c, x = [int(input()) for i in range(4)]
d = min(x // 500, a)
e = min((x - d * 500) // 100, b)
f = min((x - d * 500 - e * 100) // 50, c)
y = deque([[d, e, f]])
if d * 500 + e * 100 + f * 50 < x:
    print(0)
else:
    g = 1
    y.append([d, e, f])
    s, t, u = y.popleft()
    while s > 0:
        s -= 1
        t += 5
        y.append([s, t, u])
        if t <= b:
            g += 1
    while y:
        s, t, u = y.popleft()
        while t > 0:
            t -= 1
            u += 2
            if u > c:
                break
            if t <= b:
                g += 1
    print(g)

Submission status: Accepted

Solution code:
a = int(input())  # 500
b = int(input())  # 100
c = int(input())  # 50
x = int(input())
k = 0
for d in range(a + 1):
  for e in range(b + 1):
    for f in range(c + 1):
      if d * 500 + e * 100 + f * 50 == x:
        k += 1
print(k)

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

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
total = int(input())
count = 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) == total:
                count = count + 1;


print(count);

Submission status: Accepted

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

Submission status: Accepted

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

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

l = []
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            l.append([i, j, k])
count = 0
for i in range(len(l)):
    sum = l[i][0] * 500 + l[i][1] * 100 + l[i][2] * 50
    if sum == x:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a, b, c, money = [int(input()) for i in range(4)]
counter = 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 == money:
        counter += 1
        
print(counter)

Submission status: Accepted

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

print(result)

Submission status: Accepted

Solution code:
a = list(map(int,open(0).read().split()))
res = 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]: res+=1
print(res)

Submission status: Accepted

Solution code:
#Coins
def ABC_87_B():
    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):
                s=i*500+j*100+k*50
                if s == X:
                    count+=1

    print(count)


if __name__ == '__main__':

    ABC_87_B()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input_list = [int(input()) for i in range(4)]
number_of_coins = [input_list[0],input_list[1],input_list[2]]

price = input_list[3]

pattern = 0 

for i in range(number_of_coins[0]+1):
  for j in range(number_of_coins[1]+1):
    for k in range(number_of_coins[2]+1):
      if(500 * i + 100 * j + 50 * k == price):
          pattern += 1

print(pattern)

Submission status: Accepted

Solution code:
FHY = int(input())
OHY = int(input())
FTY = int(input())
X = int(input())
a = X // 500
b = X // 100
c = X // 50
l1 = min(FHY,a)
l2 = min(OHY,b)
l3 = min(FTY,c)

count = 0

for i in range(l1+1):
    for j in range(l2+1):
        for k in range(l3+1):
            temp = (i * 500) + (j * 100) + (k *50)
            if temp == 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 i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            price = 500*i + 100*j + 50*k
            if price == 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 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
s = 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:
                count += 1

print("{}".format(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):
    sum = 500 * a
    if sum == X:
        ans += 1
        break
    elif sum > X:
        break
    else:
        d = X - sum
        for b in range(B + 1):
            for c in range(C + 1):
                t = 100 * b + 50 * c
                if t == d:
                    ans += 1
                    break
                elif t > d:
                    break
                else:
                    continue

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,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())
N = 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 == N:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

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

Submission status: Accepted

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


def solve(A: int, B: int, C: int, X: int):
    ans = 0
    for yen500 in range(0, A + 1):
        for yen100 in range(0, B + 1):
            for yen50 in range(0, C + 1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == X:
                    ans += 1

    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
from itertools import product
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for a, b, c in product(range(A + 1), range(B + 1), 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())
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:
#import numpy as np
#from itertools import combinations as comb
from itertools import combinations_with_replacement as comb_with
A = int(input())
#A,B= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

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

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