Solution (source code)

= Solution

Write $L_i=a_ix+b_iy+c_iz$ and $S=\prod_iL_i$. The numerator and denominator have the same homogeneous degree, so their ratio is well-defined on projective points away from its poles and extends as a <meromorphic function> on $C$. Locally the pole order cannot exceed the zero order of $S|_C$, whose <divisor> is $D$. Thus $f_Q\in L(D)$.

Equality of two ratios is equivalent to $Q-Q'$ vanishing on $C$. A nonsingular projective plane <curve> is irreducible: distinct positive-degree components would intersect by <Bézout's theorem>, producing a singular point. Its homogeneous vanishing ideal is therefore generated by its irreducible defining <polynomial> $P$. One can also see this using <Bézout's theorem>: a homogeneous <polynomial> not divisible by $P$ has only finitely many intersections with $C$, so cannot vanish on the whole <curve>. Consequently
$$
\boxed{f_Q=f_{Q'}\iff Q-Q'=PR,\qquad R\in V_{m-d}.}
$$
Multiplication by the nonzero <polynomial> $P$ is injective. The <linear map> $V_m\to L(D)$ therefore has <kernel> $PV_{m-d}$ and image <dimension>
$$
\boxed{\binom{m+2}{2}-\binom{m-d+2}{2}
=md+\frac{3d-d^2}{2}=md+1-g.}
$$
The assumption $m\geq d$ makes both <polynomial>-space <dimensions> applicable directly.