Guys why am i getting run time error in this and what to do to fix this

#include<bits/stdc++.h>
using namespace std;
define ll long long
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t–){
ll n,k;
cin>>n>>k;
vectorarr(n);
for(int i=0;i<n;i++){
cin>>arr[i];
}
map<ll,ll>mpp;
for(ll i=k;i<n;i++){
mpp[arr[i]]=i;
}
ll j=k;
ll i=0;
for(auto x: mpp){
ll ind=x.second;
swap(arr[i++],arr[ind]);
mpp.erase(x.first);
if(!mpp.empty()){
if(mpp.find(arr[j])!=mpp.end()){
mpp.erase(arr[j]);
}
}
else
break;
}
for(ll i=0;i<n;i++){
cout<<arr[i]<<" ";
}
cout<<endl;
}

return 0;
}

problem link:- Swap the numbers Practice Coding Problem (codechef.com)