$f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ twice Does there exist a continuous function $f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ exactly two times?
Suppose $f(a)=f(b)=0$.  Then on each of $(-\infty,a)$, $(a,b)$, $(b,\infty)$ the function $f$ is either positive or negative by the intermediate value theorem.  By continuity $f$ has either a max on $[a,b]$ which is strictly positive or a min which is strictly negative.  WLOG say it has a max which is positive.  The left and right intervals must have opposite signs or $f$ can't be surjective.  So say WLOG the left side is positive.  Then some (very small) positive value is achieved three times, once on the left interval and twice in the middle interval.
If possible let, f be such a continuous function in $\Bbb R$ which attains every value exactly twice.
Let $f(x_1)=f(x_2)=b$, with $x_1 \neq x_2$.
Then $f(x)\neq b$, for $x_1 \neq x_2$.
Then either $f(x)\gt b$ or $f(x)\lt b \forall x\in (x_1,x_2)$.
In case , when f(x)\gt b:
there is f(x_0)=max. {f(x):x\in (x_1,x_2)}. 
Now we claim that, $f$ attains its maximum exactly once in $(x_1,x_2)$, otherwise $f$ will attain each value more than two times.
Let, $f$ attains its maximum exactly once at $c\in (x_1,x_2)$.
Again since $f$ attains its value exactly two times,  thus there exists $x_3$ ,outside of the interval $[x_1,x_2]$,
S.t. $f(x_3)=f(c)=d$ (,say) $\gt b$.
Then by IVP , we can conclude that f attains every value between $b$ and $d$ at least three times, CONTRADICTION.
Same argument can be applicable for $f(x)\lt b$.
Thus there doesn't exists any such continuous function.