Calculate how many ways you can give $7$ children $7$ identical candies My try:

Calculate how many ways you can give $7$ children $7$ identical candies if each child got at most 2 candies.

$$x_1+x_2+x_3+x_4+x_5+x_6+x_7=7 \text{    for   } x_i \in \left\{ 0,1,2\right\}$$
$$[t^7](1+t+t^2)^7[t^7](\frac{1-t^3}{1-t})^7=[t^7](1-t^3)^7 \sum {n+6 \choose 6}t^n$$
$$\begin{array}{|c|c|c|c||c|c|}
\hline
\text{first parenthesis} & \text{ways in the first} & \text{ways in the second }\\ \hline
\text{1} & 1 & { 13 \choose 6} \\ \hline
{t^3} & { 1 \choose 1} & { 10 \choose 6} \\ \hline
{t^6}  &  { 7 \choose 2} & { 7 \choose 6}\\ \hline
\end{array}$$
Sollution:$${ 7 \choose 2}{ 7 \choose 6}+{ 7 \choose 1}{ 10 \choose 6}+{ 13 \choose 6}=3333$$
But I checked it in Mathematica and I get $393$. So can you check where the error is?

As was commented, the only issue is the sign of the middle term must be negative. To see it, express the first binomial as a sum too:
$$[t^7](1-t^3)^7 \sum {n+6 \choose 6}t^n=[t^7]\sum_{k=0}^7{7\choose k}(-t^3)^k \sum_{n=0}^{\infty} {n+6 \choose 6}t^n=\\
\underbrace{{7\choose 0}{13\choose 6}}_{k=0,n=7}-\underbrace{{7\choose 1}{10\choose 6}}_{k=1,n=4}+\underbrace{{7\choose 2}{7\choose 6}}_{k=2,n=1}=393.$$
