Help me in Problem: PIPSQUIK

Here,is the problem link: Full Barrier Alchemist Practice Coding Problem - CodeChef

My code for the problem:

include
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
long long n;
long long h;
long long y1;
long long y2;
long long l;
cin>>n>>h>>y1>>y2>>l;
long long cnt = 0;
while(n–)
{
int type;
int x;
cin>>type;
cin>>x;
if(type==1)
{
if(h-y1<=x)
{
cnt++;
}
else
{
cnt++;
l–;
if(l==0)
{
cnt–;
break;
}
}

        }
        else if(type==2)
        {
            if(y2>=x)
            {
                cnt++;
            }
            else
            {
                cnt++;
                l--;
                if(l==0) 
                {
                    cnt--;
                    break;
                }
            }
        }
    }
    cout<<cnt<<endl;
}
return 0;

}

I am unable to find out failed test cases.Kindly,help me in that.

@aditya8676
plzz refer the following c++ code for debugging

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n,h,y1,y2,l,ans=0,flag=0;
	    cin>>n>>h>>y1>>y2>>l;
	    while(n--){
	        int x,y;
	        cin>>x>>y;
	        
	        if(x==1){
	            if((h-y1)>y){
	                l--;//breaked barrier
	                if(l==0) flag=1;//after breaking if no power left
	            }                   //then can't move
	            if(flag==0) ans++; //if not used all his power
	        }
	        
	        else if(x==2){
	            if(y2<y){
	                l--;
	                if(l==0) flag=1;
	            }
	            if(flag==0) ans++;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}