Solution (source code)

= Solution

A point is ramified with multiplicity $m_i$ exactly when it is a zero of $f'$ of multiplicity $m_i-1$. Since $f'$ has degree $d-1$, the <fundamental theorem of algebra> gives $\sum_i(m_i-1)=d-1$.

Conversely, choose distinct complex numbers $a_i$ and put $g(z)=c\prod_i(z-a_i)^{m_i-1}$ with $c\ne0$. The assumption makes $g$ a polynomial of degree $d-1$. Any <antiderivative> $f$ of $g$ has degree $d$ and precisely the prescribed <ramification divisor>[ramification] multiplicities.