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:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
n, c = na()
stc = []
for i in range(n):
    stc.append(na())
stc.sort(key=lambda x: (x[2], x[0]))

nstc=[]
for i in range(n):
    if(len(nstc)>0 and nstc[-1][2]==stc[i][2] and nstc[-1][1]==stc[1]):
        nstc[-1][1]=stc[i][1]
    else:
        nstc.append(stc[i])
n=len(nstc)
h=[0]*200005
for i in range(n):
    h[2*nstc[i][0]-1]+=1
    h[2*nstc[i][1]]+=-1
for i in range(len(h)-1):
    h[i]+=h[i-1]
print(max(h))

Submission status: Wrong Answer

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
n, c = na()
stc = []
for i in range(n):
    stc.append(na())
stc.sort(key=lambda x: (x[2], x[0]))

nstc=[]
for i in range(n):
    if(len(nstc)>0 and nstc[-1][2]==stc[2] and nstc[-1][1]==stc[1]):
        nstc[-1][1]=stc[i][1]
    else:
        nstc.append(stc[i])
n=len(nstc)
h=[0]*200005
for i in range(n):
    h[2*nstc[i][0]-1]+=1
    h[2*nstc[i][1]]+=-1
for i in range(len(h)-1):
    h[i]+=h[i-1]
print(max(h))

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop

# 入力
N, C = map(int, input().split())
s, t, c = zip(*(map(int, input().split()) for _ in range(N)))

# 優先度付きキューを用いてシミュレーション
Q = []
ans = 0
for x, y, z in sorted(zip(s, t, c)):
    while Q and (Q[0][0] < x or (Q[0][0] == x and Q[0][1] == z)):
        heappop(Q)
    heappush(Q, (y, z))
    ans = max(ans, len(Q))

# 出力
print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop

# 入力
N, C = map(int, input().split())
s, t, c = zip(*(map(int, input().split()) for _ in range(N)))

# 優先度付きキューを用いてシミュレーション
Q = []
ans = 0
for x, y in sorted(zip(s, t)):
    while Q and Q[0] < x:
        heappop(Q)
    heappush(Q, y)
    ans = max(ans, len(Q))

# 出力
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = list(map(int,input().split()))
stc = []
for i in range(n):
    stc.append(list(map(int,input().split())))

stc.sort(key = lambda x:(x[1],x[0]))

channel=0
while len(stc)>0:
    channel+=1
    ind=0
    before_channel=stc[ind][2]
    before_end = 0
    
    while ind < len(stc):
        #print(stc)
        #print(ind)
        if stc[ind][2]!=before_channel:
            if stc[ind][0]>=before_end+0.5:
                before_channel=stc[ind][2]
                before_end=stc[ind][1]
                del stc[ind]
            else:
                ind+=1
                
        elif stc[ind][0]>=before_end:
            before_channel=stc[ind][2]
            before_end=stc[ind][1]
            del stc[ind]          
            
        else:
            ind+=1
        #print(ind)
        #print(stc)
print(channel)

Submission status: Wrong Answer

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

T = 0
STC = []
for i in range(N):
    s, t, c = map(int, input().split())
    T = max(T, t + 1)
    STC.append([s, t, c])
    
STC.sort()

A = [[0] * (T + 1) for i in range(C + 1)]
for s, t, c in STC:
    if A[c][s + 1] == -1:
        A[c][s + 1] = 1
        continue
    A[c][s] += 1
    A[c][t + 1] -= 1
    
for i in range(C + 1):
    for j in range(1, T + 1):
        A[i][j] += A[i][j - 1]
        
for j in range(T + 1):
    for i in range(1, C + 1):
        A[i][j] += A[i - 1][j]
        
