Solution (source code)

= Solution

Let
$$
D(\lambda)=\#\{\text{odd hook lengths of }\lambda\}
-\#\{\text{even hook lengths of }\lambda\}.
$$
A direct comparison of the affected bead-gap pairs shows that removing a rim 2-hook preserves $D$: the pairs whose parities change cancel in odd-even pairs. Repeating this removal gives
$$
D(\lambda)=D(C_2(\lambda)).
$$
Every <core of a partition>[2-core] is a staircase
$$
(r,r-1,\ldots,1).
$$
All hook lengths in this staircase are odd, and it has $1+2+\cdots+r=r(r+1)/2$ cells. Hence the <odd-minus-even hook count of a partition> is
$$
\boxed{D(\lambda)=\binom{r+1}{2}}.
$$
Thus the requested integer is $m=r+1=\ell(C_2(\lambda))+1$.