Full Barrier Alchemist Practice Problem in 1400 to 1600 difficulty problems -

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

signed main() {
	// your code goes here
    int t;  cin >> t;
    while (t--){
        int n,h,y1,y2,l;
        cin >> n >> h >> y1 >> y2 >> l;
        int ct = 0;
        for (int i=0;i<n && l>0;i++) {
            int t,x;
            cin >> t >> x;
            if (t==2) {
                if (x<=y2) ct++;
                else { l--; ct++; }
            }
            if (t==1) {
                if (x >= h-y1) ct++;
                else { l--; ct++; }
            }
            
        }
        if (l==0)   ct--;
        cout << ct << endl;
    }
}

For given test case , it’s showing Wrong Answer,
2
73 678 236 205 13
1 912
1 397
2 983
2 487
2 870
2 739
1 499
2 961
1 857
1 226
1 913
1 464
1 742
1 304
1 443
2 681
2 648
1 190
1 635
1 341
2 341
1 408
1 143
2 22
2 615
2 939
2 597
2 549
1 854
2 460
1 576
1 900
2 595
2 879
2 510
2 396
1 762
2 614
2 839
1 683
2 605
2 771
1 687
1 910
2 293
1 773
1 97
1 767
2 890
2 711
2 60
2 911
1 322
2 741
1 193
2 91
2 941
2 275
1 657
1 626
2 646
2 481
2 611
1 184
2 970
1 217
1 760
1 295
2 826
2 681
1 710
2 790
2 530
104 892 749 798 68
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143

But Correct Answer for ,

1
104 892 749 798 68
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143
1 143

@abhinav_singh1
plzz refer the following code for better understanding
u can’t take false inputs which is caused by the condition l>0 etc;

#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;
}

example of false input please give me any