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

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

Solution (Python):
def solve():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    
    ans = 0
    cnt = 0
    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                if (500*i+100*j+50*k) == X:
                    ans += 1
    print(ans)
    return

solve()

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())/50
count=0
for i in range(A+1):
    for i2 in range(B+1):
        for i3 in range(C+1):
            if i*10+i2*2+i3==X:
                count+=1
print(count)

Solution (Python):


def wa(x,y,z): 
    global ans,a,b,c,n
    if x>a or y>b or z>c:
        return
    if x*500+y*100+z*50==n:
        ans+=1
        return
    elif x*500+y*100+z*50>n:
        return
    else:
        wa(x+1,y,z)
        wa(x,y+1,z)
        wa(x,y,z+1)
import math

def main():
    temp=input()
    a=int(temp)
    temp=input()
    b=int(temp)
    temp=input()
    c=int(temp)
    temp=input()
    n=int(temp)
    ans = 0
    for x in range(a+1):
        for y in range(b+1):
            for z in range(c+1):
                if 500*x+100*y+50*z==n:
                    ans+=1
                    
    print(ans)

    


if __name__ == '__main__':
    main()

Solution (Python):

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

max_a = x / 500

count = 0

for i in range(0, min(a, max_a) + 1):
    rest = x - i * 500
    max_b = rest / 100
    
    for j in range(0, min(b, max_b) + 1):
        rest_c = rest - j * 100
        if rest_c <= c * 50:
            count += 1

print count

Solution (Python):


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

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

print(ret)

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

count = 0

while x >= 0 and a >= 0:
    y = x
    bb = b
    while y >= 0 and bb >= 0:
        if 50 * c >= y:
            count += 1
        y = y - 100
        bb -= 1
    x = x - 500
    a = a - 1

print(count)

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

Solution (Python):
def main():
    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):
                price = 500 * a + 100 * b + 50 * c
                if price == X:
                    cnt +=1

    print(cnt)

main()

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

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

print(cnt)

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

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

res = 0

for i in range(A+1):
	remain = X - 500 * i
	if i < 0:
		break
	for j in range(B+1):
		rem = X - 500 * i - 100 * j
		if rem < 0:
			break;
		for k in range(C+1):
			r = X - 500 * i - 100 * j - 50 * k

			if r < 0:
				break
			elif r == 0:
				res += 1

print(res)

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

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


print(ans)

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

counter = 0
for a in range(A+1):
    for b in range(B+1):
        c = X//50 - 10*a - 2*b
        if (0<=c<=C) and 500*a+100*b+50*c == X:
            counter += 1

print(counter)

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

print(ans)

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

    f(A, B, C, X)


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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):

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)

Solution (Python):
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)

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

print(count)

Solution (Python):


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)

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

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

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

res = 0
for aa in range(a + 1):
  for bb in range(b + 1):
    for cc in range(c + 1):
      if aa * 500 + bb * 100 + cc * 50 == x:
        res += 1
print(res)

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

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


print(cnt)

Solution (Python):
n_five_hundred_coin = int(input())
n_hundred_coin = int(input())
n_fifty_coin = int(input())
total_money = int(input())

n_pattern = 0
for five_hundred_coin in range(n_five_hundred_coin+1):
  
  if five_hundred_coin * 500 > total_money:
    break

  for hundred_coin in range(n_hundred_coin+1):
    
    if five_hundred_coin * 500 + hundred_coin * 100 > total_money:
      break

    remain_money = total_money - five_hundred_coin * 500 - hundred_coin * 100
    need_fifty_coin = remain_money / 50

    if need_fifty_coin <= n_fifty_coin:
      n_pattern += 1

print(n_pattern)

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

print(count)

Solution (Python):
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

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

ans = 0

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

print(ans)

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

print(result)

Solution (Python):
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)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
q=0
i=0
while i<=a and (i*500)<=x:
    j=0
    while j<=b and (i*500+j*100)<=x:
        k=0
        while k<=c:
            if (i*500+j*100+k*50)==x:
                q+=1
                break
            k+=1
        j+=1
    i+=1
print(q)

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

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

print(count)

Solution (Python):


import itertools

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

num=0

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


print(num)

Solution (Python):
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)

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

Solution (Python):
f = lambda :int(input())
A = f()
B = f()
C = f()
X = f()
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)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
x = X//50
ans=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:
        ans+=1
print(ans)

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

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

Solution (Python):
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)

Solution (Python):
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=count+1
            

print(count)

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

Solution (Python):
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):
        res = x - (500 * i + 100 * j)
        
        if res >= 0 and res % 50 == 0 and res // 50 <= c:
            ans += 1

print(ans)

Solution (Python):
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())
ans = 0

for aa in range(a+1):
  if 500*aa > x:
    break
  for bb in range(b+1):
    if 500*aa + 100*bb > x:
      break
    for cc in range(c+1):
      if 500*aa + 100*bb + 50*cc == x:
        ans = ans + 1
      if 500*aa + 100*bb + 50*cc > x:
        break

print ans

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

cnt = 0
for f in range(0, A+1):
    for o in range(0, B+1):
        for hf in range(0, C+1):
            s = f*500 + o*100 + hf*50
            if s == X : cnt +=1

print(cnt)

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

ct = 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:
                ct += 1

print ct

Solution (Python):
import itertools
a = int(input())
b = int(input())
c = int(input())
x = int(input())
R = [i for i in range(60)]
num = 0
for i, j, k in itertools.product(R[:a + 1], R[: b + 1], R[: c + 1]):
    if 500 * i + 100 * j + 50 * k == x:
        num += 1

print(num)

Solution (Python):



import sys

a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
c = int(sys.stdin.readline().strip())
x = int(sys.stdin.readline().strip())
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)

Solution (Python):
a, b, c, x = [input() for _ in xrange(4)]
cnt = 0
for d in xrange(a + 1):
    for e in xrange(b + 1):
        for f in xrange(c + 1):
            if 500 * d + 100 * e + 50 * f == x:
                cnt += 1
print cnt

Solution (Python):
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)

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

Solution (Python):
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)