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: Wrong Answer

Solution code:
from itertools import accumulate

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

ans=list(accumulate(imos))
print(max(ans))

Submission status: Wrong Answer

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

for _ in range(N):
    s, t, c = map(int, input().split())
    c -= 1
    X[c][s - 1] += 1
    X[c][t] -= 1
# print(X)
res = [[0] * MAX_N for _ in range(C)]
for c in range(C):
    for i in range(MAX_N - 1):
        res[c][i + 1] = res[c][i] + X[c][i]
# print(ans)
ans = 0
for i in range(MAX_N - 1):
    count = 0
    for c in range(C):
        count += res[c][i]
    ans = max(ans, count)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, C: int, s: "List[int]", t: "List[int]", c: "List[int]"):
    progs = [[] for _ in range(C)]
    for si, ti, ci in zip(s, t, c):
        progs[ci - 1].append((si, ti))
    ds = []
    for prog in progs:
        if not prog:
            continue
        prog.sort()
        ds.append((prog[0][0] - 1, 1))
        ds.append((prog[-1][1], -1))
        for i in range(len(prog) - 1):
            if prog[i][1] != prog[i + 1][0]:
                ds.append((prog[i][1] - 1, -1))
                ds.append((prog[i + 1][0], 1))
    ds.sort()
    ans = 0
    m = 0
    for _, d in ds:
        m += d
        ans = max(ans, m)
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        s[i] = int(next(tokens))
        t[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, C, s, t, c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#080_D
n, c = map(int, input().split())
imo = [0 for _ in range(10 ** 5 + 2)]
for _ in range(n):
    s, t, c = map(int, input().split())
    imo[s-1] += 1
    imo[t] -= 1
for i in range(1, 10 ** 5 + 2):
    imo[i] += imo[i-1]
print(max(imo))

Submission status: Wrong Answer

Solution code:
#080_D
n, c = map(int, input().split())
imo = [0 for _ in range(10 ** 5 + 2)]
for _ in range(n):
    s, t, c = map(int, input().split())
    imo[s] += 1
    imo[t+1] -= 1
for i in range(1, 10 ** 5 + 2):
    imo[i] += imo[i-1]
print(max(imo))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k = map(int,input().split())
ch = [[] for _ in range(k)]
for _ in range(n):
    s,t,c = map(int,input().split())
    if s>t:
        s,t = t,s
    ch[c-1].append((s,t))
lst = []
for i in range(k):
    if len(ch[i])!=0:
        for i, (ns,nt) in enumerate(ch[i]):
            if i==0:
                s,t = ns, nt
            else:
                if ns==t:
                    t = nt
                else:
                    lst.append((s,t))
                    s,t = ns, nt
        else:
            lst.append((s,t))
d = [0]*(10**6)
for s,t in lst:
    d[s-1] += 1
    d[t+1] -= 1
d = np.cumsum(d)
print(min(max(d), k))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
ch = [[] for _ in range(30)]
for _ in range(n):
    s,t,c = map(int,input().split())
    if s>t:
        s,t = t,s
    ch[c-1].append((s,t))
lst = []
for i in range(30):
    if len(ch[i])!=0:
        for i, (ns,nt) in enumerate(ch[i]):
            if i==0:
                s,t = ns, nt
            else:
                if ns==t:
                    t = nt
                else:
                    lst.append((s,t))
                    s,t = ns, nt
        else:
            lst.append((s,t))
d = [0]*(10**6)
for s,t in lst:
    d[s-1] += 1
    d[t+1] -= 1
d = np.cumsum(d)
print(min(max(d), c))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
ch = [[] for _ in range(30)]
for _ in range(n):
    s,t,c = map(int,input().split())
    if s>t:
        s,t = t,s
    ch[c-1].append((s,t))

lst = []
for i in range(30):
    if len(ch[i])!=0:
        for i, (ns,nt) in enumerate(ch[i]):
            if i==0:
                s,t = ns, nt
            else:
                if ns==t:
                    t = nt
                else:
                    lst.append((s,t))
                    s,t = ns, nt
        else:
            lst.append((s,t))

d = [0]*(10**6)
for s,t in lst:
    d[s-1] += 1
    d[t+1] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
ch = [[] for _ in range(30)]
for _ in range(n):
    s,t,c = map(int,input().split())
    if s>t:
        s,t = t,s
    ch[c-1].append((s,t))
lst = []
for i in range(30):
    if len(ch[i])!=0:
        
        for i, (ns,nt) in enumerate(ch[i]):
            if i==0:
                s,t = ns, nt
            else:
                if ns<=t:
                    t = nt
                else:
                    lst.append((s,t))
                    s,t = ns, nt
        else:
            lst.append((s,t))

d = [0]*(10**6)
for s,t in lst:
    d[s-1] += 1
    d[t] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, c = map(int, input().split())
  recoders = numpy.zeros((c, 10**5+1), dtype=numpy.int)
  for _ in range(n):
    s, t, c = map(int, input().split())
    s = 2*s - 1
    t = 2*t
    c -= 1
    recoders[c][s:t] = 1
  
  print(max(numpy.sum(recoders, axis=0)))
    

if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
ch = [[] for _ in range(30)]
for _ in range(n):
    s,t,c = map(int,input().split())
    if s>t:
        s,t = t,s
    ch[c-1].append((s,t))

lst = []
for i in range(30):
    if len(ch[i])!=0:    
        for i, (ns,nt) in enumerate(ch[i]):
            if i==0:
                s,t = ns, nt
            else:
                if ns == t:
                    t = nt
                else:
                    lst.append((s,t))
                    s,t = ns, nt
        else:
            lst.append((s,t))
    
d = [0]*(10**6)
for s,t in lst:
    d[s-1] += 1
    d[t] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, c = map(int, input().split())
  recoders = numpy.zeros((c, 10**5+1), dtype=numpy.int)
  for _ in range(n):
    s, t, c = map(int, input().split())
    s = 2*s - 1
    t = 2*t
    c -= 1
    recoders[c][s:t] += 1
  
  print(max(numpy.sum(recoders, axis=0)))
    

if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
d = [0]*(10**6)
for _ in range(n):
    s,t,c = map(int,input().split())
    if s > t:
        k = s
        s = t
        t = k
    d[s-1] += 1
    d[t] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
d = [0]*(10**6)
for _ in range(n):
    s,t,c = map(int,input().split())
    d[s-1] += 1
    d[t+1] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
d = [0]*(10**6)
for _ in range(n):
    s,t,c = map(int,input().split())
    d[s-1] += 1
    d[t] -= 1
d = np.cumsum(d)
print(min(max(d), 30))

Submission status: Wrong Answer

Solution code:
import numpy as np
n,c = map(int,input().split())
d = [0]*(10**6)
for _ in range(n):
    s,t,c = map(int,input().split())
    d[s-1] += 1
    d[t] -= 1
d = np.cumsum(d)
print(max(d))

Submission status: Wrong Answer

Solution code:
#それぞれの時間に注目して最大のものを考える
#いもす法？
n,c=map(int,input().split())
imos=[0]*(10**5+1)#1~10**5+1
for i in range(n):
    s,t,_c=map(int,input().split())
    imos[s-1]+=1
    imos[t]-=1
for i in range(1,10**5+1):
    imos[i]+=imos[i-1]
print(max(imos))

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
L = []
for i in range(n):
    s,t,c = map(int,input().split())
    L.append([int((s-0.5)*2), t*2])
dp = [0]*(10**5)*3
ans = 0
for i in range(n):
    dp[L[i][0]] += 1
    dp[L[i][1]] -= 1
for j in range(1,(10**5)*3):
    dp[j] = dp[j-1]+dp[j]
    ans = max(ans, dp[j])
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int, input().split( ))
v = [0]*(10**5+2)
#ci不要ではなかった
#チャンネルは継続できる
#座圧不要
Cs = [set() for i in range(c+1)]
Ct = [set() for i in range(c+1)]
for i in range(n):
    si,ti,ci = map(int, input().split( ))
    if ti in Cs[ci]:
        Cs[ci].remove(ti)
    else:
        Ct[ci].add(ti)
    if si in Cs[ci]:
        Ct[ci].remove(si)
    else:
        Cs[ci].add(si)
