Solution (source code)

= Solution

Use the nonnegative-part convention $h=h^+-h^-$, where $h^+=\max(h,0)$ and $h^-=\max(-h,0)$. The zero-mean assumption gives
$$
A=\int_0^\pi h^+=\int_0^\pi h^-.
$$
For $k\geq1$, write the <integral> over the $k$th period as $I_k=P_k-N_k$, where
$$
P_k=\int_0^\pi\frac{h^+(t)}{k\pi+t}\,dt,
\qquad N_k=\int_0^\pi\frac{h^-(t)}{k\pi+t}\,dt.
$$
Both $P_k$ and $N_k$ lie in the <interval> $[A/((k+1)\pi),A/(k\pi)]$. Their difference therefore satisfies the stronger estimate
$$
|I_k|\leq\frac{A}{\pi k(k+1)}\leq\frac{A}{\pi k^2}.
$$
Consequently $\sum_{k\geq1}I_k$ converges absolutely as a <series> of numbers, proving the requested limit of integrals over whole periods. This does not assert absolute integrability of the original function: the cancellation took place inside each period.

Indeed, setting $B=\int_0^\pi|h(t)|\,dt$, we have
$$
\int_{k\pi}^{(k+1)\pi}|g(x)|\,dx
\geq\frac{B}{(k+1)\pi}.
$$
The <harmonic series> diverges, so $g$ is <Lebesgue integrability>[Lebesgue integrable] only if $B=0$. Conversely $B=0$ means $h=0$ almost everywhere on one period, and hence on all periods, so $g=0$ almost everywhere. Therefore
$$
\boxed{g\in L^1(\pi,\infty)\iff h=0\text{ almost everywhere}.}
$$
This is an example of <integrating a mean-zero periodic function divided by x>.