At the reception of every building in the Athlete's Village they have flags to show who is in the building, that's making this work a whole lot easier
Today I got this photo:
My guess is Kazakhstan's flag is in every building because it's hard to imagine both China (whose flag is missing, but there are tons of windows in the building with Chinese flags so they're there) and Kazakhstan in the same building with such large delegations
So if I'm seeing it right and with China added, these are the countries in Brazil's building
1. Brazil
2. Afghanistan
3. Argentina
4. Turkey
5. Chile
6. Azerbaijan
7. Hungary
8. Mexico
9. Uganda (the snowboarder going for the Olympics!)
10. Gambia (well, their official/officials, since they have no athletes)
11. Georgia
12. Iran
13. Lebanon
14. China