#agc016e. [agc016_e]Poor Turkeys
[agc016_e]Poor Turkeys
Problem Statement
There are turkeys. We number them from through .
men will visit here one by one. The -th man to visit will take the following action:
- If both turkeys and are alive: selects one of them with equal probability, then eats it.
- If either turkey or is alive (but not both): eats the alive one.
- If neither turkey nor is alive: does nothing.
Find the number of pairs () such that the following condition is held:
- The probability of both turkeys and being alive after all the men took actions, is greater than .
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the number of pairs () such that the condition is held.
Sample Input 1
3 1
1 2
Sample Output 1
2
satisfy the condition.
Sample Input 2
4 3
1 2
3 4
2 3
Sample Output 2
1
satisfies the condition. Both turkeys and are alive if:
- The first man eats turkey .
- The second man eats turkey .
- The third man does nothing.
Sample Input 3
3 2
1 2
1 2
Sample Output 3
0
Sample Input 4
10 10
8 9
2 8
4 6
4 9
7 8
2 8
1 8
3 4
3 4
2 7
Sample Output 4
5