input: from typing import List
  
  def min_or_value_after_operations(nums: List[int], k: int) -> int:
      """
      You are given a 0-indexed integer array nums and an integer k.
  
      In one operation, you can pick any index i of nums such that 0 <= i < nums.length - 1 and replace nums[i] and nums[i + 1] with a single occurrence of nums[i] & nums[i + 1], where & represents the bitwise AND operator.
  
      Return the minimum possible value of the bitwise OR of the remaining elements of nums after applying 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: 
      for _ in range(k):
          min_or = float('inf')
          min_index = -1
          for i in range(len(nums) - 1):
              new_value = nums[i] & nums[i + 1]
              new_or = new_value | (nums[:i] + nums[i+2:])
              if new_or < min_or:
                  min_or = new_or
                  min_index = i
          if min_index != -1:
              nums[min_index] = nums[min_index] & nums[min_index + 1]
              nums.pop(min_index + 1)
      return nums[0] | nums[1]
  