Run ID:108895
提交时间:2025-01-23 10:55:06
def f(L, M, r): s = set() for a, b in r: s.update(range(a, b + 1)) return L + 1 - len(s) L, M = map(int, input().split()) r = [tuple(map(int, input().split())) for _ in range(M)] print(f(L, M, r))