Problem p03504 (python)

Fixed submission:
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

N, C = map(int,input().split())
Mx = 10**5+1
sch = [[0]*Mx for _ in range(C)]
scht = [0]*Mx
plist = [[] for _ in range(C)]
for _ in range(N):
    s, t, c = map(int,input().split())
    plist[c-1].append((s,t))
for c, p in enumerate(plist):
    p.sort()
    prevt = 0
    for s, t in p:
        if prevt == s:
            sch[c][prevt] = 0
        else:
            sch[c][s] = 1
        sch[c][t] = -1
        prevt = t
    for i in range(1, Mx):
        if sch[c][i]==1:
            scht[i-1]+=1
        if sch[c][i]==-1:
            scht[i]-=1

for i in range(1, Mx):
    scht[i] += scht[i-1]

print(max(scht))

Buggy submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

N, C = map(int,input().split())
Mx = 100#10**5+1
sch = [[0]*Mx for _ in range(C)]
scht = [0]*Mx
plist = [[] for _ in range(C)]
for _ in range(N):
    s, t, c = map(int,input().split())
    plist[c-1].append((s,t))
for c, p in enumerate(plist):
    p.sort()
    prevt = 0
    for s, t in p:
        if prevt == s:
            sch[c][prevt] = 0
        else:
            sch[c][s] = 1
        sch[c][t] = -1
        prevt = t
    for i in range(1, Mx):
        if sch[c][i]==1:
            scht[i-1]+=1
        if sch[c][i]==-1:
            scht[i]-=1

for i in range(1, Mx):
    scht[i] += scht[i-1]

print(max(scht))

Buggy submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

N, C = map(int,input().split())
Mx = 10**5
sch = [0]*Mx
plist = [[] for _ in range(C)]
for _ in range(N):
    s, t, c = map(int,input().split())
    plist[c-1].append((s,t))
for p in plist:
    if len(p)==0:
        continue
    p.sort()
    prevt = -1
    for s, t in p:
        if prevt == s:
            sch[prevt] += 1
        else:
            sch[s-1] += 1
        sch[t] -= 1
        prevt = t

for i in range(1,Mx):
    sch[i]+=sch[i-1]

print(max(sch))

Buggy submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

N, C = map(int,input().split())
Mx = 10**5+1
sch = [0]*Mx
plist = [[] for _ in range(C)]
for _ in range(N):
    s, t, c = map(int,input().split())
    plist[c-1].append((s,t))
for p in plist:
    if len(p)==0:
        continue
    p.sort()
    prevt = 0
    for s, t in p:
        sch[s] += 1
        sch[t+1] -= 1
        if prevt == s:
            sch[prevt+1] += 1
            sch[s] -= 1
        prevt = t

for i in range(1,Mx):
    sch[i]+=sch[i-1]

print(max(sch))

Buggy submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

N, C = map(int,input().split())
Mx = 10**5+1
sch = [0]*Mx
plist = [[] for _ in range(C)]
for _ in range(N):
    s, t, c = map(int,input().split())
    plist[c-1].append((s,t))
for p in plist:
    p.sort()
    prevt = 0
    for s, t in p:
        sch[s] += 1
        sch[t+1] -= 1
        if prevt == s:
            sch[prevt+1] += 1
            sch[s] -= 1
        prevt = t
for i in range(1,Mx):
    sch[i]+=sch[i-1]
print(max(sch))

Buggy submission (verdict: Runtime Error):
#!/usr/bin python3
# -*- coding: utf-8 -*-

N, C = map(int,input().split())
Mx = 10**5+1
sch = [0]*Mx
for _ in range(N):
    s, t, c = map(int,input().split())
    sch[s] += 1
    sch[t+1] -= 1
for i in range(1,Mx):
    sch[i]+=sch[i-1]
print(max(sch))