Help needed in Feb 21 Long Challenge (Chef and Meetings)

can someone help me find out why my code is not producing any output?

Here’s the code;

#include<bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define ll long long int

int main() {

fastio;

int t;
cin>>t;

while(t--) {
	string p;
	getline(cin, p);
	
	int n;
	cin>>n;
	
	int H1 = p[0] - '0', H2 = p[1] - '0', M1 = p[3] - '0', M2 = p[4] - '0';
	char Merid = p[6];
	
	if(Merid == 'A' and H1 == 1 and H2 == 2) {
		H1 = 0;
		H2 = 0;
	}
	
	if(Merid == 'P' and H1 != 1 and H2 != 2) {
		H1 += 1;
		H2 += 2;
	}
	
	string ans = "";
	
	for(int i = 0; i < n; i++) {
		string a, b;
		getline(cin, a);
		getline(cin, b);
		
		int ah1 = a[0] - '0', ah2 = a[1] - '0', am1 = a[3] - '0', am2 = a[4] - '0';
		char aMerid = a[6];
		
		int bh1 = b[0] - '0', bh2 = b[1] - '0', bm1 = b[3] - '0', bm2 = b[4] - '0';
		char bMerid = b[6];
		
		if(aMerid == 'A' and ah1 == 1 and ah2 == 2) {
			ah1 = 0;
			ah2 = 0;
		}
		
		if(aMerid == 'P' and ah1 != 1 and ah2 != 2) {
			ah1 += 1;
			ah2 += 2;
		}
		
		if(bMerid == 'A' and bh1 == 1 and bh2 == 2) {
			bh1 = 0;
			bh2 = 0;
		}
		
		if(bMerid == 'P' and bh1 != 1 and bh2 != 2) {
			bh1 += 1;
			bh2 += 2;
		}
		
		int t = H1 + H2 + M1 + M2;
		int t1 = ah1 + ah2 + am1 + am2;
		int t2 = bh1 + bh2 + bm1 + bm2;
		
		if(t >= t1 and t <= t2) ans += "1";
		else ans += "0";
		
		
	}
	
	
	cout<<ans<<endl;
}

return 0;

}

Instead of using getline for repeated time , you can take string as input for two time one denotes the time and other denotes the format(AM or PM) .As you need cin.ignore also for multiple times.
You can check my code for reference: CodeChef: Practical coding for everyone

did it with extras space , but with fastes time complexity –
here’ the solution