private static long solve ( ) {
  int [ ] [ ] dist = new int [ N ] [ N ] ;
  for ( int [ ] array : dist ) {
    Arrays . fill ( array , INF ) ;
  }
  for ( Edge edge : E ) {
    dist [ edge . a ] [ edge . b ] = edge . cost ;
    dist [ edge . b ] [ edge . a ] = edge . cost ;
  }
  for ( int k = 0 ;
  k < N ;
  k ++ ) {
    for ( int i = 0 ;
    i < N ;
    i ++ ) {
      if ( dist [ i ] [ k ] == INF ) continue ;
      for ( int j = 0 ;
      j < N ;
      j ++ ) {
        if ( dist [ k ] [ j ] == INF ) continue ;
        if ( dist [ i ] [ k ] + dist [ k ] [ j ] < dist [ i ] [ j ] ) {
          dist [ i ] [ j ] = dist [ i ] [ k ] + dist [ k ] [ j ] ;
        }
      }
    }
  }
  int ans = 0 ;
  for ( Edge edge : E ) {
    if ( dist [ edge . a ] [ edge . b ] < edge . cost ) ans ++ ;
  }
  return ans ;
}

private static long solve ( ) { int [ ] [ ] dist = new int [ N ] [ N ] ; for ( int [ ] array : dist ) { Arrays . fill ( array , INF ) ; } for ( Edge edge : E ) { dist [ edge . a ] [ edge . b ] = edge . cost ; dist [ edge . b ] [ edge . a ] = edge . cost ; } for ( int k = 0 ; k < N ; k ++ ) { for ( int i = 0 ; i < N ; i ++ ) { if ( dist [ i ] [ k ] == INF ) continue ; for ( int j = 0 ; j < N ; j ++ ) { if ( dist [ k ] [ j ] == INF ) continue ; if ( dist [ i ] [ k ] + dist [ k ] [ j ] < dist [ i ] [ j ] ) { dist [ i ] [ j ] = dist [ i ] [ k ] + dist [ k ] [ j ] ; } } } } int ans = 0 ; for ( Edge edge : E ) { if ( dist [ edge . a ] [ edge . b ] < edge . cost ) ans ++ ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters) body: (block (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)) dimensions: (dimensions_expr (identifier))))) (enhanced_for_statement type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (field_access object: (identifier) field: (identifier))) index: (field_access object: (identifier) field: (identifier))) right: (field_access object: (identifier) field: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (field_access object: (identifier) field: (identifier))) index: (field_access object: (identifier) field: (identifier))) right: (field_access object: (identifier) field: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))) consequence: (continue_statement)) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier))) consequence: (continue_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (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))) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (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))))))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (field_access object: (identifier) field: (identifier))) index: (field_access object: (identifier) field: (identifier))) right: (field_access object: (identifier) field: (identifier)))) consequence: (expression_statement (update_expression (identifier)))))) (return_statement (identifier))))