TLE for the last test case

is there anything wrong with my code? it gives TLE for the last test case

@ankit-c11
Do not declare a as
int a[n]
Either declare it dynamically
int *a = new int[n]
or
int a[10000000]
Either do static allocation or dynamic. A mix of both will give you trouble.

thanks Bhaiiya… int * a = new int[n] does the job… But does this happen

i mean why does this happen could you please explain or share some references _/_

@ankit-c11
When you write
int a[n] ;
Allocation takes place at compile time. Since value of n is unknown at that time, compiler picks a random value of n and allocated the memory according to it. This can work sometimes and it may fail other times. Hence you should always avoid this.

okay bhaiiya thankyou