#K15071. Largest Flowerbed Area

    ID: 24275 Type: Default 1000ms 256MiB

Largest Flowerbed Area

Largest Flowerbed Area

You are given a garden represented as an n × m grid. Each cell of the grid contains an integer that indicates the type of flower planted in that cell. Your task is to determine the area of the largest rectangular region (flowerbed) where all cells have the same flower type.

The flowerbeds are determined by contiguous rows and columns (forming a rectangle) that contain the same number. Note that the flowerbeds do not necessarily need to be connected in a non-rectangular shape; they must form a rectangular sub-matrix.

Example:

Input:
3 3
1 2 1
2 2 2
1 2 1

Output: 3

</p>

In the above example, the largest flowerbed of the same type is the second row (with three consecutive 2's) and its area is 3.

inputFormat

The first line of input contains two space-separated integers n and m denoting the number of rows and columns respectively.

This is followed by n lines, each containing m space-separated integers. Each integer represents the type of flower in that cell.

outputFormat

Output a single integer: the maximum area of any rectangular flowerbed consisting of the same type of flower.

## sample
3 3
1 2 1
2 2 2
1 2 1
3