\[ y'(x)+y(x) \cos (x)-e^{2 x}=0 \] ✓ Mathematica : cpu = 4.14725 (sec), leaf count = 31
\[\left \{\left \{y(x)\to e^{-\sin (x)} \left (\int _1^x e^{2 K[1]+\sin (K[1])} \, dK[1]+c_1\right )\right \}\right \}\]
✓ Maple : cpu = 1.088 (sec), leaf count = 21
\[ \left \{ y \left ( x \right ) ={{\rm e}^{-\sin \left ( x \right ) }} \left ( \int \!{{\rm e}^{2\,x+\sin \left ( x \right ) }}\,{\rm d}x+{\it \_C1} \right ) \right \} \]
\begin {equation} \frac {dy}{dx}+y\left ( x\right ) \cos \left ( x\right ) =e^{2x}\tag {1} \end {equation}
Integrating factor \(\mu =e^{\int \cos \left ( x\right ) dx}=e^{\sin \left ( x\right ) }\). Hence (1) becomes
\[ \frac {d}{dx}\left ( e^{\sin \left ( x\right ) }y\left ( x\right ) \right ) =e^{\sin \left ( x\right ) }e^{2x}\]
Integrating both sides
\begin {align*} e^{\sin \left ( x\right ) }y\left ( x\right ) & =\int e^{\sin \left ( x\right ) }e^{2x}+C\\ y\left ( x\right ) & =e^{-\sin \left ( x\right ) }\int e^{2x+\sin \left ( x\right ) }+Ce^{-\sin \left ( x\right ) } \end {align*}