Guided randomized search over programs for synthesis and program optimization