Solving Computational Puzzles with Geometric Constraints and Applications