Memorise Me!

QUESTION

Arijit is a brilliant boy. He likes memory games. He likes to participate alone but this time he has to have a partner. So he chooses you.\n\nIn this Game , your team will be shown N numbers for few minutes . You will have to memorize these numbers.\n\nNow, the questioner will ask you Q queries, in each query He will give you a number , and you have to tell him the total number of occurrences of that number in the array of numbers shown to your team . If the number is not present , then you will have to say NOT PRESENT (without quotes).\n\nINPUT And OUTPUT\n\nThe first line of input will contain N, an integer, which is the total number of numbers shown to your team.\n\nThe second line of input contains N space separated integers .\n\nThe third line of input contains an integer Q , denoting the total number of integers.\n\nThe Next Q lines will contain an integer denoting an integer, Bi , for which you have to print the number of occurrences of that number (\nBi) in those N numbers on a new line.\n\nIf the number Bi isnt present then Print NOT PRESENT (without quotes) on a new line. CONSTRAINTS\n1N10^5\n0Bi1000\n1Q10^5.

“TESTCASE_1”: “6\n1 1 1 2 2 0\n6\n1\n2\n1\n0\n3\n4\n###—###SEPERATOR—###—\n3\n2\n3\n1\nNOT PRESENT\nNOT PRESENT”, “TESTCASE_2”: “6\n1 1 1 2 2 0\n3\n0\n2\n4\n###—###SEPERATOR—###—\n1\n2\nNOT PRESENT”, “TESTCASE_3”: “8\n10 19 111 220 540 111 220 540\n3\n10\n111\n50\n###—###SEPERATOR—###—\n1\n2\nNOT PRESENT”, “TESTCASE_4”: “1\n999\n3\n9\n99\n999\n###—###SEPERATOR—###—\nNOT PRESENT\nNOT PRESENT\n1”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

``````#include<stdio.h>
int main()
{

int a[100001],q,n,m,z,b[15],i,t;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&q);

a[q]++;
}
scanf("%d",&t);
while(t--)
{
scanf("%d",&m);
if(a[m]>0)
printf("%d\n",a[m]);
else
printf("NOT PRESENT\n");
}

return 0;
}``````