static void merge ( int left , int right , long [ ] sum , long [ ] temp ) {
  if ( left >= right ) return ;
  int mid = ( left + right ) / 2 ;
  merge ( left , mid , sum , temp ) ;
  merge ( mid + 1 , right , sum , temp ) ;
  int start = mid + 1 ;
  for ( int i = left ;
  i <= mid ;
  i ++ ) {
    while ( start <= right && sum [ start ] - sum [ i ] < 0 ) start ++ ;
    ans += right + 1 - start ;
  }
  int k = left , i = left , j = mid + 1 ;
  while ( i <= mid && j <= right ) {
    if ( sum [ i ] < sum [ j ] ) temp [ k ++ ] = sum [ i ++ ] ;
    else temp [ k ++ ] = sum [ j ++ ] ;
  }
  while ( i <= mid ) temp [ k ++ ] = sum [ i ++ ] ;
  while ( j <= right ) temp [ k ++ ] = sum [ j ++ ] ;
  for ( int m = left ;
  m <= right ;
  m ++ ) sum [ m ] = temp [ m ] ;
}

static void merge ( int left , int right , long [ ] sum , long [ ] temp ) { if ( left >= right ) return ; int mid = ( left + right ) / 2 ; merge ( left , mid , sum , temp ) ; merge ( mid + 1 , right , sum , temp ) ; int start = mid + 1 ; for ( int i = left ; i <= mid ; i ++ ) { while ( start <= right && sum [ start ] - sum [ i ] < 0 ) start ++ ; ans += right + 1 - start ; } int k = left , i = left , j = mid + 1 ; while ( i <= mid && j <= right ) { if ( sum [ i ] < sum [ j ] ) temp [ k ++ ] = sum [ i ++ ] ; else temp [ k ++ ] = sum [ j ++ ] ; } while ( i <= mid ) temp [ k ++ ] = sum [ i ++ ] ; while ( j <= right ) temp [ k ++ ] = sum [ j ++ ] ; for ( int m = left ; m <= right ; m ++ ) sum [ m ] = temp [ m ] ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))) body: (expression_statement (update_expression (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier))))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier)))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier)))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))))