Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}, f(x f(x)+$ $f(y))=y+f(x)^{2}$.
For $x=0, f(f(y))=y+f(0)^{2}$. Therefore, $f$ is bijective. Let $x_{0}$ be such that $f\left(x_{0}\right)=0$. Then for $x=x_{0}$ and any $y$, $f(f(y))=y$ so $f(0)=0$. By setting $x=f(t)$,
$f(t f(t)+f(y))=y+t^{2}=y+f(t)^{2}$, hence $f(t)^{2}=t^{2}$. Therefore, $f(t)=t$ or $f(t)=-t$, for each $t$. Note, the sign may depend on $t$.

First case: $f(1)=1$. Then for $x=1, f(1+f(y))=y+1$. Squaring, $(1+f(y))^{2}=$ $(y+1)^{2}$. If $f(y)=-y$, then $(1-y)^{2}=(1+y)^{2}$ so $y=0$. Therefore, $f=$ Id. Similarly, if $f(-1)=-1$, $f(x)=-x$.