Need help Getting wrong answer

I solved the question
Link : Contest Page | CodeChef
It’s Passing the testcase but giving me wrong ans plz help
What correction should i make in my code

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define FastIO ios_base :: sync_with_stdio (0) ; cin.tie(NULL) ;

using namespace std;

void solve ()
{
ll n = 0 ; cin>>n ;
ll a[n] ;
for ( int i = 0 ; i < n ; i++ )
{
cin>>a[i] ;
}

ll k = 0 ; cin>>k ;
vector <ld> v ;
for ( int i = 0 ; i < n-k+1 ; i++ )
{
    int g = i ;

    int j = i+k ;

    ll b[k] = {0} ;

    ll q = 0 ;

    while ( g < j )

    {

        b[q++] = a[g++] ;

    }

    sort ( b ,  b+k ) ;

    if ( k % 2 )

    {

        v.push_back(b[(k/2)]) ;

    }

    else

    {

        double val = (double)(b[(k/2)-1]+b[(k/2)]) / 2*1.0 ;

        v.push_back(val) ;

    }

}   

for ( int i = 0 ; i < v.size() ; i++ )

{

    cout<<v[i]<<" " ;

}

}

int main()

{

FastIO

solve() ;

return 0 ;

}