Problem:


Score : 400 points

Problem Statement

Joisino is planning to record N TV programs with recorders.

The TV can receive C channels numbered 1 through C.

The i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i.

Here, there will never be more than one program that are broadcast on the same channel at the same time.

When the recorder is recording a channel from time S to time T (including time S but not T), it cannot record other channels from time S-0.5 to time T (including time S-0.5 but not T).

Find the minimum number of recorders required to record the channels so that all the N programs are completely recorded.

Constraints

1≤N≤10^5

1≤C≤30

1≤s_i<t_i≤10^5

1≤c_i≤C

If c_i=c_j and i≠j, either t_i≤s_j or s_i≥t_j.

All input values are integers.

Input

Input is given from Standard Input in the following format:

N C
s_1 t_1 c_1
:
s_N t_N c_N

Output

When the minimum required number of recorders is x, print the value of x.

Sample Input 1

3 2
1 7 2
7 8 1
8 12 1

Sample Output 1

2

Two recorders can record all the programs, for example, as follows:

With the first recorder, record Channel 2 from time 1 to time 7. The first program will be recorded. Note that this recorder will be unable to record other channels from time 0.5 to time 7.

With the second recorder, record Channel 1 from time 7 to time 12. The second and third programs will be recorded. Note that this recorder will be unable to record other channels from time 6.5 to time 12.

Sample Input 2

3 4
1 3 2
3 4 4
1 4 3

Sample Output 2

3

There may be a channel where there is no program to record.

Sample Input 3

9 4
56 60 4
33 37 2
89 90 3
32 43 1
67 68 3
49 51 3
31 32 3
70 71 1
11 12 3

Sample Output 3

2



Sample input:
3 2
1 7 2
7 8 1
8 12 1


Sample output:
2

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
STC = [[int(i) for i in input().split()] for i in range(N)]
STC.sort()

R = [[STC[0][1], STC[0][2]]]
for s, t, c in STC[1:]:
    for i in range(len(R)):
        R[i][0], R[i][1] = t_r, c_r
        if c == c_r and t_r <= s:
            R[i] = [t, c]
            break
        if c != c_r and t_r < s:
            R[i] = [t, c]
            break
    else:
        R.append([t, c])
        
print(len(R))

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())

A = [[] for i in range(C + 1)]
for i in range(N):
    s, t, c = map(int, input().split())
    A[c].extend(list(range(s - 1, t + 1)))
    
dp = [0] * (10 ** 5 + 1)
for a in A:
    if a == []:
        continue
    a.sort()
    dp[a[0]] += 1
    dp[a[-1] + 1] -= 1
    
for i in range(1, 10 ** 5 + 1):
    dp[i] += dp[i - 1]
    
print(max(dp))

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]
ans = -float("inf")
for i in range(1, 2 ** 10):
    b, s = i, 0
    cnt = [0 for _ in range(N)]
    while b > 0:
        if b & 1:
            for j in range(N):
                cnt[j] += F[j][s]
        s += 1
        b >>= 1
    sub_ans = 0
    for j in range(N):
        sub_ans += P[j][cnt[j]]
    ans = max(ans, sub_ans)
print(ans)

Submission status: Runtime Error

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    n = I()
    f = LIR(n)
    po = [1]*11
    for i in range(n):
        k = 0
        p = 1
        for j in range(10):
            k += p*f[i][j]
            p *= 2
            po[j+1] = p
        f[i] = k
    p = LIR(n)
    ans = -float("inf")
    for i in range(1,1024):
        k = 0
        for j in range(n):
            c = i&f[j]
            s = 0
            for l in po:
                if c&l:s += 1
            k += p[j][s]
        ans = max(ans,k)
    print(ans)
#D
def D():
    n,C = LI()
    T = [[0 for i in range(100001)] for j in range(C)]
    for i in range(n):
        s,t,c = LI()
        c -= 1
        T[c][s] += 1
        T[c][t+1] -= 1
    for c in range(C):
        for i in range(100000):
            T[c][i+1] += T[c][i]
    ans = 0
    for i in range(100000):
        k = 0
        for c in range(C):
            if T[c][i]:k += 1
        ans = max(ans, k)
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()

