Streak Star Solution error

OK I don’t know what’ wrong with my code I’ve tried everything like literally everything I know I’ve over complicated my code but that’s just done by trying to get the solution correct I can’t find any test case my code will go wrong for but it’s still not able to pass hidden test cases help!!!

Problem Name: STKSTR
Starters 172

#include <bits/stdc++.h>
using namespace std;
void maxLsub(vector<int> &vec, int k) {
    if(vec.size()<1){
    std::cout << "0" << std::endl;
    return;
    }int res = 1;
    int count = 1;
    int curr = vec[0];
    bool use = false;
    int use_for = 0;
    for (int i = 1; i < vec.size(); i++) {
        if(vec[i]>=curr)
        count+=1;
        else
        {
            if(k*vec[i]>=curr && use == false)
            {
                vec[i]*=k;
                count+=1;
                use = true;
                use_for = i;
            }
            else
            {
                if(use_for!=0 && use_for == i-1)
                {if(vec[i-1]/k<=vec[i])
                count = 2;
                else
                count  = 1;}
                else count =1;
                use = false;
            }
            
        }

        res = max(res, count);
        curr = vec[i];
    }
    std::cout << res << std::endl;
}

int main() {
	// your code goes here
	int t;
	std::cin >> t;
	while(t--){
	    int a,b;
	    std::cin >> a >> b;
	    std::vector<int> vec(a);
	    for(int i = 0;i<a;i++)
	    std::cin >> vec[i];
	    maxLsub(vec,b);
	    
	}

}