3. Given $0 \leq a_{k} \leq 1(k=1,2, \ldots, 2020)$, let $a_{2021}=a_{1}, a_{2022}=a_{2}$, then the maximum value of $\sum_{k=1}^{2020}\left(a_{k}-\right.$ $\left.a_{k+1} a_{k+2}\right)$ is $\qquad$
This problem's difficulty: average of the first test
Mainly examines: basic inequalities
Solution: 1010
From $0 \leq a_{k} \leq 1$, we get $\left(1-a_{k}\right)\left(1-a_{k+1}\right) \geq 0(k=1,2, \ldots, 2020)$,
so $1 \geq a_{k}+a_{k+1}-a_{k} a_{k+1} \geq a_{k}+a_{k+1}-2 a_{k} a_{k+1}$
thus $2020 \geq \sum_{k=1}^{2020}\left(a_{k}+a_{k+1}-2 a_{k} a_{k+1}\right)=2 \sum_{k=1}^{2020}\left(a_{k}-a_{k+1} a_{k+2}\right)$
$$
\sum_{k=1}^{2020}\left(a_{k}-a_{k+1} a_{k+2}\right) \leq 1010
$$

When $a_{1}=a_{3}=\ldots=a_{2017}=a_{2019}=1$, and the rest are 0, the equality holds.