INTEST - Enormous Input Test

The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime.

Input

The input begins with two positive integers n k (n, k<=107). The next n lines of input contain one positive integer ti, not greater than 109, each.

Output

Write a single integer to output, denoting how many integers ti are divisible by k.

Example

Input:
7 3
1
51
966369
7
9
999996
11

Output:
4

Added by:adrian
Date:2004-11-09
Time limit:2.112s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:Idea put forward by Michael Mendelsohn

hide comments
2016-07-24 08:56:32
easy with c
2016-07-23 16:05:21
0.09 seconds with getchar_unlocked.
Do you have any "more efficient algorithm" ?
2016-06-05 21:03:45 ayush
Use ios_base::sync_with_stdio(false), solved in 0.5
2016-02-26 22:56:10 Bryan Poulsen
Fastest I could get with PyPy was 0.93 seconds - tried every variation of standard in that I could think of.
2016-02-26 22:24:07 Bryan Poulsen
Submitted in python 2.7.10 got TLE, resubmitted same solution in Pypy got AC in 1.02 seconds.
2016-02-22 19:19:53
used simple brute force logic in python , submitted in python 2.7.10 got TLE, resubmitted in pypy got accepted . could anyone provide me a reason why that occured
2015-11-06 14:22:58 狂徒归来
2.9s in RUST
2015-10-11 20:52:58 Andres Mauricio Rondon Patiño
Scanf/Printf AC in 0.5s
2015-08-18 19:06:32
Is there any other tricks other than getchar_unlocked in c??
2015-07-27 08:22:35 Abhinandan Agarwal
0.11s with getchar_unlocked and .56 with scanf . stream input output functions take time around 5s here.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.