Can you check my code it is not running any of the test cases

Your mistakes

  1. at line no 20
    you are inserting 2 in prime vector twice
    run the for loop from 3 because you have already pushed 2 into vector

  2. in main() don’t run the loop to print ans
    just print primes[n-1];

  3. p should be bool array not of the type ll
    because it holds 0 or 1

check out all the corrections in below code

Modified code