Solution (source code)

= Solution

Embed $Y$ in <projective space> and let $H$ be its hyperplane <Cartier divisor>. Since $f$ is surjective between integral surfaces, it is <generically finite>, with degree $r>0$. Its <pullback of a Cartier divisor> $L=f^*H$ is a <nef divisor>, and the <projection formula for algebraic cycles> gives $L^2=rH^2>0$. The same formula gives $L\cdot C=H\cdot f_*C=0$, because the curve is contracted to a point.

The <Hodge index theorem for algebraic surfaces> makes the <intersection pairing on the Picard group of a surface> have signature $(1,\rho-1)$ on $N^1(X)_{\mathbb R}$. The orthogonal complement of any positive-square vector, including $L$, is <negative definite>. The numerical class of $C$ is nonzero, since an <ample divisor> on $X$ intersects every nonzero <effective divisor> positively. Thus the <contracted curve has negative self-intersection> conclusion applies:
$$
\boxed{C^2<0.}
$$