"""# ### 谜题描述 You are given an array a of n integers, where n is odd. You can make the following operation with it: * Choose one of the elements of the array (for example a_i) and increase it by 1 (that is, replace it with a_i + 1). You want to make the median of the array the largest possible using at most k operations. The median of the odd-sized array is the middle element after the array is sorted in non-decreasing order. For example, the median of the array [1, 5, 2, 3, 5] is 3. Input The first line contains two integers n and k (1 ≤ n ≤ 2 ⋅ 10^5, n is odd, 1 ≤ k ≤ 10^9) — the number of elements in the array and the largest number of operations you can make. The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9). Output Print a single integer — the maximum possible median after the operations. Examples Input 3 2 1 3 5 Output 5 Input 5 5 1 2 1 1 1 Output 3 Input 7 7 4 1 2 4 3 4 4 Output 5 Note In the first example, you can increase the second element twice. Than array will be [1, 5, 5] and it's median is 5. In the second example, it is optimal to increase the second number and than increase third and fifth. This way the answer is 3. In the third example, you can make four operations: increase first, fourth, sixth, seventh element. This way the array will be [5, 1, 2, 5, 3, 5, 5] and the median will be 5. Here is a reference code to solve this task. You can use this to help you genereate cases or validate the solution. ```python import fileinput def D(a):print(a) def S(s,I):return int(s.split(\" \")[I]) def ok(t): global A global N global K S=0 for i in xrange(N/2,N): S+=max(t-A[i],0) return S>K def main(): z=0 global A global N global K for l in fileinput.input(): z+=1 if(z<2): N=S(l,0) K=S(l,1) continue A=map(int,l.split(\" \")) A.sort() M=0 B=0 E=2000000666 while(B str: n = question_case['n'] k = question_case['k'] array = question_case['array'] array_str = ' '.join(map(str, array)) examples = [ { 'input': "3 2\n1 3 5", 'output': 5 }, { 'input': "5 5\n1 2 1 1 1", 'output': 3 } ] example_text = '\n'.join([f"Input:\n{ex['input']}\nOutput:\n{ex['output']}" for ex in examples]) prompt = f'''You are a programming competition contestant. Solve the following problem: You are given an array of integers with an odd number of elements. You can perform up to k operations where each operation increases an element by 1. Your goal is to maximize the median of the array. The median is the middle element after sorting the array. Input format: - The first line contains two integers n and k. n is odd. - The second line contains n integers representing the array. Output: - A single integer: the maximum possible median. Examples: {example_text} Now, solve the following problem: Input: {n} {k} {array_str} What is the maximum possible median? Put your final answer within [answer] and [/answer] tags. For example: [answer]5[/answer].''' return prompt @staticmethod def extract_output(output): matches = re.findall(r'\[answer\](.*?)\[/answer\]', output, re.DOTALL) if not matches: return None last_match = matches[-1].strip() try: return int(last_match) except ValueError: return None @classmethod def _verify_correction(cls, solution, identity): n = identity['n'] k_val = identity['k'] array = identity['array'] sorted_arr = sorted(array) left = sorted_arr[n // 2] right = left + k_val # Upper bound based on maximum possible increment best = left while left <= right: mid = (left + right) // 2 required = 0 for i in range(n // 2, n): if sorted_arr[i] < mid: required += mid - sorted_arr[i] if required > k_val: break if required <= k_val: best = mid left = mid + 1 else: right = mid - 1 return solution == best