For the implementation of the sampling-and-voting method to arithmetic reasoning tasks within the GSM8K and MATH datasets, we execute the initial sampling phase by Algorithm 1. Samples are extracted from the responses by matching "boxed\(\{\)X\(\}\)", where "X" denotes a numerical value or a mathematical expression.