I want to express a thought which sounds like "Rick has eaten 8 candies and 3 pieces fewer of a pie" which means that Rick has eaten only 5 pieces of pie. Does my sentence soung grammatically correct or maybe there is some other way how to formulate that thought correctly?
It is much easier if you keep the object that is being counted the same. It makes the comparison easier.
Rick has eaten 8 candies. Susan has eaten three fewer candies than Rick.
Rick has eaten 8 candies. He has also eaten three fewer pieces of pie than candies.
It might be better to phrase it additively
Rick has eaten 8 candies. This is three more than the number of pieces of pie that he has eaten.