Prime visits algo++

https://ide.codingblocks.com/s/57863

third test case is failing.

Please check for corner cases again.
Also may understand here that numbers that have only 2 divisors are prime numbers.
So, making vector and storing the factors in it and then checking for its size increases both space and time complexity of your code; whereas you can simply check if the number is prime or not and return true or false.
Returning a true will mean that PM can visit that country and you can continue with your question ahead.