Lattice model for cold and warm swelling of polymers in water