Rank gradient, cost of groups and the rank versus Heegaard genus problem