Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

//////検証する数,超えられない数////
/*
long long cine(long long a, long long b) {
	if (a <= b) {
		return a;
	}
	else {
		return b;
	}
};*/
//vector型の初期化
/*
void vec_initialize(vector<ll>& a, const ll N) {
	ll c;

	for (int i = 0; i < N; i++) {

		cin >> c;
		a.push_back(c);

	}

};
void vec_pair_initialize(vector<pair<ll, ll>>& a, const ll N) {
	ll c, d;
	for (int i = 0; i < N; i++) {
		cin >> c >> d;
		a.push_back(make_pair(c, d));
	}
};
*/
int main() {
	ll N, C;
	vector<ll>s, t, c;
	cin >> N >> C;
	ll x,y,z;
	map<ll,ll>chanel;
	for (ll i = 0; i < N; i++) {
		cin >> x>>y>>z;
		s.push_back(2*x-1);
		t.push_back(2*y);
		c.push_back(z);
	}
	
	ll tmpc[30];
	
	for (ll i = 1; i <=C; i++) {
		vector<ll>tmps;
		vector<ll>tmpt;
		for (ll j = 0; j < N; j++) {
			if (c[j] == i) {
				tmps.push_back(s[j]);
				tmpt.push_back(t[j]);	
				tmpc[i-1]++;
			}
		}
		for (ll j = 0; j < tmpc[i - 1]; j++) {
			if (tmpt[j+1] < tmpt[j]) {
				tmps[j + 1] += 2;
			}
		}
		for (ll j = 0; j < tmpc[i - 1]; j++) {
			for (ll k = tmps[j]; k <= tmpt[j]; k++) {

				chanel[k]++;

			}
		}


	}
	sort(chanel.begin(), chanel.end());
	reverse(chanel.begin(), chanel.end());

	cout << chanel[0];

}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_iterator<pair<const long long int, long long int> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_iterator<pair<const long long int, long long int> >]'
 4772 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:86:6:   required from here
   86 |         sort(chanel.begin(), chanel.end());
      |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' and 'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >')
 1906 |                                 std::__lg(__last - __first) * 2,
      |                                           ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note:   'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
 1906 |                                 std::__lg(__last - __first) * 2,
      |                                           ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note:   'std::_Rb_tree_iterator<std::pair<const long long int, long long int> >' is not derived from 'const std::move_iterator<_IteratorL>'
 1906 |                                 std::__lg(__last - __first) * 2,
      |                                           ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = _Rb_tree_iterator<pair<const long long int, long long int> >; _ForwardIterator2 = _Rb_tree_iterator<pair<const long long int, long long int> >]':
/usr/include/c++/14/bits/stl_algo.h:1041:20:   required from 'void std::__reverse(_BidirectionalIterator, _BidirectionalIterator, bidirectional_iterator_tag) [with _BidirectionalIterator = _Rb_tree_iterator<pair<const long long int, long long int> >]'
 1041 |             std::iter_swap(__first, __last);
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:21:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = _Rb_tree_iterator<pair<const long long int, long long int> >]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:87:9:   required from here
   87 |         reverse(chanel.begin(), chanel.end());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:185:11: error: use of deleted function 'typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&) [with _T1 = const long long int; _T2 = long long int; typename enable_if<(! __and_<__is_swappable<_T1>, __is_swappable<_T2> >::value)>::type = void]'
  185 |       swap(*__a, *__b);
      |       ~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: declared here
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/stl_algobase.h:185:11: note: use '-fdiagnostics-all-candidates' to display considered candidates
  185 |       swap(*__a, *__b);
      |       ~~~~^~~~~~~~~~~~