Source Code
#include <bits/stdc++.h>

#define ll long long

#define endl "\n"

using namespace std;
int main() {

int n , d ;
cin >>n>>d ;
int c =0 ;

for(int i =0 ,x ; i<n ;i++){
    cin >>x;
    if(x==d)c++;
}
if(c&&c%2==0)c--;
cout << c<<endl ;
return 0 ; }
Copy
Legendary Alice07
GNU G++17
3 ms
808 KB
Wrong Answer