comefrom: <garvit244>995_1.py
code: def minKBitFlips( a: 'List[int]', k: 'int') -> 'int':
      from collections import deque
      q = deque()
      res = 0
      for i in range(len(a)):
          if len(q) % 2 != 0:
              if a[i] == 1:
                  res += 1
                  q.append(i+k-1)
          else:
              if a[i] == 0:
                  res += 1
                  q.append(i+k-1)
          if q and q[0] == i: q.popleft()
          if q and q[-1] >= len(a): return -1
      return res
masked: def sample_funcname ( var_0 : 'List[int]' , var_2 : 'int' ) -> 'int' :
      from var_4 import var_5
      var_6 = var_5 ( )
      var_8 = 0
      for var_11 in range ( len ( var_0 ) ) :
          if len ( var_6 ) % 2 != 0 :
              if var_0 [ var_11 ] == 1 :
                  var_8 += 1
                  var_6.append ( var_11 + var_2 - 1 )
          else :
              if var_0 [ var_11 ] == 0 :
                  var_8 += 1
                  var_6.append ( var_11 + var_2 - 1 )
          if var_6 and var_6 [ 0 ] == var_11 : var_6.popleft ( )
          if var_6 and var_6 [ - 1 ] >= len ( var_0 ) : return - 1
      return var_8
  