Biased Standings SPOJ

The test case is giving correct output, but the code is not getting submitted on SPOJ. It says wrong answer.
Please help me identify what is wrong in my code.

#include<iostream>
#include<cstring>
using namespace std;

int biased_standings(int N, int h[]){
    int avail_rank = 1;
    int sum = 0;
    for(int i=1; i<=N; i++){
        while(h[i]){
            h[i]--;
            sum += abs(avail_rank - i);
            avail_rank++;
        }
    }
    return sum;
}



int main(){
    int h[100000] = {0};
    int t;
    cin>>t;
    while(t--){
        memset(h,0,sizeof(h));
        int N;
        cin>>N;     // N teams
        for(int i=0; i<N; i++){
            string team_name;
            int rank;
            cin>>team_name>>rank;
            h[rank]++;
        }
        
        cout<<biased_standings(N,h)<<endl;
    }
    
    return 0;
}

use long long int
because ranks are large
after that you will get AC

after doing as you said, now it says TLE

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.