Ok, after I spent some (heh) time torturing both myself and SPOJ system, I got INTEST down to 2.22s.
Now, I beat Kawigi, which is alway a good thing, but - how did those guys get down around 1.6 s?
And, most importantly - what's the point? Put those types of problems (Warning! Enormous I/O!) in challenge section or something, I mean, look at my "slow" (~10 sec) solution, then "medium" (~7 sec) and then compare it with 2.22 sec solution (it is a training problem, but if people don't like if code is posted anyway, I'll remove it):
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(
System.out));
StringTokenizer st = new StringTokenizer(in.readLine());
int n = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
int count = 0;
while(n-- > 0){
int t = Integer.parseInt(in.readLine());
if(t % k == 0 ) count++;
}
out.println(count);
out.flush();
}
}
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in), 65536);
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
StringTokenizer st = new StringTokenizer(in.readLine());
int n = parseInt(st.nextToken());
int k = parseInt(st.nextToken());
int count = 0;
while (n-- > 0) {
int t = parseInt(in.readLine());
if (t % k == 0)
count++;
}
out.println(count);
out.flush();
}
// positive ints only
private static int parseInt(String s) {
// what if s.length() == 0 ?
int result = 0;
int i = 0, max = s.length();
if (max > 0) {
while (i < max) {
result *= 10;
result += s.charAt(i++) - 48;
}
}
return result; // could be 0 if not an integer
}
}
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
public class Main {
private static final int BUF_SIZE = 65536;
private static DataInputStream in;
private static byte[] buffer;
private static int t;
private static byte b;
private static int bytesRead;
private static int index, count;
private static boolean isEOF;
public static void main(String[] args) throws IOException {
in = new DataInputStream(new BufferedInputStream(System.in, BUF_SIZE));
buffer = new byte[BUF_SIZE];
boolean first = true;
int n = 0, k = 0;
count = 0;
t = 0;
isEOF = false;
while ((bytesRead = in.read(buffer)) > 0) {
index = 0;
if (first) {
first = false;
b = 0;
while (true) {
b = buffer[index++];
if (b == ' ')
break;
n *= 10;
n += b - 48;
}
while (true) {
b = buffer[index++];
if (b == '\n')
break;
k *= 10;
k += b - 48;
}
}
while (index < bytesRead) {
b = buffer[index++];
if (b < 0) {
if (t % k == 0 && t > 0)
count++;
isEOF = true;
break;
}
if (b == '\n') {
if (t % k == 0)
count++;
t = 0;
} else {
t *= 10;
t += b - 48;
}
}
if (isEOF)
break;
}
System.out.println(count);
}
}
I mean, medium one is still OK, not sure why I would have to do that though, but look at the last code - can you tell what it's doing? It sucks!
It seems that 64k buffer is the best (maybe not just for this problem?)
Interesting thing - b-48 is faster than b&0xcf - and n *= 10 is faster than n = (n<
Btw - when I saw that there was an online judge that accepts Java 1.5 I was all excited (after the torture that is Java 1.1 on UVa). But if I have to write my own I/O routines to submit here... it's not different than UVa at all. Although I do like the fact you guys support some weird languages, I must try some of those 
Darko