#K48512. Generate Grid with Consecutive Integers

    ID: 28437 Type: Default 1000ms 256MiB

Generate Grid with Consecutive Integers

Generate Grid with Consecutive Integers

Given two integers \(M\) and \(N\), your task is to generate a grid of size \(M \times N\) filled with consecutive integers starting from 1 in row-major order. That is, the first row should contain the first \(N\) numbers, the second row the next \(N\) numbers, and so on.

Example:

Input:
2 2

Output: 1 2 3 4

</p>

Note: Read input from standard input (stdin) and print the result to standard output (stdout). Each row of the grid must be printed on a new line and the numbers in each row should be separated by a single space.

inputFormat

The input consists of a single line containing two space-separated integers (M) and (N) representing the number of rows and columns respectively.

outputFormat

Output the grid with (M) rows. Each row should contain (N) space-separated integers in increasing order starting from 1. Each row must be printed on a new line.## sample

2 2
1 2

3 4

</p>