{"raw_statement":[{"iden":"problem statement","content":"You are given a simple connected undirected graph with $N$ vertices and $M$ edges.  \nEdge $i$ connects Vertex $A_i$ and Vertex $B_i$, and has a length of $C_i$.\nLet us delete some number of edges while satisfying the conditions below. Find the maximum number of edges that can be deleted.\n\n*   The graph is still connected after the deletion.\n*   For every pair of vertices $(s, t)$, the distance between $s$ and $t$ remains the same before and after the deletion."},{"iden":"notes","content":"A simple connected undirected graph is a graph that is simple and connected and has undirected edges.  \nA graph is simple when it has no self-loops and no multi-edges.  \nA graph is connected when, for every pair of two vertices $s$ and $t$, $t$ is reachable from $s$ by traversing edges.  \nThe distance between Vertex $s$ and Vertex $t$ is the length of a shortest path between $s$ and $t$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 300$\n*   $N-1 \\leq M \\leq \\frac{N(N-1)}{2}$\n*   $1 \\leq A_i \\lt B_i \\leq N$\n*   $1 \\leq C_i \\leq 10^9$\n*   $(A_i, B_i) \\neq (A_j, B_j)$ if $i \\neq j$.\n*   The given graph is connected.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$ $C_1$\n$A_2$ $B_2$ $C_2$\n$\\vdots$\n$A_M$ $B_M$ $C_M$"},{"iden":"sample input 1","content":"3 3\n1 2 2\n2 3 3\n1 3 6"},{"iden":"sample output 1","content":"1\n\nThe distance between each pair of vertices before the deletion is as follows.\n\n*   The distance between Vertex $1$ and Vertex $2$ is $2$.\n*   The distance between Vertex $1$ and Vertex $3$ is $5$.\n*   The distance between Vertex $2$ and Vertex $3$ is $3$.\n\nDeleting Edge $3$ does not affect the distance between any pair of vertices. It is impossible to delete two or more edges while satisfying the condition, so the answer is $1$."},{"iden":"sample input 2","content":"5 4\n1 3 3\n2 3 9\n3 5 3\n4 5 3"},{"iden":"sample output 2","content":"0\n\nNo edge can be deleted."},{"iden":"sample input 3","content":"5 10\n1 2 71\n1 3 9\n1 4 82\n1 5 64\n2 3 22\n2 4 99\n2 5 1\n3 4 24\n3 5 18\n4 5 10"},{"iden":"sample output 3","content":"5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}