Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = []
for i in range(a[0]):
	n,m = map(int,input().split())
	b.append([n,n*100*(i+1),m])
su = 10000
s = 0
sss = 0
ma = 0
m = 0
co = 0
c = 0
while a[1] > 0:
	for i in range(len(b)):
		if b[i][1] >= a[1]:
			ma = b[i][1]
			su = min(su,b[i][0] - (b[i][1] - a[1])//100//(i+1))
			co = i
		elif b[i][1]+b[i][2] >= a[1]:
			ma = b[i][1]+b[i][2]
			su = min(su,b[i][0])
			co = i
		m = max(m,b[i][1]+b[i][2])
		if m == b[i][1]+b[i][2]:
			s = b[i][0]
			c = i
	if ma != 0:
		sss += su
		break
	else:
		sss += s
		b.pop(c)
		a[1] -= m
	ma = 0
	su = 10000
print(sss)

Fixed submission:
a,b = map(int,input().split())

c = []

for i in range(a):
	c.append(list(map(int,input().split())))

ans = float('inf')

for i in range(1<<a):
	sc = 0
	co = 0
	for j in range(a):
		if i & (1<<j):
			sc += c[j][0]*(j+1)*100 + c[j][1]
			co += c[j][0]
	if sc >= b:
		ans = min(ans,co)
	else:
		for j in range(a)[::-1]:
			if i &(1<<j):
				continue
			else:
				for k in range(c[j][0]):
					sc += 100*(j+1)
					co += 1
					if sc >= b:
						break
				if sc >= b:
					break
		ans = min(ans,co)

print(ans)
Buggy python submission (verdict: Runtime Error):
a = list(input())

dp = [[0]*3 for i in range(len(a)+1)]

ppp ~ 1
for i in range(len(a))[::-1]:
	if a[i] == "A":
		dp[i][0] += dp[i+1][0] + dp[i+1][1]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "B":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1] + dp[i+1][2]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "C":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2] + ppp
	else:
		dp[i][0] += 3 * dp[i+1][0] + dp[i+1][1]
		dp[i][1] += 3 * dp[i+1][1] + dp[i+1][2]
		dp[i][2] += 3 * dp[i+1][2] + ppp
		ppp *= 3
		ppp %= 10**9+7
	for j in range(3):
		dp[i][j] %= (10**9 + 7)
print(dp[0][0] % (10**9 + 7))

Fixed submission:
a = list(input())

dp = [[0]*3 for i in range(len(a)+1)]

ppp = 1
for i in range(len(a))[::-1]:
	if a[i] == "A":
		dp[i][0] += dp[i+1][0] + dp[i+1][1]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "B":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1] + dp[i+1][2]
		dp[i][2] += dp[i+1][2]
	elif a[i] == "C":
		dp[i][0] += dp[i+1][0]
		dp[i][1] += dp[i+1][1]
		dp[i][2] += dp[i+1][2] + ppp
	else:
		dp[i][0] += 3 * dp[i+1][0] + dp[i+1][1]
		dp[i][1] += 3 * dp[i+1][1] + dp[i+1][2]
		dp[i][2] += 3 * dp[i+1][2] + ppp
		ppp *= 3
		ppp %= 10**9+7
	for j in range(3):
		dp[i][j] %= (10**9 + 7)
print(dp[0][0] % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = [0]*a[0]
 
for i in range(a[1]):
	m,n = map(int,input().split())
 
	b[m-1] += 1
	b[n-1] -= 1
ma = b[0]
for i in range(1,a[0]):
	b[i] += b[i-1]
	if b[i] >= ma:
		ma = b[i]
		k = i
 
print(a[1] - ma+1)

Fixed submission:
a = list(map(int,input().split()))
 
a.sort()

print(abs(a[0]-a[1])+abs(a[1]-a[2]))

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))

k = max(abs(a[0]-a[1]),abs(a[1]-a[2]),abs(a[2]-a[1]))

