input: from typing import List
  
  def operations_to_adjust_median(nums: List[int], k: int) -> int:
      """
      Given an array of integers nums and a non-negative integer k, in each operation, you can modify any element by increasing or decreasing it by 1.
  
      Return the minimum number of operations required to adjust the median of nums to be equal to k.
  
      The median of an array is the element in the middle when the array is ordered non-decreasingly. If there are two possible medians, the larger one is chosen.
  
      Examples:
      >>> nums = [2,5,6,8,5], k = 4
      2
      >>> nums = [2,5,6,8,5], k = 7
      3
      >>> nums = [1,2,3,4,5,6], k = 4
      0
  
      Constraints:
      1 <= nums.length <= 2 * 10^5
      1 <= nums[i] <= 10^9
      1 <= k <= 10^9
      """
output:     nums.sort()
      n = len(nums)
      median_index = (n - 1) // 2 if n % 2 != 0 else n // 2
      median = nums[median_index]
  
      return abs(median - k)