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_1 : 'int' ) -> 'int' :
      from var_2 import var_3
      var_4 = var_3 ( )
      var_5 = 0
      for var_6 in range ( len ( var_0 ) ) :
          if len ( var_4 ) % 2 != 0 :
              if var_0 [ var_6 ] == 1 :
                  var_5 += 1
                  var_4.append ( var_6 + var_1 - 1 )
          else :
              if var_0 [ var_6 ] == 0 :
                  var_5 += 1
                  var_4.append ( var_6 + var_1 - 1 )
          if var_4 and var_4 [ 0 ] == var_6 : var_4.popleft ( )
          if var_4 and var_4 [ - 1 ] >= len ( var_0 ) : return - 1
      return var_5
  