COULD ANYONE POINT OUT THE ERROR IN MY CODE?

My issue

My code

#include<bits/stdc++.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        // cout<<n<<" "<<k;
        vector<int>arr(n);
        for(int i=0;i<n;i++){
            cin>>arr[i];
        }
        vector<int> v;
        vector<int> ind;
        int temp=k;
        
        for(int i=0;i<n;i++){
            if(temp<n){
                v.push_back(arr[i]);
                arr[i]=0
                v.push_back(arr[i+k]);
                arr[i+k]=0;
                ind.push_back(i);
                ind.push_back(i+k);
                temp++;
            }
        }
        sort(v.begin(),v.end());
        sort(ind.begin(),ind.end());
        for(int i=0;i<v.size();i++){
            arr[ind[i]]=v[i];
        }
      
        for(int i=0;i<n;i++){
         //  cout<<i<<" ";
           cout<<arr[i]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

Problem Link: SWAPNUM31 Problem - CodeChef

semi colon !!

i was asking an error in my logic because its giving wrong answers for all test cases

include <bits/stdc++.h>
using namespace std;
define pb push_back
define all(x) (x).begin(), (x).end()
define ll long long
define rep(i,a,b) for(ll i=a;i<b;++i)
int main() {
int t;
cin>>t;
while(t–)
{
// by observation take example if n>=2k we can get any combo
ll n,k;
cin>>n>>k;
vectora(n);
for(ll i=0;i<n;++i)
cin>>a[i];
if(n>=2*k)
{
sort(all(a));
rep(i,0,n)
cout<<a[i]<<" “;
cout<<endl;
}
else
{
//take first k elements and another n-k elements as because only these elements can be swapped
vectorv(n,0),v1;
rep(i,0,n)
{
if(i=n-k)
{
v[i]=a[i]; // storing unswappable elements in vector v
}
else
v1.pb(a[i]); // storing swappable elements in another vector
}
sort(all(v1));
ll j=0;
rep(i,0,n)
{
if(v[i]==0) // when v[i] is not marked by a[i]
{
v[i]=v1[j];
j++;
}
}
rep(i,0,n)
cout<<v[i]<<” ";
cout<<endl;
}
}
}