Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Let's See!

By Shahwat_Has9 · Limits 1s, 825 MB

There is a math wizard in the University of Mathcraft. In the inter-university problem-solving contest, you faced that wizard in the final round of this contest. Basically, the rule is in a particular round two problem solver will face each other and one will set a problem for his opponent.

In the final round, the problem you set for the wizard has been solved by him. So to equalize the points in this round, you need to solve the problem set by the wizard. Or you will lose the trophy. You don't want that, do you?

In this problem, you will get to play a box game where you will receive some boxes. In a particular box, there is some money stored in it.
In box no. x, the total money stored is: (x % 1) + (x % 2) + (x % 3) + ....... + (x % x).

Calculate the sum of all x, where total_money_in_box(x) = total_money_in_box(x - 1) and L <= x <= R .

Remember in box no. 0, total money stored in it = 0.

x should be in between L and R.


First line contains an integer T. T denotes the number test cases here.

Next T line will contain two integers, L and R.

1 ≤ T ≤ 100000

1 ≤ L, R ≤ 1000000000000000000


Print the output according to the statement.

It is guaranteed that the answer will fit the 64-bit integer.


1 3


In this problem, the '%' operator denotes the modulo operation.



75% Solution Ratio

TurinhstuEarliest, Nov '19

BSMRSTU_SurvivFastest, 0.0s

TurinhstuLightest, 2.1 MB

steinumShortest, 168B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.