#include <iostream>
using namespace std;
int main() {
int t,s,ep;
cin>>t;
while(t--){
cin>>s;
int du=0;
int q[s];
for(int i=0;i<s;i++)
cin>>q[i];
for(int i=0;i<s;i++){
cin>>e;
int l,a=0;
for(int j=0;j<e;j++){
cin>>l;
a=a+l;
}
du=du+(a-((e-1)*q[i]));
}
cout<<du<<endl;
}
return 0;
}
Here I am adding the total duration of all episodes per season and subtracting (e-1)*q[i], where e is the number of episodes and q[i] is the intro time per season .
I don’t know why I am getting a wrong answer.