Submission status: Runtime Error

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    n,C = LI()
    T = [[0 for i in range(200001)] for j in range(C)]
    for i in range(n):
        s,t,c = LI()
        c -= 1
        T[c][2*s-1] += 1
        T[c][2*t+1] -= 1
    for c in range(C):
        for i in range(200000):
            T[c][i+1] += T[c][i]
    ans = 0
    for i in range(200000):
        k = 0
        for c in range(C):
            k += T[c][i]
        ans = max(ans, k)
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    D()

Submission status: Runtime Error

Solution code:
inf = float("INF")
from operator import itemgetter
a,b=map(int,input().split())
d = [0]*(2*(10**5)+10)
dp = []
for i in range(a):
    ts,tf,c =map(int,input().split())
    dp.append([ts,tf,c])

dp = sorted(dp, key=itemgetter(2))
for i in range(1,a):
    if dp[i][0] == dp[i-1][1] and dp[i][2] == dp[i-1][2]:
        dp[i][0] = dp[i-1][0]
        dp[i-1][0],dp[i-1][1],dp[i-1][2]=inf,inf,inf
        
M = 0
for ts,tf,ll in dp:
    d[(ts-1)*2]+=1
    d[(tf-1)*2+3]-=1
M = 0

for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    if i%2!=0 :M = max(M,d[i])
print(M)

Submission status: Runtime Error

Solution code:
# D
N,C = map(int, input().split())
T_MAX = int(1e5)
t = [0]*(T_MAX+1)
for _ in range(N):
    si,ti,ci = map(int, input().split())
    t[si-1] += 1
    t[ti+1] -= 1
ans = 1
wa = 0
for ti in t:
    wa += ti
    ans = max(ans, wa)
print(ans)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(N)]
time = [0 for _ in range(2 * 10 ** 5)]
for q in query:
    s, t = q[:2]
    for i in range(2 * s - 1, 2 * t + 1):
        time[i] += 1
print(max(time))

Submission status: Runtime Error

Solution code:

a,b=map(int,input().split())

d = [0]*(2*(10**5))
for i in range(a):
    ts,tf,c =map(int,input().split())
    d[(ts-1)*2]+=1
    d[(tf-1)*2+2]-=1
M = 0
for i in range(len(d)):
    if i > 0:
        d[i] = d[i-1]+d[i]
    M = max(M,d[i])
print(M)

Submission status: Runtime Error

Solution code:
import itertools
N,C = map(int,input().split())
imos = [0]*(50)
info = [list(map(int,input().split())) for i in range(N)]
info = sorted(info,key=lambda x:(x[2],x[0]))
note = -1
before_t = -1
for i in range(N):
    s,t,c = info[i]
    s -= 1
    if c == note and s < before_t:
        s = before_t
    imos[s] += 1
    imos[t] -= 1
    note = c
    before_t = t
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
N,C = map(int,input().split())
imos = [0]*(50)
info = [list(map(int,input().split())) for i in range(N)]
info = sorted(info,key=lambda x:(x[2],x[0]))
note = -1
before_t = -1
for i in range(N):
    s,t,c = info[i]
    s -= 1
    if c == note and s < before_t:
        s = before_t
    imos[s] += 1
    imos[t] -= 1
    note = c
    before_t = t
print(imos)
acc_sum = list(itertools.accumulate(imos))
ans = max(acc_sum)
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import accumulate
N, C = map(int, input().split())
STC = [list(map(int, input().split())) for _ in range(N)]

M = 10**5
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
    s, t, c = STC[i]
    merge[c][s] += 1
    merge[c][t+1] -= 1
for c in range(31):
    merge[c] = list(map(lambda x: int(bool(x)), accumulate(merge[c])))

ans = []
for i in range(M+1):
    res = 0
    for j in range(31):
        res += merge[j][i]
    ans.append(res)
print(max(ans))

Submission status: Runtime Error

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *


N, C = map(int, input().split())
stc = [[int(i) for i in input().split()] for _ in range(N)]
stc = deque(sorted(stc))

s = [-1e9] * C
index = 0
count = 0
for i in range(100000):
    if index == C:
        break
    if i == stc[index][0]:
        for j in range(C):
            if s[j] <= stc[index][0] - 0.5:
                if s[j] == -1e9:
                    count += 1
                s[j] = stc[index][1]
                break
        index += 1
        s = sorted(s, reverse=True)
print(count)

Submission status: Runtime Error

Solution code:

N,C = list(map(int,input().split()))

prog = [[] for i in range(C)]

for i in range(N):
    s,t,c = list(map(int,input().split()))
    prog[c].append([s,t])

ttable = [0 for i in range(2*(10**5)+2)]
for i in range(C):
    table = [0 for i in range(2*(10**5)+2)]
    for p in prog[i]:
        table[2*p[0]-1]+= 1
        table[2*p[1]]+= -1
    tsum = 0
    for i in range(2*(10**5)+2):
        tsum+=table[i]
        ttable[i]+=tsum
print(max(ttable))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

N, C = (int(i) for i in input().split())

pp = [[0] * 100000 for i in range(C)]

for i in range(N):
    s, t, c = (int(i) for i in input().split())
    for j in range(s, t+1):
        pp[c-1][j] = 1

res = 0
for i in range(100000):
    cc = 0
    for j in range(C):
        if pp[j][i]:
            cc += 1
    res = max(res, cc)

print(res)

Submission status: Runtime Error

Solution code:
N,C=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(N)]
Time=[[0]*(10**5+1)]*C
for i in range(N):
  T_c=list(Time[List[i][2]-1])
  T_c[List[i][0]-1:List[i][1]]=[1]*(List[i][1]-List[i][0]+1)
  Time[List[i][2]-1]=list(T_c)
T=0
T_max=0
for t in range(10**5):
  for c in range(C):
    T+=Time[c][t]
  if T_max<T:
    T_max=T
  T=0
print(T_max)
print(a)

Submission status: Runtime Error

Solution code:
def inpl(): return [int(i) for i in input().split()]
N, C = inpl()
channel = [[] for _ in range(C)]
for i in range(N):
    s, t, c = inpl()
    channel[c-1].append([s,t])
H = [0 for i in range(10**5+3)]
for i in range(C):
    channel[i].sort(key = lambda x: x[0])
    for j in range(len(channel[i])-1):
        if channel[i][j][1] == channel[i][j+1][0]:
            channel[i][j+1] = [channel[i][j][0],channel[i][j+1][1]]
            channel[i][j] = []
        channel[i] = [k for k in channel[i] if k != []]

for i in range(C):
    for st, en in channel[i]:
        H[st] += 1
        H[en+1] -= 1
ans = H[0]
for i in range(10**5+1):
    H[i+1] += H[i]
    ans = max(ans,H[i+1])
        
print(ans)

Submission status: Runtime Error

Solution code:
def inpl(): return [int(i) for i in input().split()]
N, C = inpl()
channel = [[] for _ in range(C)]
for i in range(N):
    s, t, c = inpl()
    channel[c-1].append([s,t])
H = [0 for i in range(10**5+1)]
for i in range(C):
    channel[i].sort(key = lambda x: x[0])
    for j in range(len(channel[i])-1):
        if channel[i][j][1] == channel[i][j][0]:
            channel[i][j+1] = [channel[i][j][0],channel[i][j+1][1]]
            channel[i][j] = []
        channel[i][j] = [i for i in channel[i][j] if i != []]

for i in range(C):
    for st, en in channel[i]:
        H[st] += 1
        H[en+1] -= 1
ans = H[0]
for i in range(10**5):
    H[i+1] += H[i]
    ans = max(ans,H[i+1])
        
print(ans)

Submission status: Runtime Error

Solution code:
N,C = map(int,input().split())
cum = [0]*(10**5+1)
d = {}
for i in range(10**5):
    d[i] = []
for i in range(N):
    s,t,c = map(int,input().split())
    if c not in d[s]:
        cum[s-1] += 1
        cum[t] -= 1
    else:
        cum[s] += 1
        cum[t] -= 1
    d[t].append(c)
import numpy as np
print(np.cumsum(cum).max())

Submission status: Runtime Error

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, cc = getMN()
jikan = [0 for i in range(100001)]
for i in range(n):
    s, t, c = getlist()
    jikan[s] += 1
    jikan[t+1] -= 1

