#C10872. Power Set Generation

    ID: 40125 Type: Default 1000ms 256MiB

Power Set Generation

Power Set Generation

Given a list S of n distinct integers, your task is to generate the power set of S, i.e. all possible subsets of S. Each subset must show the elements in the same order as they appear in S. The output should list the subsets in order of increasing size, and for subsets of the same size, in lexicographical order (based on the original order of S).

In mathematical terms, if S = \(\{a_1, a_2, \dots, a_n\}\), then the power set is defined as \(\mathcal{P}(S) = \{ T : T \subseteq S \}\). For example, if S = [1, 2, 3], then the power set is:

[ [ ], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3] ]

Your program should read the input from standard input (stdin) and print the result to standard output (stdout) in the Python list-of-lists format.

inputFormat

The first line of input contains an integer n representing the number of elements in the list. If n > 0, the second line contains n space-separated integers.

outputFormat

Output the power set of the given list in a single line in the format of a Python list of lists. Each subset should be displayed as a list with the elements separated by commas and a space (", ").

## sample
0
[[]]