Language: C++

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int N,M,r,q;
typedef struct{
	int t,n,m,s;
} LOG;

bool time[10000+1][1260 - 540 + 1];

void solve()
{
	memset(time,0,sizeof(time));

	cin>>r;
	vector<LOG> logs(r);
	for(int i = 0;i < r; i++){
		cin >> logs[i].t >> logs[i].n >> logs[i].m >> logs[i].s;
	}

	int count[10001]={0},t[10001] = {0};
	for(int j = 0; j < r; j++){
		int m = logs[j].m;
		if(count[m] == 1 && logs[j].s == 0)
			for(int k = t[m]; k < logs[j].t - 540; k++)
				time[m][k] = true;

		if(count[m] == 0 && logs[j].s == 1)
			t[m] = logs[j].t - 540;
		count[m] += (logs[j].s == 1) ? 1 : -1; //ツカツウツδ督トツづーツ堕敖個クツつウツつケツづゥ
	}

	cin >> q;
	for(int i = 0;i < q; i++){
		int ts,te,m;
		cin >> ts >> te >> m;
		int ans = 0;
		for(int i = ts - 540; i < te - 540; i++){
			ans += time[m][i];
		}
		cout << ans << endl;
	}


}

int main()
{
	while(cin >>N >>M,(N||M)){
		solve();
	}
	return 0;
}

Compiler output:
a.cc:14:34: error: 'bool time [10001][721]' redeclared as different kind of entity
   14 | bool time[10000+1][1260 - 540 + 1];
      |                                  ^
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:1:
/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 'void solve()':
a.cc:18:30: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
   18 |         memset(time,0,sizeof(time));
      |                             ~^~~~~
a.cc:18:9: error: 'memset' was not declared in this scope
   18 |         memset(time,0,sizeof(time));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <queue>
  +++ |+#include <cstring>
    6 | 
a.cc:31:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                                 time[m][k] = true;
      |                                       ^
a.cc:31:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   31 |                                 time[m][k] = true;
      |                                          ^
a.cc:31:44: error: assignment of read-only location '*(time + (((sizetype)m) + ((sizetype)k)))'
   31 |                                 time[m][k] = true;
      |                                 ~~~~~~~~~~~^~~~~~
a.cc:44:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                         ans += time[m][i];
      |                                      ^
a.cc:44:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                         ans += time[m][i];
      |                                         ^
a.cc:44:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                         ans += time[m][i];
      |                         ~~~~^~~~~~~~~~~~~
a.cc:44:29: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   44 |                         ans += time[m][i];
      |                         ~~~~^~~~~~~~~~~~~
      |                             |
      |                             time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}