| UFPE Starters Final Try-Outs 2025 |
|---|
| Закончено |
Geovany runs the great Paper Cup factory! At the factory, Paper Cups of various sizes are produced. More precisely, Paper Cups are produced in all sizes that are an integer $$$x$$$ such that $$$ 1 \le x \le 10^{16} $$$. These cups are so precisely manufactured that a cup of size $$$x$$$ fits perfectly inside a cup of size $$$x+1$$$.
Some sizes of Paper Cups. But the most important product of the Paper Cup factory is the Legendary Paper Cup! A Legendary Paper Cup is produced by combining $$$3$$$ Paper Cups of sizes $$$x$$$, $$$(x+1)$$$, and $$$(x+2)$$$ , and its value becomes $$$ x \times (x+1) \times (x+2) $$$ .
One day, however, Geovany's loyal employees Henrique and Ballon discovered counterfeit Legendary Paper Cups!!! Cheap copies!!! Seeking help from the hero Leo Angels to investigate the case, they found out that Oel Demons was behind it all!
Oel Demons is advertising that they sell Legendary Paper Cups with all values in a given interval $$$[L, R]$$$ , but this is obviously a lie, given the manufacturing constraints of Legendary Paper Cups!!!
Now, it's up to you to help our heroes expose Oel Demons' fraud by telling: how many Legendary Paper Cups in this interval can actually be real?
More precisely, given several intervals $$$[L, R]$$$ , determine how many integers $$$L \le x \le R$$$ are the product of three consecutive integers.
The first line of input contains an integer $$$t$$$ ($$$1 \le t \le 10^{6}$$$), the number of test cases.
The next $$$t$$$ lines contain two integers $$$L$$$ and $$$R$$$ ($$$1 \le L \le R \le 10^{16}$$$).
For each test case, print a single integer $$$x$$$, the answer for the interval $$$[L, R]$$$.
41 1010 100100 1000999900 999999
1 2 6 1
In the first test case, the only Paper Cup that can be a Legendary Paper Cup is number $$$6$$$, since $$$6 = 1 \times 2 \times 3$$$.
In the second test case, only $$$24$$$ and $$$60$$$ can be Legendary Copo Papels, since $$$ 24 = 2 \times 3 \times 4 $$$ and $$$ 60 = 3 \times 4 \times 5$$$.
| Название |
|---|


