Problem: Find all $f \colon \ZZ \to \ZZ$ such that
\[ xf\left( 2f(y)-x \right) + y^2f\left( 2x-f(y) \right)
  = \frac{f(x)^2}{x} + f\left( yf(y) \right) \]
for all $x,y \in \ZZ$ such that $x \neq 0$.

Solution: The answer is $f(x) \equiv 0$ and $f(x) \equiv x^2$. Check that these work.

Now let's prove these are the only solutions.
Put $y=0$ to obtain
\[ x f\left( 2f(0)-x \right) = \frac{f(x)^2}{x} + f(0).  \]

The nicest part of the problem is the following step:
\begin{claim*}
  We have $f(0)=0$.
\end{claim*}
\begin{proof}
  If not, select a prime $p \nmid f(0)$ and put $x=p \neq 0$.
  In the above, we find that $p \mid f(p)^2$,
  so $p \mid f(p)$ and hence $p \mid \tfrac{f(p)^2}{p}$.
  From here we derive $p \mid f(0)$, contradiction.
  Hence \[ f(0) = 0. \]
\end{proof}

\begin{claim*}
  We have $f(x) \in \{0,x^2\}$ for each individual $x$.
\end{claim*}
\begin{proof}
  The above then implies that
  \[ x^2f(-x) = f(x)^2 \]
  holds for all nonzero $x$, but also for $x=0$.
  Let us now check that $f$ is an even function.
  In the above, we may also derive $f(-x)^2 = x^2f(x)$.
  If $f(x) \neq f(-x)$ (and hence $x \neq 0$),
  then subtracting the above and factoring implies that
  $f(x) + f(-x) = -x^2$;
  we can then obtain by substituting the relation
  \[ \left[ f(x) + \frac 12x^2 \right]^2 = -\frac 34 x^4 < 0 \]
  which is impossible.
  This means $f(x)^2 = x^2f(x)$, thus
  \[ f(x) \in \{0, x^2\} \qquad \forall x. \]
\end{proof}

Now suppose there exists a nonzero integer $t$ with $f(t) = 0$.
We will prove that $f(x) \equiv 0$.
Put $y=t$ in the given to obtain that
\[ t^2 f(2x) = 0 \]
for any integer $x \neq 0$, and hence conclude that $f(2 \ZZ) \equiv 0$.
Then selecting $x = 2k \neq 0$ in the given implies that
\[ y^2 f(4k-f(y)) = f(yf(y)). \]

Assume for contradiction that $f(m) = m^2$ now for some odd $m \neq 0$.
Evidently \[ m^2 f(4k-m^2) = f(m^3). \]
If $f(m^3) \neq 0$ this forces $f(4k-m^2) \neq 0$,
and hence $m^2(4k-m^2)^2 = m^6$ for arbitrary $k \neq 0$, which is clearly absurd.
That means \[ f(4k-m^2) = f(m^2-4k) = f(m^3) = 0 \] for each $k \neq 0$.
Since $m$ is odd, $m^2 \equiv 1 \pmod 4$,
and so $f(n) = 0$ for all $n$ other than $\pm m^2$
(since we cannot select $k=0$).

Now $f(m) = m^2$ means that $m = \pm 1$.
Hence either $f(x) \equiv 0$ or
\[ f(x) = \begin{cases} 1 & x = \pm 1 \\ 0 & \text{otherwise}. \end{cases} \]
To show that the latter fails,
we simply take $x=5$ and $y=1$ in the given.

Hence, the only solutions are $f(x) \equiv 0$ and $f(x) \equiv x^2$.