P7788 [COCI 2016/2017 #6] Savrsen
Description
A number is perfect if and only if it is equal to the sum of all its divisors that are smaller than it.
For example, $28 = 1 + 2 + 4 + 7 + 14$, so $28$ is perfect.
Based on this, we define the imperfection value $F(N)$ of a number, which is the absolute value of the difference between $N$ and the sum of all divisors of $N$ that are smaller than $N$.
For example, $F(6)=|6-1-2-3|=0$.
$F(11)=|11-1|=10$.
$F(24)=|24-1-2-3-4-6-8-12|=|-12|=12$.
Now you are given two positive integers $A$ and $B$. Please compute $F(A)+F(A+1)+...+F(B)$.
Input Format
One line with two integers $A$ and $B$, as described above.
Output Format
One line with one integer, representing $F(A)+F(A+1)+...+F(B)$.
Explanation/Hint
**Sample Explanation #1**
$F(1)+...+F(9)=1+1+2+1+4+0+6+1+5=21$.
**Constraints**
For $100\%$ of the testdata, $1 \le A,B \le 10^7$.
**Notes**
The score of this problem follows the original COCI settings, with a full score of $120$.
Translated from [COCI2016_2017](https://hsin.hr/coci/archive/2016_2017/) [CONTEST #6](https://hsin.hr/coci/archive/2016_2017/contest6_tasks.pdf) _**T4 SAVRSEN**_.
Translated by ChatGPT 5