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 = input()
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

cnt = 0
for i in range(1, n+1):
    cnt += int(i)*len(make_divisors(i))
print(cnt)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    n = int(input().strip())
    ans = 0

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

Submission status: Runtime Error

Solution code:
import numpy as np
def divisor_num(n):
    if n == 1:
        return 1
    arr = []
    temp = n
    for i in range(2,int(np.sqrt(n))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)
    
    if temp!=1:
        arr.append(1)
 
    if arr==[]:
        arr.append(1)
    
    ans = 1
    for num in arr:
        ans *= num+1
    
    return ans
 
n = int(input())
total = 0
for i in range(1,n+1):
    total += i*divisor_num(i)

Submission status: Runtime Error

Solution code:
import numpy as np
from sympy import isprime

def divisor_num(n,prime_list):
    if n == 1:
        return 1
    arr = []
    temp = n
    for i in prime_list:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)
    
    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)
    
    ans = 1
    for num in arr:
        ans *= num+1
    
    return ans

n = int(input())

prime_list = []
for i in range(2,int(np.sqrt(n))+1):
    if isprime(i):
        prime_list.append(i)

total = 0
for i in range(1,n+1):
    total += i*divisor_num(i,prime_list)
print(total)

Submission status: Runtime Error

Solution code:
def divisor_count(n):
    count = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n % i == 0:
            count += 2
    else:
        if math.sqrt(n) == int(math.sqrt(n)):
            count -= 1
    return count

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

Submission status: Runtime Error

Solution code:
def main():
    import sys
    N=int(sys.stdin.readline())
    r=0
    for i in range(1,N+1):
        r+=(i+N-N%i)*(N//i)//2
        print(i,r,(i+N-N%i)*(N//i)//2,N-N%i)

    
main()

Submission status: Runtime Error

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    import sympy
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
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) + 2):
        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]]

def resolve():
    N,=pin()

    A=primes(N)
    #print(A)
    t=len(A)
    ans=[i+1 for i in range(N)]
    ##print(ans)
    ans[0]=1 #1=1**1に対応
    S=set()#もう見たやつ
    S.add(1)
    for i in A:
        temp=set()
        temp.add(i)
        
        for j in S:
            maxy=N/i+1
            cnt=j
            cnt2=1
            temp2=set()
            if j>maxy:continue
            prev=ans[j-1]//j
            while(1):
                cnt*=i

                if cnt>N:
                    break
                cnt2+=1
                temp2.add(cnt)
                ans[cnt-1]=prev*cnt2*cnt
            #print(temp2,i,j,"gfha")
            
            temp=temp|temp2
        
        S=S|temp
        ##print(S)
    print(sum(ans))
    #print(ans)
    #print(S)
    #assert S==set(range(1,N+1))
    #print(len(S))

#%%submit!
resolve()

Submission status: Runtime Error

Solution code:
import sympy

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

Submission status: Runtime Error

Solution code:
import sympy

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

Submission status: Runtime Error

Solution code:
def divisor(n):
  for i in range(n):
    x = len([i for i in range(1,n+1) if not n % i])
  return x

