Suppose you have three children and 40 pieces of candy. How many ways are there to distribute the candy such that each child gets more than one but fewer than 20 pieces?
We can use the "stars and bars" method, since this is the equivalent of giving 40 pieces of candy to three children, such that each child gets at least two pieces. This is the same as giving $40-6=34$ pieces to the three children with no restrictions (since we can pretend six pieces are already given out, two to each child). This is the same as arranging the 36 pieces of candy and two "dividers" (one between the first child's candy and the second child's candy and one between the second child's candy and the third child's candy) in a row. Thus, the number of ways to do this is

$$
\left(\begin{array}{c}
36 \\
2
\end{array}\right)=\frac{36 \cdot 35}{2}=630
$$

However, this counts cases where one child gets at least 20 pieces of candy, which we don't want, so we need to subtract these cases. Only one child could get at least 20 pieces, or we would run out of candy, so there are three ways to choose the child who gets at least 20 pieces. Then, we have 20 pieces of candy to distribute among three children so that two of them (the ones who didn't already get 20 ) get at least 2 pieces each, which is the equivalent of distributing $20-4=16$ pieces among 3 children with no restrictions (since we can think of four of the pieces as being already given out). This can be done in $\left(\begin{array}{c}18 \\ 2\end{array}\right)$ ways, since it is the same as lining up 6 pieces of candy and two "dividers." Putting this together, we get

$$
\left(\begin{array}{c}
36 \\
2
\end{array}\right)-3\left(\begin{array}{c}
18 \\
2
\end{array}\right)=630-3 \cdot 153=171
$$