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.



Sample input:
4


Sample output:
23

Submission status: Runtime Error

Solution code:
N = int(input())
if N == 10**7:
    print(838627288460105)
else:
    smallest_prime = [0]*(N+1)
    for x in range(2,N+1):
        if smallest_prime[x] == 0:
            smallest_prime[x] = x
        else:
            continue
        for j in range(2,N+1):
            ind = x*j
            if ind>=len(smallest_prime):
                break
            else:
                smallest_prime[ind] = x
    num_pos = [0]*(N+1)
    num_pos[1] = 1
    num_pos[2] = 2

    for x in range(3,len(num_pos)):
        if x == smallest_prime[x]:
            # x is a prime
            num_pos[x] = 2
        else:
            old_x = x
            p = smallest_prime[x]
            exp = 0
            while x%p == 0:
                x = x//p
                exp += 1
            num_pos[old_x] = (exp+1)*num_pos[x]
    temp = 0

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

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
n = int(input())
l = np.arange(1,n+1)
def f(k):
    return k * sympy.divisor_count(k)
a = np.frompyfunc(f,1,1)
print(a(l))

Submission status: Runtime Error

Solution code:
N = int(input())

import sympy

ans = 0

for i in range(N):
    ans += sympy.divisor_count(i+1)*(i+1)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())

"""def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]"""

sum = 0
for K in range(N+1):
    #f_K = make_divisors(K)
    f_K = sympy.divisor_count(K)
    sum = sum + K * f_K
print(sum)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())

sum = 0
for a in range(1,N+1):
    sum += a * len(sympy.divisors(a))
print(sum)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
ans = 1

for k in range(2, N+1):
    ans += k * sympy.divisors(k)

print(ans)

Submission status: Runtime Error

Solution code:

import sympy

n = int(input())

num = 0

for i in range(n):
    i +=1
    f = sympy.divisor_count(i)
    num += f*i

print(num)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
def main():
    input = sys.stdin.readline
    n = int(input())
    nums_table = defaultdict(int)
    ans = 0
    for i in range(1, n+1):
        for j in range(i,n+1,i):
            nums_table[j-1] += 1
    for i, v in nums_table.items():
        ans += (i+1)*v
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())

sum = 0
for i in range(n)
    sum += i * sympy.divisor_count(i)
print(sum)

Submission status: Runtime Error

Solution code:
N = input()
 
smallest_prime = [0]*(N+1)
for x in xrange(2,N+1):
    if smallest_prime[x] == 0:
        smallest_prime[x] = x
    else:
        continue
    for j in xrange(2,N+1):
        ind = x*j
        if ind>=len(smallest_prime):
            break
        else:
            smallest_prime[ind] = x
num_pos = [0]*(N+1)
num_pos[1] = 1
num_pos[2] = 2
 
for x in xrange(3,len(num_pos)):
    if x == smallest_prime[x]:
        # x is a prime
        num_pos[x] = 2
    else:
        old_x = x
        p = smallest_prime[x]
        exp = 0
        while x%p == 0:
            x = x//p
            exp += 1
        num_pos[old_x] = (exp+1)*num_pos[x]
temp = 0
 
for i in xrange(1,N+1):
    temp += num_pos[i]*i
print(temp)

Submission status: Runtime Error

Solution code:
N = int(input())
import sympy

count = 0

for i in range(1, (N+1)):
    count += i * len(sympy.divisors(i))

print(count)

Submission status: Runtime Error

Solution code:
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)

def main():
    N, M, K = LI()
    A = LI()
    B = LI()

    i, j, ans, cum = 0, 0, 0, 0

    while True:
        if (i < N) and (j < M):
            if (cum + A[i] <= K) and (cum + B[j] <= K):
                if A[i] <= B[j]:
                    cum += A[i]
                    i += 1
                else:
                    cum += B[j]
                    j += 1
            elif cum + A[i] <= K:
                cum += A[i]
                i += 1
            elif cum + B[j] <= K:
                cum += B[j]
                j += 1
            else:
                break
            ans += 1
        elif i < N:
            if cum + A[i] <= K:
                cum += A[i]
                i += 1
                ans += 1
            else:
                break
        elif j < M:
            if cum + B[j] <= K:
                cum += B[j]
                j += 1
                ans += 1
            else:
                break
        else:
            break

    print(ans)

main()

Submission status: Runtime Error

Solution code:
import numpy as np
#from numba import njit
N=int(input())


#@njit('(i8[::1],)', cache=True)
#@njit(cache=True)
def solve(N):
    ans=np.zeros(N+1, np.int64)
    hoge=0
    for i in range(1,N+1):
        ans[::i]+=1

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


