Solution (source code)

= Solution

The <law of total expectation> gives $\mathbb E Y=\mathbb E[X/2]=q/(2p)$. The <law of total variance> separates the two sources of randomness:
$$
\operatorname{Var}(Y)
=\mathbb E[\operatorname{Var}(Y\mid X)]
+\operatorname{Var}(\mathbb E[Y\mid X])
=\frac14\mathbb E X+\frac14\operatorname{Var}(X).
$$
Substitution gives
$$
\boxed{\mathbb E Y=\frac{1-p}{2p},\qquad
\operatorname{Var}(Y)=\frac{q(p+1)}{4p^2}
=\frac{1-p^2}{4p^2}.}
$$
The <binomial thinning of a geometric random variable> identity supplies a further check: $Y$ itself has a zero-based <geometric distribution> with success <probability> $2p/(1+p)$.