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())
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):
    ans += (n//i)*(i+(i*(n//i)))//2

print(ans)

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

ans = 0

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

Solution (Python):

import os
import sys
from io import BytesIO, IOBase
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 

from math import gcd, ceil
 
def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi
 
 
def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans
 
def lcm(a, b): return a * b // gcd(a, b)
 
 
def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


N = int(input())
k = int(1e7+1)
muls = [0] * k
for i in range(1, N+1):
    for j in range(0, N+1, i):
        muls[j] += 1

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

print(ans)

Solution (Python):
N=int(input())
if N==1:
    print(1)
    exit()
def divisor(n):
    m=N//n
    return n*m*(m+1)//2
M=N//2
ans=0
for i in range(2,M+1):
    ans+=divisor(i)
ans+=N*(N+1)-M*(M+1)//2
print(ans)

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

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

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

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

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

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

print(ans)

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

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

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

print(ans)

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

Solution (Python):
import math
N = int(input())
cnt_list = [0] * N
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        cnt_list[j - 1] += 1
ans = 0
for h in range(1, N + 1):
    ans += h * cnt_list[h -1]
print(ans)

Solution (Python):
N = int(input()); print(sum((((N // i) * (2 * i + (N // i - 1) * i) // 2) for i in range(1, N + 1))))

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

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

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

Solution (Python):











def solve(N):
    answer = 0
    for i in range(1, N + 1):
        mprime = N // i
        answer += i * (mprime * (mprime + 1)) // 2
    return answer


def main():
    N = int(input())  
    answer = solve(N)
    print(answer)


if __name__ == "__main__":
    main()

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

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

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

dp = [0]*(n+1)

for i in range(1,n+1):
  x = n//i
  for j in range(1,x+1):
    dp[i*j]+=1
    
sum_div = 0
for i in range(1,n+1):
  sum_div += i*dp[i]
print(sum_div)

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

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

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

print(ans)

Solution (Python):
def main():

    N = int(input())

    ans = 0

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

    print(int(ans/2))

if __name__ =="__main__":
    main()

Solution (Python):
def main():

    N = int(input())

    ans = 0

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

    print(int(ans/2))

if __name__ =="__main__":
    main()

Solution (Python):

import numba  
from numba import njit, b1, i4, i8, f8  

N = int(input())


@njit((i8, ), cache=True)
def main(N):
    ans = 0
    for j in range(1, N + 1):
        x = N // j
        ans += int(j * x * (x + 1) / 2)
    return ans


print(main(N))

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

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

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

print(ans)

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

Solution (Python):
'''
Created on 2020/08/23

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=0
  for i in range(1,N+1):
    ans+=((N//i)*(N//i+1)*i)//2
  print(ans)
  return
main()

Solution (Python):
'''
Created on 2020/08/23

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  ans=0
  for i in range(1,N+1):
    ans+=((N//i)*(N//i+1)*i)//2
  print(ans)
  return
main()

Solution (Python):
def solve(n):
    su = 0
    for i in range(1, n+1):
        m = n//i
        su += m*(2*i + (m-1)*i)//2
    return su

n = int(input())
print(solve(n))

Solution (Python):

import sys


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


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8)')(solve)
    cc.compile()
    exit()

n = int(input())
print(solve(n))

Solution (Python):
def solve():
    N = int(input())
    ans = 0
    for k in range(1, N+1):
        x = N // k
        ans += x * (k + x*k) // 2
    print(ans)

if __name__ == "__main__":
    solve()

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

print(ans)

Solution (Python):
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    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] += j
    
    return table
  
n=int(input())
print(sum(num_divisors_table(n)))

Solution (Python):

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from numba import njit
def main():
    @njit
    def solve(n):
        r = 0
        for i1 in range(1, n + 1):
            for i2 in range(i1, n + 1, i1):
                r += i2
        return r
    no = int(input())
    print(solve(no))
if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numba
def main():
    @numba.njit('(i8,)', cache=True)
    def solve(n):
        r = 0
        for i1 in range(1, n + 1):
            y = n // i1
            r += y * (y + 1) // 2 * i1
        return r
    no = int(input())
    print(solve(no))

if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numba
def main():
    @numba.njit
    def solve(n):
        r = 0
        for i1 in range(1, n + 1):
            y = n // i1
            r += y * (y + 1) // 2 * i1
        return r
    no = int(input())
    print(solve(no))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    r = 0
    for i1 in range(1, n + 1):
        y = n // i1
        r += y * (y + 1) // 2 * i1
    print(r)


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())

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

Solution (Python):

"""
def factorization(n):
    if (n == 1 ):
        return [1]
    arr = []
    temp = n

    
    for i in range(2, int(-(-n**0.5//1))+1) :
        if ( temp % i == 0):
            cnt = 0
            while (temp % i == 0):
                cnt +=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return [arr[1]+1 for arr in arr ]



sum_ans = 0
def cal(list):
    ans = 1
    for i in list:
        ans *= i

    return ans


for i in range(1,N+1):
    
    sum_ans += i * cal(factorization(i))
    

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

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

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

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

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

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

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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

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

ans=0

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

print(int(ans))

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

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


def main():
    n = int(input())
    table = [1]*(n+1)
    
    for i in range(2, n+1):
        for j in range(i, n+1, i):
            table[j] += 1
    
    ans = 0
    for i in range(n+1):
        ans += table[i]*i
    
    print(ans)
    
    
if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=[0]*N
ans=0
for i in range(1,N+1):
  ii=i
  while N>=ii:
    A[ii-1]+=1
    ii+=i
  ans+=A[i-1]*i
print(ans)

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

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

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

print(ans)

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

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

ans=0

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

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

ans=0

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

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

sum_num = 0
for i in range(1, N+1):
    x = N//i
    m = (x*(x+1) // 2) * i
    sum_num += m

print(sum_num)

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

Solution (Python):
ans = 0

N = int(input())

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

print(ans)

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
N=int(sys.stdin.readline())

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

Solution (Python):
import sys
N=int(sys.stdin.readline())
ans=sum((N//x)*(N//x+1)*x//2 for x in range(1,N+1))
print(ans)

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

if __name__ == '__main__':
    main()

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

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd


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

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

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

ans = 0

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

print(ans)

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

ans = 0

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

print(ans)

Solution (Python):
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):
def main():
    n = int(input())
    ans = 0
    for k in range(1,n+1):
        ans += k * (n//k) * (n//k+1) //2
    print(ans)

if __name__ == "__main__":
    main()

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

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

solve()

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


def g(n,X):
    m=X//n
    s=(m*(m+1)//2)*n
    return s

ans=0
for i in range(1,N+1):
    ans += g(i,N)
    
print(ans)

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

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

ans = 0

for i in range(1,n+1):
    a = n//i
    b = i*a

    ans += (i+b)*a//2

print(ans)

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

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

print(ans)

Solution (Python):
N = int(input())
divisors = [0 for _ in range(N+1)]
result = 0

for n in range(1, N+1):
  for m in range(n, N+1, n):
    divisors[m] += 1
for i, d in enumerate(divisors):
  result += i * d
print(result)

Solution (Python):
N = int(input())
divisors = [1 for _ in range(N+1)]
result = 0

for n in range(2, N+1):
  for m in range(n, N+1, n):
    divisors[m] += 1
for i, d in enumerate(divisors):
  result += i * d
print(result)

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

Solution (Python):
def func(n):
    return n*(n+1)//2

def main():
    import sys
    input = sys.stdin.readline

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

    print(ans)

if __name__ == '__main__':
    main()

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

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

ans = 0

for b in range(1, n+1):
  y = n // b
  ans += y*(y+1)*b/2

print(int(ans))

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

s = int(n*(n+1)/2)

for l in range(2,n+1):
    i = 1
    while l*i <= n:
        s += l*i
        i += 1
print(s)

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

s = int(N*(N+1)/2)
for k in range(2,N+1):
    i = 1
    while k*i <= N:
        s += k*i
        i += 1

print(s)

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

ans = (1 + n) * n // 2
for i in range(2, n + 1):
    for j in range(1, n):
        if i * j > n:
            break
        ans += i * j
print(ans)

Solution (Python):
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]



n = I()
ans = 0
for i in range(1,n+1):
    for j in range(i,n+1,i):
        ans += j
print(ans)

Solution (Python):


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

    anss = [0]*(N+1)

    for i in range(1, N+1):
        j = 1
        while i*j <= N:
            anss[i*j] += 1
            j += 1

    ans = 0
    for i, a in enumerate(anss[1:]):
        ans += (i+1)*a
    print(ans)


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

    i = 1
    ans = 0
    while N//i != 0:
        n = N//i
        ans += i*((n*(n+1))//2)
        i += 1
    print(ans)


if __name__ == "__main__":
    solve2()

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    ans = 0
    n = int(input())
    for j in range(1,n+1):
        ans += j*(n//j)*(n//j + 1)//2
    print(ans)

if __name__=="__main__":
    main()

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

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

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

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

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

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

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

print(ans)

Solution (Python):



def main():
  n = int(input())
  def f(d, n):
    m = n // d
    return m * (m+1) * d // 2
  print(sum([f(d, n) for d in range(1, n+1)]))
  
if __name__=='__main__':
  main()

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

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

Solution (Python):
import numpy as np

N = int(input())

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


print(count)

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

def calc_sum(b, e):
    cnt = (e - b) // b + 1
    return (b + e) * cnt // 2

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

print(ans)

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

cnt = [1] * (n + 1)
cnt[0] = 0
cnt[1] = 0

p = 2
while p  <= n // 2:
    for i in range(p*2, n+1, p):
        cnt[i] += 1
    p += 1

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

print(ans)

Solution (Python):
class Osa_k:
    def __init__(self, n_max):
        self.n_max = n_max
        self.min_factor = min_factor = list(range(n_max + 1))
        min_factor[2::2] = [2] * (n_max // 2)
        min_factor[3::6] = [3] * ((n_max + 3) // 6)
        for i in range(5, int(n_max ** .5) + 1, 2):
            if min_factor[i] == i:
                for j in range(i*i, n_max + 1, i):
                    if min_factor[j] == j:
                        min_factor[j] = i

    def __call__(self, n):
        min_factor = self.min_factor
        t = []
        while n > 1:
            if t and t[-1][0] == min_factor[n]:
                t[-1][1] += 1
            else:
                t.append([min_factor[n], 1])
            n //= min_factor[n]
        res = 1
        for _, i in t:
            res *= i + 1
        return res

P = Osa_k(10**7)
print(sum(i * P(i) for i in range(1, int(input()) + 1)))

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

Solution (Python):
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


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

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

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

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

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
l = N//2
for i in range(1, l+1): 
    n = N//i
    ans += i*n*(n+1)//2
    

ans += (l+1+N)*(N-l)//2

print(ans)

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

total = 0
for n in range(1, N+1):
    total += N//n * (n + N - N%n)//2

print(total)

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

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

times_ls = [0] * (n+1)
for base in range(1,n+1):
    for j in range(1,n+1):
        if base * j <= n:
            times_ls[base * j] += 1
        else:
            break
ans = 0
for i in range(1,n+1):
    ans += i * times_ls[i]
print(ans)

Solution (Python):
n = int(input())
cnt_tb = [0]*(n+1)
for i in range(1, n + 1):
    j = 1
    tmp = i*j
    while (tmp < n+1):
        cnt_tb[tmp] += 1
        j += 1
        tmp = i*j
ans = 0
for i in range(1, len(cnt_tb)):
    ans += i * cnt_tb[i]
print(ans)

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

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

  
  last_term = n // i * i
  num_term = (last_term - i) // i + 1
  ans += (i + last_term) * num_term // 2
   

print(ans)

Solution (Python):

N = int(input())

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

Solution (Python):

N = int(input())

ctr = [1] * (N + 1)
for n in range(2, N + 1):
    for v in range(n, N + 1, n):
        ctr[v] += 1

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

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

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

print(ans)

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

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

Solution (Python):
import math
import math
N = int(input())
N_MAX = 10 ** 7
table = [1]*N

def get_divisors(n):
  num = 0
  ceil = n
  if n == 1:
    return 1
  for i in range(1, n+1):
    q, mod = divmod(n, i)
    if mod == 0: 
      num += 2
      ceil = q
    if i < ceil: break
  print(n, num)
  return num

ans = 0
for i in range(2,N+1):
  for j in range(1,math.floor(N/i)+1):
    table[i*j-1] += 1

for i, div in enumerate(table):
  ans += (i+1)*div
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())

res = 0
for k in range(1, N+1):
    y = N // k
    res += k * y * (y+1) // 2

print(res)

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
res = [0] * (n+1)
ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        if i*j > n: break
        res[i*j] += 1
    ans += i*res[i]
print(ans)

Solution (Python):
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())
now=0
for i in range(1,n+1):
    now+=(i+(i*(n//i)))*(n//i)//2
print(now)

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

def g(x):
    return x*(x+1)//2

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

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

Solution (Python):
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):
    k = n//i
    ans += k*(k+1)*i//2
    
print(ans)

Solution (Python):
def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(4, n + 1, 2):
        sieve[i] = 2
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i * 2):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


def f(X):
    t = []
    a = X
    while a != 1:
        if len(t) != 0 and t[-1][0] == prime_table[a]:
            t[-1][1] += 1
        else:
            t.append([prime_table[a], 1])
        a //= prime_table[a]
    result = 1
    for _, n in t:
        result *= n + 1
    return result


N = int(input())

prime_table = make_prime_table(N)
result = 0
for K in range(1, N + 1):
    result += K * f(K)
print(result)

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

Solution (Python):

N = int(input())
ssum = 0

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

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

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

print(int(ans))

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

def gauss_count(n):
    return n*(n+1)//2

print(sum(x * gauss_count(N//x) for x in range(1, N+1)))

Solution (Python):
import math

N = int(input())
s = 0













for i in range(1,N+1):
    y = math.floor(N/i)
    s += y*(y+1)*i//2

print(s)

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

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

print(ans)

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

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

print(ans)

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

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

def cnt(n):
  c = 0
  for i in range(1, N+1):
    n = N // i
    j  = i * n
    c += (i + j) * n // 2
  return c

print(cnt(N))

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

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

total = 0
for j in range(1, n + 1):
  max_num = n // j
  total += (1 + max_num) * max_num * j // 2
print(total)

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

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

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

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