Code Problem

Here is my second code for [Contest Page | CodeChef](https://This PRoblem)
its working on the test case but i guess it has some problem can someone help?

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

/*
X page long poetry
Y pages in nb left
Shopkeeper shows N notebooks--> 'i' th is P pages and C rubles
But poeter has K rubles left

T cases
in each:
X Y K N
pages needed, Pages present, Money left, Notebooks seen
NEXT n lines--> P and C ie pages and rubles
LuckyChef,UnluckyChef

*/
int main(){
	cin.tie(0);
	cout.sync_with_stdio(false);
	int t,x,y,k,n,p,c;
	cin>>t;

	for (int i = 0; i < t; ++i) // for cases
	{	set<int> choice;
		int frag = 0;
		cin>>x>>y>>k>>n;
		int page_in_need = x - y;
		for (int j = 0; j < n ; ++j) // for notebooks seen
		{
			cin>>p>>c;
			if (p>=page_in_need && c<=k){
			 // if price is less or eq to money
			 // if pages are satisf
				frag=1;
				break;}



			// {
			// 	choice.insert(1);
			// }else
			// {
			// 	choice.insert(0);
			// 					} }
		// if (choice.count(1)){
		// 	cout<<"LuckyChef"<<endl;
		// }else{
		// 	cout<<"UnluckyChef"<<endl;
		// }
			}
		if (frag==1)
		{
			cout<<"LuckyChef"<<endl;

		}else{
			cout<<"UnluckyChef"<<endl;
		}
		



		}
	

	}









3 Likes

can you please intend it. i am having some confusions what you mean by this

Try running your code against the input provided by @ssjgz

Here’s the input.

2
2 1 5 2
1 1
100 5
2 1 1 1
1 1

And compare the expected output with your program’s output, this will help you trace where your program fails.

1 Like

Thankyou
Both of YOU!

can you please tell me about this as well?

1 Like