Similar Items: Tight Polynomial Bounds for Loop Programs in Polynomial Space