public static long calcMin ( int H , int W ) {
  long S1 = 0L ;
  long S2 = 0L ;
  long S3 = 0L ;
  long S4 = 0L ;
  long S5 = 0L ;
  long Smin = Long . MAX_VALUE ;
  long tmpS ;
  for ( long i = 1 ;
  i < H ;
  i ++ ) {
    S1 = i * W ;
    S2 = ( H - i ) * ( W / 2 ) ;
    S3 = ( H - i ) * ( W - ( W / 2 ) ) ;
    tmpS = Math . max ( Math . max ( S1 , S2 ) , S3 ) - Math . min ( Math . min ( S1 , S2 ) , S3 ) ;
    if ( tmpS < Smin ) {
      Smin = tmpS ;
    }
    if ( i <= H - 2 ) {
      S4 = W * ( ( H - i ) / 2 ) ;
      S5 = W * ( H - i - ( ( H - i ) / 2 ) ) ;
      tmpS = Math . max ( Math . max ( S1 , S4 ) , S5 ) - Math . min ( Math . min ( S1 , S4 ) , S5 ) ;
      if ( tmpS < Smin ) {
        Smin = tmpS ;
      }
    }
  }
  return Smin ;
}

public static long calcMin ( int H , int W ) { long S1 = 0L ; long S2 = 0L ; long S3 = 0L ; long S4 = 0L ; long S5 = 0L ; long Smin = Long . MAX_VALUE ; long tmpS ; for ( long i = 1 ; i < H ; i ++ ) { S1 = i * W ; S2 = ( H - i ) * ( W / 2 ) ; S3 = ( H - i ) * ( W - ( W / 2 ) ) ; tmpS = Math . max ( Math . max ( S1 , S2 ) , S3 ) - Math . min ( Math . min ( S1 , S2 ) , S3 ) ; if ( tmpS < Smin ) { Smin = tmpS ; } if ( i <= H - 2 ) { S4 = W * ( ( H - i ) / 2 ) ; S5 = W * ( H - i - ( ( H - i ) / 2 ) ) ; tmpS = Math . max ( Math . max ( S1 , S4 ) , S5 ) - Math . min ( Math . min ( S1 , S4 ) , S5 ) ; if ( tmpS < Smin ) { Smin = tmpS ; } } } return Smin ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))))) (return_statement (identifier))))