init solve code