#K42702. Flatten Nested List of Integers

    ID: 27146 Type: Default 1000ms 256MiB

Flatten Nested List of Integers

Flatten Nested List of Integers

Given a nested list of integers represented by structured input, your task is to flatten the list into a single list. The input starts with an integer \(N\) representing the number of sublists. Each of the following \(N\) lines starts with an integer \(L\) (indicating the number of elements in that sublist) followed by \(L\) integers. The flattened list should contain all the integers in the same order as they appear in the input.

More formally, if the nested list is given by \(S = \{s_1, s_2, \ldots, s_N\}\) where each \(s_i\) is a list of integers, you are required to output a single list \(F = [f_1, f_2, \ldots, f_M]\) in which the order of the elements is preserved.

inputFormat

The first line contains a single integer (N) (1 (\leq N \leq 10^5)) — the number of sublists. The next (N) lines each start with an integer (L) (0 (\leq L \leq 10^5)), representing the number of elements in that sublist, followed by (L) integers separated by spaces.

outputFormat

Output a single line containing the flattened list of integers in the order they appear, separated by a single space. If the list is empty, output an empty line.## sample

3
3 1 2 3
2 4 5
4 6 7 8 9
1 2 3 4 5 6 7 8 9

</p>