Codechef, July Long Challenge, solutions.