5. $S=\{1,2, \cdots, 2003\} . A$ is a three-element subset of $S$. Satisfies: The elements in $A$ can form an arithmetic sequence. Then, the number of such three-element subsets $A$ is ( ).
(A) $C_{2 \propto \infty}^{3}$
(B) $\mathrm{C}_{1001}^{2}+\mathrm{C}_{1000}^{2}$
(C) $P_{1 \infty 1}^{2}+P_{1 \infty}^{2}$
(D) $\mathrm{P}_{2003}^{3}$
5. (B).

If $a_{1}, a_{2}, a_{3}$ form an arithmetic sequence, then $a_{1}+a_{3}=2a_{2}$, which means the parity of the first and last terms $a_{1}, a_{3}$ is the same, and once the first and last terms are determined, the arithmetic sequence is also determined. It is worth noting that although $a_{1}, a_{2}, a_{3}$ form an arithmetic sequence, $a_{3}, a_{2}, a_{1}$ also form an arithmetic sequence, but they correspond to the same set $A=a_{1}, a_{2}, a_{3}$.
Divide $S$ into two sets based on parity:
$$
\begin{array}{l}
S_{1}=1,3, \cdots, 2001,2003 \\
S_{2}=2,4, \cdots, 2000,2002 .
\end{array}
$$

There are $C_{1002}^{2}$ ways to choose two elements from $S_{1}$ as the first and last terms of the arithmetic sequence, and $C_{1001}^{2}$ ways to choose two elements from $S_{2}$ as the first and last terms of the arithmetic sequence. In total, there are $C_{1002}^{2}+C_{1001}^{2}$ subsets that satisfy the condition.