Solution getting wrong answer

I have been trying to solve this question Movie Weekend Problem Code: MOVIEWKN
But my code giving me wrong answer on submission but right on my ide
Kindly help me to find where i am missing in my code

#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
 int t;
 scanf("%d",&t);
 while(t--)
 {
  long long int n,i,best=100000,s=0;
  scanf("%lld",&n);
  long long int l[n],r[n],tot[n];
  for(i=0;i<n;i++)
  {
   scanf("%lld",&l[i]);
  }
  for(i=0;i<n;i++)
  {
   scanf("%lld",&r[i]);
  }
  for(i=0;i<n;i++)
  {
   tot[i]=l[i]*r[i];
  }
  for(i=0;i<n-1;i++)
  {
   if(tot[i]<tot[i+1])
   {
    s=i+1;
    ++s;
    best=min(best,s);
   }
   else if(tot[i]>tot[i+1])
   {
    s=s+1;
    best=min(best,s);
   }
   else if(tot[i]==tot[i+1])
   {
    if(r[i]>r[i+1])
    {
     s=s+1;
    best=min(best,s);
    }
    else
    {
     s=i+1;
    ++s;
    best=min(best,s);
    }
   }
  }
 printf("%lld\n",best);
 }
}

Try this case …

5

10 10 9 8 7

10 10 1 2 3

Output should be 1 your code produces 2 (:…