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:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    cnt = 0
    for i in range(a + 1):
        y = x - 500 * i
        if y <= 0:
            if y == 0:
                cnt += 1
            break
        for j in range(b + 1):
            z = y - 100 * j
            if z <= 0:
                if z == 0:
                    cnt += 1
                break
            if z // 50 <= c:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B - Coins
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())
dp = [0 for i in range(1010)]
dp[0] = 1
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, C + 1):
            dp[i + 1 * j] += dp[i]
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, B + 1):
            dp[i + 2 * j] += dp[i]
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, A + 1):
            dp[i + 10 * j] += dp[i]
print(dp[X // 50])

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

print(cnt)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a = I()
    b = I()
    c = I()
    x = I() // 50
    r = [0] * (x+1)
    r[0] = 1
    u = [0] * (x+1)
    for i in range(c):
        if i+1 > x:
            break
        r[i+1] = 1
    for i in range(1,b+1):
        for j in range(x):
            if i*2+j > x:
                break
            u[i*2+j] += r[j]
    for i in range(x+1):
        r[i] += u[i]
    u = [0] * (x+1)
    for i in range(1,a+1):
        for j in range(x):
            if i*10+j > x:
                break
            u[i*10+j] += r[j]
    for i in range(x+1):
        r[i] += u[i]

    return r[x]



print(main())

Submission status: Accepted

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

Ans = 0

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

print(Ans)

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(4)]
yen500 = a[0]
yen100 = a[1]
yen50 = a[2]
target = a[3]

count = 0
for i1 in range(yen500+1):
  for i2 in range(yen100+1):
    for i3 in range(yen50+1):
      if i1*500 + i2*100 + i3*50 == target:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a, b, c, x = [int(input()) for _ in range(4)]
cnt = 0
for ai in range(0, a+1):
    for bi in range(0, b+1):
        for ci in range(0, c+1):
            if 500*ai + 100*bi + 50*ci == x:
                cnt += 1
print(cnt)

Submission status: Accepted

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

ANS = []
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            ans = 500*i + 100*j + 50*k
            if X == ans:
                 ANS.append(ans)
print(len(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:
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！

A = int(input())
B = int(input())
C = int(input())
X = int(input())
correct_count = 0
for A_i in range (A+1):
    for B_i in range(B+1):
        for C_i in range(C+1):
            if X == 500*A_i+100*B_i+50*C_i:
                correct_count = correct_count + 1
print(correct_count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = 0
ai = 0
while True:
    asum = 500*ai
    if asum > x or ai > a:
        break
    bi = 0
    while True:
        bsum = asum + bi*100
        if bsum > x or bi > b:
            break
        ci = 0
        while True:
            csum = bsum + ci*50
            if csum > x or ci > c:
                break
            if csum == x:
                num += 1
            ci += 1
        bi += 1
    ai += 1
print(num)

Submission status: Accepted

Solution code:
def calc(A, B, C, X):
    result = 0
    for i in range(A + 1):
        for j in range(B + 1):
            res = X - 500 * i - 100 * j
            if res >= 0 and res / 50 <= C:
                result += 1

    return result


if __name__ == '__main__':
    A = int(input())  # 500 yen coin
    B = int(input())  # 100 yen coin
    C = int(input())  # 50 yen coin
    X = int(input())

    print(calc(A, B, C, X))

Submission status: Accepted

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

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

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

print(yen.count(int(input())))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(4)]
count = 0
for i in range(l[0]+1):
    for j in range(l[1]+1):
        for k in range(l[2]+1):
            if (i*500+j*100+k*50)==l[3]:
                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):
            if x == (500 * i + 100 * j + 50 * k):
                cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
ans = 0
fhun = int(input())
hun = int(input())
fif = int(input())
money = int(input())
for i in range(fhun + 1):
  for j in range(hun + 1):
    for l in range(fif + 1):
      if (500 * i + 100 * j + 50 * l) == money:
        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):
                reX = (X - 500*i - 100*j)//50
                if 0 <= reX <= C:
                        count+=1
   
   
print(count)

Submission status: Accepted

Solution code:
def getInt():
	return int(input())

A = getInt()
B = getInt()
C = getInt()
X = getInt()

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
print ans

Submission status: Accepted

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

c = 0
ans = 0

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

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
l = 0
 
def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (500 * a + 100 * b + 50 * c < x):
			return 0
		elif (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0
 
ans = pattern(a, b, c, x)
 
print(ans)

Submission status: Accepted

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

l = 0

def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (500 * a + 100 * b + 50 * c < x):
			return 0
		elif (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0

ans = pattern(a, b, c, x)

print(ans)

Submission status: Accepted

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

l = 0

def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0

ans = pattern(a, b, c, x)

print(ans)

Submission status: Accepted

Solution code:
import sys

if __name__ == "__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):
                tmp = i * 500 + j * 100 + k * 50
                if tmp == X: pattern += 1
    print(pattern)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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

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

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

print(n)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
coinA = int(input())
coinB = int(input())
coinC = int(input())
want = int(input())
ways = 0
i = 0
while i <= coinA:
    j = 0
    while j <= coinB:
        k = 0
        while k <= coinC:
            if i*500 + j*100 + k*50 == want:
                ways = ways + 1
            k = k + 1
        j = j + 1
    i = i + 1
print(ways)

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:
def number_of_ways(a, b, c, x):
    ways = 0
    for a_count in range(a + 1):
        for b_count in range(b + 1):
            for c_count in range(c + 1):
                temp_sum = 500 * a_count + 100 * b_count + 50 * c_count
                if temp_sum == x:
                    ways += 1
    return ways

if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    print(number_of_ways(a, b, c, x))

Submission status: Accepted

Solution code:
A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
X = int(raw_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 = map(int, open(0).read().split())
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:
#abc087b

a=int(raw_input())
b=int(raw_input())
c=int(raw_input())
x=int(raw_input())

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

Submission status: Accepted

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

import sys

a = int(raw_input().split()[0])
b = int(raw_input().split()[0])
c = int(raw_input().split()[0])
x = int(raw_input().split()[0])
n = 0
for an in range(0, a + 1):
    if 500*an > x:
        break
    for bn in range(0, b + 1):
        if (500*an + 100*bn) > x:
            break
        for cn in range(0, c + 1):
            if (500*an + 100*bn + 50*cn) > x:
                break
            if (500*an + 100*bn + 50*cn) == x:
                n += 1
              
sys.stdout.write('%d\n' % n)
sys.stdout.flush()

Submission status: Accepted

Solution code:
import itertools

info = [int(input()) for i in range(4)]
A = (i for i in range(info[0]+1))
B = (i for i in range(info[1]+1))
C = (i for i in range(info[2]+1))

P_L = list(itertools.product(A, B, C))
ans = 0

for ele in P_L:
    if 500*ele[0] + 100*ele[1] + 50*ele[2] - info[3] == 0: 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):
    if 500 * i <= x:
        y=x - 500 * i
        for j in range(b+1):
            if j * 100 <= y:
                z=y - 100 * j
                for k in range(c+1):
                    if z - k * 50 == 0:
                        n += 1
print(n)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
y=0
d=0
s=0
t=0
u=0
for i in range(a+1):
    t=0
    u=0
    if s==0: 
        y=500*i
        if x < y:
            s =1
        else:
            for j in range(b+1):
                u=0
                if t==0:
                    y=500*i+100*j
                    if x < y:
                        t=1
                    else:
                        for k in range(c+1):
                            if u==0:
                                y=500*i+100*j+50*k
                                if x==y:
                                    d=d+1
                                    u=1
print(str(d))

Submission status: Accepted

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

A_list = list()
for i in range(A+1) :
    A_list.append(i*500)
B_list = list()
for i in range(B+1) :
    B_list.append(i*100)
C_list = list()
for i in range(C+1) :
    C_list.append(i*50)

count = 0
for a in A_list :
    for b in B_list :
        for c in C_list :
            if (a + b + c) == X :
                count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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 a in range(A + 1):
  for b in range(B + 1):
    for c in range(C + 1):
      charge = 500 * a + 100 * b + 50 * c
      if charge == X:
        ans += 1
print(ans)

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


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


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

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            # print(i, j, k)
            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())

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

    for j in range(b + 1): # 100
        if i * 500 + j * 100 == x:
            count += 1
            continue

        if 0 <= x - i * 500 - j * 100 <= 50 * c:
            count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

	count = 0
	for i in range(a+1):
		y = x- 500*i
		if y == 0:
			count += 1
			continue
		if y > 0:
			for j in range(b+1):
				z = y - j*100
				if z == 0:
					count += 1
					continue
				if z > 0:
					for k in range(c+1):
						if int(z-50*k) == 0:
							count += 1
							break

	print (count)

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
a, b, c, x = (int(input()), int(input()), int(input()), int(input()))
factor = []
for tmp in range(a+1):
    for tmp2 in range(b+1):
        for tmp3 in range(c+1):
            if 500*tmp+100*tmp2+50*tmp3 == x:
                factor.append((tmp,tmp2,tmp3))
print(len(factor))

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc087/tasks/abc087_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B, C, X):
    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
    return ans


def main(args):
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = solve(A, B, C, X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

for i in range(a+1):
    for j in range(b+1):
        y=(x-500*i-100*j)//50
        if (x-500*i-100*j)% 50 ==0 and y>=0 and y<=c:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
def solve(A, B, C, X):
    ans = 0
    for i in range(A+1):
        for j in range(B+1):
            Y = 500*i + 100*j
            if ((X-Y) % 50 == 0) and (0 <= (X-Y) / 50 <= C):
                ans += 1
    return ans
print solve(input(), input(), input(), input())

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

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

Submission status: Accepted

Solution code:
A,B,C,X = tuple(int(input()) for i in range(4))
ans = 0
for a in range(51):
    for b in range(51):
        c = (X - 500*a - 100*b) // 50
        if c >= 0 and a <= A and b <= B and c <= C:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=[1+int(input())for i in[0]*4];print(sum(1if~-x==500*i+100*j+50*k else 0for k in range(c)for j in range(b)for i in range(a)))

Submission status: Accepted

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

n = 0
i = 0
while i * 500 <= x and i <= a:
    if i * 500 == x:
        n += 1
#        print 10
    else:
        y = x - i * 500
        j = 0
        while j * 100 <= y and j <= b:
            if j * 100 == y:
                n += 1
#                print 20
            else:
                z = y - j * 100
                if z / 50 <= c:
                    n += 1
#                    print 30
            j += 1
    i += 1

print n

Submission status: Accepted

Solution code:
import numpy as np

a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

n = 0
i = 0
while i * 500 <= x and i <= a:
    if i * 500 == x:
        n += 1
#        print 10
    else:
        y = x - i * 500
        j = 0
        while j * 100 <= y and j <= b:
            if j * 100 == y:
                n += 1
#                print 20
            else:
                z = y - j * 100
                if z / 50 <= c:
                    n += 1
#                    print 30
            j += 1
    i += 1

print n

Submission status: Accepted

Solution code:
n500 = int(input())
n100 = int(input())
n50 = int(input())
sum = int(input())

conb = 0
for i in range(n500 + 1):
    for j in range(n100 + 1):
        for k in range(n50 + 1):
            if 500 * i + 100 * j + 50 * k == sum:
                conb += 1
print(conb)

Submission status: Accepted

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

a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

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

print str(count)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=int(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:
from sys import stdin
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
n = int(stdin.readline())
ans = 0
for i in xrange(a+1):
 for j in xrange(b+1):
  for k in xrange(c+1):
   if i * 500 + j*100 + k*50 ==n:
    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):
    if i * 500 > X:
        continue
    for j in range(B+1):
        if i * 500 + j * 100 > X:
            continue
        for k in range(C+1):
            if i * 500 + j * 100 + k * 50 > X:
                break
            elif i * 500 + j * 100 + k * 50 == X:
                count += 1

print(count)

Submission status: Accepted

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

count = 0

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

Submission status: Accepted

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

V = [500, 100, 50]

count = 0
ans = 0
def add(a, b, c):
    global ans
    count = V[0]*a + V[1]*b + V[2]*c
    if count==X:
        ans += 1
    return count

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            add(a, b, c)

print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
import sys
import math
a, b, c, x = map(int, sys.stdin.read().split("\n")[:4])
r = 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:
        r += 1
print(r)