Given prepared and requested counts for chicken, beef, and pasta, count passengers whose requested meal is unavailable.
Easy1MathImplementationNo attempts yetTime limit1sMemory limit1024 MBOn long flights an airline serves hot meals. A flight attendant usually pushes a cart of meals down the aisle, and the moment the cart reaches your row you are asked: "Chicken, beef, or pasta?" You know the options, but you have only a few seconds to pick, and you cannot tell what your choice looks like because your neighbor has not opened the wrap yet.
The attendant on this flight changed the order of things. First she asks every passenger which meal they want, and then she checks whether the number of meals prepared for each option is enough.
For example, suppose the prepared counts for chicken, beef and pasta are 80, 20 and 40, while the counts requested by passengers are 45, 23 and 48. Eleven passengers then do not get the meal they chose, because three passengers who wanted beef and eight who wanted pasta cannot be served.
Given the prepared count and the requested count for each option, find how many passengers do not get the meal they chose. A passenger is satisfied only by the option they picked, so being handed a leftover meal of another type does not count.
The first line contains three integers Ca, Ba and Pa (0≤Ca,Ba,Pa≤100), the number of meals prepared for chicken, beef and pasta.
The second line contains three integers Cr, Br and Pr (0≤Cr,Br,Pr≤100), the number of passengers who requested chicken, beef and pasta.
Print one line with a single integer, the number of passengers who do not get the meal they chose.