Feedback for the puppy is helpful. When it pees in the house and you see it happen, it should hear a stern “No.”
But punishment, locking it in a room, or not feeding it because it did something bad is not helpful.
What works better is positive reinforcement. Catching them doing something good and giving an immediate reward is the best way to encourage good behavior.
While we’re talking about puppies, these things are all true for humans also.
Specific feedback tied to action works
Long term punishment is often more about show than effectiveness
Positive reinforcement is the best way to go