#C13559. Filter Unique Elements Above Threshold

    ID: 43110 Type: Default 1000ms 256MiB

Filter Unique Elements Above Threshold

Filter Unique Elements Above Threshold

You are given a list of integers and a threshold value. Your task is to filter out and return the unique elements from the list that are greater than the given threshold. The elements should appear in the same order as in the input list.

Note: An element is included in the output only if it is strictly greater than the threshold and has not been included before.

In mathematical notation, if the input list is \(A = [a_1, a_2, \dots, a_n]\) and the threshold is \(T\), then you need to output the list \(B = [b_1, b_2, \dots, b_k]\) such that for every \(b_i\), \(b_i > T\) and for any two indices \(i \neq j, b_i \neq b_j\). The order of \(B\) should reflect the order in which the qualifying elements appear in \(A\).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  • The first line contains a sequence of space-separated integers representing the array.
  • The second line contains a single integer representing the threshold value.

outputFormat

Output to standard output (stdout) a single line containing the unique elements (in their original order) that are strictly greater than the threshold, separated by a single space. If no element qualifies, output an empty line.

## sample
1 5 7 2 5 9 1
4
5 7 9