accum = [0]
for j in jikan:
    accum.append(accum[-1]+j)

print(max(accum))

Submission status: Runtime Error

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, cc = getMN()
jikan = [0 for i in range(10001)]
for i in range(n):
    s, t, c = getlist()
    jikan[s] += 1
    jikan[t+1] -= 1

accum = [0]
for j in jikan:
    accum.append(accum[-1]+j)

print(max(accum))

Submission status: Runtime Error

Solution code:
T_MAX = 10**5
n, nc = list(map(int, input().split()))
stc = [list(map(int, input().split())) for _ in range(n)]

rec = [0]*(2*T_MAX+1)
for i in range(n):
    s, t, c = stc[i]
    rec[2*s-1] += 1
    rec[2*t+1] -= 1

for i in range(1, len(rec)):
    rec[i] += rec[i-1]
# print(rec[:100])

print(max(rec))

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
T = [[0 for k in range(100000)] for l in range(C)]

for k in range(N):
    s, t, c = map(int, input().split())
    T[c-1][s-1] += 1
    T[c-1][t] -= 1
for l in range(C):
    for k in range(1,100000):
        T[l][k] += T[l][k-1]

ans = 0
for k in range(100000):
    t = 0
    for l in range(C):
        if T[l][k]:
            t += 1
    ans = max(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
T = [[0 for k in range(100000)] for k in range(C)]

for k in range(N):
    s, t, c = map(int, input().split())
    T[c-1][s-1] += 1
    T[c-1][t] -= 1
for l in range(C):
    for k in range(1,100000):
        T[l][k] += T[l][k-1]

ans = 0
for k in range(100000):
    t = 0
    for l in range(C):
        if T[l][k]:
            t += 1
    ans = max(ans, t)

print(ans)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
r = [[0 for _ in range(C)] for _ in range(10 * 5)]

for _ in range(N):
    s, t, c = map(int, input().split())
    for i in range(s - 1, t):
        r[i][c - 1] = 1
ans = 0
for t in r:
    sum_t = sum(t)
    if sum_t > ans:
        ans = sum_t

print(ans)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
r = [[0] * C for _ in range(10 * 5)]
for _ in range(N):
    s, t, c = map(int, input().split())
    for i in range(s - 1, t):
        r[i][c - 1] = 1
ans = 0
for t in r:
    sum_t = sum(t)
    if sum_t > ans:
        ans = sum_t

print(ans)

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())
r = [[0] * C for _ in range(10 * 5)]
for _ in range(N):
    s, t, c = map(int, input().split())
    for i in range(s - 1, t):
        r[j][c - 1] = 1
ans = 0
for t in r:
    sum_t = sum(t)
    if sum_t > ans:
        ans = sum_t

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, C, STC):
    tbl = [0] * (2*int(1e+5) + 1)
    for s, t, c in STC:
        tbl[2*s-1 + 1] += 1
        tbl[2*t+1] -= 1
    for i in range(1, len(tbl)):
        tbl[i] += tbl[i-1]
    ans = max(tbl)
    return ans


def main():
    N, C = read_int_n()
    STC = [read_int_n() for _ in range(N)]
    print(slv(N, C, STC))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, C, STC):
    tbl = [0] * (2*int(1e+5) + 1)
    for s, t, c in STC:
        tbl[2*s-1 + 1] += 1
        tbl[2*t+1] -= 1
    for i in range(len(tbl)):
        tbl[i] += tbl[i-1]
    ans = max(tbl)
    return ans


def main():
    N, C = read_int_n()
    STC = [read_int_n() for _ in range(N)]
    print(slv(N, C, STC))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,C =map(int,input().split())
chan=[[] for i in range(C)]
for i in range(N):
    a,b,c=map(int,input().split())
    chan[c-1].append([a,b])
for i in range(C):
    chan[i].sort()
imos=[0]*(10**5+1)
for i in range(C):
    if len(chan[i])==0:
        continue
    imos[chan[i][0][0]]+=1
    imos[chan[i][0][1]+1]-=1
    for k in range(1,len(chan[i])):
        if chan[i][k][0]==chan[i][k-1][1]:
            imos[chan[i][k][0]+1]+=1
            imos[chan[i][k][1]+1]-=1
        else:
            imos[chan[i][k][0]]+=1
            imos[chan[i][k][1]+1]-=1

