Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
int stoi(string a){
	return (a[0]-'0')*10+a[1]-'0';
}
typedef pair<int,int> P;
priority_queue<P,vector<P>,greater<P> > que;
int main(){
	while(true){
		int n;
		cin >> n;
		if(n==0) break;
		rep(i,n){
			string x,y;
			cin >> x >> y;
			int a=stoi(x.substr(0,2))*3600+stoi(x.substr(3,2))*60+stoi(x.substr(6,2));
			int b=stoi(y.substr(0,2))*3600+stoi(y.substr(3,2))*60+stoi(y.substr(6,2));
			que.push(P(b,0));
			que.push(P(a,1));
		}
		int now=0,ans=0;
		while(!que.empty()){
			P q=que.top();
			que.pop();
			if(q.second==0) now++;
			else{
				if(now>0) now--;
				else ans++;
			}
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:35: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   23 |                         int a=stoi(x.substr(0,2))*3600+stoi(x.substr(3,2))*60+stoi(x.substr(6,2));
      |                               ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
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,
                 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/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:23:60: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   23 |                         int a=stoi(x.substr(0,2))*3600+stoi(x.substr(3,2))*60+stoi(x.substr(6,2));
      |                                                        ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
/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:23:83: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   23 |                         int a=stoi(x.substr(0,2))*3600+stoi(x.substr(3,2))*60+stoi(x.substr(6,2));
      |                                                                               ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
/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:24:35: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   24 |                         int b=stoi(y.substr(0,2))*3600+stoi(y.substr(3,2))*60+stoi(y.substr(6,2));
      |                               ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
/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:24:60: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   24 |                         int b=stoi(y.substr(0,2))*3600+stoi(y.substr(3,2))*60+stoi(y.substr(6,2));
      |                                                        ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
/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:24:83: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
   24 |                         int b=stoi(y.substr(0,2))*3600+stoi(y.substr(3,2))*60+stoi(y.substr(6,2));
      |                                                                               ~~~~^~~~~~~~~~~~~~~
a.cc:10:5: note: candidate: 'int stoi(std::string)'
   10 | int stoi(string a){
      |     ^~~~
/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)
      |   ^~~~