Hello, thanks for the query to H.C.M.
As these both situations are psychological hence in brief we will discuss.
Your's query is here that in any condition wont gain weight.
Treat your's eating habit and keep in mind one thing that "ENCOURAGE HEALTHY NOT EXCESSIVE EXERCISES" .
You wont gain weight but don't eat once in a time.
Chart will help you , keeping in mind that you have a standard height and weight.
You require 2500 calories per day if you do very hard work may be 3000 calories.
Intake 2500-3000 calories burn 2500 -3000 calories excessive hard work ( exercise)
Fat yield 9 kal/gm
Protein 6-7 kal/gm
Adjust your diet in suck a way that you eat whatever you want according to your choice but its proportion should be strictly according to calories , which you require and calories which you can burn.
Consult a diet expert and have a healthy life.