https://www.codechef.com/problems/BUYCD

Why This problem is giving wrong ans on submission if I’m doing it with help of Priority_queue.
My Code IS Here:

/************************/
void solve()
{
priority_queue maxPriceCandy;
int n,k,m;
cin>>n>>k>>m;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
maxPriceCandy.push(x);
}
int ans;
while(!maxPriceCandy.empty())
{
if(maxPriceCandy.top()*k <= m)
{
ans=maxPriceCandy.top();
break;
}else
{
maxPriceCandy.pop();
}
}
cout<<ans<<endl;
}

I did this:

        cin >> n >> k >> m;
        vec.clear();
        for (int i = 0; i < n; i++){
            cin >> a;
            vec.push_back(a);
        }
        sort(vec.begin(),vec.end(), greater<int>());
        for (int i = 0; i < n; i++){
            if (floor(m/vec[i]) >= k){
                cout << vec[i] << "\n";
                break;
            }
        }
    }```
still did not work