Placing Squares

AtCoder - agc013_e