ans = 0
tmp = 0
for i in range(c+1):
    for si in Cs[i]:
        v[si]+=1
    for ti in Ct[i]:
        
        v[ti+1]-=1
for i in range(1,10**5+1):
    tmp += v[i]
    ans = max(tmp,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n,_ = map(int, input().split( ))
v = [0]*(10**5+2)
#ci不要
#座圧不要
for i in range(n):
    si,ti,ci = map(int, input().split( ))
    v[si]+=1;v[ti+1]-=1
ans = 0
tmp = 0
for i in range(1,10**5+2):
    tmp += v[i]
    ans = max(tmp,ans)
print(ans)

Submission status: Wrong Answer

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


def solve():
    N, C = map(int, rline().split())
    schedule = [[[-1, -1]] for _ in range(C)]
    for _ in range(N):
        s, t, c = map(int, rline().split())
        if schedule[c - 1][-1][1] == s:
            schedule[c - 1][-1][1] = t
        else:
            schedule[c - 1].append([s, t])
    
    imos = [0] * (10 ** 5 + 1)
    for ch_i in schedule:
        for i, j in ch_i[1:]:
            imos[i - 1] += 1
            imos[j] -= 1
    for i in range(1, 10 ** 5 + 1):
        imos[i] += imos[i - 1]
    print(max(imos))


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
INF = 10 ** 9
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)

