some SPOJ solutions