The answer depends on the difference between stopping and parking. Stopping means the vehicle stays for up to 5 minutes, or while people get in or out or you load or unload. The railroad crossing rules ban stopping on the crossing itself, while the “closer than 50 m to the crossing” limit applies to parking, that is, stopping for longer than 5 minutes. Car A is stopped 40 m from the crossing on the right shoulder: that is too close for parking but allowed for stopping. Car B is stopped on its own right shoulder past the rails, not on the crossing, and that is allowed too. The right shoulder is exactly where the rules allow you to stop. So nobody broke the stopping rules