public static int saiki ( int x , int y ) {
  if ( memo [ y ] [ x ] != - 1 ) return memo [ y ] [ x ] ;
  long res = 0 ;
  int [ ] dx = {
    0 , 1 , 0 , - 1 };
    int [ ] dy = {
      1 , 0 , - 1 , 0 };
      for ( int i = 0 ;
      i < 4 ;
      i ++ ) {
        int nx = x + dx [ i ] ;
        int ny = y + dy [ i ] ;
        if ( 0 <= nx && nx < w && 0 <= ny && ny < h && a [ y ] [ x ] > a [ ny ] [ nx ] ) {
          res += saiki ( nx , ny ) ;
        }
      }
      memo [ y ] [ x ] = ( int ) ( res % MOD ) + 1 ;
      return memo [ y ] [ x ] ;
    }
    
public static int saiki ( int x , int y ) { if ( memo [ y ] [ x ] != - 1 ) return memo [ y ] [ x ] ; long res = 0 ; int [ ] dx = { 0 , 1 , 0 , - 1 } ; int [ ] dy = { 1 , 0 , - 1 , 0 } ; for ( int i = 0 ; i < 4 ; i ++ ) { int nx = x + dx [ i ] ; int ny = y + dy [ i ] ; if ( 0 <= nx && nx < w && 0 <= ny && ny < h && a [ y ] [ x ] > a [ ny ] [ nx ] ) { res += saiki ( nx , ny ) ; } } memo [ y ] [ x ] = ( int ) ( res % MOD ) + 1 ; return memo [ y ] [ x ] ; }
(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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (decimal_integer_literal) (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (decimal_integer_literal) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)))) (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))