Solution (source code)

= Solution

Let $S$ be the vertices of $X$ with fewer than $d|Y|/2$ neighbours in $Y$. If $|S|>\epsilon n$, it is a permissible subset in the regularity test, and averaging those degrees gives $d(S,Y)<d/2$. But $d(X,Y)\ge d$, so
$$
|d(S,Y)-d(X,Y)|>d/2>\epsilon,
$$
contradicting regularity. Therefore \b[there are at most $\epsilon n$ such vertices]. The same argument in fact rules out $|S|\ge\epsilon n$ when that threshold is integral and nonzero.