How to modify the country list and their id?
You can obviously edit the data directly in the table. Extension https://github.com/CiviCooP/org.civicoop.general.api.country provides an API for Country, you could use that as well