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

def main():
    a_500 = int(input())
    b_100 = int(input())
    c_50 = int(input())
    x = int(input())
    count = 0

    for a in range(a_500 + 1):
        if ((500 * a) > x):
            continue
        for b in range(b_100 + 1):
            if ((500 * a) > x):
                continue
            for c in range(c_50 + 1):
                if ((500 * a) > x):
                    continue
                if (((500 * a) + (100 * b) + (50 * c)) == x):
                    count += 1

    print(count)

if __name__ == '__main__':
    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 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())
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())
X=int(input())

x=[(i,j,k)for i in range(A+1) for j in range(B+1) for k in range(C+1)]
count=0
for i,j,k in x:
    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 yen_500 in range(A+1):
    for yen_100 in range(B+1):
        for yen_50 in range(C+1):
            value = 500 * yen_500 + 100 * yen_100 + 50 * yen_50
            if value == X:
                cnt += 1

print(cnt)

Submission status: Accepted

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

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:
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:
if __name__ == "__main__":
    A = int(input())
    B = int(input())    
    C = int(input())        
    X = int(input())
    result = 0
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(C + 1):
                cost = a * 500 + b * 100 + c * 50
                if cost == X:
                    result += 1
    print (result)

Submission status: Accepted

Solution code:
a, b, c, x = map(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 x - 500 * i - 100 * j - 50 * k == 0:
                        ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a + 1):
    if x - (500 * i) >= 0:
        x_0 = x - (500 * i)
        for j in range(b + 1):
            if x_0 - (100 * j) >= 0:
                x_1 = x_0 - (100 * j)
                for k in range(c + 1):
                    if x_1 - (50 * k) == 0:
                        ans += 1
print(ans)

Submission status: Accepted

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

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 + 50 * c == X:
                ans += 1
print(ans)

Submission status: Accepted

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

def main():
    a = [500 * k for k in range(A + 1)] # e.g. if A = 1, returns [0, 500]
    b = [100 * j for j in range(B + 1)]
    c = [ 50 * i for i in range(C + 1)]
    results = [am + bm + cm for am in a
                            for bm in b
                            for cm in c]
    result = results.count(X)
    print(result)

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

print(count)

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

print(t)

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 x - 500*i - 100*j - 50*k == 0:
                t += 1

print(t)

Submission status: Accepted

Solution code:
import itertools


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

    ans = 0

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

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

print(count)

Submission status: Accepted

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

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

cand = [(i, j, k) for i in range(A+1) for j in range(B+1) for k in range(C+1)]
count = 0

for c in cand:
    if 500*c[0] + 100*c[1] + 50*c[2] == X:
        count += 1
        
print(count)

Submission status: Accepted

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

count=0

for a in range(A+1):
    for b in range(B+1):
        r=x-a*10-b*2
        if r>=0 and r<=C:
            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):
            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())

a = [i for i in range(0,A*500+1,500)]
b = [i for i in range(0,B*100+1,100)]
c = [i for i in range(0,C*50+1,50)]
sum=0

for i in range(len(a)):
    for j in range(len(b)):
        for l in range(len(c)):
            if X == a[i] + b[j] + c[l]:
                sum = sum + 1
print(sum)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(0,A+1):
    Xa  = X - 500*a
    if Xa < 0:
        break
    for b in range(0,B+1):
        Xab = Xa - 100*b
        if Xab < 0:
            break
        for c in range(0,C+1):
            Xabc = Xab - 50*c
            if Xabc == 0:
                count += 1
                break
                
print(count)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(len({(a, b, c)
      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}))

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 (str(i) + " " + str(j) + " " + str(k)) == x:
			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())

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

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

count=0
for i in range(A+1):
    for j in range(B+1):
        remain=X-i*500-j*100
        if remain >=0 and remain%50==0 and remain/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:
def solve(a,b,c,x):
    count = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                if 500*i+100*j+50*k == x:
                    count += 1
    return count

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

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

Submission status: Accepted

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

