input output in python

I am having issues with time limits and large inputs using python. I have tried both input() and sys.stdin.readline(). Fail ‘enormous input test’ in practice and also believe this issue is keeping me from earning full points on several problems in competitions. This is frustrating as it seems as if Python submissions are being accepted they should be accommodated… otherwise wby accept them…

Here is my code for enormous input test:

import sys
n, k = [int(i) for i in sys.stdin.readline().strip().split()]
c = 0
for i in range(n):
     if int(sys.stdin.readline().strip()) % k == 0:
        c += 1 
print(c)

Do not use strip and also use Python 2.7.

Here is your accepted solution.

import sys 
n, k = [int(i) for i in sys.stdin.readline().strip().split()]
c = 0 
for i in range(n): 
    if int(sys.stdin.readline()) % k == 0:
        c += 1 
print(c)

Thank you!

Welcome!!! If it helped, Please upvote and accept it as correct answer :wink: