On the complexity of programs with nested loops