Test cases failing

Your code is failing for the testcases like:
4 3
3 2
3 1
4 3
Expected Output:
1
Your Output:
0

You can refer this https://ide.codingblocks.com/s/265351