I am not sure if my solution to this problem is correct:
Let $f,g$ be absolutely integrable function from $\mathbb{R}$ to $\mathbb{R}$ such that (1) for all $x\in \mathbb{R}: f(x) \leq g(x)$, and (2) $\int_{\mathbb{R}} f = \int_{\mathbb{R}} g$. Then $f = g$ almost everywhere on $\mathbb{R}$.
My proof sketch: we have $$\int_{\mathbb{R}} f^+ = \int_{\mathbb{R}} g^+ \qquad \int_{\mathbb{R}} f^- = \int_{\mathbb{R}} g^-$$ Now suppose for the sake of contradiction that the set $$E := \{ x \in \mathbb{R}: f(x) < g(x)\}$$ has Lebesgue measure of $m(E)>0$. Then on $E$ we have $$\int_{E} f^+ < \int_{E} g^+ \qquad \int_{E} f^- < \int_{E} g^-$$ (this can be derived from the supremum definition using simple functions). By partitioning the Lebesgue integral we see that $$\int_\mathbb{R} f = \int_{\mathbb{R}/E} f + \int_{E} f < \int_{\mathbb{R}/E} g + \int_{E} g = \int_{\mathbb{R}}g$$
Are all the steps correct?
The first step cannot be justified. Just because $f$ and $g$ have the same integral you cannot say the same thing about their positive and negative parts.
We have $\int (g-f)(x)dx=0$. Since $g-f \geq 0$ we get $\int_{\{x:g(x)>f(x)+\frac 1n\}} (g-f) dx \leq \int_{\mathbb R} (g-f)(x)dx=0$. But $\int_{\{x:g(x)>f(x)+\frac 1n\}} (g-f) dx \geq \frac 1 n m(\{x:g(x)>f(x)+\frac 1n\})$. Conclusion: $m(\{x:g(x)>f(x)+\frac 1n\})=0$ for each $n$. By taking the union of these sets over $n$ we get $m(\{x:g(x) >f(x)\}=0$. Can you finish now?.