Buggy python submission (verdict: Runtime Error):
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+2)
for tv in tvs:
  times[tv[0]] += 1
  times[tv[1]+1] -=1
for i in range(1,len(times)+1):
  times[i] += times[i-1]
print(max(times))


Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for x in range(N)]
times = [0]*(pow(10,5)+1)
for tv in tvs:
  times[tv[0]] += 1
  times[tv[1]+1] -=1
for i in range(1,len(times)):
  times[i] += times[i-1]
print(max(times))


Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
N,C=map(int,input().split())
chan = ''
max1 = 0
for x in range(C):
  chan = chan + '0'
reserv = {}
for i in range(N):
  tmp = input().split()
  s,t,c=int(tmp[0]),int(tmp[1]),int(tmp[2])
  for j in range(s,t+1):
    if j in reserv:
      work = list(reserv[j])
      max1 = max(max1,1 + reserv[j].count('1'))
   	else:
      max1 = max(max1,1)
      work = list(chan)
    work[(c-1)] = '1'
    reserv[j] = "".join(work)
print(max1)

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
N,C=map(int,input().split())
chan = ''
max1 = 0
for x in range(C):
  chan = chan + '0'
reserv = [chan]*pow(10,5)
for i in range(N):
  tmp = input().split()
  s,t,c=int(tmp[0]),int(tmp[1]),int(tmp[2])
  for j in range(s,t+1):
    work = list(reserv[j])
    work[(c-1)] = '1'
    reserv[j] = "".join(work)
    max1 = max(max1,reserv[j].count('1'))
print(max1)

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
tmp = input().rstrip().split()
N = int(tmp[0])
 
list = {}
count = {}
 
for i in range(N):
    work = input().rstrip().split()
    for j in range(int(work[0]),int(work[1])+1):
        if j not in list:
            list[j] = [work[2]]
        elif work[2] not in list[j]:
            list[j].append(work[2])
            count[j] = len(list[j])
            
print(max(count.values()))

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
tmp = input().rstrip().split()
N = int(tmp[0])

list = [[] for x in range(100000)]
count = [0]*100000
load = []

for y in range(N):
    work = input().rstrip().split()
    load.append(work)
load.sort()

for z in range(int(load[0][0]),int(load[N-1][1])+1):
    for i in range(N):
        if z >= int(load[i][0]) and z <= int(load[i][1]):
            if load[i][2] not in list[z]:
                list[z].append(load[i][2])
                count[z] += 1
            
print(max(count))

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Time Limit Exceeded):
tmp = input().rstrip().split()
N = int(tmp[0])

list = [[] for x in range(100000)]
count = [0]*100000

for  i in range(N):
    work = input().rstrip().split()
    for i in range(int(work[0]),int(work[1])+1):
        if int(work[2]) not in list[i-1]:
            list[i-1].append(int(work[2]))
            count[i-1] += 1
            
print(max(count))

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
tmp = input().rstrip().split()
N = int(tmp[0])

list = [[] for x in range(100001)]
count = [0]*100000

for  i in range(N):
    work = input().rstrip().split()
    for i in range(int(work[0]),int(work[1])+1):
        if int(work[2]) not in list[i]:
            list[i].append(int(work[2]))
            count[i] += 1
            
print(max(count))


Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Runtime Error):
tmp = input().rstrip().split()
N = int(tmp[0])

list = [[] for x in range(100000)]
count = [0]*100000

for  i in range(N):
    work = input().rstrip().split()
    for i in range(int(work[0]),int(work[1])+1):
        if int(work[2]) not in list[i]:
            list[i].append(int(work[2]))
            count[i] += 1
            
print(max(count))

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))

Buggy python submission (verdict: Time Limit Exceeded):
tmp = input().rstrip().split()
N = int(tmp[0])
C = int(tmp[1])
dict = {}

min = 100000
max = 0

for  i in range(N):
    work = input().rstrip().split()
    if min > int(work[0]):
        min = int(work[0])
    if max < int(work[1]):
        max = int(work[1])
    if str(work[2]) in dict:
        dict[str(work[2])].append([int(work[0])-0.5,int(work[1])])
    else:
        dict[str(work[2])] = [[int(work[0])-0.5,int(work[1])]]

def myrange(x,work):
    for loop in range(len(work)):
        if work[loop][0] <= x and work[loop][1] >= x:
            return True
    return False

result = 0

for time in range(min,max+1):
    count = 0
    for k in range(C+1):
        if str(k) in dict:
            if myrange(time,dict[str(k)]):
                count +=1
    if count > result:
        result = count
print(result)

Fixed submission:
N,C = map(int,input().split())
tvs = [list(map(int,input().split())) for _ in range(N)]
chans = [[] for _ in range(C+1)]
tvs.sort(key=lambda x:x[0])
targets = []
times = [0]*(pow(10,5)+2)

for tv in tvs:
  chans[tv[2]].append([tv[0],tv[1]])

for chan in chans:
  tmp = []
  if len(chan) == 1:
    targets.append(chan[0])
    continue
  for x in range(len(chan)):
    if len(tmp) == 0:
      tmp = chan[x]
      continue
    if chan[x][0] <= tmp[1] + 1:
      tmp[1] = chan[x][1]
      if x == len(chan)-1:
        targets.append(tmp)
    else:
      targets.append(tmp)
      tmp = chan[x]

for target in targets:
  times[target[0]] += 1
  times[target[1]+1] += -1

for j in range(1,pow(10,5)+2):
  times[j] += times[j-1]

print(max(times))