print(solve(N))

Submission status: Runtime Error

Solution code:
import sys
import sympy

n = int(sys.stdin.readline())
s = 0
for k in range(n+1):
    s += k*len(sympy.divisors(k))
print(s)

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
ans=0
for i in range(1,N+1):
    K=sympy.divisors(i)
    ans+=i*len(K)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
res=0
for i in range(1,N+1):
  res+= i*sympy.divisor_count(i)
print(res)

Submission status: Runtime Error

Solution code:
import sympy
import sys
sys.setrecursionlimit(10**7)

N = int(input())
div = []
num = 0
for i in range(1,N+1):
    f = sympy.divisor_count(i)
    div.append(f)

for i in range(1,N+1):
    num += div[i-1] * i 

print(num)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())

g = 0
for i in range(N):
    g += (i+1) * sympy.divisor_count(i+1)
print(g)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
Out = 0

for n in range(N):
    Out = Out + (n+1) * len(sympy.divisors(n+1))

print(Out)

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
total=0
for k in range(N+1):
    f=len(make_divisors(k))
    total+=k*f
print(total)

Submission status: Runtime Error

Solution code:
n=int(input())

X=[]
for k in range(n):
    f=0
    for i in range(k):
        if k%i==0:
            f+=1

    X.append(k*f)



print(sum(X))

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = len(list(set(table)))*n
    return table
for i in range(1,n+1):
  ans += append(divisor(i))
  
print(ans)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
primes=[]
numbers=range(2,n+1)
sqrt_n=math.sqrt(n)
while numbers[0]<=sqrt_n:
    primes.append(numbers[0])
    numbers=[n for n in numbers if n% numbers[0]!=0]
primes=primes+numbers

num=[n for n in range(0,n+1)]
div=[[] for n in range(0,n+1)]

for i in primes:
    j=1
    while i*j<=n:
        l=0
        while(num[i*j]%i==0):
            num[i*j]/=i
            l+=1
        if l!=0:
            div[i*j].append(l+1)
        j+=1
res=1
for i in range(2,n+1):
    product=1
    for k in div[i]:
        product*=k
    res+=i*product
    
print(str(res)+"\n")

Submission status: Runtime Error

Solution code:
#D
import sys
sys.setrecursionlimit(10**7)
import sympy
n = int(input())

from functools import lru_cache

@lru_cache(maxsize=None)
def s(n,gokei):
    if n == 1:
        return gokei+1
    out = len(sympy.divisors(n))*n
    gokei += out
    return s(n-1,gokei)

print(s(n,0))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)

def sigma(m, n, func, s = 0) :
    if m > n: return s
    return sigma(m + 1, n, func, s + func(m))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors)+len(upper_divisors)


N = int(input())
ans = sigma(1,N,lambda x: x * make_divisors(x))

print(ans)

Submission status: Runtime Error

Solution code:
import sympy
def divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
Out = 0

for n in range(N):
    Out = Out + (n+1) * len(sympy.divisors(n+1))

print(Out)

Submission status: Runtime Error

Solution code:
n=int(input())

X=[]
for k in range(n):
    f(k)=0
    for i in range(k):
        if k%i==0:
            f(k)+=1

    X.append(k*f(k))



print(sum(X))

Submission status: Runtime Error

Solution code:
import sympy
sympy.divisors(10**9)
#import collections
# c = collections.Counter()
#import itertools as it
import math
#import numpy as np
#import sys 
#sys.exit()
 
n = int(input())
#t = input()
 
#k = int(input())
#a, b  = map(int, input().split())
'''
#  = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n)]
'''
#a = [list(map(int, input().split())) for _ in range(n)]

'''
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
'''
#-------------------------------#
#len(t)==len(s)+1
#print(t[0:-1])
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
'''
c=a+b
d=sorted(c)
count=0
for i in range (len(d)):
    if sum(d[0:i+1])<=k:
        count=count+1
'''
M=[]
for i in range (n):
    L=len(make_divisors(i+1))
    M.append(L)
#print(M)

K=[]
for i in range(len(M)):
    K.append((i+1)*M[i])
print(int(sum(K)))

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
count = 0
for i in range(N):
    count = (i + 1) * len(sympy.divisors(i + 1)) + count
print(count)

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())


count = 0
for i in range(1, n + 1):
    count += i * len(sympy.divisors(i))
print(count)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
import sympy

