If this element is the first element in the individual pair in the subsequence then simply recurrence with the last element as i - th index
if ( cnt % 2 == 0 ) ans = max ( ans , recur ( i + 1 , cnt + 1 , i , a , n , k , dp ) ) ;