public static String getResult ( String input ) {
  int resultInt = 0 ;
  String [ ] splitResult = input . split ( " " ) ;
  int dancerCount = Integer . parseInt ( splitResult [ 0 ] ) ;
  int suprising = Integer . parseInt ( splitResult [ 1 ] ) ;
  int max = Integer . parseInt ( splitResult [ 2 ] ) ;
  for ( int i = 3 ;
  i < dancerCount + 3 ;
  i ++ ) {
    int current = Integer . parseInt ( splitResult [ i ] ) ;
    int ave = current / 3 ;
    int remain = current - 3 * ave ;
    int currentmax = ave + remain ;
    if ( remain == 0 && ( max - currentmax == 1 ) && current != 0 ) {
      if ( suprising > 0 ) {
        suprising -- ;
        resultInt ++ ;
      }
    }
    if ( currentmax >= max ) {
      if ( remain <= 1 ) {
        resultInt ++ ;
      }
      else if ( remain == 2 ) {
        if ( max - ave <= 1 ) {
          resultInt ++ ;
        }
        else if ( suprising > 0 ) {
          suprising -- ;
          resultInt ++ ;
        }
      }
    }
  }
  return "" + resultInt ;
}

public static String getResult ( String input ) { int resultInt = 0 ; String [ ] splitResult = input . split ( " ▁ " ) ; int dancerCount = Integer . parseInt ( splitResult [ 0 ] ) ; int suprising = Integer . parseInt ( splitResult [ 1 ] ) ; int max = Integer . parseInt ( splitResult [ 2 ] ) ; for ( int i = 3 ; i < dancerCount + 3 ; i ++ ) { int current = Integer . parseInt ( splitResult [ i ] ) ; int ave = current / 3 ; int remain = current - 3 * ave ; int currentmax = ave + remain ; if ( remain == 0 && ( max - currentmax == 1 ) && current != 0 ) { if ( suprising > 0 ) { suprising -- ; resultInt ++ ; } } if ( currentmax >= max ) { if ( remain <= 1 ) { resultInt ++ ; } else if ( remain == 2 ) { if ( max - ave <= 1 ) { resultInt ++ ; } else if ( suprising > 0 ) { suprising -- ; resultInt ++ ; } } } } return " " + resultInt ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))))))))))) (return_statement (binary_expression left: (string_literal) right: (identifier)))))