for i in range(1,10**5+1):
     imos[i] +=imos[i-1]  
print(max(imos))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
l = [0]*(10**5+10)

n, c = map(int, input().split())
for _ in range(n):
    s, t, c = map(int, input().split())
    l[s*2-1] += 1
    l[t*2]   -= 1
for i in range(1, len(l)):
    l[i] += l[i-1]
print(max(l))

Submission status: Runtime Error

Solution code:
n,c = map(int, input().split())

a = []
for i in range(n):
    a.append([x for x in map(int, input().split())])


result = [0] * 200005

for _s in a:
    result[_s[0]*2-1]+=1
    result[_s[1]*2] += -1

for i in range(1, len(result)+1, 1):
    result[i] = result[i] + result[i-1]

ans = max(result)
print(ans)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
import numpy as np

N, C = map(int, input().split())
STC = [tuple(map(int, input().split())) for i in range(N)]

# 0.5秒から10万秒まで0.5秒区切り
time = np.array([np.zeros(30) for i in range(C)])

# STC処理
for s, t, c in STC:
    # c-1でチャンネル番号ごとのtimeにアクセス
    if time[c-1][2*s] != 0:
        time[c-1][2*s] = 0
    else:
        time[c-1][2*s-2] += 1
    time[c-1][2*t] -= 1

# 各チャンネルごとに累積和を取る
for i in range(C):
    time[i-1] = np.cumsum(time[i-1])
    
# チャンネルの被りをあぶりだし
A = np.sum(time, axis=0)
print(int(np.max(A)))

Submission status: Runtime Error

Solution code:
def getter(starts, ends):
    while starts:
        if starts[-1][0] < ends[-1][1]:
            yield (starts.pop(), True)
        else:
            yield (ends.pop(), False)


def foo(targets):
    starts = sorted(targets, key=lambda x:x[0], reverse=True)
    ends = sorted(targets, key=lambda x: x[1], reverse=True)

    result = 0
    active = set()
    for x, p in getter(starts, ends):
        if p:
            active.add(x[2])
        else:
            active.remove(x[2])
        result = max(result, len(active))
    return result


if __name__ == "__main__":
    n,c  = map(int, input().split())

    targets = []
    for i in range(n):
        s, t, c = list(map(int, input().split()))
        targets.append((s-1, t, c))
    print(foo(targets))

Submission status: Runtime Error

Solution code:
temp_in=input()
temp_in=temp_in.split(" ")
temp_in=list(map(int,temp_in))
a,b=temp_in
times=[0]*(10**5+1)
times_sum=[0]*(10**5+1)
for i in range(a):
    temp_in=input()
    temp_in=temp_in.split(" ")
    temp_in=list(map(int,temp_in))
    times[temp_in[0]]+=1
    times[temp_in[1]+1]-=1
for i in range(len(times_sum)-1):
    times_sum[i]+=times_sum[i-1]+times[i]
print(max(times_sum))

Submission status: Runtime Error

Solution code:
N, C = map(int, input().split())

f = [[0] * 100000 for _ in range(C)]

for i in range(N):
    s, t, c = map(int, input().split())
    f[c-1][s-1] = 1
    f[c-1][t] = -1

for c in range(C):
    for i in range(100000):
        if i > 0:
            f[c][i] += f[c][i-1]

print(max(map(sum, zip(*f))))

Submission status: Runtime Error

Solution code:
N,C=map(int,input().split())
imos=[0]*(2*10**5)
for i in range(N):
  s,t,c=map(int,input().split())
  imos[2*s-1]+=1
  imos[2*t]-=1
channels=[imos[0]]*(2*10**5)
for i in range(2*10**5-1):
  channels[i+1]=channels[i]+imos[i+1]
print(max(channels))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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()))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
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))

Submission status: Runtime Error

Solution code:
def popcount(n):
	res=0
	while n > 0:
		res += n % 2;
		n //= 2
	return res
n=0
def init_seg(_n):
	global n
	n = 1
	while n < _n:
		n *= 2
MAX_N=131072
data=[0]*MAX_N
datb=[0]*MAX_N

