num = sorted([int(eval(input())) for i in range(0, n)])
min_unfairness = min(max_value - min_value for min_value, max_value in zip(
    num, num[k - 1:]))
print(min_unfairness)
Performance Improvement Basics in Python