This seems to be the matchingassingment/matching problem for the National Resident Matching Program which is closely related to the stable marriage problem.
In the resident matching problem your $C_i$ are medical students which have finished and need to apply to do residency. The $P_i$ are hospitals where they can train. Each hospital has some limit $p_i$ of people they can train.
Here is a video explaining the algorithm from the National Resident Matching Program.