Language: C++

/*
 * GCA : "Computer is artificial subject absolutely,Math is God"
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cctype>
#include <utility>

using namespace std;
#ifdef DEBUG
#define VAR(a,b) __typeof(b) a=(b)
#define debug(...) printf("DEBUG: "),printf(__VA_ARGS__)
#else
#define VAR(a,b) __typeof(b) a=(b)
#define debug(...)
#endif
typedef unsigned int uint;
typedef long long int Int;
typedef unsigned long long int UInt;
#define Set(a,s) memset(a,s,sizeof(a))
#define Pln() printf("\n")
#define For(i,x)for(int i=0;i<x;i++)
#define CON(x,y) x##y
#define M 1005
#define PB push_back
#define oo INT_MAX
#define FOR(a,b) for(VAR(a,(b).begin());a!=(b).end();++a)
#define eps 1e-9
#define X first
#define Y second
inline bool xdy(double x,double y){return x>y+eps;}
inline bool xddy(double x,double y){return x>y-eps;}
inline bool xcy(double x,double y){return x<y-eps;}
inline bool xcdy(double x,double y){return x<y+eps;}
const Int mod=1000000007;
int n;
int god[M];
int godlog;
int time[M];
int intime[M];
int sid[M];
char ppl[M];
int main() {
	ios_base::sync_with_stdio(0);
	while(~scanf("%d",&n)&&n){
		Set(intime,-1);
		Set(god,0);
		int godtime=-1;
		for(int i=0;i<n;i++){
			int mon,d,h,m,id;
			char p;
			scanf("%d/%d %d:%d ",&mon,&d,&h,&m);
			time[i]=mon*100*24*60+d*24*60+h*60+m;
			scanf("%c %d",&ppl[i],&sid[i]);
			p=ppl[i];id=sid[i];
			if(!id){
				if(p=='I'){
					godtime=time[i];
					godlog=i;
				}
				else if(p=='O'){
					bool outside[M]={};
					for(int j=i-1;j>=0;j--){
						if(ppl[j]=='O')outside[sid[j]]=1;
						if(ppl[j]=='I'&&intime[sid[j]]!=-1&&!outside[sid[j]]){
							god[sid[j]]+=time[i]-max(godtime,intime[sid[j]]);
						}
					}
					godtime=-1;
				}
			}else{
				if(p=='I')intime[id]=time[i];
				else if(p=='O'){
					if(godtime!=-1){
						god[id]+=time[i]-intime[id];
						intime[id]=-1;
					}
				}
			}


		}
		int ans=0;
		for(int i=1;i<1000;i++){
			ans=max(ans,god[i]);
		}
		printf("%d\n",ans);
	}

















}

Compiler output:
a.cc:47:11: error: 'int time [1005]' redeclared as different kind of entity
   47 | int time[M];
      |           ^
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:4:
/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:61:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   61 |                         time[i]=mon*100*24*60+d*24*60+h*60+m;
      |                               ^
a.cc:61:32: error: assignment of read-only location '*(time + ((sizetype)i))'
   61 |                         time[i]=mon*100*24*60+d*24*60+h*60+m;
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:66:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   66 |                                         godtime=time[i];
      |                                                       ^
a.cc:66:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   66 |                                         godtime=time[i];
      |                                                 ~~~~~~^
      |                                                       |
      |                                                       time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:74:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   74 |                                                         god[sid[j]]+=time[i]-max(godtime,intime[sid[j]]);
      |                                                                            ^
a.cc:74:77: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   74 |                                                         god[sid[j]]+=time[i]-max(godtime,intime[sid[j]]);
      |                                                                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:68: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   74 |                                                         god[sid[j]]+=time[i]-max(godtime,intime[sid[j]]);
      |                                                         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:104: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   74 |                                                         god[sid[j]]+=time[i]-max(godtime,intime[sid[j]]);
      |                                                                                                        ^
      |                                                                                                        |
      |                                                                                                        time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:80:60: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   80 |                                 if(p=='I')intime[id]=time[i];
      |                                                            ^
a.cc:80:60: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   80 |                                 if(p=='I')intime[id]=time[i];
      |                                                      ~~~~~~^
      |                                                            |
      |                                                            time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:83:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   83 |                                                 god[id]+=time[i]-intime[id];
      |                                                                ^
a.cc:83:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   83 |                                                 god[id]+=time[i]-intime[id];
      |                                                          ~~~~~~~^~~~~~~~~~~
a.cc:83:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   83 |                                                 god[id]+=time[i]-intime[id];
      |                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:83:56: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   83 |                                                 god[id]+=time[i]-intime[id];
      |                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                                                        |
      |                                                        time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}