Lebesgue non-measurable function

Let $S$ a non-measurable subset of $]0,+\infty[$. Define $$g(x)=\begin{cases} x\text{ if } x\in S\\-x\text{ if } x\notin S\end{cases}$$

$g^{-1}(y)$ is finite $\forall y\in \mathbb{R}$, but $\{ g\geq 0\}\setminus\ ]-\infty,0]=S$ is not measurable.


Take $V$ to be a non-measurable set on $[0,1]$, and consider on $[0,1]$ the function $$ f(x) := x \mathbf{1}_V(x) + (-10 -x)\mathbf{1}_{[0,1]\setminus V}(x) $$ where $\mathbf{1}_V$ is the indicator function of $V$, $$ \mathbf{1}_V(x) := \begin{cases} 1 & x∈ V \\ 0 & x \notin V \end{cases} $$Then the preimage of any $C∈ℝ$ is a singleton or empty and hence measurable.

Its also not hard to use this idea to make a non-measurable function on $ℝ$, also satisfying your criterion: $$ f(x) := e^x \mathbf{1}_V(x) + (-10 -e^x)\mathbf{1}_{ℝ \setminus V}(x)$$