what's wrong in my code?

I am getting Runtime Error in codechef but it is perfectly running in my system.
Here is the link to my solution:-https://www.codechef.com/viewsolution/18657172

You have taken N as input but you have declared the array with size 100.It should be declared with size N like->

test[N]={0};

You make this change and you will not get Runtime error

Hey Now I am getting Wrong Answer Error. Can You find what’s wrong in my code.

here is the modified code:https://www.codechef.com/viewsolution/18657377

The problem is you are not changing line after output…you should do cout<<“YES\n”; and cout<<“NO\n”; @bk54

The first error was as @swapnil159 said the second error is you are doing for(int i=1;i<=t;i++) for the test cases and again for(int i=0;i < N;i++) for the array in both these for loops the variable is i you should make it different. The third error is you are not doing endl after each test case i corrected these and got AC:) here is the solution link https://www.codechef.com/viewsolution/18812979