5. The company specializes in manufacturing "boards with a hole": this is a $300 \times 300$ grid board, in which a hole in the form of a rectangle, not extending to the board's edge, is cut out by cells. Each such board comes with a tag indicating the maximum number of non-attacking rooks that can be placed on this board. (It is assumed that rooks do not attack through the hole.) For the company's anniversary, it was decided to manufacture a board with the highest number on the tag. What is this number?
Answer: 400 rooks (in the $2-nd$ variant 440 rooks).

Let the hole have dimensions $a \times b$. Note that all cells of the board with the hole are covered by $300-b$ columns and 300 - a rows. If $a, b \geqslant 100$, then all cells are covered by no more than 400 lines, and it is impossible to place more than 400 rooks on them. If one of the sides (for example, a) is less than 100, then the board is covered by 300 - a rows and $2 a$ pieces of rows, and no more than $300+a \leqslant 400$ rooks can be placed on them.

If, however, a hole of size $100 \times 100$ is cut out in the center of the board, then rooks can be placed in cells with coordinates $(1,200),(2,199), \ldots,(100,101),(101,100), \ldots,(200,1) u(101,300),(102,299), \ldots,(200,201)$, $(201,200), \ldots,(300,101)$.