Counting Problem: How many ways to split 12 marbles between 3 people, with each person having at least one marble? So the 12 marbles are distinct with each marble being a different color. Therefore I have to take into account, the different colors and different amount each person have. For example, person 1 can have 2 marbles, person 2 can have 7 marbles, and person 3 can have 3 marbles with each marble being a different color. At first, I thought it was:
$$\binom{12}{1}\binom{11}{1}\binom{10}{1}$$
but I don't think it covers the case of each person having a different amount of marbles for each case. 
 A: Each marble can go to any of the $3$ people, hence $3^{12}$ ways.
But this also counts the cases where $1$ and/or $2$ persons get no marbles.
For one person, e.g. $1$, to get no marbles, there are $2^{12}$ ways, but these also count the number of ways for two people to get no marbles.
For two people, e.g. $1,2$, to get no marbles there is $1$ way.
So, using inclusion-exclusion, we subtract the one-person/no-marbles cases, which means we have subtracted the three two-person/no-marbles cases six times, twice each.
We need these in exactly once, so we add them back in:
$$3^{12}-3\cdot2^{12}+3$$
$$=519156$$
A: I would like to present a different solution using Analytic Combinatorics (AC). What I like about AC is that you mostly don't have to think, the solution can be achieved using standard formulas.
Let's call the three persons A, B, C, and the marbles 1, 2, .., 11, 12. Using AC it's important to know when order matters. The order for the persons matter, it's different A getting the marbles 1,3,5 than B getting the marbles 1,3,5. The order of the marbles doesn't matter, it's the same A getting 1,3,5 and A getting 3,1,5.
When the order matters, we have an operator called Sequence ($SEQ$). We want a sequence of exactly 3 elements. When the order doesn't matter, we have an operator called Set ($SET$). We don't care about the size of the set, as long as it's not empty.
The answer therefore is $SEQ_3(SET(z) - \epsilon)$: A sequence of 3 non-empty sets. To denote non-empty sets, we use $SET(z)-\epsilon$, meaning a set of any size, excluding the empty set.
Now there's a translation between constructs and formulas which you can find in tables. In our example we have $SEQ_3(z)=z^3$, $SET(z)=e^z$ and $\epsilon=1$. The final formula for your problem is $(e^z-1)^3$. (These are formulas for labelled objects, so we'll have to remember to multiply the final result for $n!$ at the end.)
Now all we have to do is finding the value when you have 12 marbles. This can be done by opening the formula above in a series, and finding the coefficient for $z^{12}$. This is better done by software. Using Mathematica (or Wolfram Alpha), you'll have the answer:
In = 12!*SeriesCoefficient[(E^z - 1)^3, {z, 0, 12}]
Out = 519156

This is the non-thinking solution, I didn't have to think about inclusion-exclusion principle, think about combinations, binomials and so on. If you find this to be cheating, then you can at least learn the method to check your solution at the end.
To learn more Analytic Combinatorics, the easiest resource is the course at Coursera, but wikipedia can also help. The definitive resource is the book by Flajolet, which you can download for free.
