How many four-digit positive integers are there that contain the digit $3$ and are divisible by $5$?

Solution 1:

You double counted, for example $3335$ appears in all your sum.

You can use inclusion-exclusion to adjust your count.

\begin{align} &|A|+|B|+|C|-|A\cap B|-|A \cap C|-|B \cap C| + |A \cap B \cap C|\\ &=560 - 18 - 20-20+2\\ &=504 \end{align}

Solution 2:

You are over counting a few cases. For example, $1330$ is counted in the first case when $x\in\{1,…,9\},y=3,z\in\{0,…,9\},w\in\{0,5\}$ and it is counted again in the second case when $x\in\{1,…,9\},y\in\{0,…,9\},z=3,w\in\{0,5\}$