In what case does my approach fail?

It’s about the problem Draughts. I just can’t find a case, in which the output is wrong. Can anybody give me a clue?
Here’s my solution: http://www.codechef.com/viewsolution/3450734

For starters, one thing i can suggest is that the maximum number of open windows is 50000.Hence the maximum possible number of pairs is 50000*(50001)/2 will exceed the range of int.

//