https://algo.monster/problems/backtracking-aggregation
The template should be modified to return ‘ans’. Currently, it shows void in the signature.