INTEST - Enormous Input Test

no tags 

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

hide comments
dunjen_master: 2017-07-24 23:21:53

getting TLE with getchar_unlocked can anyone tell why?...tried with cin along with ios_base::sync_with_stdio(false) ...done in 0.28 seconds

akshay_12001: 2017-06-20 00:56:36

0.07 seconds, I am using both getchar_unlocked along with
ios_base::sync_with_stdio(false);
cin.tie(NULL);

hkuadithya: 2017-05-07 20:36:32

0.28 secs in Java using fastest I/O method in Java.
I have a custom wrapper class which uses BufferedInputStream for input and PrintWriter for output.
This beats BufferedReader and Scanner APIs by a long shot.

Last edit: 2017-05-07 20:37:22
bnzhaxx: 2017-04-28 03:33:35

0.52 seconds in java with BufferedReader!

Last edit: 2017-04-28 03:34:00
spartax: 2017-04-24 05:00:54

0.12 sec in C

spartax: 2017-04-24 04:53:40

java 0.68 sec

lrx_22: 2016-12-10 17:49:40

0.40 with PAS, I don't see any tricks here

shreyansh26: 2016-09-28 23:00:53

easy....0.44 seconds

pt97: 2016-07-24 08:56:32

easy with c

square1001: 2016-07-23 16:05:21

0.09 seconds with getchar_unlocked.
Do you have any "more efficient algorithm" ?


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