#C7373. Non-attacking Apple Trees

    ID: 51237 Type: Default 1000ms 256MiB

Non-attacking Apple Trees

Non-attacking Apple Trees

You are given a farm grid with M rows and N columns. Your task is to plant apple trees on the grid such that no two apple trees share the same row or the same column. Under these constraints, the maximum number of apple trees that can be planted is given by \(\min(M, N)\), as you cannot place more trees than the lesser of the two dimensions.

For example, if the grid has 4 rows and 5 columns, you can plant at most \(\min(4, 5) = 4\) apple trees, each in a unique row and column.

inputFormat

The input consists of two space-separated integers M and N, where M represents the number of rows and N represents the number of columns in the grid.

outputFormat

Output a single integer representing the maximum number of apple trees that can be planted such that no two trees are in the same row or column.

## sample
4 5
4