Let $|f(x)-f(y)| \leqslant (x-y)^2$ for all $x,y\in \mathbb{R}.$ Show that $f$ is a constant.
For any $x \in \mathbb{R}$, you have: $|f(x+h) - f(x)| \le ((x+h) - x)^2=h^2=|h|^2\implies \left|\dfrac{f(x+h) - f(x)}{h}\right|\le |h|\implies \displaystyle \lim_{h \to 0} \left|\dfrac{f(x+h) - f(x)}{h}\right| = 0 \implies \displaystyle \lim_{h \to 0} \dfrac{f(x+h) - f(x)}{h} = 0\implies f'(x) = 0\implies f = \text{constant}.$
We have $$ |f(x)-f(y)| \leqslant (x-y)^2 $$ so $$ \frac{|f(x)-f(y)|}{|x-y|} \leqslant |x-y| $$ so $$ \frac{|f(x)-f(y)|}{|x-y|} \to_{y \to x} 0. $$ Thus $f'=0$ and $f$ is constant.
We needn't assume $f$ is differentiable, or even continuous. Just use the triangle inequality:$$|f(y+h)-f(y)|\le\sum_{k=1}^n|f(y+hk/n)-f(y+h(k-1)/n)|\le n(h/n)^2=h^2/n$$for all $n\in\Bbb N$, so $f(y+h)-f(y)=0$.