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:
num = int(input())
import sympy
kansu =0
for i in range(num):
    tmp=sympy.divisor_count(i)
    #print(tmp)
    kansu+=i*tmp
print(kansu)

Submission status: Runtime Error

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

for i in range len(num):
    tmp=sympy.divisor_count(i)
    print(tmp)
    kansu+=i*tmp
print(kansu)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
divisors = np.array([0] * N, dtype = 'int64')
ans = 0
for i in range(N):
    num = i+1
    divisors[i:N:num] += 1
    ans += num * divisors[i]
print(ans)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())

f = [1] * (n + 1)
for i in range(2, n + 1):
    if f[i] != 1: continue
    m = i
    while m <= n:
        tmp = m
        cnt = 0
        while tmp % i == 0:
            tmp = tmp // i
            cnt += 1
            loop += 1
        f[m] *= cnt + 1
        m += i

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

Submission status: Runtime Error

Solution code:
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; scanf("%d", &N);

    ll ans = 0;
    for(ll i=1; i*i<=N; i++) {
        ans += i*i;
        ll ub = N / i, lb = i;
        if(ub - lb >= 0) {
            ll add = 0;
            add += ub*(ub+1) / 2 * i * 2;
            add -= lb*(lb+1) / 2 * i * 2;
            ans += add;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#define ll long long int
#define all(x) x.begin(),x.end()

 #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 100005LL
using namespace std;

v visited(N);
vector<v> graph(N);
vector<ll> ans={-1};
v level(N);
v ind(N);
ll sz[N];




void dfs(ll node, ll par){
    
    visited[node]=1;
    if (node==1)level[1]=0;
    else level[node] = level[par]+1;
    ans.pb(node);
    for(auto x:graph[node]){
        if (!visited[x]){
            dfs(x,node);
            sz[node]+=sz[x];

        }
       
    }
     ++sz[node];
    
}
ll ss(v even, ll k,ll n){
    ll a=0;
    ll ans=0;
    while(true){
        auto x= lower_bound(even.begin(),even.end(),a+k)-even.begin();
        if (x==lower_bound(even.begin(),even.end(),even[x]+k)-even.begin()){
            return -1;
        }
        a=even[x];
        ans+=1;
        if(even[x]+k>=n){
            ans+=1;
            return ans;
        }

    }
    
    
}
// C++ program to count distinct divisors 
// of a given number n 
#include <bits/stdc++.h> 
using namespace std; 

void SieveOfEratosthenes(int n, bool prime[], 
						bool primesquare[], int a[]) 
{ 
	// Create a boolean array "prime[0..n]" and 
	// initialize all entries it as true. A value 
	// in prime[i] will finally be false if i is 
	// Not a prime, else true. 
	for (int i = 2; i <= n; i++) 
		prime[i] = true; 

	// Create a boolean array "primesquare[0..n*n+1]" 
	// and initialize all entries it as false. A value 
	// in squareprime[i] will finally be true if i is 
	// square of prime, else false. 
	for (int i = 0; i <= (n * n + 1); i++) 
		primesquare[i] = false; 

	// 1 is not a prime number 
	prime[1] = false; 

	for (int p = 2; p * p <= n; p++) { 
		// If prime[p] is not changed, then 
		// it is a prime 
		if (prime[p] == true) { 
			// Update all multiples of p 
			for (int i = p * 2; i <= n; i += p) 
				prime[i] = false; 
		} 
	} 

	int j = 0; 
	for (int p = 2; p <= n; p++) { 
		if (prime[p]) { 
			// Storing primes in an array 
			a[j] = p; 

			// Update value in primesquare[p*p], 
			// if p is prime. 
			primesquare[p * p] = true; 
			j++; 
		} 
	} 
} 

// Function to count divisors 
int countDivisors(int n) 
{ 
	// If number is 1, then it will have only 1 
	// as a factor. So, total factors will be 1. 
	if (n == 1) 
		return 1; 

	bool prime[n + 1], primesquare[n * n + 1]; 

	int a[n]; // for storing primes upto n 

	// Calling SieveOfEratosthenes to store prime 
	// factors of n and to store square of prime 
	// factors of n 
	SieveOfEratosthenes(n, prime, primesquare, a); 

	// ans will contain total number of distinct 
	// divisors 
	int ans = 1; 

	// Loop for counting factors of n 
	for (int i = 0;; i++) { 
		// a[i] is not less than cube root n 
		if (a[i] * a[i] * a[i] > n) 
			break; 

		// Calculating power of a[i] in n. 
		int cnt = 1; // cnt is power of prime a[i] in n. 
		while (n % a[i] == 0) // if a[i] is a factor of n 
		{ 
			n = n / a[i]; 
			cnt = cnt + 1; // incrementing power 
		} 

		// Calculating number of divisors 
		// If n = a^p * b^q then total divisors of n 
		// are (p+1)*(q+1) 
		ans = ans * cnt; 
	} 

	// if a[i] is greater than cube root of n 

	// First case 
	if (prime[n]) 
		ans = ans * 2; 

	// Second case 
	else if (primesquare[n]) 
		ans = ans * 3; 

	// Third casse 
	else if (n != 1) 
		ans = ans * 4; 

	return ans; // Total divisors 
} 








int main(){
    ll n;
    cin>>n;
    ll ans=0;

    loop(i,1,n+1){
        ll x=countDivisors(i);
        ans+=(i*x);
    }
    cout<<ans<<"\n";

   
    
}

Submission status: Runtime Error

Solution code:
n=int(input())
div=[0]*(n+1)
for i in range(1,n+1):
    for j in range(1,n+1):
        if i*j<=n:
            d[i*j]+=1
sm=0
for i in range(1,n+1):
    sm+=i*div[i]
print(sm)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

l=[4 if i%2==0 else 2 for i in range(n+1)]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):#振るい
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

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

Submission status: Runtime Error

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

l=[4 if i%2==0 else 2 for i in range(n+1)]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

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

Submission status: Runtime Error

Solution code:
N = int(input())
import numpy
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
  for m in range(n, N+1, n):
    div[m] += m
print(sum(div))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
N=int(input())
ans=0
for i in range(1,N):
  Y=math.ceil(N/i)
  ans+=(Y*(Y+1)*x)//2
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
sum = 0
for k in range(n):
  for j in range(k):
  	if k % j == 0：
    	sum += k
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
for k in range(N):
  for j in range(int(k)):
  	if k % j == 0：
    	sum += k
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
for k in range(N):
  for j in range(k):
  	if k % j == 0：
    	sum += k
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
for k in range(N):
  for j in range(k):
  	if k % j == 0：
    	sum += k
print(f)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
f = 0
for i in range(1,N):
  for j in range(1,N):
  	if k % j == 0：
    	sum += 1
print(f)

Submission status: Runtime Error

Solution code:
N = input()
sum = 0
f = 0
for k in range(1,N):
  for j in range(1,k):
  	if k % j == 0：
    	sum += k
print(f)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
f = 0
for k in range(1,N):
  for j in range(1,k):
  	if k % j == 0：
    	sum += k
print(f)

Submission status: Runtime Error

Solution code:
n = int(input())
ans, k = 0, 0
h = []
for i in range(1, n+1):
    for j in range(1, n +1):
        if i % j ==0:
            ans += 1
    h[k] = ans
    ans = 0
s = 0
for l in range(1, n +1):
    s += l*h[l-1]
print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
f = 0
for k in range(1,N):
  #define f
  #f = 0
  for j in range(1,k)
  	if k % j == 0：
    	f += k
  #sum = sum + k*f
print(f)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
f = 0
for k in range(1,N):
  #define f
  #f = 0
  for j in range(1,k)
  	if k%j == 0：
    	f += k
  #sum = sum + k*f
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0
for k in range(N):
  #define f
  f = 0
  for j in range(1,k)
  	if k%j == 0:
      f = f+1
  sum = sum + k*f
print(sum)

Submission status: Runtime Error

Solution code:
import numpy as np

def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    #print(divisors)
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    
	INF = 999999999999999999999999
	MOD = 10**9+7

	n = int(input())

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

	print(ans)
main()

Submission status: Runtime Error

Solution code:
import numpy as np
from numba import njit

@njit
def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    #print(divisors)
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

Submission status: Runtime Error

Solution code:
import numpy as np
from numba import jit

@njit
def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    #print(divisors)
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import numpy as np

def solve():
    
    n = int(input())
    
    divisors = np.zeros(n+1, np.int64)
    
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            divisors[j] += 1
    #print(divisors)
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

from numba import jit

@jit
solve()

Submission status: Runtime Error

Solution code:
import sympy

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

Submission status: Runtime Error

Solution code:
import numpy as np
n=int(input())
a=np.zeros(n+1,dtype=np.int64)
for i in range(1,n+1):
    a[i:n+1:i]+=1
b=np.linspace(0,n,n+1,dtype=np.int64)
print(np.sum(a*b,dtype=np.int64))

Submission status: Runtime Error

Solution code:
N = int(input())
def cal(n):
    return n * (n + 1) // 2
for i in range(1, N+1):
    x = N // i
    ans += i * (x * (x + 1) // 2)
print(ans)

Submission status: Runtime Error

Solution code:
def main():

#---------------------------------------------------------

N = int(input())
ans = 0
for i in range(1, N + 1):
    n = N // i  # 項数n
    cnt = (n * (2 * i + (n - 1) * i)) // 2  # 初項i, 項数n の等差数列の和の公式
    ans += cnt
print(ans)

#---------------------------------------------------------

if __name__ == '__main__':
   main()

Submission status: Runtime Error

Solution code:
N, M, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
a = [0] * (N+1)
b = [0] * (M+1)
for i in range(N):
    a[i+1] = a[i] + A[i]
for i in range(M):
    b[i+1] = b[i] + B[i]
ans = 0
j = M
for i in range(N+1):
    tmp = K - a[i]
    if tmp < 0:
        break
    while b[j] > tmp:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Submission status: Runtime Error

Solution code:
def multiple_sum(x, n):
    # x + 2x + ... + kx(<= n)
    k = n // x
    return x * (k + 1) * k // 2


def solve(N: int):
    ans = 0
    for i in range(1, N + 1):
        ans += multiple_sum(i, N)
    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sympy
import numpy as np
from operator import mul

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

num = [i for i in range(1,N+1)]

combined = map(mul, div,num)
print(sum(combined))

Submission status: Runtime Error

Solution code:
def solve(n):
  ans = n * (n + 1) - 1  # 1とk 自信

  i = 2
  while i * i <= n:
      num = n // i
      min_i = i * i
      max_i = i * num
      ans += (num - i + 1) * (min_i + max_i)  # 自分自身
      ans -= min_i
      i += 1
  print(ans)
  return True

if __name__ = "__main__":
  n = int(input())
  solve(n)

Submission status: Runtime Error

Solution code:
n=int(imput())

ans=0
for i in range(n):
  i=i+1
  a=i
  y=n//i

  ans+=(i*y*(y+1)/2)



print(ans)

Submission status: Runtime Error

Solution code:
import math
def main():

    N = int(input())

    d = [2 for _ in range(N+1)]
    d[1] = 1

    v = int(math.sqrt(N))s

    for i in range(2, v+1):
        for j in range(i+i, N+1, i):
            if j//i > v: d[j] += 2
            else: d[j] += 1  

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

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

Submission status: Runtime Error

Solution code:
# D - Sum of Divisors
from numba import njit


@njit
def main():
    N = int(input())
    res = 0
    for a in range(1, N + 1):
        for b in range(1, N // a + 1):
            res += a * b
    print(res)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
 import math
def main():

    N = int(input())

    d = [2 for _ in range(N+1)]
    d[1] = 1

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

    v = int(math.sqrt(N))
    for i in range(2, v+1):
        for j in range(i+i, N+1, i):
            d[j] += 1
            if j//i > v: d[j] += 1

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

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

Submission status: Runtime Error

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

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 sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())

def hurui(n):
    """n以下の素数のリストを返す
    """
    l = list(range(2,n))
    p = 2
    i = 0
    while True:
        l = [item for item in l if item==p or item%p!=0]
        i += 1
        p = l[i]
        if p*p>n:
            break
    return l
l = hurui(n)
nums = list(range(n+1))
t = [1]*(n+1)
for p in l:
    for k in range(1, n//p+1):
        v = 0
        while nums[k*p]%p==0:
            v += 1
            nums[k*p]//=p
        t[k*p] *= (v+1)
ans = sum(i*t[i] for i in range(1,n+1))
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())

def hurui(n):
    """n以下の素数のリストを返す
    """
    l = list(range(2,n))
    p = 2
    i = 0
    while True:
        l = [item for item in l if item==p or item%p!=0]
        i += 1
        p = l[i]
        if p*p>n:
            break
    return l
l = hurui(n)
nums = list(range(n+1))
t = [1]*(n+1)
for p in l:
    for k in range(1, n//p+1):
        v = 0
        while nums[k*p]%p==0:
            v += 1
            nums[k*p]//=p
        t[k*p] *= (v+1)
ans = sum(i*t[i] for i in range(1,n+1))
print(ans)

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:
n=int(input())
a=0
x=int(n**0.5)
for m in range(1,int(x)+1):
    a+=m*(m+n//m)*(n//m+1-m)
print(int(a-x*(1+x)/(1-x)**4+1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=0
x=int(n**0.5)
for m in range(1,x+1):
    a+=m*(m+n//m)*(n//m+1-m)
print(a-x*(1+x)//(1-x)**4)

Submission status: Runtime Error

Solution code:
n=int(input())

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

Submission status: Runtime Error

Solution code:
import numpy as np
from  numba import njit
from time import time

@njit
def main(N):
    count=0
    for n in range(1 ,N+1):
        for m in range(n,N+1,n):
            count+=m
    print(count)
if __name__ == "__main__":
    N = int(input())
    main(N)

Submission status: Runtime Error

Solution code:
import sys
import numba

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

@numba.njit
def main(N):
    x = 0
    for a in range(1, N+1):
        for b in range(1, N//a+1):
            x += a*b
    return x

from my_module import main

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

Submission status: Runtime Error

Solution code:
import numpy as np
from time import time
def main():
    N = int(input())
# div=np.zeros(N+1,np.int64)
    count=0
    for n in range(1 ,N+1):
        for m in range(n,N+1,n):
            count+=m
    print(count)
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
# div=np.zeros(N+1,np.int64)
count=0
for n in range(1 ,N+1):
    for m in range(n,N+1,n):
        count+=m
print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
div=np.zeros(N+1,np.int64)
for n in range(1 ,N+1):
    for m in range(n,N+1,n):
        div[m]+=m
print(div.sum())

Submission status: Runtime Error

Solution code:
n=int(open(0));print(sum(n//i*(n//i+1)*i//2for i in range(1,n+1)))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
  N = int(input())
  def count(n):
    ret = 0
    i = 1
    while i*i <= n:
      if n % i == 0:
        ret += 1
        if i != n // i:
          ret += 1
      i += 1
    return ret


  ans = 1
  l[0] = True
  l[1] = True
  if N==1:
    print(ans)
  else:
    for i in range(2,N+1):
      x = count(i)
      ans += x * i

    print(ans)
    
main()

Submission status: Runtime Error

Solution code:
def f(n):
  even = n // 2
  x = 0
  for i in range(1, even + 1):
    if n % i == 0:
    x += 1
  else:
    x += 1
  return x

k = int(input())
ans = 0
for j in range(1, k + 1):
  ans += j * f(j)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def countp(cp, p):
    ret = 0
    while cp % p == 0:
        ret += 1
        cp //= p
    return ret


def count_in(fx_dict):
    if not fx_dict:
        return 2
    ret = 1
    for v in fx_dict:
        ret *= (v + 1)
    return ret


def main():
    N = int(input())
    va = [i for i in range(N + 1)]
    fx = [[] for _ in range(N + 1)]
    for p in range(2, int(N**0.5) + 2):
        if va[p] == 1:
            continue
        for cp in range(p, N + 1, p):
            tmp = countp(cp, p)
            va[cp] //= p**tmp
            fx[cp].append(tmp)
    # print(fx)

    ans = 1
    for i in range(2, N + 1):
        if va[i] != 1:
            fx[i].append(1)
        tmp = count_in(fx[i])
        # print(i, tmp)
        ans += i * tmp

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def solve():
    n = int(input())

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

    table = num_divisors_table(n)
    print(sum(i*table[i] for i in range(n + 1))
solve()

Submission status: Runtime Error

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

a = [0]
b = [0]

for i in range(N):
    a.append(a[i] + A[i])

for j in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M

for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(i + j, ans)

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())

answer=1
# -*- coding:utf-8 -*-
import math
import numpy as np

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):
    arr = []
    temp = n
    for i in get_sieve_of_eratosthenes(int(N**0.5)):
        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])

    number=1


    for a in arr:
        number*=(a[1]+1)
    return number



for n in range(2,N+1):
    answer+=n*factorization(n)

print(answer)

Submission status: Runtime Error

Solution code:
N = int(input())

ans = sum([j * (N//j)*(N//j+1)/2 for j in range(N)])

print(ans)

Submission status: Runtime Error

Solution code:
from sympy import divisor_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:
n = int(input())
ans = 0

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

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
l = [0] * 10 ** 7
for i in range(1, N + 1):
    for j in range(0, N + 1, i):
        l[j] += 1

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

Submission status: Runtime Error

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


def make_prime(U):
    is_prime = np.zeros(U, np.bool)
    is_prime[2] = 1
    is_prime[3::2] = 1
    M = int(U**.5) + 1
    for p in range(3, M, 2):
        if is_prime[p]:
            is_prime[p * p::p + p] = 0
    return is_prime, is_prime.nonzero()[0]


def f(n):
    cnt = 0
    i = 0
    if n == 1:
        return 1
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            cnt += 2
    if (i - 1) * (i - 1) == n:
        cnt -= 1
    return cnt


# D = [0] * (N + 1)
is_prime, is_prime_value = make_prime(N + 1)
D = np.zeros(N + 1, dtype='int')
D[is_prime] = 2

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

        cnt = 0
        j = 0
        if i == 1:
            D[i] = 1
        for j in range(1, i + 1):
            if j * j > i:
                break
            if j * j == i:
                if j in is_prime_value:
                    D[i] += D[i // j] + 1
                    break
                else:
                    cnt += 1
            if i % j == 0:
                if j in is_prime_value:
                    D[i] += D[n // j] + 2
                    break
                else:
                    cnt += 2
        else:
            D[i] = cnt
        # v = f(i)
        # D[i] = v
        # ans += v * i
    ans += D[i] * i
    # print('i, f(i)', i, f(i))
print(ans)

Submission status: Runtime Error

Solution code:
n = ni()

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

Submission status: Runtime Error

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

ans = 0
for i in range(N):
    for j in range(N):
        if i % j == 0:
            ans += 0
print(ans)

Submission status: Runtime Error

Solution code:
ans = 0
for i in range(N):
    for j in range(N):
        if i % j == 0:
            ans += 0
print(ans)

Submission status: Runtime Error

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

print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int k;
	cin >> k;
    int ans = 0;
	
	for (int i = 1; i <= k; ++i) {
		for (int j = i; j <= k; j += i) {
			ans += i;
		}
	}
	cout << ans << '\n';
	
	return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int k;
	cin >> k;
    ans = 0
	
	for (int i = 1; i <= k; ++i) {
		for (int j = i; j <= k; j += i) {
			ans += i;
		}
	}
	cout << ans << '\n';
	
	return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
total = 0
for i in range(1,n+1):
  i = k
  j = 1
  while k >=n:
    total += k
    k *= j
    j += 1

print(total)

Submission status: Runtime Error

Solution code:
n = int(input())
total = 0
for i in range(1,n+1):
  i = k
  j = 1
  while k >=n:
    total += k
    k *= j
    j += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from itertools import accumulate
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

asum = list(accumulate(a))
bsum = list(accumulate(b))

ans, j = 0, m-1
for i in range(n):
    if asum[i] > k:
        break
    while bsum[j] > k - asum[i]:
        j -= 1
    ans = max(ans, i+1+j+1)
print(ans)

Submission status: Runtime Error

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