Problem:
 Score : 400 points    Problem Statement For a positive integer X , let f(X) be the number of positive divisors of X .  Given a positive integer N , find \sum_{K=1}^N K\times f(K) .      Constraints  1 \leq N \leq 10^7         Input Input is given from Standard Input in the following format:  N       Output Print the value \sum_{K=1}^N K\times f(K) .        Sample Input 1 4      Sample Output 1 23  We have f(1)=1 , f(2)=2 , f(3)=2 , and f(4)=3 , so the answer is 1\times 1 + 2\times 2 + 3\times 2 + 4\times 3 =23 .       Sample Input 2 100      Sample Output 2 26879       Sample Input 3 10000000      Sample Output 3 838627288460105  Watch out for overflows.

Solution (Python):
N = int(input())

RL = [0] * (10 ** 7 + 10)
for i in range(1, 10 ** 7 + 10):
    RL[i] = RL[i-1] + i



ans = 0
for i in range(1, N+1):
    a = N // i
    
    ans += RL[a] * i

print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i
    m*=i
    for j in range(i,m+1,i):
        ans+=j
print(ans)

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()


def sumofdivi(n,i):
    a = n//i
    b = (a*(a+1))//2*i
    return b

ans = 0
for i in range(1,n+1):
    v = sumofdivi(n,i)
    ans += v

print(ans)

Solution (Python):

import sys

N = int(input())

list = [1] * (N+1)
ans = 1
for i in range(2,N+1):
    ans += i * (list[i] + 1)
    j = i
    if i != 1:
        while j <= N:
            list[j] = list[j] + 1
            j = j + i

print(ans)

Solution (Python):
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    n = _i()
    s = 0
    for i in range(1, n+1):
        m = n // i
        l = (m*(m+1)) // 2
        s += i*l
    return s


if __name__ == "__main__":
    print(main())

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

INF = float("inf")


