When submitting to Codeforeces output isn’t the same as in the console

  c++, output

I’m trying to solve this problem: (https://codeforces.com/contest/1363/problem/A), and in my console when I give it the Input of the first example it outputs the right answer. but when submitting the code it says that my output was wrong and I dont know what’s the problem.
this is my code:

#include <iostream>
#include <vector>
#include <math.h>

#define endl 'n'
using namespace std;

bool solve(int sum, int n, int x, int i, vector<int> v)
{
    if(x == 0)
        return sum % 2 != 0;

    bool c1, c2;

    c1 = solve(sum + v[i], n, x - 1, i + 1, v);
    if(i == n - 1 - x)
        c2 = solve(sum, n, x, i + 1, v);

    return c1 || c2;
}

int main()
{
    fast;

    int t;
    cin >> t;
    while(t--)
    {
        int n, x;
        cin >> n >> x;
        vector<int> v(n);

        for(int i = 0; i < n; i++)
            cin >> v[i];

        if(solve(0, n, x, 0, v))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Source: Windows Questions C++

LEAVE A COMMENT