My implementation of SRM in TopCoder Algorithm Arena