Help me in solving MXEVNSUB problem

My issue

my issue is that why is my solution wrong, i saw other’s solutions and they just did a-1 in the 2nd case, meanwhile i did a-2.
if input is 2. then output should be 0, why? since then only we get an even sum. The solution given by others gives 1 as output, but it gives a odd sum bro.
another example:-
if input is 6, then output should be 4, why? since then we get an even sum. the solution given by others will give 5 as output, but it gives a odd sum ;-; .

pls explain what am i doing wrong???

My code

#include <iostream>
using namespace std;

int main() {
	int t;
	cin >> t;
	    int a;
	    cin >> a;
	    if (((a+3)%4)==0){
	    else if (((a+2)%4)==0){
	        cout << a-2;
	    cout << endl;
	return 0;

Problem Link: CodeChef: Practical coding for everyone

The logic is if the sum upto n is even then print n else print n-1
now see this example :-
1 2 3 4 =10 which is even so answer is 4
1 2 3 4 5 =15 which is not even so i will leave 1 and sum up the rest which is 2 3 4 5 =14 which is even so n-1 will be my answer.

ok i get what i was missing. thanks. i was only removing the last number of the array, and not the first one.