added solutions for codechef's october 2014 long time challenge