main(void)
{
unsigned long int n,div,out=0;
long long num;
int i;
scanf("%lu%lu",&n,&div);
for(i=0;i<n;i++)
{
scanf("%lld",&num);
if(num<div)
continue;
else
if(num%div == 0)
out++;
}
printf("%d",out);
}
I am not sure as to why this results in a Runtime Error.
your out is declared as an unsigned long, but you print it as an int. moreover, it seems, regarding the problem statement, that storing num in a long long is not really necessary. an unsigned long should be enough. please tell us if it solves your problem
Your code is optimized except for long long for num.
People whose execution is lesser, they optimize the I/O. ie they use block reading and their processing so that less I/O is performed. Generally without I/O optimized code passes in codechef, I/O optimization only reduces the execution time.