Successful solution for Chef and Subarray problem - http://www.codechef.com/JUNE14/problems/CHEFZOT