Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [0] * (10 ** 5 + 1)
for i in range(N):
    s, t, c = map(int, input().split())
    table[s] += 1
    table[t + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    table[i] += table[i - 1]
    ans = max(ans, table[i])

print(ans)


Fixed submission:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] += 1
    table[t - 1][c - 1] -= 1

imos = [0] * (10 ** 5 + 1)
for i in range(10 ** 5 + 1):
    for j in range(C):
        if table[i][j] == 1:
            imos[i] += 1
        if table[i][j] == -1:
            imos[i + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    imos[i] += imos[i - 1]
    ans = max(ans, imos[i])

print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5)]
for i in range(N):
    s, t, c = map(lambda x: int(x) - 1, input().split())
    table[s][c] += 1
    table[t + 1][c] -= 1


ans = 0
for i in range(1, 10 ** 5):
    for j in range(C):
        table[i][j] += table[i - 1][j]
    ans = max(ans, sum(table[i]))

print(ans)


Fixed submission:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] += 1
    table[t - 1][c - 1] -= 1

imos = [0] * (10 ** 5 + 1)
for i in range(10 ** 5 + 1):
    for j in range(C):
        if table[i][j] == 1:
            imos[i] += 1
        if table[i][j] == -1:
            imos[i + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    imos[i] += imos[i - 1]
    ans = max(ans, imos[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(2 * 10 ** 5 + 2)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[2 * s - 1][c - 1] = 1
    table[2 * t][c - 1] = -1

ans = [0] * (2 * 10 ** 5 + 2)
for i in range(1, 2 * 10 ** 5 + 2):
    for j in range(C):
        if table[i - 1][j] == 1 and table[i][j] == 0:
            table[i][j] = 1
    ans[i] = sum(map(lambda x: abs(x), table[i]))

print(max(ans[1:]))


Fixed submission:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] += 1
    table[t - 1][c - 1] -= 1

imos = [0] * (10 ** 5 + 1)
for i in range(10 ** 5 + 1):
    for j in range(C):
        if table[i][j] == 1:
            imos[i] += 1
        if table[i][j] == -1:
            imos[i + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    imos[i] += imos[i - 1]
    ans = max(ans, imos[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(2 * 10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[2 * s][c - 1] = 1
    table[2 * t][c - 1] = -1

ans = 0
for i in range(1, 2 * 10 ** 5 + 1):
    for j in range(C):
        if table[i - 1][j] == 1 and table[i][j] == 0:
            table[i][j] = 1
    ans = max(ans, sum(map(lambda x: abs(x), table[i])))

print(ans)


Fixed submission:
#!/usr/bin/env python3
N, C = map(int, input().split())
table = [[0] * C for i in range(10 ** 5 + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    table[s - 1][c - 1] += 1
    table[t - 1][c - 1] -= 1

imos = [0] * (10 ** 5 + 1)
for i in range(10 ** 5 + 1):
    for j in range(C):
        if table[i][j] == 1:
            imos[i] += 1
        if table[i][j] == -1:
            imos[i + 1] -= 1

ans = 0
for i in range(1, 10 ** 5 + 1):
    imos[i] += imos[i - 1]
    ans = max(ans, imos[i])

print(ans)