input: Write a Python function to calculate the total number of subarrays where the bitwise AND of the subarray elements equals a given integer k.
  
  from typing import List
  import bisect
  def subarray_and_count(nums: List[int], k: int) -> int:
      """
      Given an array of integers nums and an integer k, return the number of
      subarrays
      of nums where the bitwise AND of the elements of the subarray equals k.
  
      Examples:
      >>> nums = [1,1,1], k = 1
      6
      >>> nums = [1,1,2], k = 1
      3
  
      Constraints:
      1 <= nums.length <= 10^5
      0 <= nums[i], k <= 10^9
      """
output: def subarray_and_count(nums: List[int], k: int) -> int:
      count = 0
      for i in range(len(nums)):
          current = nums[i]
          for j in range(i, len(nums)):
              current &= nums[j]
              if current == k:
                  count += 1
              if current < k:  # If AND becomes less than k, it can't be k anymore
                  break
      return count