If the conditions affecting the stroke are worsened after a player's ball came to rest:

(1) When Restoration of Worsened Conditions Is Allowed. If the conditions affecting the stroke are worsened by any person other than the player or by an animal, without penalty under Rule 8.1a the player may:

Exception - Lie of Ball Worsened When or After a Ball Is Lifted or Moved and Before It Is Replaced: This is covered by Rule 14.2d, unless the lie was worsened when play was stopped and the ball was lifted in which case this Rule applies.

(2) When Restoration of Worsened Conditions Is Not Allowed. A player must not improve the conditions affecting the stroke (except as allowed in Rules 8.1c(1), 8.1c(2) and Rule 13.1c) that have been worsened by:

If the player improves the worsened conditions when not allowed to do so, the player gets the general penalty under Rule 8.1a

Penalty for Playing Ball from a Wrong Place in Breach of Rule 8.1d: General Penalty under 14.7a.

See Rules 22.2 (in Foursomes, either partner may act for the side and action of the partner is treated as action by the player); 23.5 (in Four-Ball, either partner may act for the side and action by the partner concerning the player's ball or equipment is treated as action of the player).
Click to view full USGA Explanation