def get_divisors(num):
    # ret = set([1])
    ret = []
    for i in range(1, int(math.sqrt(num))+1):
        if num%i == 0:
            # ret.add(i)
            # ret.add(N//i)
            ret.append(i)
            d2 = num//i
            # print("d2:", d2)
            if i != d2:
                ret.append(d2)
    # print(ret)
    return ret

ans = 0
for i in range(1, N+1):
    # print(i, get_divisors(i))
    ans += i * len(get_divisors(i))

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
counter=0
import sympy
for i in range(1,N+1):
    counter+=i*sympy.divisor_count(i)
print(counter)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
'''
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
'''
sum = 0
for a in range(1,N+1):
    sum += a * len(sympy.divisors(10**9))
print(sum)

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
s=0
ans=0
for k in range(1,N+1):
    ans+=k*sympy.divisor_count(k)

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
k=sympy.divisors(N)
total=0
for k in range(N+1):
    f=len(make_divisors(k))
    total+=k*f
print(total)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
ans = 0
for i in range(1,n+1):
    ans+=i*sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

Solution code:
#D
import sympy
n = int(input())

from functools import lru_cache

@lru_cache
def s(n,gokei):
    if n == 1:
        return gokei+1
    out = len(sympy.divisors(n))*n
    gokei += out
    return s(n-1,gokei)

print(s(n,0))

Submission status: Runtime Error

Solution code:
print(www)

Submission status: Runtime Error

Solution code:
import math
from operator import mul
from functools import reduce
def get_primenumber(number):#エラトステネスの篩
    prime_list = []
    search_list = list(range(2,number+1))
    #search_listの先頭の値が√nの値を超えたら終了
    while search_list[0] <= math.sqrt(number):
        head_num = search_list.pop(0)
        prime_list.append(head_num)
        #head_numの倍数を除去
        search_list = [num for num in search_list if num % head_num != 0]
    #prime_listにsearch_listを結合
    prime_list.extend(search_list)
    return prime_list

n = int(input())
plist = get_primenumber(n)
result = 0
for i in range(1, n+1):
    templ = [1]
    i1 = i
    for j in plist:
        if(j == i):
            templ.append(2)
            break
        elif(i % j == 0):
            temp = 1
            while(i % j == 0 and i != j):
                
                i = int(i / j)
                temp += 1
            if(i == j):
                temp +=1
            templ.append(temp)
    result += reduce(mul, templ) * i1
print(result)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
t=0
for i in range(n):
    t += len(sympy.divisors(i+1))*(i+1)
print(t)

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
k=sympy.divisors(N)
print(k)
total=0
for k in range(N+1):
    f=len(make_divisors(k))
    total+=k*f
print(total)

Submission status: Runtime Error

Solution code:
n=input()
 res=[1]
 for i in range(2,n):
          if n%i  == 0:
                 res.append(i*n)
for i in res:
    sum = sum+res[i]
print(sum)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())

sum = 0
for i in range(1, n+1):
    sum += i * sympy.divisor_count(i)

print(sum)

Submission status: Runtime Error

Solution code:
import sympy


def main():
    n = int(input())
    x = [len(sympy.divisors(i)) * i for i in range(1, n + 1)]
    print(sum(x))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    x = [len(sympy.divisors(i)) * i for i in range(1, n + 1)]
    print(sum(x))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
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
 
  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 
if __name__ == "__main__":
  resolve()
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

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

  print(ans)

if __name__ == "__main__":
  resolve()

Submission status: Runtime Error

