DIVSUM  Divisor Summation
Given a natural number n (1 <= n <= 500000), please output the summation of all its proper divisors.
Definition: A proper divisor of a natural number is the divisor that is strictly less than the number.
e.g. number 20 has 5 proper divisors: 1, 2, 4, 5, 10, and the divisor summation is: 1 + 2 + 4 + 5 + 10 = 22.
Input
An integer stating the number of test cases (equal to about 200000), and that many lines follow, each containing one integer between 1 and 500000 inclusive.
Output
One integer each line: the divisor summation of the integer given respectively.
Example
Sample Input: 3 2 10 20 Sample Output: 1 8 22
Warning: large Input/Output data, be careful with certain languages
hide comments
blackbitch_48:
20170320 07:33:21
@az10 check it on spoj toolkit


ankitshrey112:
20170312 23:22:05
easy one 0.34s.


az10:
20170122 22:24:17
where can we see the answers when we do not know the answer? 

shubham_cs_iet:
20170118 22:10:44
Nice question. 

code_aim:
20161211 12:41:52
Very good question.


lrx_22:
20161210 17:41:15
You should check if your solution works with square numbers, I got WA at first because of this 

rahul_s19:
20161209 21:22:55
take care of n=1 

aditya_rev:
20161114 07:36:03
my 6th, and still getting WA. whyy?? :( 

tungtd95:
20161111 12:10:21
brute force 2.91s LOL!!!!!!!!!!! 

av_maths9:
20161025 15:58:19
is there any rule to write code....Because my code is working properly giving right outputs then only website says answer is wrong.

Added by:  Neal Zane 
Date:  20040610 
Time limit:  3s 
Source limit:  5000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  Neal Zane 