Help me in solving CHEFGRD problem

My issue

code in c full code i need

My code

#include <stdio.h>

int main() {
	// your code goes here

}


Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP302/problems/CHEFGRD