Solution (source code)

= Solution

In the <simple module> $L_m$, weight $0$ occurs once if $m$ is even and never if $m$ is odd. Weight $1$ occurs once if $m$ is odd and never if $m$ is even. Thus each simple summand contributes exactly one to $\dim V_0+\dim V_1$.

<Complete reducibility of semisimple Lie algebra representations> writes $V=\bigoplus_mL_m^{\oplus a_m}$. Taking the two <weight spaces> commutes with this finite <direct sum>, so
$$
\boxed{\dim V_0+\dim V_1=\sum_ma_m.}
$$
The right side counts irreducible summands \b[with multiplicity], independently of a chosen decomposition.