apple pie's submission of Sticks and Rectangles | CodeChef