LearnPy Hub
← Arena
IntermediateRating 1200

k Closest to x

Print the k numbers closest to x, in increasing order. If two numbers are equally close, the smaller one wins.

Input

n, k and x, then n integers.

Output

k integers.

Sample 1

Input
5 4 3
1 2 3 4 5
Output
1 2 3 4

Sample 2

Input
5 4 -1
1 2 3 4 5
Output
1 2 3 4
solution.py
Output appears here
k Closest to x · Python Arena problem · LearnPy Hub