A ticket consists of six digits $a, b, c, d, e, f$. This ticket is called "happy" if $a+b+c=$ $d+e+f$. How many happy tickets are there (including the ticket 000000)?

## Graphs

We will not present the results on graphs as they are covered in the graph theory poly on the Animath website.
For every happy number $a b c d e f$, we associate a number $a b c \bar{d} \bar{e} \bar{f}$ where $\bar{d}=9-d, \bar{e}=9-e$ and $\bar{f}=9-f$, the sum of the digits $a b c \bar{d} \bar{e} \bar{f}$ is 27. Furthermore, we notice that for each happy number $a b c d e f$ there corresponds a number $a b c \overline{\bar{e}} \bar{f} \bar{f}$ and to every number whose sum of digits is 27, we can associate a happy number. Thus, it suffices to count the numbers whose sum of digits is 27, that is, we seek to enumerate the number of sums $a_{1}+a_{2}+\cdots+a_{6}=27$, where $0 \leq a_{i} \leq 9$. This number is $\binom{27+5}{5}-6\binom{22}{5}+15\binom{12}{5}=55252$, this sum comes from the principle of inclusion-exclusion, the first term is the number of sums $a_{1}+a_{2}+\cdots+a_{6}=27$ without restrictions on the values of $a_{i}$ (see the previous exercise), the second is the number of sums where at least one term is greater than 10 (we choose one of the 6 terms from a sum equal to 22 and add 10 to this term 10) and finally the last corresponds to the sums with at least two terms greater than 10.