Solution (source code)

= Solution

First fix distinct $q_1,\ldots,q_k$ and let $Q=q_1+\cdots+q_k$. A <negative-degree divisor has no sections>: if $0\ne f\in\mathcal L(D)$, then $(f)+D$ is an <effective divisor> of degree $\deg D$, since a <principal divisor> has degree zero, so $\deg D$ cannot be negative. As $\deg K=0$ and $\deg(K-Q)=-k<0$, the <Riemann-Roch theorem> therefore gives
$$
\boxed{\ell(Q)=\deg Q+1-g+\ell(K-Q)=k.}
$$

Now choose distinct $p_1,\ldots,p_k$ outside the support of $Q$, and put $P=p_1+\cdots+p_k$. A function with the required zeros and <poles> must be a nonzero element of $\mathcal L(Q-P)$. Conversely, if $0\ne f\in\mathcal L(Q-P)$, then $(f)+Q-P$ is an <effective divisor> of degree zero, hence is zero. It follows that $(f)=P-Q$, giving precisely the required simple zeros and simple <poles>, with no others. Thus the existence question is exactly whether $\mathcal L(Q-P)\ne0$.

Take a <basis> $f_1,\ldots,f_k$ of the <Riemann-Roch space> $\mathcal L(Q)$. Evaluation at the $p_i$ defines the <linear map>
$$
E_P:\mathcal L(Q)\longrightarrow\mathbb C^k,
\qquad f\longmapsto(f(p_1),\ldots,f(p_k)),
$$
whose <kernel> is $\mathcal L(Q-P)$. The <evaluation criterion for a prescribed principal divisor> becomes
$$
\mathcal L(Q-P)\ne0
\iff
\Delta(p_1,\ldots,p_k):=\det(f_j(p_i))_{1\leq i,j\leq k}=0.
$$
The crucial point is that this <determinant> does not vanish identically; a count of unknowns and equations alone would not prove this.

To verify it, begin with $V_0=\mathcal L(Q)$, of <dimension> $k$. Whenever $V_{j-1}\ne0$, choose a nonzero $f\in V_{j-1}$. Its zeros are finite. Choose $p_j$ outside those zeros, the support of $Q$ and the previously chosen points. Evaluation at $p_j$ is then a nonzero linear functional on $V_{j-1}$, so
$$
V_j=\{h\in V_{j-1}:h(p_j)=0\},
\qquad \dim V_j=\dim V_{j-1}-1.
$$
After $k$ steps, $V_k=0$. Thus there exists a tuple of distinct points with $\Delta\ne0$.

The entries of this <determinant> vary <holomorphically> away from the $q_i$, and are <rational functions> on the nonsingular <projective curve>. Its vanishing is therefore a proper closed exceptional locus on this configuration space; its complement is open and dense in the <Zariski topology>. For a generic choice of the $p_i$, $E_P$ is invertible and
$$
\boxed{\ell(Q-P)=0,\quad\text{so no function with the prescribed zeros and poles exists}.}
$$
This holds for every fixed tuple of distinct $q_i$, which proves the assertion for generic choices of both sets of points. At $k=1$, it is especially transparent: $\mathcal L(q_1)=\mathbb C$, so no nonzero member can vanish at a distinct $p_1$.