def main():
    n,c = map(int,input().split())
    time = [0] * (10 ** 5 + 1)

    for _ in range(n):
        s,t,c = map(int,input().split())
        s -= 1
        c -= 1
        time[s] += 1
        time[t] -= 1
    
    ans = 0
    for i in range(1,10 ** 5 + 1):
        time[i] += time[i-1]
        ans = max(ans, time[i])
    
    print(ans)
if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,C=map(int,input().split())
from collections import defaultdict
Cbef=defaultdict(int)
time=defaultdict(int)
TV=[tuple(map(int,input().split())) for i in range(N)]
TV.sort(key=lambda x:x[0])
for s,t,c in TV:
    if Cbef[c]==s:
        time[s]+=1
        time[t]-=1
        Cbef[c]=t
    else:
        time[s-1]+=1
        time[t]-=1
        Cbef[c]=t
ans=0
now=time[0]
ans=now
for i in range(1,10**5+1):
    now+=time[i]
print(ans)

Submission status: Wrong Answer

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

import itertools
acc=itertools.accumulate(d)
print(round(max(acc)))

Submission status: Wrong Answer

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

import itertools
acc=itertools.accumulate(d)
print(max(acc))

Submission status: Wrong Answer

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

import itertools
acc=itertools.accumulate(d)
print(max(acc))

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, C = MAP()
stc = [LIST() for _ in range(N)]
stc.sort(key=lambda x:x[2])

tmp_s = stc[0][0]
tmp_t = stc[0][1]
tmp_c = stc[0][2]

stc = stc[1:]
stc_new = []
for s, t, c in stc:
	if tmp_c != c:
		stc_new.append((tmp_s, tmp_t))
		tmp_s = s
		tmp_t = t
		tmp_c = c
		
	elif tmp_t != s:
		stc_new.append((tmp_s, tmp_t))
		tmp_s = s
	
	tmp_t = t
stc_new.append((tmp_s, tmp_t))

now = [0]*(10**5+2)
for s, t in stc_new:
	now[s] += 1
	now[t+1] -= 1

now_acc = accumulate(now)
print(max(now_acc))

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, C = MAP()
stc = [LIST() for _ in range(N)]

now = [0]*(10**5+2)

for s, t, c in stc:
	now[s] += 1
	now[t+1] -= 1

now_acc = accumulate(now)
print(max(now_acc))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.buffer.readline
from operator import itemgetter

