Source Code
#include<iostream>
#include<fstream>
#include<cmath>
#include<algorithm>
#include<list>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<stack>
#include<queue>
#include<iterator>
#include<time.h>
#include<sstream>
#include<iomanip>
using namespace std;


int main()
{
    int n,d;
    cin>>n>>d;
    long long x[n];
    map<long long, long long> mp;
    bool ans=false;
    for(int i=0; i<n; i++)
    {
        cin>>x[i];
        if(x[i]==d)
        {
            mp[x[i]]++;
        }
    }

    if(mp[d]>=1 && mp[d]%2==1)
        cout<<mp[d]<<endl;
    else
        cout<<0<<endl;

}
Copy
Legendary Abbro
GNU G++17
3 ms
892 KB
Wrong Answer