Find all functions $f: \mathbf{R} \rightarrow \mathbf{R}$, such that for all real numbers $x, y$, we have
$$
f\left(f(y)+x^{2}+1\right)+2 x=y+f^{2}(x+1) \text {. }
$$
(2014, Turkey National Team Selection Exam)
Let $x=0$, we get
$$
f(f(y)+1)=y+f^{2}(1) \text {. }
$$

In equation (2), replace $y$ with $f(y)+1$ to get
$$
f\left(y+f^{2}(1)+1\right)=f(y)+1+f^{2}(1) \text {. }
$$

Replace $y$ with $x^{2}+y$ in the above equation to get
$$
\begin{array}{l}
f\left(x^{2}+y+f^{2}(1)+1\right)=f(y)+1+f^{2}(1) \\
\Rightarrow f\left(x^{2}+f(f(y)+1)+1\right) \\
\quad=f(y)+1+f^{2}(1) .
\end{array}
$$

From equation (1), we get
$$
\begin{array}{l}
f(y)+1+f^{2}(x+1)-2 x=f\left(x^{2}+y\right)+1+f^{2}(1) \\
\Rightarrow f\left(x^{2}+y\right)-f(y)=f^{2}(x+1)-f^{2}(1)-2 x \\
\Rightarrow f\left(x^{2}+y\right)-f(y)=f\left(x^{2}\right)-f(0) .
\end{array}
$$

In equation (3),
let $x=1, y=0$, we get
$$
f(1)-f(0)=f^{2}(2)-f^{2}(1)-2 \text {; }
$$

let $x=-1, y=0$, we get
$$
f(1)-f(0)=f^{2}(0)-f^{2}(1)+2 \text {; }
$$

let $x=1, y=1$, we get
$$
f(2)-f(1)=f^{2}(2)-f^{2}(1)-2 \text {. }
$$

From the above three equations, we solve to get
$$
f(1)=1, f(0)=0, f(2)=2 \text {. }
$$

Thus, $f\left(x^{2}+y\right)=f\left(x^{2}\right)+f(y)$.
Hence, for $x \geqslant 0$, we have
$$
f(x+y)=f(x)+f(y) .
$$

Substitute into equation (2) to get
$$
f(f(y))+1=y+1 \Rightarrow f(f(y))=y \text {. }
$$

Substitute into equation (1) to get
$$
\begin{array}{l}
y+f\left(x^{2}\right)+1+2 x=y+(1+f(x))^{2} \\
\Rightarrow f\left(x^{2}\right)+2 x=f^{2}(x)+2 f(x) .
\end{array}
$$

In equation (4), replace $x$ with $x+1$ to get
$$
\begin{array}{l}
f\left(x^{2}\right)+f(2 x)+1+2(x+1) \\
=(1+f(x))^{2}+2 f(x+1) \\
\Rightarrow f\left(x^{2}\right)+f(2 x)+2 x \\
=f^{2}(x)+2 f(x)+2 f(x) .
\end{array}
$$

Compare equations (4) and (5) to get $f(2 x)=2 f(x)$.
In equation (4), replace $x$ with $2 f(x)$ (note that $f(2 x)=2 f(x)$) to get
$$
\begin{array}{l}
f\left(4 f^{2}(x)\right)+2 \times 2 f(x) \\
=f^{2}(f(2 x))+2 f(f(2 x)) . \\
\text { Since } f(f(x))=x, \text { thus, } \\
4 f\left(f^{2}(x)\right)+4 f(x)=4 x^{2}+4 x \\
\Rightarrow f\left(f^{2}(x)\right)+f(x)=x^{2}+x .
\end{array}
$$

Since $f(f(x))=x$, we have
$$
\begin{array}{l}
4 f\left(f^{2}(x)\right)+4 f(x)=4 x^{2}+4 x \\
\Rightarrow f\left(f^{2}(x)\right)+f(x)=x^{2}+x .
\end{array}
$$

In equation (4), replace $x$ with $f(x)$ to get
$$
f\left(f^{2}(x)\right)+2 f(x)=x^{2}+2 x \text {. }
$$

Compare equations (6) and (7) to get $f(x)=x$.
Since $f(x)=x$ satisfies equation (1), the function we seek is
$$
f(x)=x .
$$