Submit solution

Points:
20

Time limit:
1.8s

Memory limit:
256M

Author:

Problem types

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

key points in space-time, numbered to , conveniently represented by positive points on the coordinate grid. has events he would like to change, also represented by points in space-time (note that these are not necessarily key points). However, changing a point with affect all points contained within the square of that point and the origin . Formally, changing point will affect all points with and for between and . would like to make sure that no key point is affected by more than changed event. Help find the largest number of key point he can change, without changing any key point twice.

has completed his mission, but he realizes he has much more events to alter. There are#### Subtasks

For all cases: .

For 3 points, .

For additional 2 points, .

#### Sample Input

```
5 5
1 5
2 4
3 2
8 2
5 3
8 2
6 3
1 10
2 4
100 1
```

#### Sample Output

`4`

#### Explanation

Change points , and to affect points , , and .

## Comments