Language: C++

#include<iostream>

using namespace std;

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