Solution (source code)

= Solution

<Morera's theorem> states that if $f$ is continuous on an open set $U$ and its integral around every triangle whose interior and boundary lie in $U$ is zero, then $f$ is holomorphic on $U$.

For a proof, choose a disk $B\subseteq U$ and a base point $z_0\in B$. Define $F(z)=\int_{[z_0,z]}f(\zeta)\,d\zeta$ along the straight segment. Convexity keeps every triangle with vertices $z_0,z,z+h$ inside $B$. Its zero boundary integral implies
$$
F(z+h)-F(z)=\int_{[z,z+h]}f(\zeta)\,d\zeta
=h\int_0^1f(z+th)\,dt.
$$
By continuity, the last integral tends to $f(z)$ as $h\to0$, so $F'(z)=f(z)$. Thus $F$ is holomorphic on $B$. The allowed result that the <derivative> of a <holomorphic function> is holomorphic now gives that $f=F'$ is holomorphic there. Such disks cover $U$, proving
$$
\boxed{f\text{ is holomorphic on }U.}
$$