Solution to Brilliant.com's Hunger Games competiition