Help me in solving MXEVNSUB problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
/*
I don't know why my solution is incorrect?

explanation

for N=5, 5*6/2==sum and sum is even only if (5  and 5/2 is even) or (6 and 6/2 is even).
else n=n-1.


*/
	int t;
	cin>>t;
	while(t--){
	    int N;
	    cin>>N;
	    while(N>=2){
	        if(N%2==0 && (N/2)%2==0){
	                cout<<N;break;
	            
	        }
	        else if((N+1)%2==0 && ((N+1)/2)%2==0){
	                cout<<N;break;
	        }
	            N=N-1;
	    }
	    cout<<endl;
	} 
	return 0;
}

Problem Link: CodeChef: Practical coding for everyone

@saty_dude_09
i think the logic is quite simple like if (n*(n+1))/2 that is the total sum upto n is even then the answer would be n else answer would be n-1 by remove 1 from the total sum.