25. For a real number $x$, let $\lfloor x\rfloor$ denote the greatest integer not exceeding $x$. Consider the function
$$
f(x, y)=\sqrt{M(M+1)}(|x-m|+|y-m|),
$$
where $M=\max (\lfloor x\rfloor,\lfloor y\rfloor)$ and $m=\min (\lfloor x\rfloor,\lfloor y\rfloor)$. The set of all real numbers $(x, y)$ such that $2 \leq x, y \leq 2022$ and $f(x, y) \leq 2$ can be expressed as a finite union of disjoint regions in the plane. The sum of the areas of these regions can be expressed as a fraction $a / b$ in lowest terms. What is the value of $a+b$ ?
25. 2021
Fix $m \geq 2$. First note that $x, y \geq m$, and that $M \geq 2$, implying $\sqrt{M(M+1)} \geq 2$. Thus, $f(x, y) \leq 2$ necessarily implies $|x-m|+|y-m| \leq 1$, and so $|x-m|,|y-m| \leq 1$. This implies $x \in[m-1, m+1]$, and so $x \in[m, m+1]$. Similarly, $y \in[m, m+1]$. Now if $x=m+1$, then $1 \leq|x-m|+|y-m| \leq \frac{2}{\sqrt{M(M+1)}}<1$, contradiction. Using the same argument for $y$, it follows that $x, y \in[m, m+1)$. Thus, $\lfloor x\rfloor=\lfloor y\rfloor=m$ always, and so $M=m$.
The inequality is then equivalent to $|x-m|+|y-m| \leq \frac{2}{\sqrt{m(m+1)}}$. Let $r \leq 1$ be the upper bound in the inequality. Keeping in mind the fact that $x, y \geq m$, this region is a right-triangle with vertices $(m, m),(m+r, m)$ and $(m, m+r)$, which then has area $\frac{r^{2}}{2}=\frac{2}{m(m+1)}$. This region is within the set for $2 \leq m \leq 2021$, so the desired sum is
$$
\sum_{m=2}^{2021} \frac{2}{m(m+1)}=2 \sum_{m=2}^{2021}\left(\frac{1}{m}-\frac{1}{m+1}\right)=2\left(\frac{1}{2}-\frac{1}{2022}\right)=\frac{1010}{1011} .
$$

It then follows that $a+b=2021$.