I was submitting a problem in cookoff but it was showing time limit exceeded even after i used fastread function with getchar_unlocked please tell me how can i optimise it further
here is my code
#include<stdio.h>
inline void fastread(int*);
int main(){
int t,i,n,p1,p2,k;
int *a;
fastread(&n);
a = (int*)malloc(sizeof(int)*n);
fastread(&t);
for(i=0;i<n;i++)
fastread(&a[i]);
while(t--){
int count = 0;
fastread(&p1);
fastread(&p2);
fastread(&k);
for(i=p1;i<=p2;i++){
if(a[i-1]%k==0){
count++;
}
}
printf("%d\n",count);
}
return 0;
}
inline void fastread(int*a)
{
register char c=0;
while (c<33) c=getchar_unlocked();
*a =0;
while(c>33)
{
*a = *a*10+c-'0';
c=getchar_unlocked();
}
}