Refactor submit_code action to reduce code redundancy

Now set_hints will return value to determine whether the answer passed private and public test cases.