How to solve RECTARAN?

april19

#1

https://www.codechef.com/APRIL19A/problems/RECTARAN