Harryxun/stf_run huggingface dataset:
a, b = map(int, input().split(" "))
for i in range(1, 1009):
    if i * 0.08 == a and i * 0.1 == b:
        print(i)
        return
print(-1)

### FIXED CODE ###

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

found = False
for i in range(1, 10000):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        found = True
        break

if not found:
    print(-1)
A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
  break
elif A==B:
  print(A+B)
  break
else:
  print(2*B-1)

### FIXED CODE ###

A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
elif A==B:
  print(A+B)
else:
  print(2*B-1)
#include <iostream>
using namespace std;
int main(void){
    int X,Y;
    cin >> X >> Y;
    cout << X+Y/2 << endl;
    return 0;
}


### FIXED CODE ###

X,Y=map(int,input().split())
print(X+Y//2)
import sys
from bisect import bisect_right
read=sys.stdin.read
readline=sys.stdin.readline

def main():
    n=int(readline())
    a,b,c=(list(map(int,lst.split())) for lst in read().splitlines())
    a.sort()
    b.sort()
    c=[-x for x in c]
    c.sort()
    print(sum(bisect_right(x,a)*bisect_right(-x,c) for x in b))

if __name__=='__main__':
    main()
      
      


### FIXED CODE ###


import sys
from heapq import heapify,heappop,heappush
from collections import defaultdict
read=sys.stdin.read
readline=sys.stdin.readline

def main():
    n=int(readline())
    a,b,c=(list(map(int,lst.split())) for lst in read().splitlines())
    a.sort()
    b.sort()
    c=[-x for x in c]
    c.sort()

    def bise(x,lst):
        left=0
        right=len(lst)
        while right-left>0:
            mid=(right+left)//2
            if lst[mid]>=x:
                right=mid
            else:
                left=mid+1
        return left
    print(sum(bise(x,a)*bise(-x,c) for x in b))

if __name__=='__main__':
    main()
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 0
r = a[-1]

while r - l > 0:
    mid = (r + l) // 2
    cnt = 0
    for i in a:
        cnt += i // mid
    if cnt <= K:
        r = mid
    else:
        l = mid + 1

print(r)

### FIXED CODE ###

import math
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 0
r = a[-1] + 1

while r - l > 1:
    mid = (r + l) // 2
    cnt = 0
    for i in a:
        cnt += (i - 1) // mid
    if cnt <= K:
        r = mid
    else:
        l = mid
print(r)
n = int(input())
s = input()
k = int(input())
t = s[k]
for i in range(n):
    if s[i] != t:
        s[i] = "*"
print(s)

### FIXED CODE ###

n = int(input())
s = list(input())
k = int(input())
t = s[k-1]
for i in range(n):
    if s[i] != t:
        s[i] = "*"
print(*s,sep="")
a = input(),split()
t , u = int(a[0]),int(b[0])
def c(x,y):
  if x % y:
    return c(y,x%y)
  else:
    return y
print(c(t,u))


### FIXED CODE ###

a = list(map(int, input().split()))
t , u = a[0],a[1]

def c(x,y):
  if x % y:
    return(c(y,x%y))
  else:
    return(y)

print(c(t,u))
s = list(input())
count = 0
find = False
while True:
    if len(s) <=2:
        break
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            count += 2
            del s[i]
            del s[i+1]
            break
    else:
        break
    
print(count)

### FIXED CODE ###

s = list(input())
zero = s.count("0")
ans = min(len(s)-zero,zero)
print(ans*2)
N,i = map(int.input().split())

answer = N - i + 1

print(answer)

### FIXED CODE ###

N,i = map(int,input().split())

answer = N - i + 1

print(answer)
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    n = 0
    while n != len(S):
        if n % 2 == 1:
            break
        if S[n] == "h" and S[n+1] == "i":
            n += 2
        else:
            break
    if n == len(S):
        print(YES)
    else:
        print(NO)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(S) % 2 == 1:
        print(NO)
        exit()
    n = 0
    while n != len(S):
        if S[n] == "h" and S[n+1] == "i":
            n += 2
        else:
            break
    if n == len(S):
        print(YES)
    else:
        print(NO)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, S: str, T: str):
    # from math import gcd
    from fractions import gcd

    def lcm(a: int, b: int):
        return (a * b) // gcd(a, b)

    l = lcm(N, M)

    x = [''] * l

    for i in range(N):
        x[i*(l//N)] = S[i]

    for i in range(M):
        if(x[i*(l//M)] != '' and x[i*(l//M)] != T[i]):
            print(-1)
            exit()
        else:
            x[i*(l//M)] = T[i]

    

    print(l)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    M = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(N, M, S, T)

if __name__ == '__main__':
    main()


### FIXED CODE ###

N,M=map(int,input().split())
S=input()
T=input()
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
g=gcd(N,M)
L=N*M//g
if all(S[i*N//g]==T[i*M//g]for i in range(g)):
  print(L)
else:
  print(-1)
n = int(input())

max = 0
sum = 0
for i in range(n)
	data = int(input())
 	if max < data:
    	max = data
    sum = sum + data
   
print(sum - max//2)
  

### FIXED CODE ###

n = int(input())
max = 0
sum = 0

#print ("START")
for i in range(n):
	data = input()
#	print("aaa")
	data = int(data)
#	print(data)
	if max < data:
		max = data
	sum = sum + data
print(sum - max//2)
NM = list(map(int, input().split()))
N, M = NM[0],NM[1]
a = list(map(int, input().split()))

if  sum(a)> N:
    print(-1)
else:
    print(N - sum(A))

### FIXED CODE ###

R = int(input())
print(R*2*3.14)
from math import gcd

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

L = [0] * (N+1)
R = [0] * (N+2)

for i in range(N):
    L[i+1] = gcd(L[i],A[i])
for i in range(N)[::-1]:
    R[i+1] = gcd(R[i+2],A[i])
    
ans = 0

for i in range(1,N+1):
    ans = max(ans, gcd(L[i-1], R[i+1]))

print(ans)

### FIXED CODE ###

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

def gcd(a, b):
    while b :
        a, b = b, a % b
    return a

L = [0] * (N+1)
R = [0] * (N+2)

for i in range(N):
    L[i+1] = gcd(L[i],A[i])
for i in range(N)[::-1]:
    R[i+1] = gcd(R[i+2],A[i])
    
ans = 0

for i in range(1,N+1):
    ans = max(ans, gcd(L[i-1], R[i+1]))

print(ans)
K=int(input())
s=input()
S=len(s)
mod=10**9+7
MAX_N=10**6+10
fact=[1]
fact_inv=[0]*(MAX_N+4)
for i in range(MAX_N+3):
  fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
  fact_inv[i]=fact_inv[i+1]*(i+1)%mod

def mod_comb_k(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod

cnt=0
for i in range(K+1):
  a=(pow(26,i,mod)*pow(25,K-i,mod))*(mod_comb_k(K+S-i-1,S-1,mod))
  a%=mod
  cnt+=a
  cnt%=mod
print(cnt)

### FIXED CODE ###

K=int(input())
s=input()
S=len(s)
mod=10**9+7
MAX_N=10**7
fact=[1]
fact_inv=[0]*(MAX_N+4)
for i in range(MAX_N+3):
  fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
  fact_inv[i]=fact_inv[i+1]*(i+1)%mod

def mod_comb_k(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod

cnt=0
for i in range(K+1):
  a=(pow(26,i,mod)*pow(25,K-i,mod))*(mod_comb_k(K+S-i-1,S-1,mod))
  a%=mod
  cnt+=a
  cnt%=mod
print(cnt)
import numpy as np

h, w, m = map(int, input().split())

x_list = [0 for i in range(w)]
y_list = [0 for i in range(h)]

target = [set() for i in range(h)]

for i in range(m):
    hi, wi = map(int, input().split())
    y_list[hi-1] += 1
    x_list[wi-1] += 1
    target[hi-1].add(wi-1)


y_max = max(y_list)
y_max_list = np.where(np.array(y_list) == y_max)[0]
x_max = max(x_list)
x_max_list = np.where(np.array(x_list) == x_max)[0]

minus = True

for y in y_max_list:
    for x in x_max_list:
        if x in target[y]:
            continue
        else:
            minus = False
            break

if minus:
    print(y_max + x_max - 1)
else:
    print(y_max + x_max)


### FIXED CODE ###

import numpy as np

h, w, m = map(int, input().split())

x_list = [0 for i in range(w)]
y_list = [0 for i in range(h)]

target = [set() for i in range(h)]

for i in range(m):
    hi, wi = map(int, input().split())
    y_list[hi-1] += 1
    x_list[wi-1] += 1
    target[hi-1].add(wi-1)


y_max = max(y_list)
y_max_list = np.where(np.array(y_list) == y_max)[0]
x_max = max(x_list)
x_max_list = np.where(np.array(x_list) == x_max)[0]

minus = True

for y in y_max_list:
    for x in x_max_list:
        if x in target[y]:
            continue
        else:
            minus = False
            break

if minus:
    print(y_max + x_max - 1)
else:
    print(y_max + x_max)
N = int(input())
lis=[0 for i in range(N)]
for i in range(N):
    lis[i]=(int(input()))
if N == 1:
    print(lis[0])
    exit()
def Euc(x,y):
    s=0;b=0;rem=0;
    if x>y:
        s=y;b=x
    elif y>x:
        s=x;b=y
    else:
        return x
    while True:
        rem = b%s
        if rem == 0:
            return int(x*y/s)
        b = s
        s = rem
a = lis[0]
for i in range(N-1):
    a = Euc(a,lis[i+1])
print(a)


### FIXED CODE ###

def koubai(a,b):
    if b==0:
        return a
    return(koubai(b,a%b))
def kouyaku(a,b):
    return a*b//koubai(a,b)

N=int(input())
if N==1:
    print(int(input()))
    exit()
ans=1
for i in range(N):
    ans=kouyaku(ans,int(input()))
print(int(ans))
N = int(input())
t = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    t[a].append([b,c])
    t[b].append([a,c])
Q,K = map(int,input().split())
#p is parent
#pcd is parent-child distance
d = [0 for i in range(N+1)]
def f(v,p,pcd):
    global t,d
    d[v] = pcd
    for c in t[v]:
        if c[0]!=p:
            f(c[0],v,pcd+c[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(d[x]+d[y])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N = int(input())
T = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    T[a].append((b,c))
    T[b].append((a,c))
Q,K = map(int,input().split())
D = [0]*(N+1)
def f(v,p,cost):
    global T,K,D
    for C in T[v]:
        if C[0]!=p:
            D[C[0]] = cost+C[1]
            f(C[0],v,cost+C[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(D[x]+D[y])
H, W = map(int, input().split())
MAP = [list('#' + input() + '#') for j in range(H)]
MAP.insert(0, ['#' for i in range(W + 2)])
MAP.append(['#' for i in range(W + 2)])
MAP2 = copy.deepcopy(MAP)


def line(MAP):
    for i in range(1, H + 2):
        before = 0
        for j in range(1, W + 2):
            if MAP[i][j] == '#':
                for x in range(before + 1, j):
                    MAP[i][x] = j - before - 1
                before = j


def column(MAP2):
    for j in range(1, W + 2):
        before = 0
        for i in range(1, H + 2):
            if MAP2[i][j] == '#':
                for y in range(before + 1, i):
                    global ans
                    ans = max(ans, i - before - 1 + MAP[y][j])
                before = i


line(MAP)
ans = 0
column(MAP2)
print(ans - 1)

### FIXED CODE ###

def main ():
    H, W = map(int, input().split())
    MAP = [list('#' for i in range(W + 2)) for j in range(H + 2)]
    for i in range(H):
        line = list(input())
        for j, dot in enumerate(line):
            MAP[i + 1][j + 1] = dot
    L = [[0 for j in range(W + 2)] for i in range(H + 2)]


    def line(MAP):
        for i in range(1, H + 2):
            before = 0
            for j in range(1, W + 2):
                if MAP[i][j] == '#':
                    for x in range(before + 1, j):
                        L[i][x] = j - before - 1
                    before = j


    def column(MAP2):
        ans = 0
        for j in range(1, W + 2):
            before = 0
            for i in range(1, H + 2):
                if MAP2[i][j] == '#':
                    for y in range(before + 1, i):
                        ans = max(ans, i - before - 1 + L[y][j])
                    before = i
        return ans - 1

    line(MAP)
    column(MAP)
    print(column(MAP))

if __name__ == '__main__':
    main()
x = input()
x = x*x*x
print(x)


### FIXED CODE ###

x = int(input())
x = x*x*x
print(x)
K=int('K')
if K=1:
 print('ACL')
elif K=2:
 print('ACL'*2)
elif K=3:
 print('ACL'*3)
elif K=4:
 print('ACL'*4)
else:
 print('ACL'*5)


### FIXED CODE ###

print('ACL'*int(input()))
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for i in range(m)]

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(s[i])
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))


### FIXED CODE ###

a, b, c = map(int,input().split())
if a + b >= c:
  print("Yes")
  
else:
  print("No")
S = input()
if S == 'ARC:
  print("ABC")
else:print('ARC')

### FIXED CODE ###

S = input()
if S == 'ARC':
  print("ABC")
else:print('ARC')
l = input().split()
print( "Yes" (len(set(l)) == 2) else "No")

### FIXED CODE ###

l = input().split()
print( "Yes" if (len(set(l)) == 2) else "No")
import networkx as nx
G=nx.DiGraph()
G.add_nodes_from([i for i in range(0,10)])
h,w=map(int,input().split())
for i in range(10):
    l=list(map(int,input().split()))
    for j in range(10):
         G.add_edge(i,j,weight=l[j])
d={}
for i in range(10):
    l,p=nx.multi_source_dijkstra(G,[i],target=1)
    d[i]=l
ans=0
for i in range(h):
    l=list(map(int,input().split()))
    for j in l:
        ans+=d.get(j,0)
print(ans)

### FIXED CODE ###

from heapq import *
h,w=map(int,input().split())
g=[[] for i in range(10)]
for i in range(10):
    l=list(map(int,input().split()))
    for j in range(10):
         g[i].append([l[j],j])
d={}
for i in range(10):
    q=[[0,i]]
    heapify(q)
    l=[-1 for i in range(10)]
    while l[1]==-1:
        c,t=heappop(q)
        if(l[t]==-1):
            l[t]=c
            for j in g[t]:
                C,T=j
                if(l[T]==-1):
                    heappush(q,[c+C,T])
    d[i]=l[1]           
ans=0
for i in range(h):
    l=list(map(int,input().split()))
    for j in l:
        ans+=d.get(j,0)
print(ans)
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

import itertools

a = [i+1 for i in range(n)]

C = list(itertools.permutations(a))

idxs = []

for i, c in enumerate(C):
    l = list(c)
    if l == p or l == q:
        idxs.append(i)

ans = idxs[1]-idxs[0]

print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

import itertools

a = [i+1 for i in range(n)]

C = list(itertools.permutations(a))

idxs = []

for i, c in enumerate(C):
    l = list(c)
    if l == p:
        idxs.append(i)
    if l == q:
        idxs.append(i)

ans = idxs[1]-idxs[0]

print(ans)
from math import floor

def dostuff():
    a, b = (int(x) for x in input().split(' '))

    x = b * 10
    i = x
    for i in range(x, x + 10):
        if floor(i * 0.08) == a:
            print(i)
            return
    print(-1)

dostuff()

### FIXED CODE ###

n = input()

if n == "AAA" or n == "BBB":
  print("No")
else:
  print("Yes")
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

a.sort()

plus = a[a > 0]
minus = a[a < 0]
zero = a[a == 0]

#infだと割ってもinf
left = -10 ** 18
right = 10 ** 18

while left + 1 < right:
    x = (left + right) // 2
    cnt = 0
    if x >= 0:
        cnt += n * len(zero)
    cnt += a.searchsorted(x // plus, side="right").sum()
    cnt += (n - a.searchsorted(-(-x // minus), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= x)
    cnt //= 2

    if cnt >= k:
        right = x
    else:
        left = x

print(right)


### FIXED CODE ###

import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))

a.sort()

plus = a[a > 0]
minus = a[a < 0]
zero = a[a == 0]

#infだと割ってもinf
left = -10 ** 18
right = 10 ** 18

while left + 1 < right:
    x = (left + right) // 2
    cnt = 0
    if x >= 0:
        cnt += n * len(zero)
    cnt += a.searchsorted(x // plus, side="right").sum()
    cnt += (n - a.searchsorted(-(-x // minus), side="left")).sum()
    cnt -= np.count_nonzero(a * a <= x)
    cnt //= 2

    if cnt >= k:
        right = x
    else:
        left = x

print(right)
S = str(input())
cnt1=0
cnt2=0
for i in range(len(S)):
    if i==0:
        list1=S[0]
        cnt1+=1
    elif i==1:
        if S[i]==list1:
            cnt1+=1
        else:
            list2=S[i]
            cnt2+=1
    else:
        if S[i]==list1:
            cnt1+=1
        elif S[i]==list2:
            cnt2+=1
        else:
            pass
if cnt1==2 and cnt2==2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

S = str(input())
s = list(S)
s.sort()
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
    print('Yes')
else:
    print('No')
#input
N, K = map(int, input().split())

#output
answer = 0
for i in range(K, N+2):
    answer += ((N*(N+1)//2)  - ((N-i)*(N-i+1)//2) - (i*(i-1)//2) + 1) % mod

print(answer % mod)

### FIXED CODE ###

#input
N, K = map(int, input().split())

#output
mod = pow(10, 9) + 7
answer = 0
for i in range(K, N+2):
    answer += ((N*(N+1)//2)  - ((N-i)*(N-i+1)//2) - (i*(i-1)//2) + 1) % mod

print(answer % mod)
import numpy as np
n=int(input())
*a,=map(int, input().split())
x=0
for ai in a:
    x^=ai

ans=[ai^x for ai in ans]
print(*ans)

### FIXED CODE ###

n=int(input())
*a,=map(int, input().split())
x=0
for ai in a:
    x^=ai

a=[ai^x for ai in a]
print(*a)
i = input().split(' ')
W = int(i[0])
H = int(i[1])
x = int(i[2])
y = int(i[3])
r = int(i[4])

if x - r >= 0 and y - r >=0 and x + r <= W and y + r <= H:
    print('Yes')
else('No')

### FIXED CODE ###

(w, h, x, y, r) = input().split(' ')
w = int(w)
h = int(h)
x = int(x)
y = int(y)
r = int(r)
 
if 0 + r <= x <= w - r and 0 + r <= y <= h - r:
    print('Yes')
else:
    print('No')
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2018
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (L,R):
    for j in range (i+1,R+1):
      x = (i * j) % 2019
      b = min(b,x)
  print(b)

### FIXED CODE ###

L, R = map(int,input().split())
b = 2018
if R - L >= 2019:
  print(0)
else:
  L = L % 2019
  R = R % 2019
  for i in range(L, R):
    for j in range(i + 1, R + 1):
      if b > (i * j) % 2019:
        b = (i * j) % 2019
  print(b)
[N, M] = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))

if(A[M] < (1 / 4 *sum(A))):
    print('No')
else:
    print('Yes')



### FIXED CODE ###

[N, M] = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
A = sorted(A, reverse=True)

if(A[M-1] < (sum(A) * 1 / (4 * M))):
    print('No')
else:
    print('Yes')
from collections import deque
N, M = map(int, input().split())

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

D=[]
for i in range(M):
    B, C = map(int, input().split())
    D += [C]*B

D.sort(reverse = True)
A += D[:N]
A.sort(reverse = True)

print(sum(E[:N])) 

### FIXED CODE ###

N, M = map(int, input().split())

A = sorted(list(map(int, input().split())), reverse=True)

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

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

cnt = 0
ans = 0
a = 0
b = 0
while True:
    if b <= M-1 and A[a] <= B[b][1]:
        n = min(B[b][0], N-cnt)
        ans += B[b][1]*n
        cnt += n
        if cnt == N:
            print(ans)
            break
        b += 1
    elif a <= N-1:
        cnt += 1
        ans += A[a]
        if cnt == N:
            print(ans)
            break
        a += 1
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
import numpy as np
#decimal.getcontext().prec = 10

N, C = MAP()

n = [[] for _ in range(C)]
for _ in range(N):
	s, t, c = MAP()
	n[c-1].append((s, t))

m = [[] for _ in range(C)]

for i in range(C):
	if n[i] == []:
		continue
	n[i].sort(key = lambda y:y[0])
	s = n[i][0][0]
	t = n[i][0][1]
	L = len(n[i])
	n[i].append((0, 0))
	for j in range(L):
		if j < L and n[i][j][1] == n[i][j+1][0]:
			t = n[i][j+1][1]
		else:
			m[i].append((s, t))
			s = n[i][j+1][0]
			t = n[i][j+1][1]

#print(m)
cnt = [0]*(15)

for x in m:
	for s, t in x:
		cnt[s-1] += 1
		cnt[t] -= 1


cnt = list(accumulate(cnt))
#print(cnt)
print(max(cnt))


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
import numpy as np
#decimal.getcontext().prec = 10

N, C = MAP()

n = [[] for _ in range(C)]
for _ in range(N):
	s, t, c = MAP()
	n[c-1].append((s, t))

m = [[] for _ in range(C)]

for i in range(C):
	if n[i] == []:
		continue
	n[i].sort(key = lambda y:y[0])
	s = n[i][0][0]
	t = n[i][0][1]
	L = len(n[i])
	n[i].append((0, 0))
	for j in range(L):
		if j < L and n[i][j][1] == n[i][j+1][0]:
			t = n[i][j+1][1]
		else:
			m[i].append((s, t))
			s = n[i][j+1][0]
			t = n[i][j+1][1]

#print(m)
cnt = [0]*(10**5+1)

for x in m:
	for s, t in x:
		cnt[s-1] += 1
		cnt[t] -= 1


cnt = list(accumulate(cnt))
#print(cnt)
print(max(cnt))