Help me in solving PUSH7PA problem ...what is wrong in this code

My issue

what is wrong in this code?

My code

#include <iostream>
#include<algorithm>
#define ll long long int

using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    ll n;
	    cin>>n;
	   ll h[n];
	    ll fre[d]={0};
	    for( ll i=0;i<n;i++){
	        cin>>h[i];
	        fre[h[i]]++;
	    }
	  sort(h,h+n);
	 ll ans=0;
	 for(ll i=0;i<n;i++){
	     ans=max(ans,(h[i]+fre[h[i]]-1));
	 }
	  
	    cout<<ans<<endl;
	}
	    
	return 0;
}

Problem Link: PUSH7PA Problem - CodeChef

u can’t create frequency array because the value of the elements of hi is upto 10^9 so u need to create 10^9 size array which is not possible .
so to tackle this use datastructure named map;

without map we also can do

yes we can but using map will be much easier.