https://www.codechef.com/COTH2020/problems/ONEVALUE

https://www.codechef.com/COTH2020/problems/ONEVALUE

Why is it WA?

#pragma GCC optimize(“Ofast”)
#include<bits/stdc++.h>
#define Test int t;cin>>t;for(int j=1;j<=t;j++)
#define f(i,a,n) for(int i=a;i<n;i++)
#define RUCHITA ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lcm(a,b) boost::math::lcm(a,b)
#define pb push_back
#define mod (int)(10e9+7)
#define ll long long int
#define fi first
#define se second
#define ld long double
using namespace std;

// 1. Vectors can have the operator ‘==’ overloaded to check if vector (v1==v2) unlike arrays;
// 2. Lambda Expressions: Syntax:: sort(v1.begin(),v2.end(),[](int a,int b){return a > b;});

ll power(ll base,ll expo)
{
ll res=1;
while(expo>0)
{
if(expo%2)
res=(res * base);
expo= expo >> 1;
base=(base*base);
}
return res;
}

int main()
{
RUCHITA;

``````int n;
cin >> n;

vector<int> s(n+1);
f(i,0,n)
cin >> s[i];
s[n]=-1;

map<int,int> m;
int sum = 0;
f(i,0,n)
{
if(s[i]==s[i+1])
continue;
else
{
m[s[i]]++;
sum++;
}
}
int maxi=INT_MIN;
for(auto x:m)
maxi = max(maxi,x.se);

cout << sum - maxi <<endl;

return 0;
``````

}