public static long f ( long n ) {
  Long memo = mb . get ( n ) ;
  if ( memo != null ) return memo ;
  if ( n <= 2 ) {
    return n ;
  }
  long res = f ( n / 2 ) + f ( ( n - 1 ) / 2 ) + f ( ( n + 1 ) / 2 ) ;
  res %= MOD ;
  mb . put ( n , res ) ;
  return res ;
}

public static long f ( long n ) { Long memo = mb . get ( n ) ; if ( memo != null ) return memo ; if ( n <= 2 ) { return n ; } long res = f ( n / 2 ) + f ( ( n - 1 ) / 2 ) + f ( ( n + 1 ) / 2 ) ; res %= MOD ; mb . put ( n , res ) ; return res ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (return_statement (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) (return_statement (identifier))))