Why is my code showing wrong answer while submiting it on codechef? When I solved it just as bhaiya told

I solved PAYING UP problem on codechef. Here is the entire code. But, its showing wrong answer. Kindly help me to resolve what error m I making

#include<bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin>>tc;
while(tc–)
{
int n,m;
cin>>n>>m;
vectorv;
bool check=false;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
if(x>1000)
check=true;
v.push_back(x);
}

    if(n>20 || check==true)
    {
        cout<<"NO"<<endl;
        continue;
    }
    
    long long int range=(1<<n)-1;
    bool flag=false;
    for(long long int i=range;i>=0;i--)
    {
        long long int no=i;
        int j=n-1;
        int sum=0;
        while(no>0)
        {
            if(no&1)
                sum+=v[j];
            j--;
            no=no>>1;
        }
        if(sum==m)
        {
            flag=true;
            //break;
        }
    }
    if(flag)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    
}

}

Hi @ashu.heretocode your solution to the problem is absolutely correct. The only reason you are getting the wrong answer verdict is because your are printing YES instead of yes and NO instead of No.
https://www.codechef.com/viewsolution/27540017
I would suggest you to always read the problem statement and the input/output formats very carefully.
Hope this helps :slight_smile:

Please mark the doubt resolved if the response has cleared your doubt :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.