#C1234. Left Array Rotation

    ID: 41756 Type: Default 1000ms 256MiB

Left Array Rotation

Left Array Rotation

Given an array of integers and a non-negative integer (n), perform a left rotation on the array by (n) positions. In a left rotation, the first (n) elements are moved to the end of the array, preserving their order.

For example, if the input array is [1, 2, 3, 4, 5] and (n = 2), the output will be [3, 4, 5, 1, 2].

This problem requires you to read input from standard input (stdin) and print the result to standard output (stdout).

inputFormat

The input is read from stdin and has the following format:
- The first line contains two integers (m) and (n), where (m) is the number of elements in the array and (n) is the number of positions to rotate the array to the left.
- The second line contains (m) space-separated integers representing the array elements.
Note: If (m = 0), the array is empty.

outputFormat

Output to stdout the rotated array as a sequence of space-separated integers on a single line. If the array is empty, output an empty line.## sample

5 2
1 2 3 4 5
3 4 5 1 2