KIIT Coding Weekends problem in submission

in the KIIT Coding Weekends competition I tried the Large Products problem. My code works successfully on CodeBlocks and it results in a ‘Wrong Answer’ in the codeChef IDE.
Can anyone try to help me…
here is my code…

#include <iostream>

using namespace std;

int main()

long long n;
long long a[n];
for(long long i=0;i<n;i++)
long long p=1;
for(long long  i=0;i<n;i++)
cout<<p+(1000000007)%(1000000007)<<" "<<endl;


Don’t post questions related to ongoing contest…

You should do the modulus at each step of multiplication so that the answer doesn’t become out of bound before we reach the last element . And use unsigned long long int for maximum number that can be stored .