Solution for Code Chef Problem 'DOUBLE' (http://www.codechef.com/problems/DOUBLE)