I coded this problem at CodeChef and submitted it as Python3 solution:
import sys
n,k = map(int,sys.stdin.readline().split(" "))
nos = map(int,sys.stdin.readlines())
ans = 0
for i in nos:
if i>0 and i%k == 0:
ans += 1
print(ans)
But it gives you a Time Limit Exceeded, to my horror, if I write the code as:
import sys
n,k = map(int,sys.stdin.readline().split(" "))
nos = map(int,sys.stdin.readlines())
ans = 0
for i in nos:
if i>0 and i%k == 0:
ans += 1
print ans
and submit it as a Python2 solution, then the solution gets accepted.
I simply fail to understand where is this going?...
====### UPDATE ###====
solution by Sebastian works for Python3 but is a considerable 10secs slower than my python2.7 solution. I still did not get the answer that why is there a degradation of performance with latest version of the language compared to previous?...