According to Archimedes' formula, an object floats only when it weighs less than the weight of the same volume of water. If the weight of an object is equal to the weight of its equivalent water, then the object floats in a submerged state. And if the weight of the object is more than the weight of its equivalent water, then the object will sink. Usually when the density of an object is less than the density of water then the object floats in water. The density of the human body is less than the density of water, so if someone falls into the water, he floats in the water for a few seconds. But when water comes in the middle of the body, its density increases and it sinks under the water. If you fall into the water, you have to drink a lot of water, as a result of which water enters the body and due to this the body becomes swollen. As its volume increases then the density decreases again. That is why corpses float in water.