Three times the number of red candies is 40*3=<<40*3=120>>120.
So, for yellow candies, there were 20 less than 120 candies, or a total of
120-20=<<120-20=100>>100 yellow candies.
Half as many blue candies as yellow candies is 100/2=<<100/2=50>>50 blue candies.
If Carlos ate all of the yellow candies, then only the 40 red and 50 blue candies remained for a total of 40+50=<<40+50=90>>90 candies.
#### 90