Source Code
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, d;
    cin >> n >> d;

    int cnt = 0;
    for(int i = 0; i < n; ++i){
        int t; cin >> t;
        if( t == d ) cnt += 1;
    }
    if((cnt&1) == 0 && cnt)
        cnt -= 1;
    cout << cnt << endl;

	return 0;
}
Copy
Legendary Trainee
GNU G++17
4 ms
924 KB
Wrong Answer