input: from typing import List
  
  def max_good_subsequence_length(nums: List[int], k: int) -> int:
      """
      Given a list of integers nums and a non-negative integer k, a sequence of integers is termed as good if there are at most k positions i within the range [0, seq.length - 2] where seq[i] is not equal to seq[i + 1].
  
      Return the longest possible length of a good subsequence from nums.
  
      Examples:
      >>> nums = [1,2,1,1,3], k = 2
      4
      >>> nums = [1,2,3,4,5,1], k = 0
      2
  
      Constraints:
      1 <= nums.length <= 500
      1 <= nums[i] <= 1,000,000,000
      0 <= k <= min(nums.length, 25)
      """
output:     n = len(nums)
      if n <= 1:
          return n
      
      max_length = 1
  
      for i in range(n):
          count = 0
          seq_length = 1
          
          for j in range(i + 1, n):
              if nums[j] != nums[j - 1]:
                  count += 1
              if count > k:
                  break
              seq_length += 1
          
          max_length = max(max_length, seq_length)
      
      return max_length