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

i have tried two pointer technique to solve this question. I checked for a valid sub-array where LCM(sub-array) == product(sub-array ) but i am getting WA . any help would be appreciated .

```
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (a*b)/(gcd(a,b));}
void solve(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vl arr(n);
frep(i,0,n,1){cin>>arr[i];}
int ans=-1,l=0,r=0;
ll cpro=1,clcm=1;
frep(i,0,n,1){
cpro*=arr[i];
clcm=lcm(clcm,arr[i]);
if(cpro==clcm){
ans=max(ans,i-l+1);
}
else{
cpro=arr[i];
clcm=arr[i];
l=i;
}
}
if(ans==1){ans=-1;}
cout<<ans<<endl;
}
}
```