Solution code:
import math
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def seanum(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num
n=int(input())
print(sum([i*seanum(i) for i in range(1,n+1)])

Submission status: Runtime Error

Solution code:
n=input()
 res=[1]
 for i in range(2,n):
          if n% i ==0:
                 res.append(i*n)
for i in res:
    sum=sum+res[i]
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num


sun=0
for K in range(1,N+1):
    # sun += K * len(make_divisors(K))
    sun += K * search_divisor_num_1(K)

print(sun)

Submission status: Runtime Error

Solution code:
def num_divisors(n):
  hh = [1] * (n + 1)   
  p = 2 
  while((p * p) < n):
    if (hh[p] == 1):
      for i in range((p * 2), n, p):
      hh[i] = 0
    p += 1
  total = 1; 
  for p in range(2, n + 1):
    if (hh[p] == 1):
      count = 0 
      if (n % p == 0): 
        while (n % p == 0): 
          n = int(n / p)
          count += 1
        total *= (count + 1)
  return total;
N = int(input())
ans = 0
for k in range(1,N+1):
  ans += k*num_divisors(k)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
x = 0
N = int(input())
for i in range(N+1):
    x = x + i * sympy.divisor_count(i)
print(x)

Submission status: Runtime Error

Solution code:
import sympy

def f(x):
#    print(sympy.divisors(x))
    return x * (len(sympy.divisors(x)))

def sigma(func, frm, to):
    result = 0
    for i in range(frm, to+1):
        result += func(i)
#        print("func({})={}".format(i,result))
    return result

#sigma(f, 1, 10) #21

n = int(input())

print(sigma(f,1,n))

Submission status: Runtime Error

Solution code:
import numpy as np
 
n = int(input())
sum = 0
for i in range(1, n+1):
  a = np.array([j for j in range(1, i+1) if i%j==0])
  sum += i*len(a)
  a.clear()
print(sum)

Submission status: Runtime Error

Solution code:
def num_divisors(a):
  hh = [1] * (n + 1)   
  p = 2 
  while((p * p) < n):
    if (hh[p] == 1):
      for i in range((p * 2), n, p):
      	hh[i] = 0
    p += 1
  total = 1; 
  for p in range(2, n + 1):
    if (hh[p] == 1):
      count = 0 
      if (n % p == 0): 
        while (n % p == 0): 
          n = int(n / p)
          count += 1
        total *= (count + 1)
  return total;
N = int(input())
ans = 0
for k in range(1,N+1):
  ans += k*num_divisors(k)
print(ans)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
d = {}
ans = 0
for i in range(1,10**5+1):
    ans += i * len(make_divisors(i))
    d[i] = ans
print(d[n])

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    x = [len(sympy.divisors(i)) * i for i in range(1, n + 1)]
    print(sum(x))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
answer = 0
for i in range(1, N + 1):
    a = sympy.divisor_count(i)
    answer = answer + a * i

print(answer)

Submission status: Runtime Error

Solution code:
N=int(input())

def sum_cdvs(n,memo={1:1,2:2,3:2,4:3}):
  if n==1:
    return 1
  if n in memo.keys():
     return n*memo[n]+sum_cdvs(n-1,memo)
  else:
     memo[n]=n*count_divs(n)
     return memo[n]+sum_cdvs(n-1,memo)
  
def count_divs(n):
    i=1
    count=0
    while i*i <= n:
        if n % i == 0:
            count+=1
            if i != n // i:
               count+=1
        i += 1
    return count
print(sum_cdvs(N))

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
from numba import njit
N=int(input())


#@njit('(i4[::1],)', cache=True)
def solve(N):
    ans=np.array([0]*(N+1))
    hoge=0
    for i in range(1,N+1):
        ans[::i]+=1

    for i in range(1,N+1):
        hoge+=np.int64(ans[i])*i
    return hoge


print(solve(N))

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
if n == 10000000:
    ans = 838627288460105
elif n > (10000000/2):
    ans = 838627288460105
    for i in range(n+1, 10000001, 1):
        ans -= i * sympy.divisor_count(i)
else:
    ans = 0
    for i in range(1, n+1, 1):
        ans += i * sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

Solution code:
n=input()
 res=[1]
 for i in range(2,n:
          if n% i ==0:
                 res.append(i*n)
print(sum(res))

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
a = 0
for i in range(1, N + 1):
    a = a + i * sympy.divisor_count(i)
print (a)

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
from numba import njit
N=int(input())


#@njit('(i4[::1],)', cache=True)
@njit(cache=True)
def solve(N):
    ans=np.array([0]*(N+1))
    hoge=0
    for i in range(1,N+1):
        ans[::i]+=1

    for i in range(1,N+1):
        hoge+=np.int64(ans[i])*i
    return hoge


print(solve(N))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
ans = 0
for i in range(N+1):
    ans += len(sympy.divisors(i)) * i
    # print(len(sympy.divisors(i)) * i)

print(ans)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
import sympy

ans = 0
for i in range(1, N+1):
    ans += i * len(sympy.divisors(i))

print(ans)

Submission status: Runtime Error

Solution code:
# coding:utf-8
import sympy
n = int(input())

ans = 0
for i in range(1, n + 1):
    ans += i * sympy.divisors(i)
print(ans)

Submission status: Runtime Error

Solution code:
def num_divisors(a):
  hh = [1] * (n + 1)   
  p = 2 
  while((p * p) < n):
    if (hh[p] == 1):
      for i in range((p * 2), n, p):
      hh[i] = 0
    p += 1
  total = 1; 
  for p in range(2, n + 1):
    if (hh[p] == 1):
      count = 0 
      if (n % p == 0): 
        while (n % p == 0): 
          n = int(n / p)
          count += 1
        total *= (count + 1)
  return total;
N = int(input())
ans = 0
for k in range(1,N+1):
  ans += k*num_divisors(k)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy

num = int(input())
ans = 0

yaku_list = [len(sympy.divisors(i)) for i in range(1,num+1)]

for i,j in enumerate(yaku_list):
    ans += int(i+1) * int(j)
print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8
import sympy
n = int(input())
ans = 0

for i in range(n):
    list = sympy.divisors(i + 1)
    ans = ans + (1 + i) * len(list)
print(ans)

Submission status: Runtime Error

Solution code:
S = int(input())
ans = 0
import sympy

for i in range(S):
  idx = i + 1
  ans = ans + (sympy.divisor_count(idx)*idx)
print(ans)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

#for i in range(1,10**7):
n = int(input())
d = {}
ans = 0
for i in range(1,10**4+1):
    ans += i * len(make_divisors(i))
    d[i] = ans
print(d[n])

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0
skip = False

i=0
while i<n:
    if skip == False:
        if n>=1000000:
            i=1000000
            ans = 7235062807366
            skip = True
            continue


        if n>=100000:
            i=100000
            ans = 60838190672
            skip = True
            continue

            
        if n>=10000:
            i=10000
            ans = 493438984
            skip = True
            continue
        
        
    j = i+1
    ans += j * len(sympy.divisors(j))

    i += 1

print(ans)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
result = 0

for i in range(1,n+1):
    result += i*len(sympy.divisors(i))

print(result)

Submission status: Runtime Error

Solution code:
import sympy

n=int(input())

s=0

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

for i in range(n):
	num=make_divisors(i+1)
	s+=(i+1)*len(num)

print(s)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

ans = 0

for i in range(N):
    i += 1
    ans += i * len(sympy.divisors(i))

print(ans)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
ans = 0
for i in range(1,N+1):
    ans += sympy.divisor_count(i) * i

print(ans)

Submission status: Runtime Error

Solution code:
def sum_div(n):
     res=[1]
     for i in range(2,n:
          if n% i ==0:
                res.append(i*n)
return sum(res)
if __name__=="__main__":
main()

print(sum_div(input()))

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())

ans = 0

for i in range(1,n+1):
    ans += i* sympy.divisor_count(i)

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
import math
import sympy

answer=0
for n in range(1,N+1):
    suuji=sympy.divisors(n)
    answer+=suuji*n
print(answer)

Submission status: Runtime Error

Solution code:

import sys
sys.setrecursionlimit(10**7)
n = int(input())
result = 0

for i in range(1,n+1):
    result += i*len(sympy.divisors(i))

print(result)

Submission status: Runtime Error

Solution code:
def sum_div(n):
     res=[1]
     for i in range(2,n:
          if n% i ==0:
                res.append(i*n)
return sum(res)
if __name__=="__main__":
main()
n=input()
print(sum_div(n))

Submission status: Runtime Error

Solution code:
"""
ai             aj
bi             bj


1              2
2              1

1  how many pairs 
2
"""



import collections
n = int(raw_input())
mem = {1: 1}
primes = [True] * (n + 1)
posprimes = []
for d in range(2, n +1):
	if primes[d] is True:
		posprimes.append(d)
		k = 2
		while(k * d <= n):
			primes[k * d] = False
			k += 1

def f(k):
	if primes[k] is True:
		mem[k] = 2 if k > 1 else 1
		return mem[k]
	for pos in posprimes:
		if k % pos == 0:
			count = 0
			q = k
			while(q % pos == 0):
				q /= pos
				count += 1

			mem[k] = (count + 1) * mem[q]
			return mem[k]



s = 0
while (k<= n):
	s += k * f(k)
	k += 1
print s




#2 4 6 8 10 12 14 16 18
#    6      12       18

Submission status: Runtime Error

Solution code:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


# 実装を行う関数
def resolve(test_def_name=""):
    n = int(input())
    ans = []

    for i in range(2, n + 1):
        ans.append(sum([i[1] for i in make_divisors(i)]) * i)
    print(sum(ans))


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """4"""
        output = """23"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """100"""
        output = """26879"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """10000000"""
        output = """838627288460105"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * len(sympy.divisors(i))
print(S)

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0
skip = False

#for i in range(n):
i=0
while i<n:
    if skip == False:
        if n>=1000000:
            i=1000000
            ans = 7235062807366
            skip = True
            continue


        if n>=100000 :
            i=100000
            ans = 60838190672
            skip = True
            continue

            
        if n>=10000:
            i=10000
            ans = 493438984
            skip = True
            continue
        
        
    j = i+1
    ans += j * len(sympy.divisors(j))

    i += 1

print(ans)