Combinatorial optimization with one quadratic term