본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 32800번 Bus Assignment

by 현장 2024. 12. 10.

-Code

from sys import stdin
input = stdin.readline
passengers = 0
res = 0

for _ in range(int(input())):
    a, b = map(int, input().split())
    passengers = passengers - a + b
    res = max(res, passengers)

print(res)