input: from typing import List
  
  def minimum_or_value_after_k_operations(nums: List[int], k: int) -> int:
      """
      Given a zero-indexed integer array nums and an integer k.
  
      In each operation, you can select any index i in nums such that 0 <= i < nums.length - 1 and merge nums[i] and nums[i + 1] into a single occurrence of nums[i] & nums[i + 1], where & represents the bitwise AND operation.
  
      Return the smallest possible value of the bitwise OR of the remaining elements in the array nums after performing at most k operations.
  
      Examples:
      >>> nums = [3,5,3,2,7], k = 2
      3
      >>> nums = [7,3,15,14,2,8], k = 4
      2
      >>> nums = [10,7,10,3,9,14,9,4], k = 1
      15
  
      Constraints:
      1 <= nums.length <= 10^5
      0 <= nums[i] < 2^30
      0 <= k < nums.length
      """
output:     from functools import reduce
      import heapq
  
      def combine_elements(nums):
          min_or_result = reduce(lambda x, y: x | y, nums)
          return min_or_result
  
      min_heap = [(nums[i] & nums[i + 1], i) for i in range(len(nums) - 1)]
      heapq.heapify(min_heap)
  
      while k > 0 and len(min_heap) > 0:
          value, index = heapq.heappop(min_heap)
          nums[index] = value
          del nums[index + 1]
          if index < len(nums) - 1:
              heapq.heappush(min_heap, (nums[index] & nums[index + 1], index))
          if index > 0:
              heapq.heappush(min_heap, (nums[index - 1] & nums[index], index - 1))
          k -= 1
  
      return combine_elements(nums)