Help with MAXHAMDIST

Wondering why this approach would not work.
Any help is great!

Submission Link - Solution: 1091093476 (codechef.com)