#K54462. Maximum Non-Attacking Rooks

    ID: 29759 Type: Default 1000ms 256MiB

Maximum Non-Attacking Rooks

Maximum Non-Attacking Rooks

You are given a chessboard with R rows and C columns. The task is to determine the maximum number of rooks that can be placed on the board such that no two rooks can attack each other. Two rooks attack each other if they share the same row or the same column.

The answer is given by the formula: \(\min(R, C)\), since rooks placed on distinct rows and columns do not threaten each other.

For example, on an 8×8 board, the maximum number of non-attacking rooks is 8, and on a 3×5 board, it is 3.

inputFormat

The input consists of a single line containing two space-separated integers \(R\) and \(C\), where \(R\) is the number of rows and \(C\) is the number of columns of the board.

outputFormat

Output a single integer, the maximum number of non-attacking rooks that can be placed on an \(R \times C\) grid. This is given by \(\min(R, C)\).

## sample
8 8
8