No tags yet

No tag edit access

time limit per test: 0.25 sec.

memory limit per test: 65536 KB

memory limit per test: 65536 KB

input: standard

output: standard

output: standard

Let us consider an undirected graph G = <V, E> which has N vertices and M edges. Incidence matrix of this graph is an N × M matrix A = {a_{ij}}, such that a_{ij} is 1 if i-th vertex is one of the ends of j-th edge and 0 in the other case. Your task is to find the sum of all elements of the matrix A^{T}A where A^{T} is A transposed, i.e. an M × N matrix obtained from A by turning its columns to rows and vice versa.

The first line of the input file contains two integer numbers — N and M (2 le N le 10,000, 1 le M le 100,000). 2M integer numbers follow, forming M pairs, each pair describes one edge of the graph. All edges are different and there are no loops (i.e. edge ends are distinct).

Output the only number — the sum requested.

Input

4 4

1 2

1 3

2 3

2 4

1 2

1 3

2 3

2 4

Output

18

Author: | Andrew Stankevich, Georgiy Korneev |

Resource: | Petrozavodsk Winter Trainings 2003 |

Date: | 2003-02-06 |

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/23/2019 19:59:15 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|