#C14832. Square Elements

    ID: 44525 Type: Default 1000ms 256MiB

Square Elements

Square Elements

You are given an input that is intended to represent a Python list. Your task is to compute the square of each integer in the list and output a new list with these squared values.

More formally, if the input list is \(L = [a_1, a_2, \ldots, a_n]\) where each \(a_i\) is an integer, then you should output \([a_1^2, a_2^2, \ldots, a_n^2]\). If the input does not represent a list, or if any element of the list is not an integer, you should output an appropriate error message.

The error messages are exactly as follows:

  • If the input is not a list: Error: Input is not a list
  • If any element in the list is not an integer: Error: List contains non-integer elements

inputFormat

The input is provided as a single line read from standard input, representing a Python literal. For example: [1, 2, 3, 4] or "not a list". The input might be invalid or contain non-integer elements.

outputFormat

If the input is a valid list of integers, print the list of squared integers in Python list format. Otherwise, print the appropriate error message as specified.

## sample
[1, 2, 3, 4]
[1, 4, 9, 16]