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: Wrong Answer

Solution code:
from numba import jit
def _resolver(N):
    count = 0
    for j in range(N+1):
        for i in range(N+1):
            if i % j ==0:
                count += i
    #j, j*2, j*3 ,,,, j*(N//j)
    return count

#@jit("u8(u8)")
def resolver(N):
    if N == 0:
        return 0
    if N == 1:
        return 1
    
    count = 0
    #for j in range(N+1):
    #    for i in range(N+1):
    #        if i % j ==0:
    #            count += i
    #j, j*2, j*3 ,,,, j*(N//j)

    for j in range(1,N+1):
        count += j*(j+(j*(N//j))) // 2
    
    #import numpy as np
    #J = np.arange(1, N+1, dtype=np.int64)
    #count = sum(J*(J+(J*(N//J))) // 2)
    return count

def test():
    print(resolver(10**7))
    for n in range(1, 15):
        ans1 = resolver(n)
        ans2 = resolver(n)
        print(f"n={n} ans={ans1}, {ans2}")
    


def main():
    #test()
    N = int(input())
    ans = resolver(N)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from numba import jit
def _resolver(N):
    count = 0
    for j in range(N+1):
        for i in range(N+1):
            if i % j ==0:
                count += i
    #j, j*2, j*3 ,,,, j*(N//j)
    return count

@jit("u8(u8)")
def resolver(N):
    if N == 0:
        return 0
    if N == 1:
        return 1
    
    count = 0
    #for j in range(N+1):
    #    for i in range(N+1):
    #        if i % j ==0:
    #            count += i
    #j, j*2, j*3 ,,,, j*(N//j)

    for j in range(1,N+1):
        count += j*(j+(j*(N//j))) // 2
    
    #import numpy as np
    #J = np.arange(1, N+1, dtype=np.int64)
    #count = sum(J*(J+(J*(N//J))) // 2)
    return count

def test():
    print(resolver(10**7))
    for n in range(1, 15):
        ans1 = resolver(n)
        ans2 = resolver(n)
        print(f"n={n} ans={ans1}, {ans2}")
    


def main():
    #test()
    N = int(input())
    ans = resolver(N)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
x = int(input())
data = [0]

for i in range(1, x + 1):
  data.append(1)

print(data)

for i in range(2,x + 1):
  for d in range(1, x + 1):
    if d % i == 0:
      data[d] = data[d] + 1

print(data)

ban = 0
ans = 0

for i in data:
  ans = ans + ban * i
  ban += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
def mul(x,y):
    return x*y
def div(x):
    i=1
    d=0
    while i < x**0.5:
        if x % i ==0:
            d += 1
        i += 1
    if x ** 0.5.is_integer():
        return d*2+1
    else:
        return d*2

d=[]
a=[i+1 for i in range(n)]
k = 1
while k <= n:
    d.append(div(k))
    k += 1

print(sum(list(map(mul,a,d))))

Submission status: Wrong Answer

Solution code:
n=int(input())
def mul(x,y):
    return x*y
def div(x):
    i=1
    d=0
    while i <= x:
        if x % i ==0:
            d += 1
        i += 1
    return d

d=[]
a=[i+1 for i in range(n)]
k = 1
while k <= n:
    j = k*div(k)
    d.append(j)
    k += 1

print(sum(list(map(mul,a,d))))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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

def T(i):
    return i * (i + 1) // 2


def solve():
    # n log n : sieving
    # n = ri()
    # sieve = [1] * (n + 1)
    # ans = 1
    # for p in range(2, n + 1):
        # for q in range(p, n + 1, p):
            # sieve[q] += 1
        # ans += p * sieve[p]
    # print (ans)

    # summing with floor n / i technique
    # O(sqrt n)
    n = ri()
    if n in [1,2,3]:
        print ({1:1, 2:5, 3:11}[n])
        return

    sq = int(n**0.5)
    ans = 0
    for i in range(1, sq):
        # print (i, i * T(n // i), T(i) * (T(n // i) - T(n // (i + 1))))
        ans += i * T(n // i)
        ans += T(i) * (T(n // i) - T(n // (i + 1)))

    ans += sq * T(n // sq)
    print (ans)





mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
def main():
    n = int(input())
    if n == 1:
        print(1)
        sys.exit()
    # nd:num of div
    r = 0
    for i1 in range(1, n):
        y = n // i1
        r += y * (y + 1) * i1 / 2
    print(int(r))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def make_divisors(n):
    i = 1
    ans = 0
    while i*i <= n:
        if n % i == 0:
            ans += 1
            if i != n // i:
                ans += 1
        i += 1
    return ans

def main():
    N = II()
    ans = 0

    #for i in range(1,N+1):
    #    ans += i * make_divisors(i)
    
    for j in range(1,N+1):
        for i in range(1, N+1):
            if i%j ==0:
                ans+=1

    print(ans)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
l = list(range(1, N+1))


def calc(i):
    return (i + N//i * i) * i // 2


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

print(ans)

Submission status: Wrong Answer

Solution code:
def func(n):
    div = 0 
    for i in range(1, int(n**0.5)+1):
        if(n%i == 0):
            div += 1
            if(i != n //i):
                div += 1
    return div

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = 100
a = [1,2]
num =0

for i in range(3, n+1):
    for j in range(2, i):
        cnt = 0
        num = 0
        if i%j == 0:
            num = i
            while num%j ==0:
                cnt += 1
                num = num/j
            break  
    
    if num == 0:
        a.append(2)
    else:
        number = int(num)
        b = (cnt+1) * a[number-1]
        a.append(b)
sum = 0
for i in range(1,n+1):
    sum += i*a[i-1]

print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())

N_list = list(range(1, N+1))

def divisor_gen(n):
  for i in range(2, int(n**(1/2))+1):
    if n % i == 0:
      yield [i, int(n/i)]

num_divisors = []
for i in range(1, N+1):
	N_divisors = list(divisor_gen(i))
	num_divisors.append(len(N_divisors))

s = 0
for a, b in zip(N_list, num_divisors):
	s += a*b
	
print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())

t = 0

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

print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = [0]*N

for i in range(1,N+1):
    for j in range(1,i):
        if i % j == 0:
            lst[i-1] += i

print(sum(lst))

Submission status: Wrong Answer

Solution code:
N = int(input())
lst = [0]*N

for i in range(1,N+1):
    for j in range(1,N+1):
        if j % i == 0:
            lst[j-1] += j

print(lst)
print(sum(lst))

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re


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

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

    print(ans)
main_chk()

Submission status: Wrong Answer

Solution code:
def yakusuu(x):
  kosuu = 0
  for i in range(1,x + 1,1):
    if x % i == 0:
      kosuu += 1
  return kosuu


x = input()
intNum = int(x)

ans = 0

for i in range(1,intNum + 1,1):
  print(i)
  ans += i * yakusuu(i)


print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ans = 0

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = np.ones(n+1)
ans = 1
for i in range(2,n+1):
    for j in range(i,n+1,i):
        s[j] += 1
    ans += (i * s[i])

print(ans)

Submission status: Wrong Answer

Solution code:
import sys


def _sum_ob_divisors(n):
    def f(n, x):
        y = n // x
        return y * (y + 1) * x / 2
    return sum(f(n, i) for i in range(1, n + 1))


def sum_ob_divisors(f):
    n = int(f.read())

    return _sum_ob_divisors(n)


def main():
    ans = sum_ob_divisors(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def rec(n):
    count=0
    for i in range(n):
        if n%(i+1)==0:
            count=count+1
    return count


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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0
    for i in range(2, N+1):
        for j in range(i, N+1, i):
            ans += j
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import time
import math
N=int(input())
if N==1:
    print(1)
    exit()


d=[1]*(N+1)

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


print(ans)

Submission status: Wrong Answer

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 len(lower_divisors + upper_divisors[::-1])

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

Submission status: Wrong Answer

Solution code:
N = int(input())

m = [0] * (N+1)
for i in range(1, N):
  temp = i
  for k in range(temp, N+1, i):
    m[k] += 1

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

Submission status: Wrong Answer

Solution code:
import math
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        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 times(x,y):
    a=0
    while x>=y and x%y==0:
        x=x//y
        a+=1
    return a
N=int(input())
M=primes(math.ceil(10000000*0.5))
S=len(M)
B=[1 for i in range(N+1)]
count=1
for j in range(S):
    for i in range(M[j],N+1,M[j]):
        B[i]*=times(i,M[j])+1
c=math.ceil(N*0.5)
for i in range(2,c):
    count+=i*B[i]
for i in range(c,N+1):
    count+=i*max(2,B[i])
print(count)

Submission status: Wrong Answer

Solution code:
import math
def times(x,y):
    a=0
    while x>=y and x%y==0:
        x=x//y
        a+=1
    return a
N=int(input())
M=[2,
 3,
 5,
 7,
 11,
 13,
 17,
 19,
 23,
 29,
 31,
 37,
 41,
 43,
 47,
 53,
 59,
 61,
 67,
 71,
 73,
 79,
 83,
 89,
 97,
 101,
 103,
 107,
 109,
 113,
 127,
 131,
 137,
 139,
 149,
 151,
 157,
 163,
 167,
 173,
 179,
 181,
 191,
 193,
 197,
 199,
 211,
 223,
 227,
 229,
 233,
 239,
 241,
 251,
 257,
 263,
 269,
 271,
 277,
 281,
 283,
 293,
 307,
 311,
 313,
 317,
 331,
 337,
 347,
 349,
 353,
 359,
 367,
 373,
 379,
 383,
 389,
 397,
 401,
 409,
 419,
 421,
 431,
 433,
 439,
 443,
 449,
 457,
 461,
 463,
 467,
 479,
 487,
 491,
 499,
 503,
 509,
 521,
 523,
 541,
 547,
 557,
 563,
 569,
 571,
 577,
 587,
 593,
 599,
 601,
 607,
 613,
 617,
 619,
 631,
 641,
 643,
 647,
 653,
 659,
 661,
 673,
 677,
 683,
 691,
 701,
 709,
 719,
 727,
 733,
 739,
 743,
 751,
 757,
 761,
 769,
 773,
 787,
 797,
 809,
 811,
 821,
 823,
 827,
 829,
 839,
 853,
 857,
 859,
 863,
 877,
 881,
 883,
 887,
 907,
 911,
 919,
 929,
 937,
 941,
 947,
 953,
 967,
 971,
 977,
 983,
 991,
 997,
 1009,
 1013,
 1019,
 1021,
 1031,
 1033,
 1039,
 1049,
 1051,
 1061,
 1063,
 1069,
 1087,
 1091,
 1093,
 1097,
 1103,
 1109,
 1117,
 1123,
 1129,
 1151,
 1153,
 1163,
 1171,
 1181,
 1187,
 1193,
 1201,
 1213,
 1217,
 1223,
 1229,
 1231,
 1237,
 1249,
 1259,
 1277,
 1279,
 1283,
 1289,
 1291,
 1297,
 1301,
 1303,
 1307,
 1319,
 1321,
 1327,
 1361,
 1367,
 1373,
 1381,
 1399,
 1409,
 1423,
 1427,
 1429,
 1433,
 1439,
 1447,
 1451,
 1453,
 1459,
 1471,
 1481,
 1483,
 1487,
 1489,
 1493,
 1499,
 1511,
 1523,
 1531,
 1543,
 1549,
 1553,
 1559,
 1567,
 1571,
 1579,
 1583,
 1597,
 1601,
 1607,
 1609,
 1613,
 1619,
 1621,
 1627,
 1637,
 1657,
 1663,
 1667,
 1669,
 1693,
 1697,
 1699,
 1709,
 1721,
 1723,
 1733,
 1741,
 1747,
 1753,
 1759,
 1777,
 1783,
 1787,
 1789,
 1801,
 1811,
 1823,
 1831,
 1847,
 1861,
 1867,
 1871,
 1873,
 1877,
 1879,
 1889,
 1901,
 1907,
 1913,
 1931,
 1933,
 1949,
 1951,
 1973,
 1979,
 1987,
 1993,
 1997,
 1999,
 2003,
 2011,
 2017,
 2027,
 2029,
 2039,
 2053,
 2063,
 2069,
 2081,
 2083,
 2087,
 2089,
 2099,
 2111,
 2113,
 2129,
 2131,
 2137,
 2141,
 2143,
 2153,
 2161,
 2179,
 2203,
 2207,
 2213,
 2221,
 2237,
 2239,
 2243,
 2251,
 2267,
 2269,
 2273,
 2281,
 2287,
 2293,
 2297,
 2309,
 2311,
 2333,
 2339,
 2341,
 2347,
 2351,
 2357,
 2371,
 2377,
 2381,
 2383,
 2389,
 2393,
 2399,
 2411,
 2417,
 2423,
 2437,
 2441,
 2447,
 2459,
 2467,
 2473,
 2477,
 2503,
 2521,
 2531,
 2539,
 2543,
 2549,
 2551,
 2557,
 2579,
 2591,
 2593,
 2609,
 2617,
 2621,
 2633,
 2647,
 2657,
 2659,
 2663,
 2671,
 2677,
 2683,
 2687,
 2689,
 2693,
 2699,
 2707,
 2711,
 2713,
 2719,
 2729,
 2731,
 2741,
 2749,
 2753,
 2767,
 2777,
 2789,
 2791,
 2797,
 2801,
 2803,
 2819,
 2833,
 2837,
 2843,
 2851,
 2857,
 2861,
 2879,
 2887,
 2897,
 2903,
 2909,
 2917,
 2927,
 2939,
 2953,
 2957,
 2963,
 2969,
 2971,
 2999,
 3001,
 3011,
 3019,
 3023,
 3037,
 3041,
 3049,
 3061,
 3067,
 3079,
 3083,
 3089,
 3109,
 3119,
 3121,
 3137,
 3163]
S=len(M)
B=[1 for i in range(N+1)]
count=1
for j in range(S):
    for i in range(M[j],N+1,M[j]):
        B[i]*=times(i,M[j])+1
for i in range(2,N+1):
    count+=i*min(B[i],2)
print(count)

Submission status: Wrong Answer

Solution code:
from math import sqrt

N = int(input())

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

for i in range(2, N+1):
    for j in range(1, int(sqrt(i))+1):
        if i % j == 0:
            A[j-1] += i
print(sum(A))

Submission status: Wrong Answer

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

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

    return

resolve()

Submission status: Wrong Answer

Solution code:
def positive_div(n):
    c = 0
    for i in range(1, (n // 2) + 1):
        if n % i == 0:
            c += 2
    return c - 1
n = int(input())
s = 0
for j in range(1, n+1):
    s += j*positive_div(j)
print(s)

Submission status: Wrong Answer

Solution code:
#172D
#Sum of Divisors

n=int(input())
ans=0

for i in range(1,n+1):
    j=1
    while i*j<=n:
        ans+=i*j
        j+=1
    print(i,j,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    NI = lambda : int(sys.stdin.readline())

    N = NI()

    ans = N * (N-1) - 1
    for i in range(2,int(math.sqrt(N))+1):
        ans += i*i
        j = i + 1
        while i * j <= N:
            ans += 2 * i * j
            j += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

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

terms = n - n // 2
result += terms * (n // 2 + n) // 2

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from functools import reduce
from operator import mul
from collections import defaultdict, Counter
from heapq import heappush, heappop
import sys
from math import sqrt, floor

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")


def debug(*x):
    print(*x)


def solve(N):
    ret = 0
    for i in range(1, N + 1):
        end = N // i
        num = end // i
        ret += (i + end) * num / 2
    print(ret)


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


def _test():
    """
    >>> solve(4)
    23

    >>> solve(100)
    26879

    >>> solve(10000000)
    838627288460105
    """
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
num = [0 for i in range(n + 1)]
for i in range(n):
    for j in range(n // (i + 1)):
        num[(i + 1) * (j + 1)] += 1
print(num)
ans = 0
for i in range(n):
    ans += (i + 1) * num[i + 1]
print(ans)

Submission status: Wrong Answer

Solution code:
# 約数の個数の表を作る
N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(i, N+1, i):
        ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

Solution code:
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()

    num = 0

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

    print(num)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()

    num = 0

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

    print(num)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
from numba import njit


@njit
def main(N):
    ans = N

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


if __name__ == '__main__':
    N = int(input())
    main(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def solve(N: int):
    # k = P{ ai^bi }のとき k * f(k) = Pi{ (bi + 1) * ai ^ bi }
    # 
    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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#約数
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

# 初期入力
import sys
input = sys.stdin.readline
N = int(input())

#DP
f_dp =[0]*(N+1)
"""
f =make_divisors(N)
f_dp[N] =len(f)
f_dp[f[1]] =f_dp[N] -1
"""
ans =[]
for i in range(N,0,-1):
    if f_dp[i] ==0:
        f =make_divisors(i)
        f.sort(reverse=True)
        f_dp[i] =len(f)
        for j in range(len(f)-1):
            f_dp[f[j+1]] =f_dp[f[j]]-1
    ans.append(i *f_dp[i])
print(sum(ans))

Submission status: Wrong Answer

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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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):
    print(j, f(j))
    ans += j * f(j)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

Ans = [2 * i for i in range(N+1)]
Ans[0] = 0
Ans[1] = 1
ans = 0
for i in range(2, N):
    if i * 2 > N:
        break
    for j in range(2 * i, N+1, i):
        Ans[j] += j
        ans += j

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

furui = [1]*(N+1)
ans = N
for i in range(2, N+1):
    k = i
    while k < N:
        furui[k] += 1
        k += i
    ans += furui[i]*i

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

furui = [1]*(N+1)
ans = 0
for i in range(2, N+1):
    k = i
    while k < N:
        furui[k] += 1
        k += i
    ans += furui[i]*i

print(ans)

Submission status: Wrong Answer

Solution code:

n = int(input())

ans = 0

def calc(b,e):
    cnt = e // b
    return (b + e) * cnt // 2

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


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

    divisors.sort()
    return len(divisors)

def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        l = make_divisors(i)
        ans += l * i

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

Submission status: Wrong Answer

Solution code:
def readinput():
    n=int(input())
    return n

def main(n):
    fk=[1]*(n+1)
    for i in range(2,n+1):
        j=i
        while(j<=n):
            fk[j]+=1
            j+=i
    sum=0
    for i in range(1,n+1):
        sum+=i*fk[i]
    return sum

def main2(n):
    fk=[1]*(n+1)
    for i in range(2,n+1):
        j=i
        while(j<=n):
            fk[j]+=j
            j+=i
    sum=0
    for i in range(1,n+1):
        sum+=fk[i]
    return sum

if __name__=='__main__':
    n=readinput()
    ans=main2(n)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def f(n):
  x = 0
  for i in range(2, int(n ** 0.5 + 2)):
    if n == 1:
      x = 1
      break
    elif n == 2:
      x = 2
      break
    if n % i == 0:
      x += 1
  else:
    x += 2
  return x

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

print(ans)