time limit exceeded

i am actually trying to write the code for this problem.
however it says time limit exceeded. how can i optimise my code.

#include <iostream>

using namespace std;

int main()
{
    long int cases,neuron_num,minx,maxx,*w,*b,c_even=0,c_odd=0,*prod;
    cin>>cases;
    for(int i=0;i<cases;i++)
    {
        c_even=c_odd=0;
        cin>>neuron_num>>minx>>maxx;
        int x=minx-1;
        w=new long int[neuron_num];
        b=new long int[neuron_num];
        prod=new long int[neuron_num];
        for(int j=0;j<neuron_num;j++)
        {
            cin>>w[j]>>b[j];
        }

        for(int k=minx;k<=maxx;k++)
        {
            x++;
            for(int j=0;j<neuron_num;j++)
            {
                if(j==0)
                {
                    prod[k]=w[j]*x+b[j];
                }
                else
                {
                    prod[k]=w[j]*prod[k]+b[j];
                }
            }
            if(prod[k]%2==0)
            {
                c_even++;
            }
            else
            {
                c_odd++;
            }
        }
        cout<<c_even<<" "<<c_odd;
        delete []prod;
        delete []b;
        delete []w;
    }
}

your help would be greatly appreciated.

Here is ur AC code : qYLhfh - Online C++0x Compiler & Debugging Tool - Ideone.com

ok thanks .