Help me find my mistake

#include
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
int s; int ne; long int sum=0; long int tsum=0; int le;
cin>>s;

    int q[s];
    for(int i=0; i<s; i++)
    {
        cin>>q[i];
    }
    for(int i=0; i<s; i++)
    {
        cin>>ne;
        
        for(int i=0; i<ne; i++)
        {
            cin>>le;
            sum+=le;
        }
        
        tsum=sum-(ne-1)*q[i];
   }
   cout<<tsum<<endl;
}
return 0;

}

Above is my code. I’m getting correct output for all given 3 test cases but on submission, I’m getting Wrong Answer!
Please help me to find my mistake in the code.

(s= total number of episodes, ne= no. of episodes in each season, q= intro song length)

Please perform constraint checking as instructed in the contest problem.

#include
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
int s; int ne; long long int tsum=0; int le;
cin>>s;

int q[s];
for(int i=0; i<s; i++)
{
    cin>>q[i];
}
for(int i=0; i<s; i++)
{
    cin>>ne;
   
    for(int j=0; j<ne; j++)
    {
        cin>>le;
        
        if(j==0)
        tsum+=le;
        else
        tsum+=le-q[i];
    }
}
cout<<tsum<<endl;

}
return 0;
}

This code is getting accepted… I can’t figure out the difference. I think its same as the first one. Could you please help.

@abhi0310 In the first code u have used the same variable i in nested for loop. So you can change the second variable to some j or k.

I changed the loop variable to j… but still I’m getting the wrong answer!