Solution (source code)

= Solution

Every nonzero word has weight divisible by $4$. Weight $4$ is impossible: using $u+v=a+b$, $u+w=b$, $v+w=a$, and $u+v+w=x$, the distance-four properties force any nonzero one of these sums to have weight $4$; coordinate counting in total weight $4$ then forces two blocks to vanish, which would put a nontrivial word in $H'\cap K'$. That intersection contains only $0$ and $\mathbf1$, and $\mathbf1$ gives block weight at least $8$. Hence $d(G)\ge8$, and taking $a\ne0,b=x=0$ gives weight $2\operatorname{wt}(a)=8$, so $d(G)=8$.