print(max(A[-1]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
sortls = [list(map(int,input().split())) for i in range(n)]
sortls.sort(key = lambda k:(k[2],k[0]))
sortls.append([sortls[-1][0],sortls[-1][1],sortls[-1][2]+1])
count = 0;ls = [];start = -1;tf = False
while True:
    if tf:
        if sortls[count][1] != sortls[count+1][0] and sortls[count][2] == sortls[count+1][2]:
            pass
        else:
            ls.append([start,sortls[count][1],sortls[count][2]])
            tf = False
    elif sortls[count][1] != sortls[count+1][0] or sortls[count][2] != sortls[count+1][2]:
        ls.append(sortls[count])
    elif sortls[count][2] == sortls[count+1][2]:
        start = sortls[count][0]
        tf = True
    else:
        ls.append(sortls[count])
    count += 1
    if count > n-1:break
        

for i in range(len(ls)):
    ls[i][0] -= 0
ios = [0]*(10**5+5)
for i in range(len(ls)):
    ios[ls[i][0]] += 1
    ios[ls[i][1]+1] -= 1
ans = ios[0]
for i in range(1,len(ios)):
    ios[i] += ios[i-1]
    ans = max(ans,ios[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
sortls = [list(map(int,input().split())) for i in range(n)]
sortls.sort(key = lambda k:(k[2],k[0]))
sortls.append([sortls[-1][0],sortls[-1][1],sortls[-1][2]+1])
count = 0;ls = [];start = -1;tf = False
for i in range(c):
    if count > n-1:break
    while sortls[count][2] == i+1:
        if tf:
            if sortls[count][1] != sortls[count+1][0] and sortls[count][2] == sortls[count+1][2]:
                pass
            else:
                ls.append([start,sortls[count][1],sortls[count][2]])
                tf = False
        elif sortls[count][1] != sortls[count+1][0]:
            ls.append(sortls[count])
        elif sortls[count][2] == sortls[count+1][2]:
            start = sortls[count][0]
            tf = True
        else:
            ls.append(sortls[count])
        count += 1
        if count > n-1:break
        

for i in range(len(ls)):
    ls[i][0] -= 0
ios = [0]*(10**5+5)
for i in range(len(ls)):
    ios[ls[i][0]] += 1
    ios[ls[i][1]+1] -= 1
ans = ios[0]
for i in range(1,len(ios)):
    ios[i] += ios[i-1]
    ans = max(ans,ios[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
sortls = [list(map(int,input().split())) for i in range(n)]
sortls.sort(key = lambda k:(k[2],k[0]))
sortls.append([sortls[-1][0],sortls[-1][1],sortls[-1][2]+1])
count = 0;ls = [];start = -1;tf = False
for i in range(c):
    if count > n-1:break
    while sortls[count][2] == i+1:
        if tf:
            if sortls[count][1] != sortls[count+1][0] and sortls[count][2] == sortls[count+1][2]:
                pass
            else:
                ls.append([start,sortls[count][1],sortls[count][2]])
                tf = False
        elif sortls[count][1] != sortls[count+1][0]:
            ls.append(sortls[count])
        elif sortls[count][2] == sortls[count+1][2]:
            start = sortls[count][0]
            tf = True
        else:
            ls.append(sortls[count])
        count += 1
        if count > n-1:break
print(ls)
        

for i in range(len(ls)):
    ls[i][0] -= 0
ios = [0]*(10**5+5)
for i in range(len(ls)):
    ios[ls[i][0]] += 1
    ios[ls[i][1]+1] -= 1
ans = ios[0]
for i in range(1,len(ios)):
    ios[i] += ios[i-1]
    ans = max(ans,ios[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
sortls = [list(map(int,input().split())) for i in range(n)]
sortls.sort(key = lambda k:(k[2],k[0]))
sortls.append([sortls[-1][0],sortls[-1][1],sortls[-1][2]+1])
count = 0;ls = [];start = -1;tf = False
for i in range(c):
    if count > n-1:break
    while sortls[count][2] == i+1:
        if tf:
            if sortls[count][1] != sortls[count+1][0] - 1 and sortls[count][2] == sortls[count+1][2]:
                pass
            else:
                ls.append([start,sortls[count][1],sortls[count][2]])
                tf = False
        elif sortls[count][1] != sortls[count+1][0] - 1:
            ls.append(sortls[count])
        elif sortls[count][2] == sortls[count+1][2]:
            start = sortls[count][0]
            tf = True
        else:
            ls.append(sortls[count])
        count += 1
        if count > n-1:break
        

for i in range(len(ls)):
    ls[i][0] -= 0
ios = [0]*(10**5+5)
for i in range(len(ls)):
    ios[ls[i][0]] += 1
    ios[ls[i][1]+1] -= 1
ans = ios[0]
for i in range(1,len(ios)):
    ios[i] += ios[i-1]
    ans = max(ans,ios[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n,c = map(int,input().split())
ls = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    ls[i][0] -= 0
ios = [0]*(10**5+5)
for i in range(n):
    ios[ls[i][0]] += 1
    ios[ls[i][1]+1] -= 1
ans = ios[0]
for i in range(1,len(ios)):
    ios[i] += ios[i-1]
    ans = max(ans,ios[i])
print(ans)

Submission status: Wrong Answer

Solution code:
def recording(N: int, C: int, info: list) -> int:
    MAX_TIME = 2*(10**5)

    # 各チャンネルでのレコーダーの使用数を累積和として求める。
    # cum が累積和であり、S-0.5 を配列で表すために 2*(10**5)
    # のサイズにしている。
    cum = [0] * (MAX_TIME + 1)

    # スタート時間を +1 、終了時間を -1 とすることで、あとで
    # 累積和をとるときに、録画している時間帯が 1 、していない
    # 時間が 0 になるようにできる。
    for s, t, ch in info:
        cum[2*s-1] += 1
        cum[2*t] -= 1

    # 累積和をとる。
    for t in range(MAX_TIME):
        cum[t+1] += cum[t]

    # 各時間帯でのレコーダーの使用台数の最大値をとる。
    return max(cum)


if __name__ == "__main__":
    N = 0
    N, C = map(int, input().split())
    info = [tuple(map(int, input().split())) for _ in range(N)]
    ans = recording(N, C, info)
    print(ans)

Submission status: Wrong Answer

Solution code:
def recording(N: int, C: int, info: list) -> int:
    MAX_TIME = 2*(10**5)

    # 各チャンネルでのレコーダーの使用数を累積和として求める。
    # cum が累積和であり、S-0.5 を配列で表すために 2*(10**5)
    # のサイズにしている。
    cum = [[0] * (MAX_TIME + 1) for _ in range(C)]

    # スタート時間を +1 、終了時間を -1 とすることで、あとで
    # 累積和をとるときに、録画している時間帯が 1 、していない
    # 時間が 0 になるようにできる。
    for s, t, ch in info:
        cum[ch-1][2*s-1] += 1
        cum[ch-1][2*t] -= 1

    # 累積和をとる。
    for ch in range(C):
        for t in range(MAX_TIME):
            cum[ch][t+1] += cum[ch][t]

    # 各時間帯でのレコーダーの使用台数の最大値をとる。
    return max(
        sum(cum[ch][t] for ch in range(C))
        for t in range(MAX_TIME+1))


if __name__ == "__main__":
    N = 0
    N, C = map(int, input().split())
    info = [tuple(map(int, input().split())) for _ in range(N)]
    ans = recording(N, C, info)
    print(ans)

Submission status: Wrong Answer

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

dataSet = [list(map(int, input().strip().split())) for i in range(N)]

for data in dataSet:
    data[0] -= 0.5

sortedData = sorted(dataSet, key=lambda x:x[1])


num = 0
sTime = 0
recoder = 1

while(True) :
    if(len(sortedData)==0) :
        break
    if(num < len(sortedData)) :
        if(sortedData[num][0] >= sTime) :

            sTime = sortedData.pop(num)[1]
        else :
            num += 1
    else :
        recoder += 1
        num = 0
        sTime = 0


print(recoder)

Submission status: Wrong Answer

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

#C
def C():
    N = I()
    F = LIR(N)
    P = LIR(N)
    ans = -1*float("INF")
    kaiten = list((itertools.product([0,1], repeat=10)))
    del kaiten[0]
    for patern in kaiten:
        i = list(patern)
        anskaiten = [0 for i in range(N)]
        for youbi, n in enumerate(i):
            if n == 1:
                for nn,f in enumerate(F):
                    if f[youbi] == 1:
                        anskaiten[nn] += 1
        ansb = 0
        #print(anskaiten, end="")
        for k, p in enumerate(P):
            ansb += p[anskaiten[k]]
        ans = max(ans, ansb)
    print(ans)
        
def D():
    N, C = LI()
    STC = LIR(N)
    STC.sort(key=lambda x: x[1])
    ans = 0
    while len(STC) != 0:
        q = [0]
        #stc[0][0] = s
        t = STC[0][1]
        c = STC[0][2]
        for num, stc in enumerate(STC):
            if stc[2] == c:
                if t <= stc[0]:
                    q.append(num)
                    t = stc[1]
            else:
                if t <= stc[0] - 0.5:
                    q.append(num)
                    t = stc[1]
        for i in q[::-1]:
            del STC[i]
        ans += 1
    print(ans)


if __name__ == '__main__':
    D()

Submission status: Wrong Answer

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

#C
def C():
    N = I()
    F = LIR(N)
    P = LIR(N)
    ans = -1*float("INF")
    kaiten = list((itertools.product([0,1], repeat=10)))
    del kaiten[0]
    for patern in kaiten:
        i = list(patern)
        anskaiten = [0 for i in range(N)]
        for youbi, n in enumerate(i):
            if n == 1:
                for nn,f in enumerate(F):
                    if f[youbi] == 1:
                        anskaiten[nn] += 1
        ansb = 0
        #print(anskaiten, end="")
        for k, p in enumerate(P):
            ansb += p[anskaiten[k]]
        ans = max(ans, ansb)
    print(ans)
        
def D():
    N, C = LI()
    STC = LIR(N)
    for stc in STC:
        stc[0] -= 0.5
    STC.sort(key=lambda x: x[1])
    ans = 0
    while len(STC) != 0:
        q = [0]
        #stc[0][0] = s
        t = STC[0][1] 
        for num,stc in enumerate(STC):
            if t <= stc[0]:
                q.append(num)
                t = stc[1]
        for i in q[::-1]:
            del STC[i]
        ans += 1
    print(ans)


if __name__ == '__main__':
    D()

Submission status: Wrong Answer

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(200002)] for j in range(C)]
    for i in range(n):
        s,t,c = LI()
        c -= 1
        T[c][2*s] += 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: Wrong Answer

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(200002)] 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: Wrong Answer

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

Solution code:
def recording(N: int, C: int, info: list) -> int:
    recorders = []
    info.sort(key=lambda x: x[1])
    for s, t, c in info:
        recorded = False
        for i, (rt, rc) in enumerate(recorders):
            if c == rc and rt <= s:
                recorders[i] = (t, c)
                recorded = True
            elif c != rc and rt < s:
                recorders[i] = (t, c)
                recorded = True
        if not recorded:
            recorders.append((t, c))
    return len(recorders)


if __name__ == "__main__":
    N = 0
    N, C = map(int, input().split())
    info = [tuple(map(int, input().split())) for _ in range(N)]
    ans = recording(N, C, info)
    print(ans)

Submission status: Wrong Answer

Solution code:
def recording(N: int, C: int, info: list) -> int:
    recorders = []
    info.sort(key=lambda x: x[0])
    for s, t, c in info:
        recorded = False
        for i, (rt, rc) in enumerate(recorders):
            if c == rc and rt <= s:
                recorders[i] = (t, c)
                recorded = True
            elif c != rc and rt < s:
                recorders[i] = (t, c)
                recorded = True
        if not recorded:
            recorders.append((t, c))
    return len(recorders)


if __name__ == "__main__":
    N = 0
    N, C = map(int, input().split())
    info = [tuple(map(int, input().split())) for _ in range(N)]
    ans = recording(N, C, info)
    print(ans)

Submission status: Wrong Answer

Solution code:
inf = 10**5+9
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]=-1,-1,-1
        
M = 0
for ts,tf,ll in dp:
    if ll != -1:
        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: Wrong Answer

Solution code:
inf = 10**7+9
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:
    if ts != inf:
        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)
#print(d[:30])

Submission status: Wrong Answer

Solution code:
inf = 10**5+9
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:
    if ts == inf:
        continue
    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: Wrong Answer

Solution code:
import heapq

n, c = map(int, input().split())
stc = []
for _ in range(n):
  stc.append(tuple(map(int, input().split())))

flist = []
numc = 0
for s, t, c in sorted(stc, key=lambda x: x[0]):
  if len(flist) == 0:
    heapq.heappush(flist, t)
    numc += 1
  else:
    f = heapq.heapreplace(flist, t)
    if f + 1 > s:
      heapq.heappush(flist, f)
      numc += 1
print(numc)

Submission status: Wrong Answer

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,C=rl()
st = [[] for _ in range(C)]
for i in range(N):
    s,t,c = rl()
    st[c-1].append([s,t])
for st_i in range(len(st)):
    st_ = st[st_i]
    if len(st_) <= 1: continue
    st_.sort(key=lambda x:x[0])
    l = []
    new = 0
    lst_ = len(st_)
    for i in range(lst_):
        if new == 0:
            s,t = st_[i]
            if i != lst_ -1 and t==st_[i+1][0]:
               new = 1
               continue
            else:
                l.append([s,t])
        else:
            t = st_[i][1]
            if i != lst_ -1 and t==st_[i+1][0]:
                new = 1
                continue
            else:
                l.append([s,t])
    st[st_i] = l


TT = [0 for _ in range(10**5+2)]

for st_ in st:
    if len(st_) == 0: continue
    for i in range(len(st_)):
        TT[st_[i][0]] += 1
        TT[st_[i][1]+1] -= 1

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

print(max(TT))

Submission status: Wrong Answer

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,C=rl()

TT = [0 for _ in range(10**5+2)]

for _ in range(N):
    s,t,c=rl()
    TT[s] += 1
    TT[t+1] -= 1

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

print(max(TT))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

n,c = map(int, input().split())
show = [list(map(int, input().split())) for i in range(n)]
show.sort(key = itemgetter(1))
n = 0
ans = 1
a = [show[0][1]]
for i in show[1:]:
  if i[0] <= a[n]:
    ans += 1
  else:
    n += 1
  a.append(i[1])
print(ans)

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]

A.sort(key = lambda x:x[0])
A.sort(key = lambda x:x[2])

for i in range(n-1) :
    if A[i][2] == A[i+1][2] and A[i+1][0] - A[i][1] <= 1 :
        A[i][1] = A[i+1][1]
        A[i+1] = [-10, 0, 0]
for i in range(n) :
    A[i][0] -= 1

#A.sort(key = lambda x:x[0])

T = [0 for i in range(10**5+10)]
ans = 0
for i in range(n) :
    if A[i][0] != -11 :
        T[A[i][0]] += 1
        T[A[i][1]] -= 1

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

print(max(T))

Submission status: Wrong Answer

Solution code:
n, c = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]

A.sort(key = lambda x:x[0])
A.sort(key = lambda x:x[2])

for i in range(n-1) :
    if A[i][2] == A[i+1][2] and A[i+1][0] - A[i][1] <= 1 :
        A[i][1] = A[i+1][1]
        A[i+1] = [0, 0, 0]
for i in range(n) :
    A[i][0] -= 1

A.sort(key = lambda x:x[0])

T = [0 for i in range(10**5+2)]
ans = 0
for i in range(n) :
    if A[i][0] != -1 :
        T[A[i][0]] += 1
        T[A[i][1]] -= 1

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

print(max(T))

Submission status: Wrong Answer

Solution code:
# D
N,C = map(int, input().split())
st = [[] for _ in range(C)]
for _ in range(N):
    s,t,c = map(int, input().split())
    st[c-1].append((s,t))
# 同じチャンネルなら区間を結合できる
for ch in range(C):
    if st[ch]==[]: continue
    st[ch].sort()
    r,l = st[ch][0]
    for j in range(len(st[ch])):
        sj,tj = st[ch][j]
        if l==sj:
            st[ch].remove((st[ch][j-1]))
            st[ch].append((r, tj))
        r,l = sj,tj

# 累積和
T_MAX = int(1e5)
ruiseki = [0]*(T_MAX+1)
for ch in range(C):
    for sj,tj in st[ch]:
        ruiseki[sj-1] += 1
        ruiseki[tj] -= 1
ans = 1
wa = 0
for ri in ruiseki:
    wa += ri
    ans = max(ans, wa)
print(ans)

Submission status: Wrong Answer

Solution code:
# D
N,C = map(int, input().split())
T_MAX = int(1e5)
t = [0]*(T_MAX+2)
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: Wrong Answer

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
ans = 1
wa = 0
for ti in t:
    wa += ti
    ans = max(ans, wa)
print(ans)

Submission status: Wrong Answer

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
ans = 0
wa = 0
for ti in t:
    wa += ti
    ans = max(ans, wa)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, C = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(N)]
time = [0 for _ in range(10 ** 6)]
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: Wrong Answer

Solution code:
a,b=map(int,input().split())

d = [0]*(2*(10**5)+10)
for i in range(a):
    ts,tf,c =map(int,input().split())
    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)
#print(d[:30])

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

d = [0]*(2*(10**5)+10)
for i in range(a):
    ts,tf,c =map(int,input().split())
    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]
    M = max(M,d[i])
print(M)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())

d = [0]*(2*(10**5)+10)
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: Wrong Answer

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+1]-=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)