Problem: Solve over $\RR$ the functional equation
\[ f(x^2-y)+2yf(x) = f(f(x))+f(y). \]

Solution: The answer is $f(x) \equiv x^2$, $f(x) \equiv 0$, $f(x) \equiv -x^2$,
which obviously work.

Let $P(x,y)$ be the usual assertion.
\begin{claim*}
  We have $f(0) = 0$ and $f$ even.
\end{claim*}
\begin{proof}
  Combine $P(1,1/2)$ with $P(1,0)$ to get $f(0) = 0$.
  Use $P(0,y)$ to deduce $f$ is even.
\end{proof}

\begin{claim*}
  $f(x) \in \{-x^2, 0, x^2\}$ for every $x \in \RR$.
\end{claim*}
\begin{proof}
  Note that $P(x,x^2/2)$ and $P(x,0)$ respectively give
  \[ x^2f(x) = f(x^2) = f(f(x)). \]
  Repeating this key identity several times gives
  \begin{align*}
    f(f(f(x))) &= f(f(x^2)) = f(x^4) = x^4 f(x^2) \\
    &= f(x)^2 \cdot f(f(x)) = f(x)^2 f(x^2) = f(x)^3 x^2
  \end{align*}
  Suppose $t \neq 0$ is such that $f(t^2) \neq 0$.
  Then the above equalities imply
  \[ t^4 f(t^2) = f(t)^2 f(t^2) \implies f(t) = \pm t^2 \]
  and then
  \[ f(t)^2 f(t^2) = f(t)^3 t^2 \implies f(t^2) = \pm t^4. \]
  Together with $f$ even, we get the desired result.
\end{proof}
\begin{remark*}
  Another proof is possible here that doesn't use as iterations of $f$:
  the idea is to ``show $f$ is injective up to sign outside its kernel''.
  Specifically, if $f(a) = f(b) \neq 0$,
  then $a^2f(a) = f(f(a)) = f(f(b)) = b^2f(b) \implies a^2=b^2$.
  But we also have $f(f(x))=f(x^2)$,
  so we are done except in the case $f(f(x))=f(x^2)=0$.
  That would imply $x^2f(x) = 0$, so the claim follows.
\end{remark*}

Now, note that $P(1,y)$ gives
\[ f(1-y) + 2y \cdot f(1) = f(1) + f(y). \]
We consider cases on $f(1)$ and show that $f$ matches the desired form.
\begin{itemize}
  \ii If $f(1) = 1$, then $f(1-y) + (2y-1) = f(y)$.
  Consider the nine possibilities that arise:
  \[
    \begin{array}{lll}
    (1-y)^2 + (2y-1) = y^2 &
    0 + (2y-1) = y^2 &
    -(1-y)^2 + (2y-1) = y^2 \\
    (1-y)^2 + (2y-1) = 0 &
    0 + (2y-1) = 0 &
    -(1-y)^2 + (2y-1) = 0 \\
    (1-y)^2 + (2y-1) = -y^2 &
    0 + (2y-1) = -y^2 &
    -(1-y)^2 + (2y-1) = -y^2.
    \end{array}
  \]
  Each of the last eight equations is a nontrivial polynomial equation.
  Hence, there is some constant $C > 100$ such that the latter eight equations
  are all false for any real number $y > C$.
  Consequently, $f(y) = y^2$ for $y > C$.

  Finally, for any real number $z > 0$, take $x,y > C$ such that $x^2-y=z$;
  then $P(x,y)$ proves $f(z) = z^2$ too.

  \ii Note that (as $f$ is even), $f$ works iff $-f$ works,
  so the case $f(1) = -1$ is analogous.

  \ii If $f(1) = 0$, then $f(1-y) = f(y)$.
  Hence for any $y$ such that $|1-y| \neq |y|$, we conclude $f(y) = 0$.
  Then take $P(2, 7/2) \implies f(1/2) = 0$.
\end{itemize}

\begin{remark*}
  There is another clever symmetry approach possible after the main claim.
  The idea is to write
  \[ P(x,y^2) \implies f(x^2-y^2) + 2y^2f(x) = f(f(x)) + f(f(y)). \]
  Since $f$ is even gives $f(x^2-y^2) = f(y^2-x^2)$,
  one can swap the roles of $x$ and $y$ to get $2y^2f(x) = 2x^2f(y)$.
  Set $y=1$ to finish.
\end{remark*}