2nd version, time to 1m23s, memory usage only 4.8MB
chk cmd: /usr/bin/time -v ./test < in
This can show both the run time and the memory usage