why gives me wrong???Spam Classification Using Neural Net(https://www.codechef.com/problems/SPAMCLAS)

#include
using namespace std;
int w[100000],b[100000];
int main(){

int t;
cin>>t;
int nspam=0,spam=0;
while(t--){
    int n,minx,maxx;
    cin>>n>>minx>>maxx;
    
    int total=maxx-minx+1;
    int out=minx,out1=minx+1;
    for(int i=0;i<n;i++){
        cin>>w[i]>>b[i];
        out=w[i]*out+b[i];
        out1=w[i]*out1+b[i];
        
    }
    cout<<out<<" "<<out1<<endl;
    if((out%2)==0&&out1%2==0)
    nspam=total;
    else if(out%2==0){
    nspam=(total-1)/2+1;
    spam=total-nspam;
    }
    else if(out1%2==1&&out%2==1)
    spam=total;
    else{
    spam=(total-1)/2+1;
    nspam=total-spam;
    }
    
    cout<<nspam<<" "<<spam;
}
return 0;

}

//