<s>[INST] How many five-digit numbers can be made from the digits $0, 1, 2, 3, 4$, provided that each digit can be repeated twice? The 10,000th place can be filled in $4$ different ways, the 1000th place can be filled in $5$ different ways, the 100th place can be filled in $4$ different ways, seeing the double repetition of numerical values, and the 10th and 1st places must be filled $(5-2)=3$ different ways each. Thus, the total number of possible such 5-digit numbers is $4 \cdot 5 \cdot 4 \cdot 3 \cdot 3 = 720$.
However, i found the following solution:
$$1) 1\cdot5!/1=120$$
$$2) 5\cdot5!/2=300$$
$$3) 10\cdot5!/4=300$$
$1)$ understandable. The number of all possible choices with zero in any position.
$1) 2)$ already incomprehensible. In theory, you need to calculate how many numbers there will be so that there is no zero in front. After all, such numbers are invalid. And somehow calculate, the number of options with repeating numbers $2$ times. Could you explain this to me?
 [/INST] $\color{red}{HINT=}$There are three situation such that zero is used once , zero is used two times  and zero is not used.
Zero is not used : Our generaitng function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^5$ and multiply it by $5!$
Zero is used once= Our generating function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^4$ and multiply it by $4!$. After that select one place for $0$ among $4$ suitable place.
Zero is used two times = Our generating function is $(1+ x+ \frac{x^2}{2})^4$ , then find the coefficient of $x^3$ and multiply it by $3!$. After that select two place for $0$ among $3$ suitable place.
$\color{blue}{OR}$,
More concisely, Lets think all of arrangement where zero may be leadind digit such that $(1+ x+ \frac{x^2}{2})^5$ , then find the coefficient of $x^5$ and multiply it by $5!$.
Now we should subtract the cases where zero is leading digit such that $(1+ x+ \frac{x^2}{2})^4 \times (1+x)$ , then find the coefficient of $x^4$ and multiply it by $4!$.
At last , subtract these two cases . Then you will find the number of $5$ digits numbers where it does not start with $0$ and each terms repeat at most $2$ times.
</s>