Merge partitions after windows installation failure
This is a very common question. Again, here is the commands you need to enter in a Terminal application window.

I assume the untitled disk0s4 partition was created by the Boot Camp Assistant. If so, then use the command below to remove this partition. Otherwise, skip this command.

sudo diskutil eraseVolume free none disk0s4


The next two commands will remove the disk03 partition labeled OSXRESERVED and return the free space back to the disk0s2 APFS container partition.

sudo diskutil eraseVolume free none disk0s3
sudo diskutil apfs resizeContainer disk0s2 0


There may still be Windows boot files stored in the hidden EFI partition (disk0s1). These files can be removed by entering the commands given below.

sudo diskutil mount disk0s1
cd /Volumes/EFI/EFI
rm -r Boot
rm -r Microsoft
cd ~
diskutil unmount disk0s1