Language: C++

#include<iostream>
#include<string>
#include<sstream>
#include<string.h>
#include<algorithm>

using namespace std;

int time[86400];

int stoi(string str){
	stringstream ss;
	int num;
	ss << str;
	ss >> num;
	return num;
}

int hmstot(string str){
	return stoi(str.substr(0,2)) * 3600 + stoi(str.substr(2,2)) * 60 + stoi(str.substr(4,2));
}

int main(){
	while(1){
		memset(time, 0,sizeof(time));
		int n;
		cin >> n;
		if(n == 0) break;
		
		for(int i = 0;i < n;i++){
			string shms,ghms;
			cin >> shms >> ghms;
			int st,gt;
			st = hmstot(shms);
			gt = hmstot(ghms);
			for(int j = st;j < gt;j++){
				time[j]++;
			}
		}
		
		int ans = 0;
		for(int i = 0;i < 86400;i++){
			ans = max(ans,time[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc:9:15: error: 'int time [86400]' redeclared as different kind of entity
    9 | int time[86400];
      |               ^
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 hmstot(std::string)':
a.cc:20:20: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   20 |         return stoi(str.substr(0,2)) * 3600 + stoi(str.substr(2,2)) * 60 + stoi(str.substr(4,2));
      |                ~~~~^~~~~~~~~~~~~~~~~
a.cc:11:5: note: candidate: 'int stoi(std::string)'
   11 | int stoi(string str){
      |     ^~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
a.cc:20:51: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   20 |         return stoi(str.substr(0,2)) * 3600 + stoi(str.substr(2,2)) * 60 + stoi(str.substr(4,2));
      |                                               ~~~~^~~~~~~~~~~~~~~~~
a.cc:11:5: note: candidate: 'int stoi(std::string)'
   11 | int stoi(string str){
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
a.cc:20:80: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   20 |         return stoi(str.substr(0,2)) * 3600 + stoi(str.substr(2,2)) * 60 + stoi(str.substr(4,2));
      |                                                                            ~~~~^~~~~~~~~~~~~~~~~
a.cc:11:5: note: candidate: 'int stoi(std::string)'
   11 | int stoi(string str){
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
a.cc: In function 'int main()':
a.cc:25:39: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
   25 |                 memset(time, 0,sizeof(time));
      |                                      ~^~~~~
a.cc:25:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
   25 |                 memset(time, 0,sizeof(time));
      |                        ^~~~
      |                        |
      |                        time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from a.cc:4:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:37:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |                                 time[j]++;
      |                                       ^
a.cc:37:39: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   37 |                                 time[j]++;
      |                                 ~~~~~~^
a.cc:37:39: error: lvalue required as increment operand
   37 |                                 time[j]++;
      |                                       ^
a.cc:43:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                         ans = max(ans,time[i]);
      |                                             ^
a.cc:43:34: error: no matching function for call to 'max(int&, time_t (&)(time_t*) noexcept)'
   43 |                         ans = max(ans,time[i]);
      |                               ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:43:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
   43 |                         ans = max(ans,time[i]);
      |                               ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:43:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |                         ans = max(ans,time[i]);
      |                               ~~~^~~~~~~~~~~~~