aboutsummaryrefslogtreecommitdiff
path: root/codechef/maximumLengthEvenSubarray.cpp
blob: 2cbd52bf6d0aaa3aceb72b27b5d831d677054492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<bits/stdc++.h>

using namespace std;

int sum(int x) {
  int res = 0;
  for(int i = 1; i <= x; i++) {
    res+=i;
  }
  return res;
}

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int n;
    cin >> n;
    if(sum(n) % 2 == 0) {
      cout << n << '\n';
    } else {
      cout << n - 1 << '\n';
    }
	}
}