The problem code is “HEIGHTS” , its rating is 1390 and my code is:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff(i, strt, end) for(int i = strt; i < end; i++)
#define fb(i, strt, end) for(int i = strt; i >= end; i–)
#define CY cout<<“YES”<<endl;
#define CN cout<<“NO”<<endl;
void solution(){
ll n; cin>>n;
int cnt=0;
ll arr[n];
map<ll, int> mp;
ff(i,0,n){
cin>>arr[i];
mp[arr[i]]++;
}
for(auto &iter : mp){
if((iter.second)==1) cnt++;
}
if(cnt%2==0) cout<<(cnt/2)<<endl;
else if(cnt==1) cout<<cnt<<endl;
else cout<<((cnt-1)/2)<<endl;
}
int main()
{
int t;
cin>>t;
while(t--){
solution();
}
return 0;
}