Help me in solving TWODISH problem

My issue

my logic is fine, but implement in code is wrong, please correct my code

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin >>t;
	while(t--){
	    int n,a,b,c;
	    int e = a+c;
	    int d = min(b,e);
	    if(d >= n){
	        cout << "Yes" << endl;
	    }
	    else{
	        cout << "No" << endl;
	    }
	    
	}
	return 0;
}

Learning course: Level up from 1* to 2*
Problem Link: CodeChef: Practical coding for everyone

@jayambe7
Here u go buddy .
I have done it in much simpler way .
First i have calculated the maximum dishes i can prepare and then stored it in val variable .
Hope u will get the logic.

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n,a,b,c;
	    cin>>n>>a>>b>>c;
	    int val;
	    if(c>=a)
	    {
	        val=min(c,b)+max(0,min(b-c,a));
	    }
	    else
	    {
	        val=min(a,b)+max(0,min(b-a,c));
	    }
	    if(val>=n)
	    cout<<"YES";
	    else
	    cout<<"NO";
	    cout<<endl;
	}
	return 0;
}