Solution (source code)

= Solution

If $g_X=0$, the <Riemann-Hurwitz formula> gives $2=d(2-2g_Y)-R$, where $R\geq0$. If $g_Y\geq1$, the right side is nonpositive, a contradiction. Therefore
$$
\boxed{g_Y=0.}
$$