Biased standing question

#include
#include
using namespace std;

int main(){
int t;
cin>>t;

while(t--){
    int n;
    cin>>n;
    vector<pair<char*,int>> v;
    char s[10000];
    int x;
    int freq[n]={0};
    for(int i=1;i<=n;i++){
        cin>>s;
        cin>>x;
        v.push_back(make_pair(s,x));
        freq[x]++;
    }
    int count=0;
    int p=1;
    int q=1;
    while(q!=(n+1)){
        if(freq[q]!=0){
            count+=abs(p-q);
            freq[q]--;
            p++;
        }
        else
            q++;
    } 
    cout<<count<<endl;
}

}

what is wrong in this code? waiting for a prompt reply

Hey @SHRADDHA666
Please send your code on the CB IDE. Some code is lost by direct copy paste. Also please mention the point in the video where the said question was mentioned.

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.