Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for any real numbers $x$ and $y$,

$$
f(x+y)=\max (f(x), y)+\min (f(y), x) .
$$
We claim the only answer is the identity function $f(x) \equiv x$, which clearly works.

Let $(x, y)=(a, 0)$ and $(x, y)=(0, a)$ so that

$$
\begin{aligned}
& f(a)=\max (f(a), 0)+\min (f(0), a) \\
& f(a)=\max (f(0), a)+\min (f(a), 0) .
\end{aligned}
$$

Sum:

$$
2 f(a)=(f(a)+0)+(f(0)+a)
$$

so $f(a)=a+f(0)$.

It is easy to check from here $f$ is identity.