Implement Context-Free Grammar for $L=\{a^n b^m \mid n \neq 2m\}$ I am trying to implement a context-free grammar for $L=\{a^n b^m \mid n \neq 2m\}$.

I have a difficulty trying to implement it because I don't know how to ensure that $n \neq 2m$.

I can easily implement $n=2m$ but the other way around doesn't seem intuitive. How can I approach this problem?
Hint: A string of the form $a^nb^m$ where $n \neq 2m$ can be either


A string with too many $a$'s, or
A string with too few $a$'s


Create production rules for each of these cases.