A question from a newbie who doesnt want to quit? HELP

Been trying the following question and i’ve been getting wrong answers on the codechef compiler, and i have no clue why. Heres my solution and heres the question. CNOTE Problem - CodeChef . I’m new to competitive coding. It’s hard to figure out a solution when you’re not sure what’s wrong with the code. It works for multiple test cases on other compilers

int main()
{ long long int tries,ppages,lpages,money,books,a[100000]={0},i,j,temppages,flag=0;
 int price,npages;

 printf("Insert the trails\n");

    {  scanf("%lld %lld %lld %lld",&ppages,&lpages,&money,&books);

           {  scanf("%d %d",&npages,&price);
              if (ppages<=(npages+lpages)&&money>=price)
          if (a[i]==1)

} }
	/* code */
	return 0;
printf("Insert the trails\n");

Print ONLY whats specified in output section. It is a machine checking if what you print is an exact match of what the answer is. First remove such superfluous statements. Then, please explain your logic if you still get WA :slight_smile:

Also, you are not printing correct words for answer. Its UnluckyChef not Unluckychef. The judge is case-sensitive. Print EXACTLY what is required.

  1. Remove

printf(“Insert the trails\n”);

In competitive coding we print only the output that is required and nothing else. Also as vijju mentioned print the exact output that is given in question as judge is case-sensitive.

  1. You can remove the if(ppages>lpages) condition as the used pages will be always less than total pages.
  2. Your logic if (ppages<=(npages+lpages)&&money>=price) is wrong. Think again what you want and then rewrite your code. When will chef get Lucky? HInt:
Click to view

When your temppages<=npages && price<= money

If you still need help you can refer to this solution: https://www.codechef.com/viewsolution/19316976