Note that this problem is precisely FE #28 with x restricted to the nonnegative reals. We remark that this proof was directly inspired by FE #475, which is essentially a slightly harder version of this problem.
Let Q(x,y) denote the assertion that f(x+f(y)2)=f(x)+y2, where x≥0. We claim that a function f:R→R satisfies Q(x,y) for all x∈R≥0 and y∈R iff f satisfies ∣f(x)∣=∣x∣ for all x∈R and f(x)=x whenever x≥0.
Proof. Let us quickly verify all such f work. Since f(y)2=y2 for all y∈R, we have x+f(y)2=f(x)+y2≥0 for all x≥0. Hence, f(x+f(y)2)=f(x)+y2 holds for all x∈R≥0 and y∈R.
It remains to show that these are the only solutions. By Q(0,y), we have f(f(y)2)=f(0)+y2 for any y∈R. Another application yields f(0)+f(y)4=f(f(f(y)2)2)=f((f(0)+y2)2); setting y=0 gives f(0)+f(0)4=f(f(0)2)=f(0), so f(0)=0. It follows that f(f(y)2)=y2 and f(y)4=f(y4) for all y∈R.
Consider the behavior of f over R≥0. For any x≥0, we have f(f(x)2)=x, so every x≥0 is the output of f for some input f(x)2≥0. For any y≥0, we also verify that f(y)=f(4y)4≥0. It follows that the restriction of f to R≥0 is a surjection to R≥0.
As such, we recall that any r≥0 may be written as f(y)2 for some y≥0. By Q(x,y), we then have f(x+r)≥f(x) for any x,r≥0, so f is nondecreasing over R≥0.
Since f(y)4=f(y4), we know that f(1)∈{0,1}. If f(1)=0, then f(0)=f(f(1)2)=1, a contradiction; thus, f(1)=1. Meanwhile, noting that f(y)2≥0, we have by Q(f(y)2,y) that f(2f(y)2)=f(f(y)2)+y2=2f(f(y)2). Letting r=f(y)2, we have f(2r)=2f(r) for any r≥0. Since f(1)=1, it follows that f(2n)=2n for any n∈Z. Applying Q(x,2n), we then find f(x+4n)=f(x)+4n for any n∈Z; since f(0)=0, it follows that that f(4nm)=4nm for any n,m∈Z with m≥0.
We have proven f(x)=x for all x in a dense subset of R≥0, so we are essentially done. Any x≥0 may be approximated by 4nm≤x≤4n(m+1) to arbitrarily high precision by taking n→−∞; since f(4nm)≤f(x)≤f(4n(m+1)), this forces f(x)=x for all x≥0. As for x<0, one simply notes that f(f(x)2)=x2, from which it follows that f(x)2=x2, implying ∣f(x)∣=−x. This concludes the proof.