4. Xiaohong calculated the sum of all consecutive five positive integers not greater than 2008, while Xiaoming calculated the sum of all consecutive six positive integers not greater than 2008. Then the number of the same sums calculated by Xiaohong and Xiaoming is ( ).
(A) 333
(B) 335
(C) 338
(D) 400
4. A.

The sum Xiao Hong is looking for can be expressed as
$$
1+2+3+4+5+5 m=5 m+15 \text {; }
$$

The sum Xiao Ming is looking for can be expressed as
$$
1+2+3+4+5+6+6 n=6 n+21 \text {, }
$$

where $m, n$ are natural numbers, $m \leqslant 2003, n \leqslant 2002$.
From the problem, we know
$$
\begin{array}{l}
5 m+15=6 n+21 \\
\Rightarrow m=n+1+\frac{n+1}{5} . \\
\text { Let } \frac{n+1}{5}=k(k \text { is an integer }) \text {. Then } \\
n=5 k-1, m=6 k . \\
\text { Therefore }\left\{\begin{array}{l}
0 \leqslant 5 k-1 \leqslant 2002, \\
0 \leqslant 6 k \leqslant 2003 .
\end{array}\right.
\end{array}
$$

Let $\frac{n+1}{5}=k$ ( $k$ is an integer $)$. Then

Solving, we get $\frac{1}{5} \leqslant k \leqslant 333 \frac{5}{6}$.
Thus, $k$ can take 333 integer values, meaning the two have
333 identical sums.