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

print(ans)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
list=[]
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            list.append(500*i+100*j+50*k)
print(list.count(x))

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

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

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

Submission status: Accepted

Solution code:
c500 = int(input())
c100 = int(input())
c50 = int(input())
t = int(input())
s = 0

for a in range(0, c500 + 1):
    for b in range(0, c100 + 1):
        for c in range(0, c50 + 1):
            if 500*a + 100*b + 50*c == t:
                s = s + 1
print(s)

Submission status: Accepted

Solution code:
a,b,c,x=eval('int(input())+1,'*4);print(sum(c>x/50-I//b*10-I%b*2>0for I in range(a*b)))

Submission status: Accepted

Solution code:
import numpy as np
import sys

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

count = 0
X_rest = 0


for i in range(A + 1):
    X_rest = X - 500 * i
    if X_rest < 0:
        print(count)
        sys.exit()
    elif X_rest == 0:
        count += 1
        continue
    for j in range(B + 1):
        X_rest = X - 500 * i
        X_rest = X_rest - 100 * j
        if X_rest == 0:
            count += 1
            
            continue

        elif X_rest >= 0 and X_rest % 50 == 0 and X_rest / 50 <= C:
            count += 1
         

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(A+1):
    for j in range(B+1):
        goukei = 500*i+100*j
        if 0 <= (X-goukei)/50 <= C:
            pattern+=1
print(pattern)

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

X //= 50
ans = 0
for a in range(A+1):
    tmp = 10*a
    if tmp > X:
        break
    for b in range(B+1):
        tmpB = 2*b+tmp
        if tmpB > X:
            break
        else:
            r = X-tmpB
            if r <= C:
                ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(number)

Submission status: Accepted

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

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
	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)
		
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc087/tasks/abc087_b

import itertools
import collections
import bisect

def main():
    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):
            rest = X - 500 * a - 100 * b
            if 0 <= rest <= 50 * C:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 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):
        k = x - i*500 - j*100
        if k >= 0 and k // 50 <= c:
            count += 1
print(count)

Submission status: Accepted

Solution code:
a,b,c,d=[int(input()) for i in range(4)]
print([500*x+100*y+50*z for x in range(a+1) for y in range(b+1) for z in range(c+1)].count(d))

Submission status: Accepted

Solution code:
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 x == ai*500 + bi* 100 + ci*50:
				count+=1
				
print(count)

Submission status: Accepted

Solution code:
### ABC087B - 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())

cnt = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if(k*50+j*100+i*500 == 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 (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())
pattern = 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:
                pattern += 1
print(pattern)

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    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 = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

if(X >= 500):
 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)

else:
 for j in range(B+1):
    for k in range(C+1):
      if((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())
num = 0

# a:500yen b:100yen c:50yen x:sum_kingaku

for i in range(a+1):
    if 500 * i == x:
        num = num + 1
        break
    
    elif 500 * i > x:
        break
    
    else:
        for j in range(b+1):
            if 500 * i + 100 * j == x:
                num = num + 1
                break

            elif 500 * i + 100 * j > x:
                break

            else:
                for k in range(c+1):
                    if 500 * i + 100 * j + 50 * k == x:
                        num = num + 1
                        break

                    elif 500 * i + 100 * j + 50 * k > x:
                        break

print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
count = 0

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
A = int(input())
B = int(input())
C = int(input())
X = int(input()) // 50
ans = 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:
                ans += 1
print(ans)

Submission status: Accepted

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

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:
from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
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 X == 500*i+100*j+50*k:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
c500=int(input())
c100=int(input())
c50=int(input())
x=int(input())
a=0
for i in range(c500+1):
    for j in range(c100+1):
        for k in range(c50+1):
            amount=k*50+j*100+i*500
            if amount==x:
                a+=1
print(a)

Submission status: Accepted

Solution code:
count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())

count=0
for i in range(count_500+1):
  for j in range(count_100+1):
    for k in range(count_50+1):
      if target==500*i+100*j+50*k:
        count+=1
print(count)

Submission status: Accepted

Solution code:
count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())

count = 0
for i in range(count_500+1):
    for j in range(count_100+1):
        for k in range(count_50+1):
            if target == 500 * i + 100 * j + 50 * k:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,x=[int(input()) for i in range(4)]
cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 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())
maxa = min([a,x//500])
maxb = min([b,x//100])
maxc = min([c,x//50])
count = 0
for i in range(maxa + 1):
    for j in range(maxb + 1):
        for k in range(maxc + 1):
            if 10*i + 2*j + k == x/50:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

out_sum = 0
cnt = 0

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

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 16:15:21 2019

@author: yuta
"""

def coin(a,b,c,x):
    count = 0
    for i in range(a + 1):
        for j in range(b + 1):
            for k in range(c + 1):
                d = 500 * i + 100 * j + 50 * k
                if d == x:
                    count += 1
    print(count)

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

coin(a,b,c,x)

Submission status: Accepted

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

Submission status: Accepted

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

n = 0
for fiveHundred in range(a+1):
    for hundred in range(b+1):
        for fifty in range(c+1):
            if x == 500*fiveHundred + 100*hundred + 50*fifty:
                n +=1

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = list(map(lambda x: x * 500, range(A + 1)))
b = list(map(lambda x: x * 100, range(B + 1)))
c = list(map(lambda x: x * 50, range(C + 1)))

counter = 0

for i in a:
    for p in b:
        for o in c:
            if (i + p + o) == X:
                counter += 1

print(counter)

Submission status: Accepted

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

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


def only_hun_fif(b,c,m):
    count=0
    for i in range(b+1):
        if m-(i*100)<=50*c and m-(i*100)>=0:
            count+=1

            
    return count
        
count=0

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

Submission status: Accepted

Solution code:
c = [500,100,50]
a = []
for i in range(3):
    a.append(int(input()))
x = int(input())

def dfs(d,y):
    if d == 3:
        if y == x:
            return 1
        return 0

    ret = 0
    for i in range(a[d]+1):
        ret += dfs(d+1, y+c[d]*i)
    return ret

print(dfs(0,0))

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):
        x = X - (a*500+b*100)
        if x < 0:
            break
        if (x % 50 == 0) and (x / 50 <= C):
            count += 1
print(count)

Submission status: Accepted

Solution code:
a, b, c, x = [int(d[0]) for d in [input().split() for _ in range(4)]]
cnt = 0
for o in range(a+1):
    for p in range(b+1):
        for q in range(c+1):
            if o * 500 + p * 100 + q * 50 == x:
                cnt += 1
print(cnt)

Submission status: Accepted

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

if X % 50:
    print(k)
else:
    maxA = min(X // 500, A)
    for i in range(maxA + 1):
        d = X - 500 * i
        maxB = min(d // 100, B)
        for j in range(maxB + 1):
            dd = d - 100 * j
            if dd // 50 <= C:
                k += 1
    print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
la = [500 * i for i in range(int(input())+1)]
lb = [100 * i for i in range(int(input())+1)]
lc = [50 * i for i in range(int(input())+1)]
d = int(input())
r = list(itertools.product(la, lb, lc))
ans = 0

for s in r:
  if sum(s) == d:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(c>x/50-I//b*10-I%b*2>0for I in range(a*b)))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(c>x/50-s*10-t*2>0for s in range(a)for t in range(b)))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(x-1==(10*s+2*t+r)*50for s in range(a)for t in range(b)for r in range(c)))

Submission status: Accepted

Solution code:
R=range;a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(x-1==(10*s+2*t+r)*50for s in R(a)for t in R(b)for r in R(c)))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())+1for _ in[0]*4];print(sum(1for s in range(a)for t in range(b)for r in range(c)if x-1==(10*s+2*t+r)*50))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())+1for _ in[0]*4];print(len([0for s in range(a)for t in range(b)for r in range(c)if x-1==(10*s+2*t+r)*50]))

Submission status: Accepted

Solution code:
a,b,c,x=[int(input())for _ in[0]*4];print(len([0for s in range(a+1)for t in range(b+1)for r in range(c+1)if x==(10*s+2*t+r)*50]))

Submission status: Accepted

Solution code:
i=lambda:int(input());a,b,c,x=i(),i(),i(),i();print(len([0for s in range(a+1)for t in range(b+1)for r in range(c+1)if x==(10*s+2*t+r)*50]))

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())#50*x 50~20000

l=[]
count=0

for i in range(A+1):#+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)
"""
for i in range(A):
	if(X>=500*i):
		Y=X-500*i
		print(Y)
		a+=1
	for j in range(B):
		if(Y>=100*j):
			Z=Y-100*j
			print(Z)
			b+=1
"""

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())
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())
cnt=0
for i in range(0,int(a)+1):
    # print("i=%d" % i)
    for j in range(0,int(b)+1):
        # print("j=%d" % j)
        for k in range(0,int(c)+1):
            # print("k=%d" % k)
            if i*500+j*100+k*50 == x:
                # print(i*500+j*100+k*50)
                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()) for _ in range(3)]
N=int(input())
ans=0

for i in range(A[0]+1):
  for j in range(A[1]+1):
    for k in range(A[2]+1):
      if N==(500*i+100*j+50*k):
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())

ways = 0
for i in range(1+count_500):
    for j in range(1+count_100):
        for k in range(1+count_50):
            if target == 500*i+100*j+50*k:
                ways +=1
print(ways)

Submission status: Accepted

Solution code:
a=int(input())#500
b=int(input())#100
c=int(input())#50
x=int(input())#sum
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())

num = 0
for i in range(0,A+1):
    for ii in range(0,B+1):
        for iii in range(0,C+1):
            t = i*500 + ii*100 + iii*50
            if t ==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 i in range(a+1):
    for j in range(b+1):
        rest = x- (i*500 + j*100)
        # print(i,j,rest//50,rest)
        if 0<=rest and rest//50 <=c:
            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(500*i + 100*j + 50*k == X):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a,b,c,x=int(input()),int(input()),int(input()),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, b, c, x = int(raw_input()), int(raw_input()), int(raw_input()), int(raw_input())
def calc(a, b, c, x, m) :
    if not x : 
        return 1

    result = 0
    if m >= 500 and x >= 500 and a :
        result += calc(a - 1, b, c, x - 500, 500)
    if m >= 100 and x >= 100 and b :
        result += calc(a, b - 1, c, x - 100, 100)
    if x >= 50 and c:
        result += calc(a, b, c - 1, x - 50, 50)
    
    return result


print calc(a, b, c, x, x)

Submission status: Accepted

Solution code:
nums = [input() for i in range(3)]
A,B,C = map(int,nums)
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:
int_a = int(input())
int_b = int(input())
int_c = int(input())
int_x = int(input())

int_pattern = 0

for a in range(int_a + 1):
    for b in range(int_b + 1):
        for c in range(int_c + 1):
            if 500 * a + 100 * b + 50 * c == int_x:
                int_pattern = int_pattern + 1

print(int_pattern)