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

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2


Fixed submission:
N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2

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

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            timeline[c][t - 1] = timeline[c][t]
            timeline[c][t] = 0

max_ = 0
stack = 0
for t in range(L):
    for c in range(C):
        stack += timeline[c][t]
    if stack > max_:
        max_ = stack

print(max_)

# 3 2
# 1 3 1
# 3 4 1
# 4 5 2

Fixed submission:
N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2

Buggy python submission (verdict: Runtime Error):
N, C = map(int, input().split(' '))

ss = [0 ] * N
tt = [0 ] * N
cc = [0 ] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

timeline = [0] * (10 ** 5)

for n in range(N):
    timeline[ss[n] - 1] += 1
    timeline[tt[n]] -= 1

max_ = 0
stack = 0
for t in timeline:
    stack += t
    if stack > max_:
        max_ = stack
        
print(max_)

Fixed submission:
N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2