Hmmm....if your plane arrives on time, pretty doable.
The process is driven by Immigration, not Customs. There definitely can be lines at Passport Check (the European name), as several international flights arrive around that time. The next step is getting your bags, which as you have only carry ons, saves you a truckload of time. Lastly, Customs is the 'red/green" system, which literally takes a few seconds.
Don't know anything about a code, and we have flown to Italy, and any number of other countries many times. Don't think catching a train is critical to clearing Immigration. I have seen people who proclaim such important issues frequently get more attention from security folks than they wished.