Buggy python submission (verdict: Runtime Error):
n, c = map(int,raw_input().split())

arr = [[0 for i in range(c)] for j in range(10**5+1)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	s -= 1
	ch -= 1
	for i in range(s,t):
		arr[i][ch] = 1

ans = 0

for i in range(10**5+1):
	ans = max(ans,sum(arr[i]))

print ans

Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy python submission (verdict: Runtime Error):
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+1))] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s-1] = 1
	arr[ch-1][t] = -1

for i in range(c):
	for j in range(1,(10**5+1)):
		arr[i][j] += arr[i][j-1]



ans = 0
for i in range(((10**5+1))):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans



Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy python submission (verdict: Runtime Error):
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for i in range(n):
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
  	ans = max(ans,sum(r[i])

print(ans)

Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+2) * 2)] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s*2-1] = 1
	arr[ch-1][t*2] = -1

for i in range(c):
	for j in range(1,(10**5+2)*2):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range(((10**5+2)*2)):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans



Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy python submission (verdict: Runtime Error):
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5) * 2)] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s*2-1] = 1
	arr[ch-1][t*2] = -1

for i in range(c):
	for j in range(1,(10**5)*2):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range((10**5*2)):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans



Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,c = map(int,raw_input().split())

imos = [[0 for i in range(10**5+1)] for j in range(c)]


for i in range(n):
	s,t,chan = map(int,raw_input().split())

	imos[chan-1][s-1] += 1
	imos[chan-1][t] -= 1


ans = 0

imoscumsum = []
for i in range(c):
	imoscumsum.append(np.cumsum(imos[i]))

#for i in range(c):
#	print imoscumsum[i]

for i in range(10**5+1):
	count = 0
	for j in range(c):
		if imoscumsum[j][i] != 0:
			count += 1

	ans = max(ans,count)

print ans


Fixed submission:
n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)