n=int(input())
s=0
for i in range(1,n+1):
  s=s+(i+(divisor(i))

Submission status: Runtime Error

Solution code:
N=int(input())
def m(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
ans=0
for i in range(1,N+1):
  ans+=i*len(m)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

def func(num):
  count = 0  # 1は約数
  for a in range(1, num+1):
    if not num % a:
      count += 1
  return count

nums = [0] * (N + 1)
nums[1] = 1

for i in range(2, N+1):
  if not nums[i]:
    tmp = func(i)
    # print(i, tmp)
    for j in range(i, N+1, i):
      add_num = nums[j // i] if j // i > 1
      nums[j] = j * (tmp + add_num)
      # print(j, tmp, add_num)

print(sum(nums))

Submission status: Runtime Error

Solution code:
n=int(input())
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

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]

so=seachPrimeNum(n)
ans=0
for i in range(n+1):
    if i in so:
        ans+=i*2
    else:
        ans+=i*len(make_divisors(i))

print(ans)

Submission status: Runtime Error

Solution code:
primes = [2]
li = [[],[]]
f_ans = [0]
def f(x):
  if x==1:
    f_ans.append(1)
    return 1
  if x==2:
    f_ans.append(2)
    return 2
  flag = True
  for i in range(len(primes)):
    if x%primes[i]==0:
      tmp = li[x//primes[i]][:]
      tmp[i] += 1
      li.append(tmp)
      f_ans.append(f_ans[x//primes[i]]//tmp[i]*(tmp[i]+1))
      return f_ans(x)
    else:
      li.append([0]*len(primes)+[1])
      f_ans.append(2)
      primes.append(x)
      return 2

n = int(input())
sum = 0
for i in range(1,n+1):
  sum += i * f(i)
print(sum)

Submission status: Runtime Error

Solution code:
 = int(input())
ans = 1

for n in range(2, j + 1):
    arr = 0
    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 *= cnt + 1
    if temp != 1:
        arr = 1 + 1

    if arr == 0:
        arr = 1 + 1
        
    print(n,arr)
    
    ans += n * arr
ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

    return data

def factorization(n, data):
    arr = []
    temp = n
    num = 0
    for i in data:
        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 math.prod([f[1]+1 for f in arr])
if __name__ == "__main__":
    N = int(input())
    ans = 0
    data = get_sieve_of_eratosthenes(N)
    for i in range(1, N+1):
        ans += i*factorization(i, data)
    print(ans-1)

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())
sum = 0
for i in range(N):
    sum += i * sum(make_divisor(i))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0

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

Submission status: Runtime Error

Solution code:
import numpy as np
from sympy import isprime
import sympy
n = int(input())


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2, N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum


ans = 0
l = [{} for _ in range(n+1)]
dp = [0]*(n+1)
primes = seachPrimeNum(n)
for s in primes:
    dp[s] = 1
for i in range(1, n+1):
    if i == 1:
        l[i][i] = 1
    if dp[i]:
        l[i][i] = 1
    else:
        for prime in primes:
            if i % prime == 0:
                l[i] = l[i//prime].copy()
                l[i][prime] += 1
                break
ans = 1
for i in range(2, n+1):
    b = 1
    for s in l[i].values():
        b = b*(s+1)
    ans += i*b
print(ans)

Submission status: Runtime Error

Solution code:
は？

Submission status: Runtime Error

Solution code:
def s(num):
    yakusuu_array = []
    for i in range(1,num):
        if num % i == 0:
            yakusuu_array.append(i)
    return len(yakusuu_array)
N = int(input())
count = 0
for i in range(N):
    count = (i + 1) * len(s(i + 1)) + count
print(count)

Submission status: Runtime Error

Solution code:
import copy
from sys import exit
from math import ceil
from collections import defaultdict as dd
n = int(input())
yakusuu_dic = dd(lambda: dd(int))
f = [0] * (n+1)
f[1] = 1
f[2] = 2

if n == 1:
    print(1)
    exit()
if n == 2:
    print(5)
    exit()
sosus = [2]

counter = 0
yakusuu_dic[2] = {2: 1}
for num in range(3, n+1):
    #print(num)
    for divider in sosus:
        if num % divider == 0:
            yakusuu_dic[num] = copy.deepcopy(yakusuu_dic[num // divider])
            yakusuu_dic[num][divider] += 1
            if divider in yakusuu_dic[num // divider]:
                f[num] = f[num // divider] // (yakusuu_dic[num // divider][divider] + 1) * (yakusuu_dic[num // divider][divider] + 2)
            else:
                f[num] = f[num // divider] * 2
            break
    else:
        yakusuu_dic[num][num] = 1
        f[num] = 2
        sosus.append(num)

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

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0

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

print(int(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = [0] * 10 ** 5
N = int(input())
# print(s)
# print(N)

for i in range(1, N+1):
    for j in range(1, 10**4):
        s[j*i]+=1
# print('='*30)
# s[i] * i
ans = 0
for i in range(1, N+1):
    ans += s[i] * i
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

N = input()
N = int(N)

def countDiv(n):
	cnt = 0
	for i in range(n):
		if n % i == 0:
			if n / i == i:
				cnt += 1
			else:
				cnt += 2

su = 0
for i in range(1, N + 1):
	su += countDiv(i)

print(su)

Submission status: Runtime Error

Solution code:
import sympy

def main():
    N = int(input())
    ans = 1
    for i in range(2, N+1):
        num_divisors = len(sympy.divisors(i))
        ans += i * num_divisors
    print(ans)
main()

Submission status: Runtime Error

Solution code:
import queue

N, M, K  = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

Aq = queue.Queue()
Bq = queue.Queue()
for i in A:
    Aq.put(i)
for i in B:
    Bq.put(i)

total = 0
cnt = 0

while total <= K:
    if Aq.empty() and Bq.empty():
        cnt += 1
        break
    elif Aq.empty():
        total += Bq.get()
    elif Bq.empty():
        total += Aq.get()
    elif Aq.get() < Bq.get():
        total += Aq.get()
    else:
        total += Bq.get()
    cnt += 1

print(cnt-1)

Submission status: Runtime Error

Solution code:
N = input()


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)))
    return table
an=0
    for x in range(N):
        x += 1
        an=an+x*divisor(x)
print(an)

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())
sum = 0
for i in range(N):
    sum += i * sum(meke_divisor(i))

Submission status: Runtime Error

Solution code:
import sys
nums=input().split()
a=int(nums[0])
b=int(nums[1])
n=int(nums[2])
lista=input().split()
listb=input().split()

acount=0
bcount=0
count=0
time=0
atime=0
btime=0
for i in lista:
  val=int(i)
  if val+atime>n:
    break
  atime+=val
  acount+=1

count=acount
btime=atime
for j in listb:
  valb=int(j)
  if valb+btime>n:
    break
  btime+=valb
  count+=1
  bcount+=1

for i in range(1,acount):
  bcount=count-i
  btime-=int(lista[acount-i])
  for j in range(bcount,b):
    valb=int(j)
    if valb+btime>n:
      break
    btime+=valb
    bcount+=1
  if count<bcount:
    count=bcount
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())

import sympy

def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True

A=0
before=0
for i in range(N):
    if isPrime(i+1):
        cnt=2
    else:
        cnt=sympy.divisor_count(i+1)
    A+=(i+1)*cnt
print(A)

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())
check = 0
result = 0
yakusuu = make_divisors(N)
for i in range(1,N+1):
  if yakusuu[check] <= i < yakusuu[check+1]:
    result += i * (len(yakusuu[:check])+1)
  else:
    check += 1
    result += i * (len(yakusuu[:check])+1)
print(result)

Submission status: Runtime Error

Solution code:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func newScanner() *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

var sc = newScanner()

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanString() string {
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

func main() {
	n := scanInt()
	answer := findDivisors(n)
	fmt.Println(answer)
}

func debug(a ...interface{}) {
	// fmt.Println(a...)
}

func findDivisors(n int) int {
	searchList := make([]int, n+1)
	for i := 2; i <= n; i++ {
		searchList[i] = i
	}
	debug(searchList)
	table := make([]int, n+1)
	for i := 1; i <= n; i++ {
		for j := i; j <= n; j += i {
			table[j]++
		}
	}

	debug(table)

	divisors := 0
	for i := 2; i <= n; i++ {
		if searchList[i] == 0 {
			continue
		}

		localDivisors := table[i]
		divisors += localDivisors * searchList[i]
		debug(searchList[i], "has ", localDivisors, "divisors")
		step := searchList[i]
		for j := i * step; j <= n; j *= step {
			localDivisors += 1
			debug(searchList[j], "has ", localDivisors, "divisors")
			divisors += localDivisors * searchList[j]
			searchList[j] = 0
		}
	}

	return divisors + 1 // plus 1 * 1
}

var table []int

Submission status: Runtime Error

Solution code:
N = int(input())

def f(x):
    if x == 1:
        return 1
    else:
        divisors = []
        for i in range(1, int(x**0.5)+1):
            if x % i == 0:
                divisors.append(i)
                if i != x // i:
                    divisors.append(x//i)
        return (len(divisors)*x) + f(x-1)
print(f(N))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    if n>1:
        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 n*len(divisors)+make_divisors(n-1)
    elif n==1:
        return 1
n=int(input())
make_divisors(n)

Submission status: Runtime Error

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

print(S)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy

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

        ans = 0

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

        return int(ans)

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

Submission status: Runtime Error

Solution code:
N=int(input())
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
for k in range(N+1):
    f=len(divisor(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:
import sympy
N = input()
    
sum = 0
for K in range(1, N+1):
    sum += K * len(sympy.divisors(K))
print(sum)

Submission status: Runtime Error

Solution code:
import sys
from io import StringIO
import unittest


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__":
    unittest.main()

Submission status: Runtime Error

Solution code:
N = int(input())

def f(x):
    if x == 1:
        return 1
    else:
        divisors = []
        for i in range(1, int(x**0.5)+1):
            if x % i == 0:
                divisors.append(i)
                if i != x // i:
                    divisors.append(x//i)
        return (len(divisors)*x) + f(x-1)


print(f(N))

Submission status: Runtime Error

Solution code:
n = int(input())

prime = []
for i in range(2, 10**4):
    for j in range(2, i):
        if i%j == 0:
            break
    else: 
        prime.append(i)


num = [i for i in range(1, 10**7)]

for i in range(1, n+1):
    target = i
    cnt = 0
    for j in prime:
        sub_cnt = 1
        while True:
            if target%j != 0:
                break
            else:
                if sub_cnt == 0:
                    sub_cnt += 1
                sub_cnt += 1
        cnt *= sub_cnt
    num[i-1] *= cnt

print(sum[num[:n]])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
n = int(input())
cnt  = 0
k = [ i for i in range(1,n+1)]
f = [sympy.divisor_count(i) for i in range(1,n+1)]
#print(f)
#print(k)
a = np.array(k)
b = np.array(f)
print(a.dot(b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
input = raw_input

def get_primes(n):
    ass = []
    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
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass


max_n = 10 ** 7
primes = get_primes(max_n)
n_primes = 664579
#n_primes = 100
import sys
sys.setrecursionlimit(n_primes*2)

out = 0
def f(fcur, fpi, fkosuu):
    global out
    pi = fpi + 1
    cur_prime = primes[pi]
    cur = fcur

    #print("end", pi, n_primes)
    npi = pi + 1
    do_next = npi < n_primes
   
    count = 0
    #if cur_prime == 3:
    #print("cur", cur, fpi, pi, npi, cur_prime)
    while True:
        kosuu = fkosuu * (count+1)
        if do_next:
            f(cur, pi, kosuu)
        else:
            #print(cur, kosuu)
            cur_out = cur * kosuu
            out += cur_out

        cur = cur * cur_prime
        if cur > n:
            return
        count += 1
 
n = int(input())
#n = 4
f(1, -1, 1)
print(out)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    if n>1:
        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 n*len(divisors)+make_divisors(n-1)
    elif n=1:
        return 1
n=int(input())
make_divisors(n)

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
n = int(input())
cnt  = 0
k = [ i for i in range(1,n+1)]
f = [sympy.divisor_count(i) for i in range(1,n+1)]
print(f)
print(k)
a = np.array(k)
b = np.array(f)
print(a.dot(b))

Submission status: Runtime Error

Solution code:
from sympy import divisor_count

N  = int(input())
result = 0
for i in range(1,N+1):
    result += i * divisor_count(i)
print(result)

Submission status: Runtime Error

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

def enzan(k, yakusu):
    return(k * yakusu)


# def make_divisor_list(num):
#     if num == 1:
#         return 1
#     else:
#         cnt = 2
#         # divisor_list = []
#         # divisor_list.append(1)
#         for i in range(2, num // 2 + 1):
#             if num % i == 0:
#                 # divisor_list.append(i)
#                 cnt += 1
#         # divisor_list.append(num)

#         # return len(divisor_list)
#         return cnt


# 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


wa = 0
for k in range(1, N+1):
    wa += enzan(k, sympy.divisor_count(k))

print(wa)

# print(make_divisor_list(4))

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0

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

print(ans)

Submission status: Runtime Error

Solution code:
import sympy    
def main():
    n = int(input())
    s = 0
    for k in range(1,n+1):
        s+=k*sympy.divisor_count(k)
    print(s)

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
A = 0

for k in range(N):
    A += (k+1)*len(sympy.divisors(k+1))
    print(A, k)
print(A)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

result = 0
j = 1
while ( j <= N and N <= 10000000):
  result += j * sympy.divisor_count(j)  
  j += 1

print(result)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
result = 0

for i in range(1,N+1):
    result += i * sympy.divisor_count(i,modulus=1)

print(result)

Submission status: Runtime Error

Solution code:
n=int(input())

import sympy

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


print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

def main():
    import sympy
    N = int(input())
    print(sum([i * sympy.divisor_count(i) for i in range(N + 1)]))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

result = 0
j = 1
while ( j <= N ):
  result += j * sympy.divisor_count(j)  
  j += 1

print(result)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from functools import reduce
n = int(input())


def get_primes(n):
    primes = [2]
    lim = int(n ** 0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if lim < p:
            return primes + data
        primes.append(p)
        data = [e for e in data if e % p != 0]


primes = get_primes(n)
primes_set = set(primes)


def divide(n):
    np = 0
    divider = defaultdict(int)
    while primes[np] <= n:
        p = primes[np]
        while n % p == 0:
            n //= p
            divider[p] += 1
        np += 1
    return divider


result = 1
for i in range(2, n + 1):
    if i in primes_set:
        result += i * 2
    else:
        div = divide(i)
        n_pat = reduce(lambda p, c: p * c,
                       map(lambda v: v + 1, div.values()), 1)
        result += i * n_pat

print(result)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
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()))

def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):

        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial): 
            input_list[s] = False

n = inp()
if n == 1:
    print(1)
    quit()
cnt = 1
res = 1
ans = [-1] * (n+1)
ans[1] = 1 
pp = sieve_of_erastosthenes(n)
# print(pl)
pl = []
for x in range(1,n):
    if not pp[x]: continue
    # print(x)
    cnt += 1
    ans[x] = 2
    res += 2*x
    c = 2
    while pow(x,c) <= n:
        now = pow(x,c)
        if ans[now] == -1:
            ans[now] = c+1
            res += now*(c+1)
            cnt += 1
        c += 1
# print(ans)
while cnt < n:
    for i in range(2,n+1):
        for j in range(i+1,n+1):
            if i * j > n: break
            if math.gcd(i,j) != 1 or ans[i*j] != -1: continue
            if ans[j] == -1: continue
            ans[i*j] = ans[i] * ans[j]
            res += (i*j) * ans[i*j]
            cnt += 1
# print(ans)
# for i in range(1,n+1):
#     res += ans[i] * i
#     if ans[i] < -1:
#         print(i)
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
s=0
i=1
for i in range(1,n+1):
  j=1
  while j<=math.sqrt(i):
    if i%j==0:
      c = c+1
      if i/j!=j:
        c = c+1
    j = j+1
  s = s+i*c  
   	
  
    
print(s)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
result = 0

for i in range(1,N+1):
    result += i * sympy.divisor_count(i)

print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()

def f(K): # kの正の約数の個数
    cnt = 0
    for i in range(1, K+1): 
        if (K % i == 0): cnt += 1
    return cnt
    
sum = 0
for K in range(1, N+1):
    sum += K*f(K)
print(sum)

Submission status: Runtime Error

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

n = len(sympy.divisors(N))

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

Submission status: Runtime Error

Solution code:
n=int(input())
c=1
for i in range(1,n+1):
    if i>1:
        for j in range(1,i):
        
            if i%j ==0 and i!=0:
            
                y=y+1
                
        c=c+(i*y)
    
print(c)