Help me in solving CHRISDECOR problem

My issue

Throws an error in the 2nd test case

My code

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t, n;
    cin>>t;

    bool ans;
    for(int l,s,i=0; i<t; i++)
    {
        cin>>n>>l>>s;
        if (n<=l && ceil(l/2)<=n)
            ans = 1;
        else
            ans = 0;

        if (s>=3*(2*n-l) && ans == 1)
            cout<<"YES"<<'\n';
        else
            cout<<"NO"<<'\n';
    }

    return 0;
}

Problem Link: Decorating Christmas Tree Practice Coding Problem - CodeChef

@sumant_d
refer the following solution for better understanding of the logic

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

int main() {
	// your code goes here
    int t;
    cin>>t;
    while(t--){
        int n,x,y;
        cin>>n>>x>>y;
        if(n>x){
            cout<<"NO\n";
        }else {
            x+=(y/3);
            if(n*2<=x) cout<<"yes\n";
            else cout<<"no\n";
        }
    }
}