Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int time[200010];
int ch[200010][30];

int main() {
	int N, C;
	cin >> N >> C;

	REP(i, 200010) {
		time[i] = 0;
		REP(j, 30) ch[i][j] = 0;
	}

	REP(i, N) {
		int si, ti, ci;
		cin >> si >> ti >> ci;
		ci -= 1;

		if (ch[2 * si][ci] == -1 && ch[2 * ti - 1][ci] == 1) {
			ch[2 * si][ci] = 0;
			ch[2 * ti - 1][ci] = 0;
		}
		else if (ch[2 * si][ci] == -1) {
			ch[2 * si][ci] = 0;
			ch[2 * ti][ci] = -1;
		}
		else if (ch[2 * ti - 1][ci] == 1) {
			ch[2 * si - 1][ci] = 1;
			ch[2 * ti - 1][ci] = 0;
		}
		else {
			ch[2 * si - 1][ci] = 1;
			ch[2 * ti][ci] = -1;
		}
	}


	REP(i, 200001){
		REP(j, C) {
			if (ch[i][j] == 1) {
				time[i]++;
			}
			else if (ch[i][j] == -1) {
				time[i]--;
			}
		}
	}

	int ans = 0;
	REPS(i, 1, 200001) {
		time[i] += time[i - 1];
		ans = max(ans, time[i]);
	}
	cout << ans;
	system("pause");
	return 0;
}

Compiler output:
a.cc:28:16: error: 'int time [200010]' redeclared as different kind of entity
   28 | int time[200010];
      |                ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:36:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   36 |                 time[i] = 0;
      |                       ^
a.cc:36:25: error: assignment of read-only location '*(time + ((sizetype)i))'
   36 |                 time[i] = 0;
      |                 ~~~~~~~~^~~
a.cc:67:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   67 |                                 time[i]++;
      |                                       ^
a.cc:67:39: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   67 |                                 time[i]++;
      |                                 ~~~~~~^
a.cc:67:39: error: lvalue required as increment operand
   67 |                                 time[i]++;
      |                                       ^
a.cc:70:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   70 |                                 time[i]--;
      |                                       ^
a.cc:70:39: warning: ISO C++ forbids decrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   70 |                                 time[i]--;
      |                                 ~~~~~~^
a.cc:70:39: error: lvalue required as decrement operand
   70 |                                 time[i]--;
      |                                       ^
a.cc:77:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   77 |                 time[i] += time[i - 1];
      |                       ^
a.cc:77:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   77 |                 time[i] += time[i - 1];
      |                                      ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:77:25: error: invalid operands of types 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator+'
   77 |                 time[i] += time[i - 1];
      |                 ~~~~~~~~^~~~~~~~~~~~~~
a.cc:77:25: note:   in evaluation of 'operator+=(time_t(time_t*) noexcept {aka long int(long int*) noexcept}, time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept})'
a.cc:78:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   78 |                 ans = max(ans, time[i]);
      |                                      ^
a.cc:78:26: error: no matching function for call to 'max(int&, time_t (&)(time_t*) noexcept)'
   78 |                 ans = max(ans, time[i]);
      |                       ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:78:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
   78 |                 ans = max(ans, time[i]);
      |                       ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:11:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:78:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   78 |                 ans = max(ans, time[i]);
      |                       ~~~^~~~~~~~~~~~~~