The relevant visas that correspond to these exemptions are the A visa and the G visa.
In calculating days of presence for the substantial presence test, a person can exclude a few calendar years present on a F visa, J visa, M visa, or Q visa (the number of calendar years varies based on the status) [REF].