Buggy python submission (verdict: Runtime Error):
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_min <= i <= R_min]
print(len(ids))


Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_min = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_min <= i <= R_min]
print(len(ids))


Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

for _ in range(M):
    (L, R) = map(int, input().split(" "))
    ids = [i for i in ids if L <= i <= R]
print(len(ids))


Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))

Buggy python submission (verdict: Time Limit Exceeded):
(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

for _ in range(M):
    (L, R) = map(int, input().split(" "))
    ids = list(filter(lambda x: (L <= x) and (x <= R), ids))

print(len(ids))

Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

for _ in range(M):
    (L, R) = map(int, input().split(" "))
    ids = list(filter(lambda x: (L <= x) and (x <= R), ids))

print(len(list(ids)))


Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

for _ in range(M):
    (L, R) = map(int, input().split(" "))
    ids = list(filter(lambda x: (L <= x) and (x <= R), ids))

print(len(list(ids)))


Fixed submission:
# coding: utf-8

(N, M) = map(int, input().split(" "))

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))