Solution (source code)

= Solution

If $\check H^1(S,\mathcal O)=0$, that cocycle is a <Čech coboundary>: there are $f_i\in\mathcal O(U_i)$ with
$$
P_m=f_m-f_0\quad\text{on }U_0\cap U_m.
$$
Set $F=-f_0$ on $U_0$ and $F=P_m-f_m$ on $U_m$. These formulas agree on overlaps, so the <sheaf gluing axiom> gives a global <meromorphic function>. Moreover $F-P_m=-f_m$ is holomorphic near $x_m$. Thus $F$ solves the <Mittag-Leffler problem on a Riemann surface> with precisely the prescribed principal parts.