hacker cup prob 1