Prove a function is constant under certain conditions
If $f$ is not constant, then $f'(a)\ne 0$ for some $a.$ Thus for some $\delta >0,$ $|f(y)-f(a)|/|y-a|>|f'(a)|/2$ for $a<y<a+\delta.$ Taking $x=a,$ the integral of interest is at least
$$\int_{a}^{a+\delta}\frac{|f(a)-f(y)|}{|a-y|^2}dy \ge \frac{|f'(a)|}{2}\int_{a}^{a+\delta}\frac{1}{y-a}dy =\infty,$$
contradiction.