rewrite the cyk code