print(abs(a[0]-a[1])+abs(a[1]-a[2])+abs(a[2]-a[0])-k

Fixed submission:
a = list(map(int,input().split()))
 
a.sort()

print(abs(a[0]-a[1])+abs(a[1]-a[2]))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

c - []
for i in range(a[1]):
  c.append(list(map(int,input().split())))

c.sort(key = lambda x:x[1])

s = c[0][0]
l = c[0][1]
re = 1

for i in range(1,a[1]):
  if l >= c[i][0]:
    re += 1
    l = c[i][1]
    
print(re)

Fixed submission:
a,b = map(int,input().split())

c = []
for i in range(b):
  c.append(list(map(int,input().split())))

c.sort(key = lambda x:x[1])

s = c[0][0]
l = c[0][1]
re = 1

for i in range(1,b):
  if l <= c[i][0]:
    re += 1
    l = c[i][1]
    
print(re)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())

if (a+b) == 15:
  print("+")
elif (a*b)==15:
  print("*")
else:
  print("x")

Fixed submission:
a,b = map(int,input().split())
if (a+b) == 15:
  print("+")
elif (a*b) == 15:
  print("*")
else:
  print("x")
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n % 2==0
	print(n)
else:
  print(n*2)

Fixed submission:
n = int(input())

if n % 2==0:
  print(n)
else:
  print(n*2)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
 
for i in range(a):
	b[i] -= i + 1
 
b.sort()
s = 0
co = 0
ss = 0
coco = 0
cococo = 0
summ = 0
su = 0
bb = 0
for i in range(a):
	if b[i] < 0:
		co += 1
	elif b[i] > 0:
		coco += 1
	else:
		cococo += 1
	su += abs(b[i])

if co > coco:	
	while su != 0:
		bb = 0
		for i in range(a):
			b[i] += 1
			bb += abs(b[i])
		if bb > su:
			print(su)
			break
		su = bb
		bb = 0


elif coco >= co:
	while su != 0:
		for i in range(a):
			b[i] -= 1
			bb += abs(b[i])
		if bb > su:
			print(su)
			break
		su = bb
		bb = 0

if su == 0:
	print(0) 

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
 
for i in range(a):
	b[i] -= i + 1
 