for a in range(min(A, X // 500) + 1):
    leave500 = X - a * 500
    for b in range(min(B, leave500 // 100) + 1):
        leave100 = leave500 - b * 100
        if leave100 // 50 <= C and leave100 % 50 == 0:
            count += 1

print(count)

Submission status: Accepted

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

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

count = 0

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    five_hundred_yen_count = int(input())
    one_hundred_yen_count = int(input())
    fifty_yen_count = int(input())
    total_yen = int(input())

    pattern_count = 0

    for i in range(five_hundred_yen_count + 1):
        for j in range(one_hundred_yen_count + 1):
            for k in range(fifty_yen_count + 1):
                summed_yen = 500 * i + 100 * j + 50 * k

                if total_yen - summed_yen == 0:
                    pattern_count += 1

    print(pattern_count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
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:
n1 = int(raw_input())
n2 = int(raw_input())
n3 = int(raw_input())
x = int(raw_input())

y1 = 500
y2 = 100
y3 = 50

n = 0
for i in range(min(n1,x/y1)+1):
  xn = x - i*y1
  for j in range(min(n2,xn/y2)+1):
    xn = x - i*y1 - j*y2
    if (0<=xn<=n3*y3):
      n += 1
      k = xn/y3
      #print i, j, k, y1*i+y2*j+y3*k
print n

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 (X== 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())
N500 = X // 500
R1 = X % 500
N100 = R1 // 100
R2 = R1 % 100
N50 = R2 // 50
count = 0
if R2 % 50 != 0:
	print(count)
	exit(0)
li = []
while N500>=0:
	while N100>=0:
		li.append((N500, N100, N50))
		N100 -= 1
		N50 += 2
	N100 = (N50 - 2) // 2
	N50 = (N50 - 2) % 2
	N500 -= 1
	N100 += 5

for n500, n100, n50 in li:
	if n500<=A and n100<=B and n50<=C:
		count += 1

print(count)

Submission status: Accepted

Solution code:
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
X = int(input())
count = 0

for i in range(coin500, -1, -1):
    if i*500 > X:
        continue
    for j in range(coin100, -1, -1):
        if i*500 + j*100 > X:
            continue
        for k in range(coin50, -1, -1):
            if 500*i+100*j+50*k == X:
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n500 = int(input())
n100 = int(input())
n50 = int(input())
X=int(input())
count = 0
for i500 in range(n500+1):
    for i100 in range(n100+1):
        for i50 in range(n50+1):
            if i500*500+i100*100+i50*50==X:
                count+=1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

if a * 500 + b *100 + c * 50 < x:
    print(0)
else:
    count = 0
    for a_n in range(a+1):
        for b_n in range(b+1):
            for c_n in range(c+1):
                if (a_n * 500) + (b_n * 100) + (c_n * 50) == x:
                    count += 1
                else:
                    continue
    print(count)

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

cnt = 0

for a in range(A+1):
    S1 = a*500
    if S1 > X:
        break
    for b in range(B+1):
        S2 = S1 + b*100
        if S2 > X:
            break
        for c in range(C+1):
            S3 = S2 + c*50
            if S3 > X:
                break

            if S3 == 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:
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


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

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

print(ans)

Submission status: Accepted

Solution code:
GI = lambda: int(raw_input()); GIS = lambda: map(int, raw_input().split())

def main():
  A = GI()
  B = GI()
  C = GI()
  X = GI()

  waze = 0
  for a in xrange(A+1):
    for b in xrange(B+1):
      left = X - (a * 500 + b * 100)
      if left >= 0 and left / 50 <= C:
        waze += 1

  print(waze)

main()

Submission status: Accepted

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

Submission status: Accepted

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

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
a = 0
while a <= A:
    b = 0
    c = 0
    A_price = 500 * (a)
    while b <= B:
        c = 0
        B_price = 100 * b
        while c <= C:
            C_price = 50 * c
            if A_price + B_price + C_price == X:
                count += 1
            c += 1
        b += 1
    a += 1
print count

Submission status: Accepted

Solution code:

def solve(A, B, C, X):
    r = 0
    for i in range(0, A + 1):
        for j in range(0, B + 1):
            t = i * 500 + j * 100
            if t > X:
                break
            if 0 <= (X - t) / 50 <= C:
                r += 1
    return r

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

if __name__ == '__main__':
    print(solve(A, B, C, X))

Submission status: Accepted

Solution code:

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

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

if __name__ == '__main__':
    print(solve(A, B, C, X))

Submission status: Accepted

Solution code:
def fc(c, x):
    if(x > c * 50):
        return 0;
    return 1;

def fb(b, c, x):
    ans = 0;
    if(b > 0 and x >= 100):
        ans += fb(b-1, c, x-100);
    ans += fc(c, x);
    return ans;

def fa(a, b, c, x):
    ans = 0;
    if(a > 0 and x >= 500):
        ans += fa(a-1, b, c, x-500);
    ans += fb(b, c, x);
    return ans;


a = int(input())
b = int(input())
c = int(input())
x = int(input())
    
print(fa(a, b, c, x))

Submission status: Accepted

Solution code:
import itertools

A = list(range(int(input()) + 1))
B = list(range(int(input()) + 1))
C = list(range(int(input()) + 1))
X = int(input())
count = 0

abc_list = list(itertools.product(A, B, C))
for a, b, c in abc_list:
    if 500 * a + 100 * b + 50 * c == X:
        count += 1
print(count)

Submission status: Accepted

Solution code:
def main():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    
    count = 0
    for ai in [x*500 for x in range(A+1)]:
        Xa = X - ai
        if Xa < 0: break
        for bi in [x*100 for x in range(B+1)]:
            Xb = Xa - bi
            if Xb < 0: break
            for ci in [x*50 for x in range(C+1)]:
                Xc = Xb - ci
                if Xc < 0: break

                if Xc == 0:
                    count += 1
    return count
if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
def main():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    
    if 500 > X: A = 0
    if 100 > X: B = 0
    count = 0
    for ai in [x*500 for x in range(A+1)]:
        Xa = X - ai
        for bi in [x*100 for x in range(B+1)]:
            Xb = Xa - bi
            for ci in [x*50 for x in range(C+1)]:
                Xc = Xb - ci
                if Xc == 0:
                    count += 1
    return count
if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            temp = 500 * i + 100 * j + 50 * k
            if temp == x:
                ans += 1
            elif temp > x:
                break
        if 500 * i + 100 * j > x:
            break
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):
            #print((i*500+j*100+k*50))
            if X==(i*500+j*100+k*50):
                count+=1

print(count)

Submission status: Accepted

Solution code:
# 標準入力
A = int(input())
B = int(input())
C = int(input())
X = int(input())

x = X // 50

cnt = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10*a + 2*b + c == x:
                cnt += 1
            else:
                c += 1
        b += 1
    a += 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 == 0:
                ans += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def B_Coins():
    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):
            y = (X-(500*i+100*j))/50
            if y >=0 and y <= C:
                count += 1
    print(count)

B_Coins()

Submission status: Accepted

Solution code:
# 500 yen
A = int(input())
# 100 yen
B = int(input())
# 50 yen
C = int(input())
# target
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:
# -*- coding: utf-8 -*-

a = int(input())#500
b = int(input())#100
c = int(input())#50
x = int(input())

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

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:
# coding: utf-8
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):
            sum = a * 500 + b * 100 + c * 50
            if sum == X:
                ans = ans + 1
            
print(ans)

Submission status: Accepted

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