Why it is showing run time error

Hello @Namanjain123,

The run-time error is due to the incorrect way of insertion into vector.
I have corrected your code:

I would suggest you to go through this link to understand the concept better.

Hope, this would help.
Give a like if you are satisfied.