When copying ranges, we need to take care when the input and output ranges overlap.
For std::copy, only the tail of the destination range can overlap the source range; for std::copy_backward, only the head of the destination range can overlap the source range.
Compiler Explorer link: https://compiler-explorer.com/z/Pa43oKfa4