http://usaco.org/index.php?page=viewproblem2&cpid=642

Edit: The input for a certain case is:

6

2 3

4 7

10 8

12 6

200 5

15 30

I know for a fact that the answer should be 40.

Shouldn’t the answer for this case be 16? We only need to use the cows at coordinates (4, 7), (10, 8), and (12, 6) and can remove the other 3 cows.