Please do not attempt to power an Arduino via "Vin" or the "barrel jack". Stock explanation follows.
Remember that when you open the Comms port on the PC with any program, that action always resets the Arduino. That is how it is programmed, but opening the Serial Monitor does the same thing.
The UNO and Mega 2560 have a "polyfuse" between the USB connector and the 5 V line, so if things are drawing more than 500 mA it is likely to shut down sooner or later. The logic circuits operate from the 5 V line, so 5 V is what you really need to provide, and preferably via the "5V" pin as well as to all the external 5 V devices.
A very real danger is that the obsolete tutorials on the Arduino site and others misleadingly imply that the largely ornamental "barrel jack" and "Vin" connections to the on-board regulator allow a usable source of 5 V power. This is absolutely not the case. It is essentially only for demonstration use of the bare board back in the very beginning of the Arduino project when "9V" transformer-rectifier-capacitor power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.
If you are asking this question, it is highly likely that you will wish to connect something else. In which case, the answer is regulated 5 V.
This is because the on-board regulator is essentially capable of powering only the microcontroller itself and no more than a couple of indicator LEDs. The on-board regulator might be able to power a few other things if it had a heatsink, but on the (older) Arduinos, it does not.
Powering via the "barrel jack" or "Vin" connections is asking for trouble. The "5V" pin is not by any means an output pin, if anything a "reference" pin but most certainly the preferred pin to which to supply a regulated 5 V.