Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int lastin[1111];
int blessed[1111];
bool manin[1111];
bool valkyria_in;
int valkyria_time;
int n;
string s;
int ans;
int hr,mi;
char move;
int index;
void solve(){
	int t=hr*60+mi;
	if(move=='I'){
		if(index==0){
			valkyria_in=true;
			valkyria_time=t;
		}
		else{
			manin[index]=true;
			lastin[index]=t;
		}
	}
	else{
		if(index==0){
			valkyria_in=false;
			for(int i=1;i<1111;i++){
				if(manin[i])blessed[i]+=t-max(lastin[i],valkyria_time);
			}
		}
		else{
			manin[index]=false;
			if(valkyria_in)blessed[index]+=t-max(lastin[index],valkyria_time);
		}
	}
}
int main(){
	while(cin>>n&&n>0){
		ans=0;
		memset(manin,0,sizeof(manin));
		memset(blessed,0,sizeof(blessed));
		valkyria_in=false;
		while(n--){
			cin>>s>>hr>>move>>mi>>move>>index;
			solve();
		}
		for(int i=1;i<1111;i++)ans=max(ans,blessed[i]);
		cout<<ans<<"\n";
	}
}

Compiler output:
a.cc:14:5: error: 'int index' redeclared as different kind of entity
   14 | int index;
      |     ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'void solve()':
a.cc:17:12: error: reference to 'move' is ambiguous
   17 |         if(move=='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,
                 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/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:6: note:                 'char move'
   13 | char move;
      |      ^~~~
a.cc:18:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator=='
   18 |                 if(index==0){
      |                    ~~~~~^~~
a.cc:23:30: error: invalid types 'bool [1111][<unresolved overloaded function type>]' for array subscript
   23 |                         manin[index]=true;
      |                              ^
a.cc:24:31: error: invalid types 'int [1111][<unresolved overloaded function type>]' for array subscript
   24 |                         lastin[index]=t;
      |                               ^
a.cc:28:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator=='
   28 |                 if(index==0){
      |                    ~~~~~^~~
a.cc:35:30: error: invalid types 'bool [1111][<unresolved overloaded function type>]' for array subscript
   35 |                         manin[index]=false;
      |                              ^
a.cc:36:47: error: invalid types 'int [1111][<unresolved overloaded function type>]' for array subscript
   36 |                         if(valkyria_in)blessed[index]+=t-max(lastin[index],valkyria_time);
      |                                               ^
a.cc:36:68: error: invalid types 'int [1111][<unresolved overloaded function type>]' for array subscript
   36 |                         if(valkyria_in)blessed[index]+=t-max(lastin[index],valkyria_time);
      |                                                                    ^
a.cc: In function 'int main()':
a.cc:47:37: error: reference to 'move' is ambiguous
   47 |                         cin>>s>>hr>>move>>mi>>move>>index;
      |                                     ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:6: note:                 'char move'
   13 | char move;
      |      ^~~~
a.cc:47:47: error: reference to 'move' is ambiguous
   47 |                         cin>>s>>hr>>move>>mi>>move>>index;
      |                                               ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: candidates are: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
  675 |     move(_II __first, _II __last, _OI __result)
      |     ^~~~
/usr/include/c++/14/bits/move.h:137:5: note:                 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
  137 |     move(_Tp&& __t) noexcept
      |     ^~~~
a.cc:13:6: note:                 'char move'
   13 | char move;
      |      ^~~~