Help regarding INTEST

I am getting a TLE error while I am submitting the following solution to codechef, can somebody explain why I am getting this error and also the reason behind me getting this error.

#include<iostream>
#include<cstdio>
 
using namespace std;
 
int main()
{
long long int n,k,count=0;
cin>>n;
cin>>k;
while(n--){
long long int num;
cin>>num;
if(num%k==0)
count++;
}
cout<<count<<endl;
return 0;
}

As the problem name suggests, this ques tests the efficiency/speed of your I/O techniques. Try using faster methods like scanf/printf for I/O.

And if you want to use cin/cout add this line in the beginning of your code(in main):

ios_base::sync_with_stdio(0);

This is what it does!!!

Hope this helps…:slight_smile: