var arr = '';
process.stdin.on('data',function(chunk){
arr += chunk;
});
process.stdin.on('end',function(){
arr = arr.split('\n');
let t = parseInt(arr.shift()),i=0,x,y,k,n,j,pages,rubbles,ctr;
while(i<t){
x = parseInt(arr[0].split(' ')[0]);
y = parseInt(arr[0].split(' ')[1]);
k = parseInt(arr[0].split(' ')[2]);
n = parseInt(arr[0].split(' ')[3]);
j=1;ctr=0;
while(j<=n){
pages = parseInt(arr[j].split(' ')[0]);
rubbles = parseInt(arr[j].split(' ')[1]);
if((pages >=(x-y)) && (k>=rubbles)){
ctr++;
break;
}
j++;
}
if(ctr === 0) console.log("UnluckyChef");
else console.log("LuckyChef");
if(i != (t-1)){
arr = arr.slice(j,arr.length);
}
i++;
}
});
What is wrong with my solution? when running with the sample input test cases then I am getting the correct answer but on submission, I am getting the wrong answer.
Can anyone help me out to know what is wrong?
This program is in node.js.