Say a sequence of 0s and 1s is *good* if it meets the specified conditions, that is, if, for every even $k \ge 2$, each subsequence of length $k+1$ contains at least $k/2$ 1s. Let $a(n,m)$ denote the number of good permutations of the multiset $\{1^n,0^m\}$. Then $a(n-m,m)$ is the answer to the question posed. Since 3 consecutive 0s are forbidden, a good permutation $p$ has one of the 3 mutually exclusive forms (i) 1$p'$, (ii) 01$p'$, (ii) 001$p'$, where $p'$ is good. Conversely, if $p'$ is good, then certainly $1p'$ and $01p'$ are good. The key observation is that $001p'$ is good iff $0p'$ is good, and good permutation of the form $0p'$ are obtained by discarding the $1p'$ permutations from all good permutations of that length. So, for $n+m\ge 3$, the 3 cases are counted respectively by (i) $a(n-1,m),$ (ii) $ a(n-1,m-1),$ (iii) $ a(n-1,m-1)-a(n-2,m-1)$. Together with initial conditions for small $n,m$, this gives a recurrence for $a(n,m)$, leading to the rational expression $$ F(x,y)=\frac{1 + y - x y + y^2}{1 - x - 2 x y + x^2 y} $$ for the generating function $F(x,y):=\sum_{n,m\ge 0}a(n,m)x^n y^m$.