Language: C++

#include<iostream>

using namespace std;

#define NMAX 200
#define NOT 10000

int time[10001][1261];

int main(){

	while(1){
		int N,M,r,q;
		int t,n,m,s;
		int ts,te;

		cin>>N>>M;

		if(N==0&&M==0) break;

		cin>>r;
		for(int i=0;i<=M;i++){
			for(int j=0;j<=1260;j++){
				time[i][j]=0;
			}
		}
		for(int i=0;i<r;i++){
			cin>>t>>n>>m>>s;
			if(s==0) time[m][t]--;
			if(s==1) time[m][t]++;
		}
		for(int i=0;i<=M;i++){
			for(int j=1;j<=1260;j++){
				time[i][j]+=time[i][j-1];
			}
		}
		cin>>q;
		for(int i=0;i<q;i++){
			cin>>ts>>te>>m;
			int ans=0;
			for(int j=ts;j<te;j++){
				if(time[m][j]!=0) ans++;
			}
			cout<<ans<<endl;
		}
	}
}

Compiler output:
a.cc:8:21: error: 'int time [10001][1261]' redeclared as different kind of entity
    8 | int time[10001][1261];
      |                     ^
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 'int main()':
a.cc:24:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                                 time[i][j]=0;
      |                                       ^
a.cc:24:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                                 time[i][j]=0;
      |                                          ^
a.cc:24:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   24 |                                 time[i][j]=0;
      |                                 ~~~~~~~~~~^~
a.cc:29:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |                         if(s==0) time[m][t]--;
      |                                        ^
a.cc:29:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   29 |                         if(s==0) time[m][t]--;
      |                                           ^
a.cc:29:43: warning: ISO C++ forbids decrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   29 |                         if(s==0) time[m][t]--;
      |                                  ~~~~~~~~~^
a.cc:29:43: error: lvalue required as decrement operand
   29 |                         if(s==0) time[m][t]--;
      |                                           ^
a.cc:30:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                         if(s==1) time[m][t]++;
      |                                        ^
a.cc:30:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   30 |                         if(s==1) time[m][t]++;
      |                                           ^
a.cc:30:43: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   30 |                         if(s==1) time[m][t]++;
      |                                  ~~~~~~~~~^
a.cc:30:43: error: lvalue required as increment operand
   30 |                         if(s==1) time[m][t]++;
      |                                           ^
a.cc:34:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                 time[i][j]+=time[i][j-1];
      |                                       ^
a.cc:34:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                 time[i][j]+=time[i][j-1];
      |                                          ^
a.cc:34:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                 time[i][j]+=time[i][j-1];
      |                                                   ^
a.cc:34:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                                 time[i][j]+=time[i][j-1];
      |                                                        ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:34:43: 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+'
   34 |                                 time[i][j]+=time[i][j-1];
      |                                 ~~~~~~~~~~^~~~~~~~~~~~~~
a.cc:34:43: 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:42:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   42 |                                 if(time[m][j]!=0) ans++;
      |                                          ^
a.cc:42:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   42 |                                 if(time[m][j]!=0) ans++;
      |                                             ^