do not optimize/remove html
Depending on which one you are using (filter or full html) You need to go to 

/admin/config/content/formats/filtered_html

OR 

/admin/config/content/formats/full_html



Then under Limit Allowed html Tags add &lt;form&gt; &lt;input&gt; into the list. 

If that does not do it, try unchecking the correct faulty and chopped off html box.

Edit:

If you want to switch between text formats and not have your code erased go to: 

/admin/config/content/ckeditor/edit/Advanced (for Filter HTML)

/admin/config/content/ckeditor/edit/Full (for Full HTML)

Then under Advanced Content Filter, select disabled.