private static long solve ( Scanner scanner ) {
  int N = Integer . parseInt ( scanner . nextLine ( ) ) ;
  long [ ] a = lineToNums ( scanner . nextLine ( ) ) ;
  long sumAll = Arrays . stream ( a ) . sum ( ) ;
  long [ ] xSum = new long [ N ] ;
  long [ ] ySum = new long [ N ] ;
  xSum [ 0 ] = a [ 0 ] ;
  ySum [ 0 ] = sumAll - xSum [ 0 ] ;
  long ret = Math . abs ( xSum [ 0 ] - ySum [ 0 ] ) ;
  for ( int i = 1 ;
  i < N - 1 ;
  i ++ ) {
    xSum [ i ] = xSum [ i - 1 ] + a [ i ] ;
    ySum [ i ] = sumAll - xSum [ i ] ;
    ret = Math . min ( ret , Math . abs ( xSum [ i ] - ySum [ i ] ) ) ;
  }
  return ret ;
}

private static long solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . nextLine ( ) ) ; long [ ] a = lineToNums ( scanner . nextLine ( ) ) ; long sumAll = Arrays . stream ( a ) . sum ( ) ; long [ ] xSum = new long [ N ] ; long [ ] ySum = new long [ N ] ; xSum [ 0 ] = a [ 0 ] ; ySum [ 0 ] = sumAll - xSum [ 0 ] ; long ret = Math . abs ( xSum [ 0 ] - ySum [ 0 ] ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { xSum [ i ] = xSum [ i - 1 ] + a [ i ] ; ySum [ i ] = sumAll - xSum [ i ] ; ret = Math . min ( ret , Math . abs ( xSum [ i ] - ySum [ i ] ) ) ; } return ret ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))))))))) (return_statement (identifier))))