Source Code
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define p1 2*p
#define p2 p1+1
#define ll long long
#define pb push_back
#define LFT p1,L,Mid
#define pf push_front
#define Mid ((L+R)/2)
#define RGT p2,Mid+1,R
#define pi pair<int,int>
#define pii pair<pi,pi>
#define deb(x) cout<<#x<<"="<<x<<endl
#define go ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
int n,d,ans;
int main()
{
    go;
    cin>>n>>d;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==d)
            ans++;
    }
    if(ans%2==0 && d!=0)
        ans--;
    cout<<max(0,ans);
    return 0;
}
Copy
Legendary Grapeee
GNU G++17
18 ms
1.1 MB
Accepted