Baltic Olympiad in Informatics: 2011 Day 1, Problem 2
Rasmus and his friends are on vacation in Italy. Since they are suffering from the heat, they decide
to buy some ice cream. There are flavors of ice cream available; flavors are numbered from
to
. However, some pairings of flavors should be avoided; otherwise, the taste would be unpleasant.
Rasmus wants to know how many ways there are to choose three different flavors without any such
impossible pairing. The order of flavors is not taken into account.
Constraints
Input Specification
The first line of input contains two non-negative integers and
, the number of flavors and the
number of impossible pairings. Each of the
following lines describes an impossible pairing and
contains two different flavor numbers. No impossible pairing will appear twice.
Output Specification
The first and only line of output must contain a single integer: the number of possible choices.
Sample Input
5 3
1 2
3 4
1 3
Sample Output
3
Explanation for Sample
There are flavors and
impossible pairings. Flavor
should be combined with neither flavor
nor
flavor
, and flavor
also should not be chosen together with flavor
. Only
ways to choose three
different flavors remain:
,
, and
.
Comments