P2706 Chocolate

Background

Wang 7's birthday has arrived, and his younger brother plans to give him chocolate.

Description

There is a chocolate box divided into $n \times m$ cells; at position $(i, j)$ there are $a_{i,j}$ pieces of chocolate. On the night before gifting it, mice raided the box: some cells were looted and now have holes. So you—Wang 7's younger brother, Wang 9—must cut out a rectangular chocolate box from this battered box, such that it contains no looted cells and the total number of chocolates inside is as large as possible.

Input Format

The first line contains two integers $n, m$. In line $i+1$, the $j$-th number denotes $a_{i,j}$. If this number is $0$, it means the cell at that position was looted.

Output Format

Output the maximum number of chocolates.

Explanation/Hint

**Example Explanation** The first three cells in the third row `10 3 4` form the rectangle with the maximum number of chocolates. **Constraints** For all the testdata, $1 \le n, m \le 300$, $0 \le a_{i,j} \le 255$. Translated by ChatGPT 5