def add(a, b, x, k, l, r):
	if a <=l and r <= b:
		data[k] += x
	elif l < b and a < r:
		datb[k] += (min(b,r) - max(a,l))*x
		add(a, b, x, 2 * k + 1, l, (l + r) / 2)
		add(a, b, x, 2 * k + 2, (l + r) / 2, r)

def sum(a, b, k, l, r):
	if b <=l or r <= a:
		return 0
	elif a <= l and r <= b:
		return data[k] * (r - l) + datb[k]
	else:
		res = (min(b, r) - max(a, l)) * data[k]
		res += sum(a, b, 2 * k + 1, l, (l + r) / 2)
		res += sum(a, b, 2 * k + 2, (l + r) / 2, r)
		return int(res)

def main():
	N,C=map(int,input().split())
	init_seg(N)
	global n
	for i in range(n):
		add(i, i + 1, 0, 0, 0, n)

	for i in range(N):
		s,t,c=map(int,input().split())
		add(s, t, 2**(c-1), 0, 0, n)

	res=0
	for i in range(1,int(1e5)):
		prev=sum(i - 1, i, 0, 0, n)
		curr=sum(i, i+1, 0, 0, n)
		if prev == curr:
			res = max(res, popcount(curr))
		else:
			res = max(res, popcount(curr | prev))

	print(res)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
def popcount(n):
	res=0
	while n > 0:
		res += n%2;
		n /= 2
	return res
n=0
def init_seg(_n):
	n=1
	while(n < _n) n *= 2

data=[0]*n
datb=[0]*n

def add(a,b,x,k,l,r):
	if a <=l and r <= b:
		data[k] += x
	else:
		datb[k] += (min(b,r) - max(a,l))*x
		add(a,b,x,2*k+1,l,(l+r)/2)
		add(a,b,x,2*k+2,(l+r)/2,r)

def sum(a,b,k,l,r):
	if b <=l or r <=a:
		return 0
	elif a <= l and r <= b:
		return data[k] * (r - l) + datb[k]
	else:
		res=(min(b,r) - max(a,l)) * data[k]
		res+=sum(a,b,2*k+1,l,(l+r)/2)
		res+=sum(a,b,2*k+2,(l+r)/2,r)
		return res

init_seg(1e5)
for i in range(n):
	add(i,i+1,0,0,0,n)

N,C=map(int,input().split())
for i in range(N):
	s,t,c=map(int,input().split())
	add(s,t,2**(c-1),0,0,n)

res=0
for i in range(1,1e5):
	prev=sum(i-1,i,0,0,n)
	curr=sum(i,i+1,0,0,n)
	if prev == curr:
		res = max(res, popcount(curr))
	else:
		res = max(res, popcount(curr | prev))

print(res)

Submission status: Runtime Error

Solution code:
def popcount(n):
	res=0
	while n > 0:
		res += n%2;
		n /= 2
	return res
n=0
def init_seg(_n):
	n=1
	while(n < _n) n *= 2

data=[0]*n
datb=[0]*n

def add(a,b,x,k,l,r):
	if a <=l and r <= b:
		data[k] += x
	else:
		datb[k] += (min(b,r) - max(a,l))*x
		add(a,b,x,2*k+1,l,(l+r)/2)
		add(a,b,x,2*k+2,(l+r)/2,r)

def sum(a,b,k,l,r):
	if b <=l or r <=a:
		return 0
	elif a <= l and r <= b:
		return data[k] * (r - l) + datb[k]
	else:
		res=(min(b,r) - max(a,l)) * data[k]
		res+=sum(a,b,2*k+1,l,(l+r)/2)
		res+=sum(a,b,2*k+2,(l+r)/2,r)
		return res

init_seg(1e5)
for i in range(n):
	add(i,i+1,0,0,0,n)

N,C=map(int,input().split())
for i in range(N):
	s,t,c=map(int,input().split())
	add(s,t,2**(c-1),0,0,n)

res=0
for i in range(1:1e5):
	prev=sum(i-1,i,0,0,n)
	curr=sum(i,i+1,0,0,n)
	if prev == curr:
		res = max(res, popcount(curr))
	else:
		res = max(res, popcount(curr | prev))

print(res)