static boolean satisfy ( boolean [ ] b ) {
  int L = b . length ;
  int N = ( L + 1 ) / 2 ;
  int l = N - 1 ;
  while ( l > 0 && b [ l ] != b [ l - 1 ] ) l -- ;
  int r = N - 1 ;
  while ( r < L - 1 && b [ r ] != b [ r + 1 ] ) r ++ ;
  if ( l > 0 ) {
    if ( r < L - 1 ) {
      if ( b [ l ] == b [ r ] ) return b [ l ] ;
      else return ( l + r ) / 2 >= N - 1 ? b [ l ] : b [ r ] ;
    }
    else {
      return b [ l ] ;
    }
  }
  else if ( r < L - 1 ) {
    return b [ r ] ;
  }
  else {
    return b [ N - 1 ] ^ N % 2 == 0 ;
  }
}

static boolean satisfy ( boolean [ ] b ) { int L = b . length ; int N = ( L + 1 ) / 2 ; int l = N - 1 ; while ( l > 0 && b [ l ] != b [ l - 1 ] ) l -- ; int r = N - 1 ; while ( r < L - 1 && b [ r ] != b [ r + 1 ] ) r ++ ; if ( l > 0 ) { if ( r < L - 1 ) { if ( b [ l ] == b [ r ] ) return b [ l ] ; else return ( l + r ) / 2 >= N - 1 ? b [ l ] : b [ r ] ; } else { return b [ l ] ; } } else if ( r < L - 1 ) { return b [ r ] ; } else { return b [ N - 1 ] ^ N % 2 == 0 ; } }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (boolean_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) body: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) body: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (return_statement (array_access array: (identifier) index: (identifier))) alternative: (return_statement (ternary_expression condition: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (array_access array: (identifier) index: (identifier)) alternative: (array_access array: (identifier) index: (identifier)))))) alternative: (block (return_statement (array_access array: (identifier) index: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (return_statement (array_access array: (identifier) index: (identifier)))) alternative: (block (return_statement (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)))))))))