Can't figure the bug in my simple program (CNOTE)

Hey guys!,
I am new to programming and codechef. I am trying this beginner question : CNOTE

Link: CNOTE Problem - CodeChef

The program runs successfuly for the sample input, but i get WA when i submit it.
I am not able to find the bug that is causing this.

My C++ code:

#include<iostream>
using namespace std;
int main()
{
    int x,y,n,p,c,t,k;
    cin>>t;
    while(t>0)
    {
        cin>>x>>y>>k>>n;
        int i =0;
        for( ; i<n ; i++)
        {
            cin>>p>>c;

            if((x-y)<=p && c<=k)
               {
                cout<<"LuckyChef";
                goto en;
               }
        }
        if(i == n)
            cout<<"UnluckyChef";
        en:
        cout<<"\n";
        t--;
    }
    return 0 ;
}

Any help would be much appreciated!!
Thanks :slight_smile:

See CNOTE - Editorial - #33 by ssjgz :slight_smile:

1 Like