You say calories in calories out, but it’s not true. A rock has zero calories, but eat a rock that’s too big to pass through your digestive tract and you’ll gain one rock-worth of weight (followed by death).
That’s why I prefer a much more simple and natural model: mass-in vs mass-out.