Gradient And Hessian In Codechef CPOINT

Can somebody explain this solution http://www.codechef.com/viewsolution/2949645 for this problem http://www.codechef.com/problems/CPOINT/.