Let $f : \mathbb{R} \to \mathbb{R}$ be a Lebesgue measurable function and $D$ be a countable dense subset of $\mathbb{R}$.
Suppose that for a.e. $x \in \mathbb{R}$ we have
\begin{equation*}
f(x + d) = f(x)
\qquad
\text{for every } d \in D
\end{equation*}
(notice that, without loss of generality, we can assume that $D$ is a module over the integers).

Does it follow that $f(x) = c$ a.e.?