Feedback for MXEVNSUB problem

Problem Link: CodeChef: Practical coding for everyone

Feedback

I finished the code code runs correctly but ı do not know MAybe Codechef system accepts only one format answer. System does not accept my code as a correct answer when I submit the code
Answer is “Wrong Answer”.
Can anyone say me that why this happens to me lots of time ?
I tested my code many times with different inputs. All are Correct.
My code :

#include <stdio.h>

int main(void) {
	// your code goes here
	int t,N;
	
	scanf("%d",&t);
	
	while(t--)
	{
	     int res=0;
	     
         scanf("%d",&N);

	    for (int i=1;i<=N;i++)
	    {
	        
	        res = res + i;
	    }
	        
        if(res%2 ==0)
        printf("%d\n",N);
        
        else 
        {
            int i=0;
            for (i;N-i>0;i++)
            {
                res = res - (N-i);
             if(res%2==0)
             {  N  = N-(i+1);
                break;
             }
            }
            printf("%d\n",N);
        }
           
	}
	return 0;
}

And also what is this subtask about ?
Subtask 1 (100 points): original constraints

@furkan81
for n=2;
your code will print 0;
but it would be 1;
like for n=2 its lts like 1+2=3
which is odd then u subtract 2 from it which will give 1 which is again odd.
then u subtract 1 from it . which will give 0 and then u print 0 .
but if i subtract 1 from 3 i’ll get 2 which is even and then my answer would be 1.
Your logic is not right
Logic is which u get all sum as even then print n and when u get all sum as odd then print n-1.

Thanks for the help. but I think It is not related to that. I re arrange the code.
If N=2 output 1…
So output is like that. but after submit the result is the same. “Wrong Answer”