Hoghest frequency: my whole program is correct still test casses are not passing

// CPP program to find the most frequent element
// in an array.
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mostFrequent(ll arr[], ll n)
{
// Insert all elements in hash.
unordered_map<ll, ll> hash;
for (ll i = 0; i < n; i++)
hash[arr[i]]++;

// find the max frequency 
ll max_count = 0, res = -1; 
for (auto i : hash) { 
	if (max_count < i.second) { 
		res = i.first; 
		max_count = i.second; 
	} 
} 

return res; 

}

// driver program
int main()
{
ll n;
cin>>n;
ll arr[n];
for(ll i=0;i<n;i++)
cin>>arr[i];
n = sizeof(arr) / sizeof(arr[0]);
cout << mostFrequent(arr, n);
return 0;
}

Use
if (max_count <= i.second)
in your code and then try to submit it.