Arduino serial is blocked by program

Hello, I make mistake and I uploaded bad program to arduino uno. In program I set digital pin 0(RX) and 1(TX) to output and now I cant upload any program to arduino. Is there any way to clear memory in which is located arduino program? I was trying holding arduino reset button and tried to upload blink program at same time but it didnt work.

In arduino IDE output I see this error message:

avrdude: stk500_getsync(): not in sync: resp=0x00

Press & Hold the reset button, when the Arduino IDE shows "Compiled xxx of 32xxx bytes" release it. Can be easier to get the timing right if you select File:Preferences and turn on Verbose outputs. This has worked for a lot of people over the years.

Is there any way to clear memory in which is located arduino program?

Not without a "tool". Get a Programmer that connects to the ICSP header and reload the bootloader.

Thanks for help, but it didnt work, it seems that upload is too slow and reset sequence is too short to upload blink program.

I have got an idea. School own some arduinos, can I use one of them to burn the bootloader?

Edit: Today I tried upload program again and it works on the first attempt !!!

I did it this way: 1. On unplugged arduino I pressed and holded arduino reset button 2. I connected USB cable 3. In Arduino IDE I opened blink example and I clicked on upload button 4. When compiling sketch changed to uploading I release reset button

Thank you CrossRoads, you saved me lot of time !