In how many ways we can distribute $15$ apples to $4$ students if each of the first two students has to get at most $4$ apples?
I know how to solve these types of problems if it were to ask "at least" or "an even/odd amount," but because the question asks that two of the students get "at most $4$ apples" is making it more difficult for me to solve. I tried to use generating and I end up with $f(x)=(1-x^5)^2 \cdot (1-x)^{-4}$, then I would have to expand and find the coefficient of $x^{15}$ but I am not sure if this is correct, there has to be a more efficient solution. I tried doing exponential generating functions but I got stuck at an earlier step.
So how do I solve the types of questions with the constraint that some number of people must get "at most" of something? Is there a different method besides generating functions or is there an intelligent solution to these types of problems?
I do not want a solution to the original question, just a hint.
You could certainly use the inclusion-exclusion principle here.
Say, without loss, that students 1 and 2 are the ones with the restriction. Let $A$ be the set of configurations you want. Let $A_1$ be the configurations in which student 1's restriction is violated, $A_2$ the configurations in which student 2's restriction is violated, and $A_{1,2}$ the configurations in which both restrictions are violated. Then $$ \lvert A\rvert=\binom{15}{4}-(\lvert A_1\rvert+\lvert A_2\rvert)+\lvert A_{1,2}\rvert=\binom{15}{4}-(\lvert A_1\rvert+\lvert A_2\rvert)+\lvert A_1\cap A_2\rvert. $$