b.sort()
su = 0
c = b[(a - 1) // 2]

for i in range(a):
	su += abs(b[i] - c)

print(su)
Buggy python submission (verdict: Runtime Error):
a = list(input())
su = 0
s = 0
k = 0
for i in a:
  s += int(i)
a.reverse()
for i in a:
  su += i*pow(10,k)
  k += 1
  
if su % s == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
a = list(input())
su = 0
s = 0
k = 0
for i in a:
  s += int(i)
a.reverse()
for i in a:
  su += int(i)*pow(10,k)
  k += 1
  
if su % s == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
da  = int(input())

k = list(input())
p = [0]*da
for i in range(da):
  for j in range(da):
    if k[i] == "W" and j < i:
      p[j] += 1
    elif k[i] == "E" and j > i:
      p[j] += 1
      
print(da - max(p)-1)

Fixed submission:
da  = int(input())

k = list(input())
p = [0]*da
for i in range(da):
  if k[i] == "E" and i < da -1:
    p[i+1] += 1
  elif k[i] == "W":
    p[0] += 1
    p[i] -= 1

for i in range(1,da):
  p[i] += p[i-1]

k = max(p)
if max(p) != p[0] or max(p) != p[da-1]:
  k += 1
print(da - k)
Buggy python submission (verdict: Runtime Error):
d = input()
a = int(input())
p = []
k = len(d)
for i in range(k):
  for j in range(min(6,k-i+1)):
    p.append(d[i:i+j])
    
x = list(set(p))
x.sort()
del x[0]
 
print(x[a-1])

Fixed submission:
a = list(map(int,input().split()))
if (abs(a[0]-a[2]) <= a[3]) or ((abs(a[0] - a[1]) <= a[3]) and (abs(a[1] -a[2]) <= a[3])):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
d = input()
a = int(input())
p = []
k = len(d)
for i in range(k):
  for j in range(min(5,k-i)):
    p.append(d[i:i+j+1])
    
x = list(set(p))
x.sort()
del x[0]
 
print(x[a-1])

Fixed submission:
a = list(map(int,input().split()))
if (abs(a[0]-a[2]) <= a[3]) or ((abs(a[0] - a[1]) <= a[3]) and (abs(a[1] -a[2]) <= a[3])):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys,collections as cl
def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	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

n = int(input())

a = seachPrimeNum(55555)
aa = []
for i in range(len(a)):
	if a[i] % 5 == 1:
		aa.append(a[i])

print(" ".join(aa[:n]))


Fixed submission:
import numpy as np
import sys,collections as cl
def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	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

n = int(input())

a = seachPrimeNum(55555)
aa = []
for i in range(len(a)):
	if a[i] % 5 == 1:
		aa.append(a[i])

print(" ".join(map(str,aa[:n])))
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

a.sort()

n = a[n//2-1][0]
m = a[n//2][0]
for i in range(n):
    a[i].append(i)

a.sort(key = lambda x:x[1])

for i in range(n):
    if a[i][2] <= n//2 -1:
        print(m) 
    else:
        print(n)

Fixed submission:
n = int(input())
aa = list(map(int,input().split()))
a = [[] for i in range(n)]
for i in range(n):
    a[i].append(aa[i])
    a[i].append(i)

a.sort()

mm = a[n//2-1][0]
m = a[n//2][0]
for i in range(n):
    a[i].append(i)
a.sort(key = lambda x:x[1])

for i in range(n):
    if a[i][2] <= n//2 -1:
        print(m) 
    else:
        print(mm)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
a = int(input())
da = list(map(int,input().split()))
k = a//2
for i in range(a):
  n = copy.deepcopy(da)
  del n[i]
  n.sort()
  print(n[k-1])

Fixed submission:
n = int(input())
aa = list(map(int,input().split()))
a = [[] for i in range(n)]
for i in range(n):
    a[i].append(aa[i])
    a[i].append(i)

a.sort()

mm = a[n//2-1][0]
m = a[n//2][0]
for i in range(n):
    a[i].append(i)
a.sort(key = lambda x:x[1])

for i in range(n):
    if a[i][2] <= n//2 -1:
        print(m) 
    else:
        print(mm)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
a = int(input())
da = list(map(int,input().split()))
k = a//2
for i in range(a):
  n = copy.deepcopy(da)
  del n[i]
  n.sort()
  print(n[k-1])

Fixed submission:
n = int(input())
aa = list(map(int,input().split()))
a = [[] for i in range(n)]
for i in range(n):
    a[i].append(aa[i])
    a[i].append(i)

a.sort()

mm = a[n//2-1][0]
m = a[n//2][0]
for i in range(n):
    a[i].append(i)
a.sort(key = lambda x:x[1])

for i in range(n):
    if a[i][2] <= n//2 -1:
        print(m) 
    else:
        print(mm)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
a = int(input())
da = list(map(int,input().split()))
k = a//2
for i in range(a):
  n = copy.deepcopy(da)
  del n[i]
  list.sort(n)
  print(n[k-1])

Fixed submission:
n = int(input())
aa = list(map(int,input().split()))
a = [[] for i in range(n)]
for i in range(n):
    a[i].append(aa[i])
    a[i].append(i)

a.sort()

mm = a[n//2-1][0]
m = a[n//2][0]
for i in range(n):
    a[i].append(i)
a.sort(key = lambda x:x[1])

for i in range(n):
    if a[i][2] <= n//2 -1:
        print(m) 
    else:
        print(mm)
Buggy python submission (verdict: Runtime Error):
input()
da = list(map(int,input().split()))
 
x = max(da)
y = x + 1
for i in da:
	if i == x:
  		continue
    if abs(x/2 - i ) <= abs(x/2 - y):
		y = i
print(x,y)

Fixed submission:
input()
da = list(map(int,input().split()))
 
x = max(da)
y = x + 1
for i in da:
  if i == x:
    continue
  if abs(x/2 - i ) <= abs(x/2 - y):
    y = i
print(x,y)

Buggy python submission (verdict: Runtime Error):
input()
da = list(map(int,input().split()))
 
x = max(da)
y = x + 1
for i in x:
	if i == x:
  		continue
    if abs(x/2 - i ) <= abs(x/2 - y):
		y = i
print(x,y)

Fixed submission:
input()
da = list(map(int,input().split()))
 
x = max(da)
y = x + 1
for i in da:
  if i == x:
    continue
  if abs(x/2 - i ) <= abs(x/2 - y):
    y = i
print(x,y)

Buggy python submission (verdict: Runtime Error):
input()
da = list(map(int,input().split()))

x = max(da)
y = x + 1
for i in x
	if i == x:
  		continue
    if abs(x/2 - i ) <= (x/2 - y):
		y = i
print(x,y)

Fixed submission:
input()
da = list(map(int,input().split()))
 
x = max(da)
y = x + 1
for i in da:
  if i == x:
    continue
  if abs(x/2 - i ) <= abs(x/2 - y):
    y = i
print(x,y)
Buggy python submission (verdict: Runtime Error):
d = list(input())

for i in range(3):
  if d[i] == "a":
    a = 1
  if d[i] == "b":
    b = 1
  if d[i] == "c":
    c = 1
    
    
if a*b*c == 1:
  print("Yes")
else:
  print("No")


Fixed submission:
a = list(input())
if "a" in a and "b" in a and "c" in a:
	print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
d = list(input().split())

for i in range(3):
  if d[i] == "a":
    a = 1
  if d[i] == "b":
    b = 1
  if d[i] == "c":
    c = 1
    
    
if a*b*c == 1:
  print("Yes")
else:
  print("No")


Fixed submission:
a = list(input())
if "a" in a and "b" in a and "c" in a:
	print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import copy
nu = int(input())
data = list(map(int,input().split()))
al = 0
for i in range(nu):
  ta = copy.deepcopy(data)
  da = ta.pop(i)
  for j in range(nu - 2):
    al += abs(ta[j + 1] - ta[j])
  if i == 0:
    al += abs(data[1]) + abs(data[nu - 1])
  elif i == nu - 1:
    al += abs(data[0]) + abs(data[nu - 2])
  else:
    al += abs(data[0]) + abs(data[nu - 1])
  print(al)
  al = 0



Fixed submission:
n = int(input())

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

su = 0
su += abs(a[0])
for i in range(n-1):
    su += abs(a[i+1] - a[i])
su += abs(a[-1])
for i in range(n):
    if i == 0:
        print(su - abs(a[0]) - abs(a[0] - a[1])+ abs(a[1]))
    elif i == n-1:
        print(su - abs(a[-1]) - abs(a[-1] - a[-2]) + abs(a[-2]))
    else:
        print(su - abs(a[i] - a[i-1]) - abs(a[i] - a[i+1]) + abs(a[i+1] - a[i-1]))
Buggy python submission (verdict: Runtime Error):
import collections
l = collections.Counter()
n = int(input())
for i in range(n):
    k = input()
    l[k] += 1
n = int(input())
for i in range(n):
    k = input()
    l[k] -= 1
l = l.most_common()
print(l[1])

Fixed submission:
import collections
l = collections.Counter()
n = int(input())
for i in range(n):
    k = input()
    l[k] += 1
n = int(input())
for i in range(n):
    k = input()
    l[k] -= 1
l = l.most_common()
print(l[0][1] if l[0][1] >= 0 else 0)
Buggy python submission (verdict: Runtime Error):
l = [list(input()) for range(3)]
print(l[0][0]+l[1][1]+l[2][2])

Fixed submission:
l = [list(input()) for i in range(3)]
print(l[0][0]+l[1][1]+l[2][2])
Buggy python submission (verdict: Runtime Error):
b = list(map(int,input().split()))

if b[0] == 1 and b[1] == 1:
	print(1)
elif b[0] == 1:
	print(b[1]-2)
elif b[1] == 1:
	print(b[0] -2)

else:
	print(b[0]*b[1] - 2(b[0] + b[1] - 2))

Fixed submission:
b = list(map(int,input().split()))

if b[0] == 1 and b[1] == 1:
	print(1)
elif b[0] == 1:
	print(b[1]-2)
elif b[1] == 1:
	print(b[0] -2)

else:
	print(b[0]*b[1] - 2*(b[0] + b[1] - 2))
Buggy python submission (verdict: Runtime Error):
N = input()
t = N[0]
if N == t + "9"(len(N)-1):
  print(int(t)+9*(len(N)-1))
else:
  print(int(t)-1+9*(len(N)-1))

Fixed submission:
N = input()
t = N[0]
if N == t + "9"*(len(N)-1):
  print(int(t)+9*(len(N)-1))
else:
  print(int(t)-1+9*(len(N)-1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse = True)

su = 0

for i in range(n:
    if i % 2 == 0:
        su += a[i]
    else:
        su -= a[i]
print(su)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse = True)

su = 0

for i in range(n):
    if i % 2 == 0:
        su += a[i]
    else:
        su -= a[i]
print(su)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
a = [list(map(int,input().split()))]

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy % 2):
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()

print("Yes")

Fixed submission:
import sys
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy) % 2:
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
    h = a[i][0]
    j = a[i][1]
    k = a[i][2]
print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
n = input()
co = 0
if len(n) == a+b+1:
  for i in range(a+b+1):
    if n[i] == "-":
      if i != a:
        print("No")
        exit()
      else:
        co = 1
  if co == 1:
    print("Yes")
  else:
    print("No")
    
else:
  print("No")
  exit()

Fixed submission:
a,b = map(int,input().split())
n = input()
co = 0
if len(n) == a+b+1:
  for i in range(a+b+1):
    if n[i] == "-":
      if i != a:
        print("No")
        exit()
      else:
        co = 1
  if co == 1:
    print("Yes")
  else:
    print("No")
    
else:
  print("No")
  exit()
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input())
su = 0
co = 0
for i in range(1,n+1):
  ii = list(map(int,list(str(i))))
  for j in range(len(ii)):
    co += ii[j]
  if co <= b and co >= a:
    su += 1
  co = 0
print(su)

Fixed submission:
n,a,b = map(int,input().split())
su = 0
co = 0
for i in range(1,n+1):
  ii = list(map(int,list(str(i))))
  for j in range(len(ii)):
    co += ii[j]
  if co <= b and co >= a:
    su += i
  co = 0
print(su)
Buggy python submission (verdict: Runtime Error):
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+1)]

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+1):
    time[i][0] += time[i-1][0]
    ma = max(ma,time[i][0])
print(ma)




Fixed submission:
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(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)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

print((1990*m + 100(n-m))*2**m )

Fixed submission:
n,m = map(int,input().split())

print((1900*m + 100*(n-m))*(2**m) )
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')


Fixed submission:
s = input()
t = input()

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

l = []

for i in range(len(s)-len(t) - 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')


Fixed submission:
s = input()
t = input()

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

l = []

for i in range(len(s)-len(t) - 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[i:] + t + s[:i+len(t)]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')


Fixed submission:
s = input()
t = input()

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

l = []

for i in range(len(s)-len(t) - 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[:i+len(t)]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')


Fixed submission:
s = input()
t = input()

l = []

for i in range(len(s)-len(t) + 1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
            break
    if f:
        a = s[:i] + t + s[i+len(t):]
        l.append(a.replace('?','a'))
if len(l)>0:
    print(min(l))
else:
    print('UNRESTORABLE')