Prime visits problem


sir the code shows wrong answer for 1 test case. please help.

@DJ20001 you are checking all the values from k=1 to k=n if a[k] lies between n and m but size of your array a exist only upto b rest is garbage so in case n is greater than b your code may fail.
do following:
define b globally and check a[k] for 1<=k<b.