Problem: Let $S$ be the set of lattice points in the coordinate plane, both of whose coordinates are integers between $1$ and $30,$ inclusive. Exactly $300$ points in $S$ lie on or below a line with equation $y=mx.$ The possible values of $m$ lie in an interval of length $\frac ab,$ where $a$ and $b$ are relatively prime positive integers. What is $a+b?$
$\textbf{(A)} ~31 \qquad \textbf{(B)} ~47 \qquad \textbf{(C)} ~62\qquad \textbf{(D)} ~72 \qquad \textbf{(E)} ~85$

Solution: It's easier to calculate the number of lattice points inside a rectangle with vertices $(0,0)$ $(p,0)$ $(p,q)$ $(0,q)$ . Those lattice points are divided by the diagonal $y = \frac{p}{q} \cdot x$ into $2$ halves. In this problem the number of lattice points on or below the diagonal and $x \ge 1$ is
$(p+1)(q+1)$ is the total number of lattice points inside the rectangle. Subtract the number of lattice points on the diagonal, divided by 2 is the number of lattice points below the diagonal, add the number of lattice points on the diagonal, and subtract the lattice points on the $x$ axis, then we get the total number of lattice points on or below the diagonal and $x \ge 1$
There are $900$ lattice points in total. $300$ is $\frac{1}{3}$ of $900$ . The $x$ coordinate of the top-right vertex of the rectangle is $30$ $\frac{1}{2} \cdot 30 \cdot 20 = 300$ . I guess the $y$ coordinate of the top-right vertex of the rectangle is $20$ . Now I am going to verify that.  The slope of the diagonal is $\frac{20}{30} = \frac{2}{3}$ , there are $11$ lattice points on the diagonal. Substitute $(p,q)=(30, 20)$ $d=11$ to the above formula:
Because there are $11$ lattice points on line $y = \frac{2}{3}x$ , if $m < \frac{2}{3}$ , then the number of lattice points on or below the line is less than $300$ . So $m = \frac{2}{3}$ is the lower bound.
Now I am going to calculate the upper bound. From $\frac{b}{a} < \frac{b+1}{a+1}$
$\frac{2}{3} = \frac{18}{27} < \frac{19}{28}$
$\frac{2}{3} = \frac{20}{30} < \frac{21}{31} < \frac{19}{28}$
[asy] /* Created by Brendanb4321, modified by isabelchen */ import graph; size(18cm); defaultpen(fontsize(9pt)); xaxis(0,31,Ticks(1.0)); yaxis(0,22,Ticks(1.0));  draw((0,0)--(30,20)); draw((0,0)--(30,30*19/28), dotted); draw((0,0)--(31,31*21/31), dotted);  for (int i = 1; i<=31; ++i) { for (int j = 1; j<=2/3*i+1; ++j) { dot((i,j)); } }  dot((28,19), red); dot((31,21), blue); label("$m=2/3$", (33,20)); label("$m=21/31$", (33,21)); label("$m=19/28$", (33,22));  [/asy]
If $m = \frac{21}{31}$ , I will calculate by using the rectangle with blue vertex $(p,q) = (31, 21)$ , then subtract lattice points on line $x = 31$ , which is $21$ . There are 2 lattice points on the diagonal, $d=2$
If $m = \frac{19}{28}$ , I will calculate by using the rectangle with red vertex $(p,q) = (28, 19)$ , then add lattice points on line $x = 29$ and $x = 30$ , which is $19 + 20 = 39$ . There are 2 lattice points on the diagonal, $d=2$
When $m$ increases, more lattice points falls below the line $y = mx$ . Any value larger than $\frac{19}{28}$ has more than $301$ lattice points on or below $y = \frac{19}{28} x$ . So the upper bound is $\frac{19}{28}$
$\frac{19}{28}-\frac{2}{3}=\frac{1}{84}$ $\boxed{85}$

Answer: E 85