<s>[INST] Stars and bars to find "how many $x$ digit numbers are there with sum of digits $y$"? This question poses a seemingly very simple method to solve problems of the sort "how many $x$ digit numbers are there with sum of digits $y$?", but I don't understand it. Why are the "bad" solutions in correspondence to the solutions of $y_1 + 10 + x_2 + x_3 + x_4 + x_5 = 23$? What's the idea?
For instance, what "correct solution" corresponds to taking $y_1=13$? How to solve this problem?
 [/INST] The referred question asks for the number of non-negative integer solutions of
\begin{align*}
  x_1+x_2+x_3+x_4+x_5=23
  \end{align*}
with only one additional restriction $0\leq x_1\leq 9$. In this case we do not need the inclusion-exclusion principle.

In order to determine all integer solutions with
  \begin{align*}
  x_1+x_2+x_3+x_4+x_5=23\qquad\qquad0\leq x_1\leq 9,0\leq x_2,x_3,x_4,x_5\tag{1}
  \end{align*}
we look at all integer solutions of
\begin{align*}
  x_1+x_2+x_3+x_4+x_5=23\qquad\qquad\qquad\qquad 0\leq x_1,x_2,x_3,x_4,x_5\tag{2}
  \end{align*}
and subtract all solutions of
\begin{align*}
  x_1+x_2+x_3+x_4+x_5=23\qquad\qquad\qquad x_1\geq 10, 0\leq x_2,x_3,x_4,x_5\tag{3}
  \end{align*}

The solutions of (3) are the so-called  bad solutions in the referred question, meaning the invalid solutions which are to subtract when determining the solutions of (2).

In order to calculate (2) with the nice range $x_1,x_2,x_3,x_4,x_5\geq 0$ we can use the stars-and-bars
  technique and obtain
  \begin{align*}
  \binom{23+4}{4}=\binom{27}{4}=17550
  \end{align*}

In order to calculate (3) we transform the range by a proper substitution which enables us to apply the stars-and-bars technique again. Instead of $x_1\geq 10$, we substitute $x_1=y_1+10$ and the range $x_1\geq 10$ can then be transformed to $y_1+10\geq 10$ or equivalently $y_1\geq 0$.

This way we obtain from (3)
\begin{align*}
  x_1+x_2+x_3+x_4+x_5&=23\qquad\qquad\qquad x_1\geq 10, 0\leq x_2,x_3,x_4,x_5\\
  (y_1+10)+x_2+x_3+x_4+x_5&=23\qquad\qquad\qquad 0\leq y_1,x_2,x_3,x_4,x_5\\
  y_1+x_2+x_3+x_4+x_5&=13
\end{align*}
We are now in the same situation as in (2) and can apply the stars-and-bars technique again.
\begin{align*}
  \binom{13+4}{4}=\binom{17}{4}=2380
  \end{align*}

$$ $$

We finally obtain the number of wanted solutions as the total number of solutions of (2) minus the number of solutions of (3) 
  \begin{align*}
  \binom{27}{4}-\binom{17}{4}=17550-2380=15170
  \end{align*}

</s>