N = int(input())
table = [False for i in range(N+1)]
def primes(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return is_prime

p = primes(N)
pr = []
for i in range(N+1):
    if p[i]:
        pr.append(i)
n = len(pr)
ans = 1
def dfs(cur_num,index,s,pre,me):
    global ans
    for i in range(index,n):
        if i == index:
            if cur_num*pr[i] <= N:
                ans += (pre*(me+2))*cur_num*pr[i]
                dfs(cur_num*pr[i],index,s+pre*(me+2),pre,me+1)
            else:
                break
        else:
            if cur_num*pr[i] <= N:
                ans += pre*(me+1)*2*cur_num*pr[i]
                dfs(cur_num*pr[i],i,s+pre*(me+1)*2,pre*(me+1),1)
            else:
                break
    return 
dfs(1,0,1,1,0)
print(ans)

Solution (Python):
def main():
    N = int(input())

    ans = 1
    dp = [1] * (N+1)
    for i in range(2, N+1):
        for j in range(i, N+1, i):
            dp[j] = dp[j] + 1
        ans = ans + i*dp[i]
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

import sys

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    answer=0

    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
        answer+=(table[i]*i)
    print(answer)

    return

resolve()

Solution (Python):
n = int(input())
su = 0
for i in range(1,n+1):
  t = n//i
  l = t*i
  m = t/2
  su += m*(i+l)
print(int(su))

Solution (Python):

def main():
  n=int(input())+1
  yueg=[0]*(n)
  for i in range(1,n):
    j=0
    while j < n:
      yueg[j]+=1
      j+=i
    yueg[i]*=i
  r=0  



  print(sum(yueg)-yueg[0])
main()

Solution (Python):
def f(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
        table[i] *= i
    
    return table

def main():
    N = int(input())
    ans = 0
    print(sum(f(N)))


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

M = [2 for k in range(N+1)]
M[0] = 0
M[1] = 1

for k in range(2, N+1):
    if N//k >1:
        for j in range(k, N+1-k, k):
            M[k+j] +=1

ans = 0
for k in range(1, N+1):
    ans+=(k)*M[k]
print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1,N+1):
    n = N//i
    ans += i*n*(n+1)//2
    
print(ans)

Solution (Python):
N = int(input())

ans = 0
memo = [0] * (N + 1)
for i in range(1,N+1):
    n = N // i
    if memo[n] == 0:
        tmp = n * (n + 1) // 2
        ans += tmp * i
        memo[n] = tmp
    else:
        ans += memo[n] * i
print(ans)

Solution (Python):
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction

n = int(input())

is_prime = [1]*(n + 1)
is_prime[0], is_prime[1] = 0, 0

for num in range(2, n+1):
    for mult in range(2*num, n+1, num):
        is_prime[mult] += 1
    

ans = 1
for i, elem in enumerate(is_prime[2:]):
    ans += (elem + 1)*(i + 2)

print(ans)

Solution (Python):
n = int(input())
total = 0
for i in range(1, n+1):
  total += i * (n // i) * (n // i + 1) // 2
print(total)

Solution (Python):
N = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table

S = num_divisors_table(N)

ans = 0

for i in range(1,N+1):
    ans += i*S[i]
    
print(ans)

Solution (Python):
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 

if __name__ == "__main__":
  resolve()

Solution (Python):
n=int(input())
ans=0
for i in range(1,n+1):
    num=0
    while num<=n:
        num+=i
        if (num>n):
            break
        ans+=num
print(ans)

Solution (Python):
N = int(input())

v = 0
for k in range(1, N+1):
    v += int(k/2 * (N//k) * int(1 + N/k))
print(v)

Solution (Python):
N = int(input())
dp = [1] * (N+1)
def primes(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**(0.5)+1)):
        if not is_prime[i]:
            continue
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
li_p = primes(N)
for i in li_p:
    cnt = 1
    I = i
    while i <= N:
        tmp = cnt
        cnt += 1
        for j in range(i, N+1, i):
            dp[j] //= tmp
            dp[j] *= cnt
        i *= I
ans = 0
for i in range(1, N+1):
    ans += i*dp[i]
print(ans)

Solution (Python):

import sys


def solve(N: int):
    ns = [0]*N
    for i in range(1,N+1):
        for k in range(1,N//i+1):
            ns[i*k-1] += i*k
    print(sum(ns)) 
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
from numba import njit
import numpy as np


@njit("i8(i8)")
def solve(n):
    ans = 1
    res = np.ones(n + 1, dtype=np.int64)
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            res[j] += 1
        ans += i * res[i]
    return ans


N = int(input())
print(solve(N))

Solution (Python):
def dt(n):
  table = [0] * (n + 1)
  r = 0
    
  for i in range(1, n + 1):
    for j in range(i, n + 1, i):
      table[j] += 1
    
  for i in range(1,n+1):
    r += i*table[i]
    
  return r

N = int(input())
print(dt(N))

Solution (Python):
N = int(input())
cumsum = [1] * (N+1)

for i in range(2, N+1):
  for j in range(i, N+1, i):
    cumsum[j] += 1

res = 0
for i in range(1, N+1):
  res += i * cumsum[i]

print(res)

Solution (Python):
n=int(input())
dp=[1]*((10**7)+100)
ans=1
for num in range(2,n+1):
  for i in range(num,(10**7)+1,num):
    dp[i]+=1
  ans+=dp[num]*num
print(ans)

Solution (Python):
n = int(input())
ans = 0
lst = [0]*(n+1)
for i in range(1,n+1):
    for j in range(i,n+1,i): lst[j] += 1
    ans += i*lst[i]
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n + 1):
    for j in range(i, n + 1, i):
        ans += j
print(ans)

Solution (Python):
N = int(input())
cumsum = [1] * (N+1)

for i in range(2, N+1):
  for j in range(i, N+1, i):
    cumsum[j] += 1

res = 0
for i in range(1, N+1):
  res += i * cumsum[i]

print(res)

Solution (Python):
n = int(input())
l = [2] * n
l[0] = 1
for i in range(1, n):
    for j in range(i, n, i + 1):
        if j == i:continue
        l[j] += 1
cnt = 0
for i in range(n):
    cnt = cnt + (i + 1) * l[i]
print(cnt)

Solution (Python):
import sys

from numba import njit

input = sys.stdin.readline


@njit
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table


def main():
    N = int(input())

    table = num_divisors_table(N)

    ans = 0
    for i, v in enumerate(table):
        ans += i * v

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())


def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table





li = num_divisors_table(N)


ans = 0
for i in range(N + 1):
    ans += i * li[i]

print(ans)

Solution (Python):
N=int(input())
L=[2]*(N+1)
L[1]=1
for i in range(2,N):
  j=i*2
  while j<=N:
    L[j]+=1
    j+=i
ans=0
for i in range(1,N+1):
  ans+=L[i]*i
print(ans)

Solution (Python):

import sys
import math
input = sys.stdin.readline

 
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def num_divisors_table(n):
    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    return table
n = I()
table = num_divisors_table(n)

result = 0
for i, k in enumerate(table):
    result += i * k

print(result)

Solution (Python):
import math

n = int(input())
answer = 0
c = 0
b = 0
for i in range(1,n+1):
  b = n//i
  c = i*b*(b+1)/2
  answer = answer + c
print(int(answer))

Solution (Python):
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n=N()
ans=0
for i in range(1,n+1):
    x=n//i
    ans+=(i+x*i)*x//2
print(ans)

Solution (Python):
n=int(input())

ans_tmp = sum(range(n+1)) * 2 -1

from itertools import accumulate
sum_list = list(accumulate(range(1, n)))

ans_tmp_2 = 0

for i in range(2, n+1//2+1):
    if n // i > 1:
        count_tmp = n // i
        ans_tmp_2 += i * sum_list[count_tmp - 1] - i

print(ans_tmp + ans_tmp_2)

Solution (Python):
n=int(input())
half=n//2
s=0
for i in range(1,half+1):
  w=n//i
  s+=i*w*(w+1)
s+=(n+half+1)*(n-half)
print(s//2)

Solution (Python):


N=int(input())
yaku=[0]+[1]*N

for i in range(2,N+1):
    t=N//i
    for j in range(1,t+1):
        
        yaku[i*j] +=1
ans=0
for i in range(1,N+1):
    ans += i*yaku[i]
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    a = n//i
    ans += (i + a*i)*a
print(ans//2)

Solution (Python):
N = int(input())
l = [0] * (N + 1)
s = 0
for i in range(1,N + 1):
    d = N // i
    n = 0
    for j in range(1,d + 1):
        n += i
        l[n] += 1
    s += l[i] * i
print(s)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n//2 + 1):
    ans += i * (n//i) * (n//i + 1) // 2

ans += (n + n//2 + 1) * (n - n//2) // 2

print(ans)

Solution (Python):


def main():
    n = int(input())
    a = [0] * (n + 1)
    ans = 0
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            ans += j
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    til = N//i
    divsum = int(til*(til+1)/2)
    ans += divsum*i
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n + 1):
    ans += (n//i) * (i + n // i * i) // 2
print(ans)

Solution (Python):
N = int(input())
table = [0] * (N + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        table[j] += 1
ans = 0
for i in range(N):
    i += 1
    ans += i * table[i]
print(ans)

Solution (Python):
N = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table

ls = num_divisors_table(N)
ans = 0
for i in range(1, N+1):
    ans += i * ls[i]
print(ans)

Solution (Python):
import math
N = int(input())

cnt = 0
for i in range(1, int(math.sqrt(N)+1)):
    sub = N//i
    cnt += (sub-i+1)*(sub+i)*i - i**2  
cnt = int(cnt)
print(cnt)

Solution (Python):
N = int(input())

table = [0] * (N + 1)

for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        table[j] += 1

ans = 0
for i in range(N):
    i += 1
    ans += i * table[i]

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

class Sieve:
    def __init__(self, n):
        self.plist = [2]  
        min_prime_factor = [2, 0] * (n // 2 + 5)
        for x in range(3, n + 1, 2):
            if min_prime_factor[x] == 0:
                min_prime_factor[x] = x
                self.plist.append(x)
                if x ** 2 > n: continue
                for y in range(x ** 2, n + 5, 2 * x):
                    if min_prime_factor[y] == 0:
                        min_prime_factor[y] = x
        self.min_prime_factor = min_prime_factor

    def isprime(self, x):
        return self.min_prime_factor[x] == x

    
    def pfct(self, x):
        pp, ee = [], []
        while x > 1:
            mpf = self.min_prime_factor[x]
            if pp and mpf == pp[-1]:
                ee[-1] += 1
            else:
                pp.append(mpf)
                ee.append(1)
            x //= mpf
        return ee

def main():
    sv=Sieve(10**7+5)
    n=II()
    ans=0
    for a in range(1,n+1):
        f=1
        for e in sv.pfct(a):
            f*=e+1
        ans+=a*f
    print(ans)

main()

Solution (Python):
def main():
    n = int(input())

    l = [1] * n

    for i in range(2,n+1):
        for j in range(i,n+1,i):
            l[j-1] += 1

    for i in range(n):
        l[i] *= (i+1) 
    print(sum(l))

if __name__ == "__main__":
    main()

Solution (Python):
MAX = int(input())
MAX+=1
factor = [0]*(MAX + 1); 
def generatePrimeFactors(): 
	factor[1] = 1;
	for i in range(2,MAX): 
		factor[i] = i; 
	for i in range(4,MAX,2): 
		factor[i] = 2; 

	i = 3; 
	while(i * i < MAX): 
		if (factor[i] == i): 
			j = i * i; 
			while(j < MAX): 
				if (factor[j] == j): 
					factor[j] = i; 
				j += i; 
		i+=1; 

def ca(n): 
	if (n == 1): 
		return 1; 
	ans = 1; 
	dup = factor[n]; 
	c = 1; 
	j = int(n / factor[n]); 
	while (j > 1): 
		if (factor[j] == dup): 
			c += 1; 
		else: 
			dup = factor[j]; 
			ans = ans * (c + 1); 
			c = 1; 
		j = int(j / factor[j]); 

	ans = ans * (c + 1); 
	return ans; 
generatePrimeFactors() 
r=1
for i in range(2,MAX):
    r+=i*ca(i)
print(r)

Solution (Python):
import sys
from io import StringIO
import unittest


def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table

def resolve():
    n = int(input())

    ans = num_divisors_table(n)

    print(sum([i * a for i, a in enumerate(ans)]))



class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4"""
        output = """23"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """100"""
        output = """26879"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10000000"""
        output = """838627288460105"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
N = int(input())
A = [2 for i in range(10 ** 7 + 1)]
A[1] = 1
for i in range(2, 10 ** 7 + 1):
    for j in range(2*i, 10 ** 7 + 1, i):
        A[j] +=1

ans = 0
for i in range(1, N+1):
    ans += i * A[i]
    
print(ans)

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
        table[i] *= i
    
    return table

n = int(input())
eras = num_divisors_table(n)
  
print(sum(eras))

Solution (Python):

import sys

def sumOfSeries(a,s,e):
    n = (e-a)//s+1
    return n*(a+e)//2

def solve(N: int):
    s = 0
    for i in range(1,N+1):
        
        e = N - N % i
        s += sumOfSeries(i,i,e)
    print(s)
    return




def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())

m=0
for i in range(1,N+1):
  for j in range(1,N//i+1):
    m+=i*j
print(m)

Solution (Python):


import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())


def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table


table = num_divisors_table(N)

ans = 0
for i in range(N + 1):
    ans += i * table[i]

print(ans)

Solution (Python):
import math

n = int(input())
ans = 0
SQRT = int(n ** 0.5)
for m in range(1,int(n ** 0.5) + 1):
    ans += m * (m + int(n/m)) * (int(n/m) + 1 - m)
ans -= SQRT * (SQRT+1) * (2*SQRT+1) // 6
print(ans)

Solution (Python):
n=int(input())

su = 0
for i in range(1,n+1):
    m = int(n/i)
    su += int(m*(2*i + (m-1)*i)/2)
    

print(su)

Solution (Python):
N = int(input())
div = [2]*(N+1)
div[0] = 0
div[1] = 1
for i in range(2,N//2+2):
    for j in range(i+i,N+1,i):
        div[j] += 1
ans = 0
for i in range(1,N+1):
    ans += div[i]*i
print(ans)

Solution (Python):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N = int(input())
ans = 0
for i in range(1, N+1):
    k = N // i
    ans += i * k * (k + 1) // 2
print(ans)

Solution (Python):
n=int(input())

ans=0
for i in range(1,n+1):
    f=n//i
    ans+=f*(f+1)//2*i
print(ans)

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(N):
    div = np.zeros(N+1, np.int64)
    for n in range(1, N+1):
      for m in range(n, N+1, n):
        div[m] += m
    return div.sum()

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    main = cc_export(main, (i8, ))
    cc.compile()

from my_module import main

N = int(read())
print(main(N))

Solution (Python):
def main():
    N = int(input())
    A = [1]*(N+1)
    A[0] = 0

    for i in range(2, N+1):
        j = i
        while j <= N:
            A[j] += 1
            j += i
    print(sum(i*a for i, a in enumerate(A)))


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n + 1):
    k = n // i
    ans += k * (i + i * k) // 2
print(ans)

Solution (Python):
N = int(input())

ans = 0
for n in range(1, N+1):
    ans += n * (N//n) * (N//n + 1) // 2
print(ans)

Solution (Python):
n = int(input())
divs = [1] * (n+1)
for i in range(2,n+1):
    if divs[i] != 1:continue
    for x in range(n//i,0,-1):
        cnt = 1
        while x * i**cnt < n+1:
            ind = x * (i ** cnt)
            divs[ind] = divs[x]*(cnt+1)
            cnt += 1
xs = divs[1:]
ans = 0
for i,x in enumerate(xs):
    ans += (i+1)*x
print(ans)

Solution (Python):
N = int(input())
ans = 0
cnt = 1

for i in range(1,N+1):
  a = N//i
  b = a * i
  ans += (i + b) * a /2
    
print(int(ans))

Solution (Python):
n=int(input())
A=[1]*(n+1)
A[1]=1
for i in range(2,n+1):
    for j in range(i,n+1,i):
        A[j]+=1
A[1]=1
sum=0
for i in range(1,n+1):
    sum+=i*A[i]
print(sum)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())

s = 0

for i in range(1,n+1):
    s += (i + (n - (n % i))) * (n // i) // 2

print(s)

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False



def divisor(n):
    ret = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


def sum_arr(a, d, n):
    return (n * (2 * a + (n - 1) * d)) // 2

def divisor_sum(n):
    s = 0
    for i in range(1, n + 1):
        cnt = n // i
        
        nxt = sum_arr(i, i, cnt)
        if nxt == 0:
            s += i
        else:
            s += nxt
    return s


def main():
    N = I()

    print(divisor_sum(N))



if __name__ == '__main__':
    main()

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table

n = int(input())
t = num_divisors_table(n)

ans = 0
for k in range(1, n+1):
    ans += k * t[k]
print(ans)

Solution (Python):
n=int(input())
from math import sqrt,floor
x=floor(sqrt(n))
print(sum(m*(n//m+m)*(n//m+1-m) for m in range(1,floor(sqrt(n))+1))  -x*(x+1)*(2*x+1)//6)

Solution (Python):
def main():
    N = int(input())

    dp = [1] * (N+1)
    for i in range(2, N+1):
        for j in range(i, N+1, i):
            dp[j] = dp[j] + 1
    ans = 0
    for i in range(1, N+1):
        ans = ans + dp[i] * i
    print(ans)

main()

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table




def main():
    n = int(input())
    tmp = num_divisors_table(n + 2)
    ans = 0
    for i in range(1, n + 1):
        ans += tmp[i]*i
    print(ans)
    return


if __name__ == "__main__":
    main()

Solution (Python):

def main():
  N = int(input())
  d = [1] * (N)
  ans = 0

  for i in range(2, N+1):
    f = i

    while True:
      d[f - 1] += 1
      f += i

      if(f > N):
        break

  for K in range(1, N+1):
    ans += K * d[K-1]

  print(ans)

if __name__ == "__main__":
  main()

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table
N = int(input())
table = num_divisors_table(N)
ans = 0
for i in range(1,N+1):
    ans += i*table[i]
print(ans)

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def eratosthenes(lim):
  is_p=[2]*lim

  is_p[0]=0
  is_p[1]=1

  for i in range(2,lim):
    if 1==1:


      for j in range(i*2,lim,i):


        is_p[j] += 1

  return is_p

lim=n+1
is_p=eratosthenes(lim)



ans=0
for i in range(1,n+1):
  ans+=i*is_p[i]
print(ans)

Solution (Python):
n = int(input())
a = 1
b = [0]*(n+1)
for i in range(2, int(n**(1/2))+1):
    for j in range(2, int(n/i)+1):
        if i <= j:
            b[i*j] += 1
for i in range(2, n+1):
    if int(i**(1/2))**2 == i:
        a += i*(b[i]*2+1)
    else:
        a += i*(b[i]*2+2)
print(a)

Solution (Python):
from numba import njit

@njit('i8(i8)', cache =True)
def loop(n):
  N = -(-n//2)
  ans = 0
  for i in range(1, N+1):
      x = n // i
      ans += i * x * (x+1)// 2
  return ans

n = int(input())
N = -(-n//2)
ans = loop(n)
ans -= N * (N+1) //2
ans += n * (n+1) //2
print(ans)

Solution (Python):
N, = map(int, input().split())
R = 0
for i in range(1, N+1):
    c = N//i
    R += i*c*(c+1)//2
print(R)

Solution (Python):

n = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table

fk = num_divisors_table(n+1)  
  
ans = 0
for k in range(1, n+1):
  ans += k*fk[k]
  
print(ans)

Solution (Python):
import math
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
    
  
n = int(input())

t = num_divisors_table(n)

ans = 0
for i, j in enumerate(t):
  ans += i * j
  
print(ans)

Solution (Python):
n = int(input())

a = [1] * (n+1)
ans = 1
for i in range(2, n+1):
  a[i] += 1
  for j in range(i*2, n+1, i):
    a[j] += 1
  ans += i * a[i]

print(ans)

Solution (Python):
n=int(input())
s=0
for i in range(1,int(n**0.5)+1):
  m=n//i
  s+=i*m*(m+1)//2
mx=n
for i in range(1,int((n-1)**0.5)+1):
  mn=max(n//(i+1),int(n**0.5))
  s+=i*(i+1)*(mx*(mx+1)-mn*(mn+1))//4
  mx=mn
print(s)

Solution (Python):
n = int(input())

temp = [1 for i in range(n + 1)]
ans = 1
for i in range(2, n + 1):
    temp[i] += 1
    ans += i * temp[i]
    count = 2
    while i * count <= n:
        temp[i * count] += 1
        count += 1

print(ans)

Solution (Python):
import sys

import math
import collections

import bisect
import itertools
import fractions

import copy

import decimal

import queue



sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))




def main():
    n = ni()

    
    

    
    ans = 0
    for i in range(1, n + 1):
        ans += (n // i) * (2 * i + (n // i - 1) * i) // 2

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
lst = [0]*(n+1)
for i in range(1,n+1):
    for j in range(i,n+1,i): lst[j] += 1
for i in range(1,n+1):
    ans += i*lst[i]
print(ans)

Solution (Python):
n = int(input())
L = [1] * n
ans = 0
for i in range(1, n+1):
    nn = n // i
    ans += i * (nn + nn * (nn - 1) // 2)
print(ans)

Solution (Python):
n = int(input())
t = [1]*(n+1)
for i in range(2,n+1):
    for j in range(1,n//i+1):
        t[i*j] += 1
p = 0
for i in range(1,n+1):
    p += t[i]*i
print(p)

Solution (Python):
import sys
input = sys.stdin.readline
from collections import Counter
import numpy as np
from numba import njit


def read():
    N = int(input().strip())
    return N,


@njit
def f(n):
    """
    約数の個数を求める
    """
    ndivs = np.ones((n+1), dtype=np.int32)
    for i in range(2, n+1):
        for j in range(i, n+1, i):
            ndivs[j] += 1
    return ndivs


@njit
def solve(N):
    fn = f(N)
    ans = 0
    for k in range(1, N+1):
        ans += k * fn[k]
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):

"""
@author: H_Hoshigi
"""
def main():
    N = int(input())

    answer = 0
    for i in range(1, N+1):
        quotient = N // i
        answer += (((1+quotient)*quotient) // 2) * i
    print(answer)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans = 0

for i in range(1, N+1):
    ans += i * (1 + (N // i)) * (N // i) // 2

print(ans)

Solution (Python):
n=int(input())
s=0
for i in range (1,n+1):
    a=n//i
    z=a*(a+1)*i//2
    s+=z
print(s)

Solution (Python):
def LI():return list(map(int,input().split()))

n=int(input())

def main(n):
    ans=0
    from math import floor
    
    def f(n):
        return n*(n+1)*(2*n+1)//6
        
    for m in range(1,floor(n**0.5)+1):
        tmp=m*(m+floor(n/m))*(floor(n/m)+1-m)
        ans+=tmp
        
    return (ans-f(floor(n**0.5)))

print(main(n))

Solution (Python):
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))


N = INT()












ans = 0
for i in range(1, N+1):
    tmp = (N//i)
    ans += tmp * (tmp+1) // 2 * i
print(ans)

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    return table


N = int(input())
ans = 0
L = num_divisors_table(N)[1:]

for i in range(N):
    ans += (i+1)*L[i]
print(ans)

Solution (Python):
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in xrange(1, n + 1):
        for j in xrange(i, n + 1, i):
            table[j] += 1
    
    return table
  
n = int(input())  
a =  num_divisors_table(n)
ans = 0
for i in range(n+1):
  ans += i*a[i]
print(ans)

Solution (Python):
N = int(input())

ans = 0

t = N // 2

for i in range(1, t+1):
  d = N // i
  ans += d * (i + i*d)

ans += (t+1 + N) * (N-t)

print(ans // 2)