Why after the reset the program vanish?
By connecting BOOT0 to 3.3V you are telling the chip When I reset for whatever reason you must go into the bootloader.

So you reset, and it goes into the bootloader. You then upload your sketch.

At that point the programming software tells the bootloader "Ok, you are done now. Run the program". And it does.

Until you reset. And because you are telling it to go into the bootloader with BOOT0 it dutifully does so, waiting for you to load a new program.

The old program is still there, but you just aren't letting run, since you are insisting that the chip go into the bootloader when you reset.

In order to get your program to run and not the bootloader you must disconnect BOOT0 so it doesn't enter the bootloader.

You only need to connect the BOOT0 when you want to put a new program on there.