static int maxValue ( int n , int m , int x [ ] , int y [ ] , int a [ ] ) {
  int c [ ] [ ] = new int [ MAXN ] [ MAXN ] ;
  for ( int i = 0 ;
  i < m ;
  ++ i ) {
    for ( int p = 0 ;
    p < n ;
    ++ p ) {
      for ( int q = 0 ;
      q < n ;
      ++ q ) {
        int dx = Math . abs ( p - x [ i ] ) ;
        int dy = Math . abs ( q - y [ i ] ) ;
        int d = Math . max ( dx , dy ) ;
        c [ p ] [ q ] += Math . max ( 0 , a [ i ] - d ) ;
      }
    }
  }
  int res = 0 ;
  for ( int i = 0 ;
  i < n ;
  ++ i ) {
    for ( int j = 0 ;
    j < n ;
    ++ j ) {
      res = Math . max ( res , c [ i ] [ j ] ) ;
    }
  }
  return res ;
}

static int maxValue ( int n , int m , int x [ ] , int y [ ] , int a [ ] ) { int c [ ] [ ] = new int [ MAXN ] [ MAXN ] ; for ( int i = 0 ; i < m ; ++ i ) { for ( int p = 0 ; p < n ; ++ p ) { for ( int q = 0 ; q < n ; ++ q ) { int dx = Math . abs ( p - x [ i ] ) ; int dy = Math . abs ( q - y [ i ] ) ; int d = Math . max ( dx , dy ) ; c [ p ] [ q ] += Math . max ( 0 , a [ i ] - d ) ; } } } int res = 0 ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < n ; ++ j ) { res = Math . max ( res , c [ i ] [ j ] ) ; } } return res ; }
(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)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (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 (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 (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (block (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))))) (return_statement (identifier))))