Problem p03504 (python)

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 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))

Buggy 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))

Buggy 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)

Buggy 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)

Buggy 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()))

Buggy 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))

Buggy 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))

Buggy 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))