One is punished if one is found guilty. Or one is punished even if one is not guilty. those two claims, in your bible contradict each other. You yourself said “how can someone who didn’t do anything be guilty of it?” If they aren’t guilty of it why are they being punished?
Your implication is that if one is punished they are being punished due to their guilt. That idea is not necessarily true as parties that are not guilty can often suffer for the actions of an associated party.
The passages we went over that speak of guilt illustrate to the reader that each individual's GUILT will be on that individual and that individual alone. When we consider the punishment aspect mentioned in the passages we can see that the punishment for the actions of the guilty party would in fact affect others who may not have born any guilt.
What you are calling a contradiction, does not appear to be one at all as guilt and punishment are two distinctly different things. What I will say though is that the idea of fairness seems to be thrown out of the window as those not responsible for the ship sinking are being forced to go down with it.