Solution to Google Code Jam store credit