The Sammarinese televote is a nebulous thing that nobody has been able to back calculate - there's a very in-depth look here:
https://escinsight.com/2019/05/28/s...-song-contest-2019-broken-hidden-calculation/
Basically it seems it must use more data than we get, e.g. the raw number of votes cast in each country that it uses or something, it doesn't work to do it with just the ranking/points.
Re: Sugar, it also came dead last in Albania and the Czech Republic's televote in the semi, then went on to get 7 from Albania and 12 from the Czech Republic in the final - could it be that the rigging was *so* blatant in those countries (e.g. 80% of the votes cast went to Moldova - easily feasible as those 2 countries get amongst the smallest televotes cast) that the EBU discounted those votes in the semi, then in the final it was more 'realistic'?