You are given an integer NN. Consider the sequence containing the integers 1,2,…,N1,2,…,N in increasing order (each exactly once). Find the maximum length of its contiguous subsequence with an even sum.

For each test case, print a single line containing one integer — the maximum length of a contiguous subsequence with even sum.

**Example case 1:** The optimal choice is to choose the entire sequence, since the sum of all its elements is 1+2+3=61+2+3=6, which is even.

**Example case 3:** One of the optimal choices is to choose the subsequence [1,2,3,4][1,2,3,4], which has an even sum.

25-08-2021

0.5 secs

50000 Bytes Maximum Length Even Subarray solution codechef

CPP14, C, JAVA, PYTH 3.6, CPP17, PYTH, PYP3, CS2, ADA, PYPY, TEXT, PAS fpc, NODEJS, RUBY, PHP, GO, HASK, TCL, PERL, SCALA, LUA, kotlin, BASH, JS, LISP sbcl, rust, PAS gpc, BF, CLOJ, R, D, CAML, FORT, ASM, swift, FS, WSPC, LISP clisp, SQL, SCM guile, PERL6, ERL, CLPS, ICK, NICE, PRLG, ICON, COB, SCM chicken, PIKE, SCM qobi, ST, SQLQ, NEM