MIKe and hashTrick

codeLink : https://ide.codingblocks.com/s/186607
my code is showing some errors which I am unable to understand please , correct it and specify my error

probably an index out of bound is giving an error
hash array need to be of size max+1 instead of max since in the next line
we are trying to access till <= MAX

long long *hash = new long long[MAX+1];
for (long long i = 0; i <= MAX; i++)
hash[i] = -1;

i dont see no other error.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

@chhavibansal even after correcting max to max + 1 I am getting wrong answer for all test cases please specify my error and correct the code asap