F13 (33-2, India) Let $R$ be the set of all real numbers. Find all functions $f: \mathbf{R} \rightarrow \mathbf{R}$ such that for all $x$ and $y$ in $\mathbf{R}$, we have
$$
f\left(x^{2}+f(y)\right)=y+(f(x))^{2} .
$$
Solution 1 First prove $f(0)=0$. Let $x=0, t=f^{2}(0)$, we get
$$
f(f(y))=y+t,
$$

From (2), we get (let $y=x^{2}+f(f(y))$ )
$$
f\left[f\left(x^{2}+f(f(y))\right)\right]=x^{2}+f(f(y))+t .
$$

From (1), we get
$$
\begin{aligned}
f\left[f\left(x^{2}+f(f(y))\right)\right] & =f\left[(f(x))^{2}+f(y)\right] \\
& =y+[f(f(x))]^{2}
\end{aligned}
$$

From (2), (3), (4), we get
$$
\begin{array}{c}
x^{2}+y+2 t=y+(x+t)^{2} \\
2 t=t^{2}+2 t x
\end{array}
$$

which holds for any real number $x$, hence $t=0$, i.e., $f(0)=0$.
Thus, (2) becomes
$$
f(f(y))=y .
$$

When $x \geqslant 0$, from (1) and (5), we get
$$
\begin{aligned}
f(x+y) & =f(x+f(f(y))) \\
& =f(y)+(f(\sqrt{x}))^{2} \\
& \geqslant f(y),
\end{aligned}
$$

so $f(x)$ is an increasing function on $\mathbf{R}$, i.e., when $x \geqslant y$, we have $f(x) \geqslant f(y)$.
If there exists $x$ such that $f(x)>x$, then
$$
f(f(x)) \geqslant f(x)>x,
$$

which is a contradiction; if there exists $x$ such that $f(x)<x$, then
$$
f(f(x)) \leqslant f(x)<x,
$$

which is also a contradiction. Therefore, $f(x)=x$.
Clearly, $f(x)=x$ satisfies the conditions given in the problem.
Solution 2 From (1) and the fact that $y$ can take any real value, we get that $f$ is surjective.
Also, if $f\left(y_{1}\right)=f\left(y_{2}\right)$, then from (1) we get
$$
\begin{aligned}
y_{1}+f^{2}(x) & =f\left(x^{2}+f\left(y_{1}\right)\right) \\
& =f\left(x^{2}+f\left(y_{2}\right)\right) \\
& =y_{2}+f^{2}(x)
\end{aligned}
$$

Thus, $y_{1}=y_{2}$, so $f$ is injective.
Therefore, $f$ is a bijection.
From (1) we get
$$
\begin{aligned}
y+f^{2}(x) & =f\left(x^{2}+f(y)\right) \\
& =f\left((-x)^{2}+f(y)\right) \\
& =y+f^{2}(-x),
\end{aligned}
$$

When $x \neq 0$, $x \neq -x$, and $f(x) \neq f(-x)$, so
$$
f(x)=-f(-x) \neq 0 .
$$

Since $f$ is surjective, there must be $f(0)=0$, thus
$$
f(f(y))=y \text {. }
$$

The rest is the same as Solution 1.