Mrs. Verma has decided to sell his car. N people have offered to buy the car. Instead of…
- User
Mrs. Verma has decided to sell his car. N people have offered to buy the car. Instead of selling to the highest bidder, Mrs. Verma decides to sell his company to the Kth lowest bidder. How much money will Mrs. Verma get? Input
The first line of the input contains 2 space-separated integers, N and K. The next line contains N space separated integers A1, A2, ..., AN, denoting the money each of the N people are willing to pay.
Output
Print a single integer, denoting the money Mrs/ Verma will sell his company for. Constraints
1 ≤ K ≤ N ≤ 1000 1 ≤ Ai ≤ 10000
Example
Input: 5 4 1 2 1 3 3
Output: 3
Explanation Out of the 5 bids, the 4th lowest amount is 3.
Assistant
python# Read input values n, k = map(int, input().split()) bids = list(map(int, input().split())) # Sort the list of bids in ascending order bids.sort() # Output the Kth lowest bid print(bids[k-1])
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.