Dynamic Programming for a variant of the coin exchange problem
Add a parity parameter to $C$ and check for it in the base case, making the wrong parity invalid:

$$
\newcommand{\for}{\text{for }}
C(S, m, n, p) = 
    \begin{cases}
      0&amp; \for n &lt; 0\\
      0&amp; \for n = 0 \wedge p = 1\\
      1&amp; \for n = 0 \wedge p = 0\\
      0&amp; \for m = 0\\
      C(S,m-1,n,p) + C(S, m,n-S_m, 1-p)&amp; \text{otherwise}
    \end{cases}
$$

Note that I'm using mathematical notation above so $S$ and $m$ are using one-based indices. 

Since we want only an even number of summands we want $p = 0$, thus $C(S, m, n, 0)$ gives the answer you want.