COUPON2 -EDITORIAL help

This is weird that my code executes testcase successfully and still on submission it shows wrong answer. Can anyone tell me what’s wrong with this. Atleast codechef should provide the test case where my code fails.
Here is the problem link

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int day1,day2;
	    int D,C;
	    cin>>D>>C;
	    
	    int A1,A2,A3;
	    cin>>A1>>A2>>A3;
	    
	    int B1,B2,B3;
	    cin>>B1>>B2>>B3;
	    
	    day1=A1+A2+A3;
	    day2=B1+B2+B3;
	    
	    int penalty=0;
	    
	    if(day1<=150)
	    {
	        penalty+=D;
	    }
	    if(day2<=150)
	    {
	        penalty+=D;
	    }
	    
	    int withCoupon=day1+day2+C+penalty;
	    int withoutCoupon=day1+day2+D+D;
	    
	    
	    if(withCoupon<withoutCoupon)
	    {
            cout<<"YES"<<endl;
	    }
	    else
	    {
	         cout<<"NO"<<endl;
             }
	}
}

if(day1<150)
	    {
	        penalty+=D;
	    }
if(day2<150)
	    {
	        penalty+=D;
	    }

The inequality you have used is wrong. Replace it with the ones I have posted here. It works correctly.
Hope it helps :smiley:

Yeah it helped but still i can’t find a testcase where my code stuck.
What’s wrong with this symbol ‘=’?

It is about inequalities. The solution requires you to use strict inequality( i.e., only > or <) whereas you are using slack inequality (i.e., <= or >=).

(Bolded words are the variables from your solution above.)
You should add D to penalty in your solution only if day1 and day2 are strictly less than 150 and not less than or equal to 150.
Try and learn more about inequalities. All the best! :+1: