Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$, we have

$$
f(f(x)+y)=2 x+f(f(y)-x)
$$
By setting $y=f(x)$, we have $f(f(y)-x)=f(0)-2 x$ and we see that $f$ is surjective. Let's prove the injectivity: let $a, b \in \mathbb{R}$ such that $f(a)=f(b)$. We have $f(f(a)+y)=$
$f(f(b)+y)$, so $2 a+f(f(y)-a)=2 b+f(f(y)-b)$. By surjectivity, we can take $y$ such that $f(y)=a+b$, so $2 a+f(b)=2 b+f(a)$, hence $a=b$. Therefore, $f$ is injective.

By taking $x=0$ in the initial equation, we have $f(f(0)+y)=f(f(y))$ and thus by injectivity $f(y)=f(0)+y$ for all $y \in \mathbb{R}$. Conversely, the functions $x \mapsto x+c$, for some $c \in \mathbb{R}$, work.