Solve over $\mathbb{R}$ the functional equation $f\left(x^{2}-y\right)+2 y f(x)=f(f(x))+f(y)$.
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.
Claim - We have $f(0)=0$ and $f$ even.

Proof. Combine $P(1,1 / 2)$ with $P(1,0)$ to get $f(0)=0$. Use $P(0, y)$ to deduce $f$ is even.
Claim - $f(x) \in\left\{-x^{2}, 0, x^{2}\right\}$ for every $x \in \mathbb{R}$.

Proof. Note that $P\left(x, x^{2} / 2\right)$ and $P(x, 0)$ respectively give
$$
x^{2} f(x)=f\left(x^{2}\right)=f(f(x)) \text {. }
$$

Repeating this key identity several times gives
$$
\begin{aligned}
f(f(f(x))) & =f\left(f\left(x^{2}\right)\right)=f\left(x^{4}\right)=x^{4} f\left(x^{2}\right) \\
& =f(x)^{2} \cdot f(f(x))=f(x)^{2} f\left(x^{2}\right)=f(x)^{3} x^{2}
\end{aligned}
$$

Suppose $t \neq 0$ is such that $f\left(t^{2}\right) \neq 0$. Then the above equalities imply
$$
t^{4} f\left(t^{2}\right)=f(t)^{2} f\left(t^{2}\right) \Longrightarrow f(t)= \pm t^{2}
$$
and then
$$
f(t)^{2} f\left(t^{2}\right)=f(t)^{3} t^{2} \Longrightarrow f\left(t^{2}\right)= \pm t^{2} .
$$

Together with $f$ even, we get the desired result.
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^{2} f(a)=f(f(a))=f(f(b))=b^{2} f(b) \Longrightarrow a^{2}=b^{2}$. But we also have $f(f(x))=f\left(x^{2}\right)$, so we are done except in the case $f(f(x))=f\left(x^{2}\right)=0$. That would imply $x^{2} f(x)=0$, so the claim follows.
Now, note that $P(1, y)$ gives
$$
f(1-y)+2 y \cdot f(1)=f(1)+f(y) .
$$

We consider cases on $f(1)$ and show that $f$ matches the desired form.
- If $f(1)=1$, then $f(1-y)+(2 y-1)=f(y)$. Consider the nine possibilities that arise:
$$
\begin{array}{lll}
(1-y)^{2}+(2 y-1)=y^{2} & 0+(2 y-1)=y^{2} & -(1-y)^{2}+(2 y-1)=y^{2} \\
(1-y)^{2}+(2 y-1)=0 & 0+(2 y-1)=0 & -(1-y)^{2}+(2 y-1)=0 \\
(1-y)^{2}+(2 y-1)=-y^{2} & 0+(2 y-1)=-y^{2} & -(1-y)^{2}+(2 y-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.
- Note that (as $f$ is even), $f$ works iff $-f$ works, so the case $f(1)=-1$ is analogous.
- 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) \Longrightarrow f(1 / 2)=0$.

Remark. There is another clever symmetry approach possible after the main claim. The idea is to write
$$
P\left(x, y^{2}\right) \Longrightarrow f\left(x^{2}-y^{2}\right)+2 y^{2} f(x)=f(f(x))+f(f(y)) .
$$

Since $f$ is even gives $f\left(x^{2}-y^{2}\right)=f\left(y^{2}-x^{2}\right)$, one can swap the roles of $x$ and $y$ to get $2 y^{2} f(x)=2 x^{2} f(y)$. Set $y=1$ to finish.