Time limit
1s
Memory limit
128 MB
An intelligent train runs through 10 stations from station 1 (departure) to station 10 (terminal) in order. At each station, a device records how many passengers get off and how many get on. Passengers always board only after everyone who wants to get off has left.
The records for all 10 stations satisfy these conditions.
After subtracting the number getting off and then adding the number getting on at each station, find the maximum number of passengers that were on the train at any point during the trip.
Ten lines are given, one for each station in order from the first station to the tenth. Each line contains two space-separated integers: the number of passengers who get off and the number of passengers who get on at that station.
Print the maximum number of passengers that were on the train during the trip.