def main():
    N,C = map(int,input().split())
    ch = [[] for _ in range(C)]
    
    for _ in range(N):
        s,t,c = map(int,input().split())
        ch[c-1].append((s,t))
    
    for x in ch:
        x.sort(key=itemgetter(0))
    
    print(ch)
    imos = [0 for _ in range(10**5+2)]
    for x in ch:
        now = -1
        for st,ft in x:
            if st == now:
                imos[st] += 1
            else:
                imos[st-1] += 1
            imos[ft] -= 1
            now = ft
                
    for i in range(10**5+1):
        imos[i+1] += imos[i]
    
    print(max(imos))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

popopo = [[] for i in range(30)]

for i in range(n):
    s,t,c = m()
    popopo[c-1].append([s,t])


for i in range(30):
    popopo[i].sort()
    print(popopo[i])
for i in range(30):
    for j in range(len(popopo[i])):
        s,t = popopo[i][j]
        if time[s][i+1] == 0:
            time[t][i+1] = 1
            time[s-1][0] += 1
            time[t][0] -= 1
        else:
            time[t][i+1] = 1
            time[s][0] += 1
            time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

popopo = [[] for i in range(30)]

for i in range(n):
    s,t,c = m()
    popopo[c-1].append([s,t])


for i in range(30):
    popopo[i].sort()
for i in range(26):
    for j in range(len(popopo[i])):
        s,t = popopo[i][j]
        if time[s-1][i+1] == 0:
            time[t-1][i+1] = 1
            time[s-1][0] += 1
            time[t][0] -= 1
        else:
            time[t-1][i+1] = 1
            time[s][0] += 1
            time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

popopo = [[] for i in range(30)]

for i in range(n):
    s,t,c = m()
    popopo[c-1].append([s,t])


for i in range(30):
    popopo[i].sort()
for i in range(26):
    for j in range(len(popopo[i])):
        s,t = popopo[i][j]
        if time[s-1][i+1] == 0:
            time[t-1][i+1] = 1
            time[s-1][0] += 1
            time[t][0] -= 1
        else:
            time[t][i+1] = 1
            time[s][0] += 1
            time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

popopo = [[] for i in range(30)]

for i in range(n):
    s,t,c = m()
    popopo[c-1].append([s,t])


for i in range(30):
    popopo[i].sort()
for i in range(26):
    for j in range(len(popopo[i])):
        s,t = popopo[i][j]
        if time[s-1][i+1] == 0:
            time[t][i+1] = 1
            time[s-1][0] += 1
            time[t][0] -= 1
        else:
            time[t][i+1] = 1
            time[s][0] += 1
            time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

popopo = [[] for i in range(30)]

for i in range(n):
    s,t,c = m()
    popopo[c-1].append([s,t])


for i in range(30):
    popopo[i].sort()
for i in range(26):
    for j in range(len(popopo[i])):
        s,t = popopo[i][j]
        if time[s][i+1] == 0:
            time[t][i+1] = 1
            time[s-1][0] += 1
            time[t][0] -= 1
        else:
            time[t][i+1] = 1
            time[s][0] += 1
            time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

for i in range(n):
    s,t,c = m()
    if time[s][c] == 0:
        time[t][c] = 1
        time[s-1][0] += 1    
        time[t][0] -= 1
    else:
        time[t][c] = 1
        time[s][0] += 1
        time[t][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

for i in range(n):
    s,t,c = m()
    if time[s-1][c] == 0:
        time[t][c] = 1
        time[s-1][0] += 1    
        time[t+1][0] -= 1
    else:
        time[t][c] = 1
        time[s][0] += 1
        time[t+1][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

for i in range(n):
    s,t,c = m()
    if time[s-1][c] == 0:
        time[t][c] = 1
        time[s][0] += 1    
        time[t+1][0] -= 1
    else:
        time[t][c] = 1
        time[s-1][0] += 1
        time[t+1][0] -= 1

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c = m()

time = [[0 for i in range(31)] for j in range(10**5+2)]

for i in range(n):
    s,t,c = m()
    #if time[s-1][c] == 0:
    time[t][c] = 1
    time[s][0] += 1    
    time[t+1][0] -= 1
    """
    else:
        time[t][c] = 1
        time[s][0] += 1
        time[t+1][0] -= 1
    """

ma = time[0][0]
for i in range(1,10**5+2):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)