very cheap hackish brute force in cpp