<s>[INST] Can we solve this using stars and bars? The number of ways of distributing 12 identical oranges among 4 children so that every child gets at least one and no child more than 4 is 31.
My try: First of all give each child 1 orange and we are left with 8 oranges.
Then 
3 3 2 0
3 3 1 1
3 2 2 1
2 2 2 2
and permuting each, we get total 31. But can we solve this using stars and bars?
 [/INST] A simple solution by generating functions, ellipses cover terms that don't influence the result:
\begin{align}
[z^{12}] (z + z^2 + z^3 + z^4)^4
  &= [z^{12}] \left( \frac{z (1 - z^4)}{1 - z} \right)^4 \\
  &= [z^8] (1 - z^4)^4 (1 - z)^{-4} \\
  &= [z^8] (1 - 4 z^4 + 6 z^8 - \cdots)
              \sum_{n \ge 0} \binom{-4}{n} (-1)^n z^n \\
  &= [z^8] (1 - 4 z^4 + 6 z^8 - \cdots) 
              \sum_{n \ge 0} \binom{n + 4 - 1}{4 - 1} z^n \\
  &= \binom{11}{3} - 4 \binom{7}{3} + 6 \binom{3}{3} \\
  &= 31
\end{align}
</s>