code for ZOJ and PAT