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: Runtime Error

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):
        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: Runtime Error

Solution code:
if int(x / 500) <= a:
    y = x - int(x / 500)
    
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z/50)
    
    else:
        z = y - 100*b
        print(z/50)

else:
    y = x - 500*b
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z)
    else:
        z = y - 100*b
        print(z/50)

#print(int(x / 500), int(y/ 100), int(z/50 ))
print(int(x / 500) *5 + (y//100 + x // 500 *5) * 2 + z//50)

Submission status: Runtime Error

Solution code:
if int(x / 500) <= a:
    y = x - int(x / 500)
    
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z/50)
    
    else:
        z = y - 100*b
        print(z/50)

else:
    y = x - 500*b
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z)
    else:
        z = y - 100*b
        print(z/50)

print(int(x / 500) *5 + (y//100) * 2 + z//50)

Submission status: Runtime Error

Solution code:
if int(x / 500) <= a:
    y = x - int(x / 500)
    
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z)
    
    else:
        z = y - 100*b
        print(z/50)

else:
    y = x - 500*b
    if  int(y/ 100) <=b:
        z = y - 100* int(y/ 100)
        print(z)
    else:
        z = y - 100*b
        print(z/50)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))

int main(void){
	int x,a,b,c;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	int s=0;
	reg(i,0,a)reg(j,0,b)reg(k,0,c){
		if(i*500+j*100+k*50==x)s++;
	}
	printf("%d\n",s);
	return 0;
}

Submission status: Runtime Error

Solution code:
ans = 0
5hun = int(input())
hun = int(input())
fif = int(input())
money = int(input())
for i in range(5hun + 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: Runtime Error

Solution code:
ans = 0
for i in range(int(input())):
  for j in range(int(input())):
    for l in range(int(input())):
      try:
        money = int(input())
      except:
        pass
      if (500 * i + 100 * j + 50 * l) == money:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = input()
x = 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: Runtime Error

Solution code:
a = input()
b = input()
c = input()
x = 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: Runtime Error

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 - A*i - B*j;
  if 0<= reX <= X
  count++;

print(count)

Submission status: Runtime Error

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

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

A_list = list()
for i in range(A) :
    A_list.append(i*500)
B_list = list()
for i in range(B) :
    B_list.append(i*100)
C_list = list()
for i in range(C) :
    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: Runtime Error

Solution code:
import itertools
import pandas as pd
import math 
from collections import defaultdict as dd
import numpy as np
import pandas as pd
def main():
	a = int(input())
	b = int(input())
	c = int(input())
	x = 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: Runtime Error

Solution code:
from test import set_stdin_sandbox
set_stdin_sandbox("at87")

from pydoc import help# {{{
import re
from scipy import integrate
from operator import itemgetter
from collections import Counter
from collections import deque
import fractions
from heapq import heappop, heappush, heapify
import sys
import array
from copy import deepcopy as dcopy
from scipy.special import factorial
import sympy
import time
# }}}

from bisect import bisect_left, bisect_right, insort_left, insort_right

import numpy as np

import itertools
import pandas as pd
import math 
from collections import defaultdict as dd
import numpy as np
import pandas as pd
def main():
	a = int(input())
	b = int(input())
	c = int(input())
	x = 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: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main()
    a = int(input())
    b = int(input())
    c = int(input())
    tt = int(input())
    total = 0

    for yen500 in range(a+1):
        for yen100 in range(b+1):
            for yen50 in range(c+1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == tt:
                    total += 1

    print(total)

main()

Submission status: Runtime Error

Solution code:
import sys

a = []
for line in sys.stdin:
    a.append(int(line))

#a[0]*500 + a[1]*100 + a[2]*50 = a[3]

if a[3]/50 == 0 && a[3]/100 != 0:
  if a[2] == 0:
    print("0")