Solution (source code)

= Solution

\b[Prepare $|0\rangle$, then apply $H$, then $T$.] With $T=\operatorname{diag}(1,e^{i\pi/4})$,
$$
TH|0\rangle=T\frac{|0\rangle+|1\rangle}{\sqrt2}
=\frac{|0\rangle+e^{i\pi/4}|1\rangle}{\sqrt2}.
$$
This uses only the allowed state preparation and elementary gates. The rightmost operator acts first, so $TH$ denotes the temporal order $H$ followed by $T$.