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:
N = int(input())
 
sum = 0
ro = 1
for n in range(1,N+1):
    num = int(N/n)
    if num == 1:
        record = n
        break
    s = int(((1+num)*num)/2)
    sum += ro*s
    ro += 1

print(record)
print(sum)

sum += int(((record+N)*(N-record+1))/2)
print(sum)

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)
    return divisors

def main():
    N = int(input())
    divisor_num = 0
    for i in range(1, N + 1):
        divisor_num += len(make_divisors(i))
    return divisor_num

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

Submission status: Wrong Answer

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

Solution code:
N = int(input())
prime = [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, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559]
ans = 0
for i in range(1,N+1):
    tmp = []
    for j in prime:
        if j < i :
            t = i//j
            if t >= 1 :
                tmp.append(t+1)
        else:
            break
    if len(tmp) > 0:
        n = 1
        for k in tmp:
            n *= k
        ans += n
        tmp.clear()
          
    
print(ans)

Submission status: Wrong Answer

Solution code:
def make_divisors2(n):
    cnt=1
    for i in range(1,int(n/2)):
        if n%i==0:
            cnt+=1
    return cnt

def f(x):
    return x * (make_divisors2(x))

n = int(input())

result = 0
for i in range(1, n+1):
    result += f(i)
print(result)

Submission status: Wrong Answer

Solution code:
N = int(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)
    return len(divisors)
def is_prime(num):
    if num < 2:
        return False
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    sqrt_num = int(num ** 0.5) + 1
    for i in range(3, sqrt_num, 2):
        if num & i == 0:
            return False
    return True
ans = 0
for i in range(1, N+1):
    if is_prime(i):
        ans += i * 2
    else:
        ans += i * make_divisors(i)
print(ans)

Submission status: Wrong Answer

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())
def main(n):
    t=0
    if n > 10000000:
        t = 838627288460105
        for i in range(10000000,n):
            t += len(make_divisors(i+1))*(i+1)
            return t
    if n > 1000000:
        t = 60838590676
        for i in range(1000000,n):
            t += len(make_divisors(i+1))*(i+1)
            return t
    if n > 100000:
        t = 60838190672
        for i in range(100000,n):
            t += len(make_divisors(i+1))*(i+1)
            return t
    if n > 10000:
        t = 493438984
        for i in range(10000,n):
            t += len(make_divisors(i+1))*(i+1)
            return t
    if n > 100:
        t = 26879
        for i in range(100,n):
            t += len(make_divisors(i+1))*(i+1)
        return t

    for i in range(n):
            t += len(make_divisors(i+1))*(i+1)
            return t
print(main(n))

Submission status: Wrong Answer

Solution code:
n=int(input())
def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)

    upper_divisors.reverse()
    return n+len(lower_divisors + upper_divisors)
sumi=0
for i in range(1,n+1):
    sumi+=make_divisors(i)
print(sumi)

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

print(sum(make_divisors(n)))

Submission status: Wrong Answer

Solution code:
def sieve(n):
    is_prime = [float('inf')] * (n+1)
    is_prime = list(range(n+1))
    is_prime[0] = 0
    is_prime[1] = 1

    p = 0
    for i in range(2,n+1):
        if is_prime[i] == i:
            p = i
            for j in range(p+p, n+1, p):
                is_prime[j] = min(is_prime[j],i)
        
        if p * p > n:
            break
    
    return is_prime

def solve():
    N = int(input())
    dp = [-1] * (N+1)
    dp[0] = 0
    dp[1] = 1
    sieve_res = sieve(N)
    ans = 0
    for i in range(N,0,-1):
        dfs(N,dp,sieve_res)
        ans += i * dp[i]

    print(ans)

def dfs(N,dp, sieve):
    if dp[N] != -1:
        return dp[N]
    
    dp[N] = dfs(N // sieve[N], dp, sieve) * 2

    return dp[N] 

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import math
from sys import stdin
input = stdin.readline


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

  s = 0
  for k in range(1, N+1):
    f_k = 1
    a = k
    for j in range(2, int(math.sqrt(a))):
      cnt = 0
      while a % j == 0:
        cnt += 1
        a /= j
      f_k *= (cnt + 1)
      if a == 1:
        break
    if not(a == 1):
      f_k *= 2
    s += k * f_k
  print(s)


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

Submission status: Wrong Answer

Solution code:
N = int(input())

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


print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

    upper_divisors.reverse()
    return len(lower_divisors + upper_divisors)
import numpy as np
N = int(input())
print(make_divisors(N))
lis = np.arange(N)
tes = np.arange(N)
for i in range(N):
  lis[i] = make_divisors(i+1)
lis = lis * tes
print(np.sum(lis))

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
ans += N*(N+1)/2

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

print(ans)

Submission status: Wrong Answer

Solution code:
def divisor(n): 
    i = 1
    count = 1
    if( n == 1):
      count = 0
    while i * i <= n:
        if n%i == 0:
          count += 1
        i += 1
    return count
  
n = int(input())
sum = 0
for i in range(1,n+1):
  sum += i * divisor(i)
print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())

RL = [0] * (10 ** 7 + 10)
for i in range(1, 10 ** 7 + 10):
    RL[i] = RL[i-1] + i

print("step")

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

answer = [0 for i in range(0, n+1)]
answer[1] = 1

r_two = 2
d_two = 1
while r_two <= n:
  answer[r_two] = d_two + 1
  r_two = r_two << 1
  d_two = d_two + 1
  
prime = 3
  
l = set([1,2])
to_delete = set()
to_add = set()

while prime <= n // 2:
  #print("\n\nPrime: " + str(prime))
  #print("List: " + str([(idx, answer[idx]) for idx in l]))
  to_add.clear()
  to_delete.clear()
  
  for idx in l:
    k, d = idx, answer[idx]
    #print("\nk: " + str(k) + "\n")
    if k * prime > n:
      #print("\nDeleting: " + str(k))
      to_delete.add(idx)  # O(n) total deletions
      continue

    power = 1
    while k * prime <= n:
      k = k * prime
      #print("x: " + str((k, (power + 1) * d)))
      answer[k] = (power + 1) * d  # O(n) x's
      power = power + 1
      if k <= n // prime:
        to_add.add(k)  # O(n) total additions

  l = l.difference(to_delete)  # O(n) total deletions
  l = l.union(to_add)  # O(n) total additions
  
  while answer[prime] != 0:
    prime = prime + 2  # O(n) total increments
ans=0
for i,k in enumerate(answer):
    ans+=(i*k)
print(ans)

Submission status: Wrong Answer

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

# n以下の整数でiで割り切れる数の総和
def sumofdivi(n,i):
    a = n//i
    b = (a*(a+1))//2*i
    return b

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

ans += sumofdivi(n,n)
print(ans)

Submission status: Wrong Answer

Solution code:
nn=int(input())

yakusu=[0]*(nn+1)

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

for i in range(1,nn+1):
    if i==1:
        yakusu[i]=[1]

    elif yakusu[i]==0:
        yakusu[i]=prime_factorize(i)
        bi=1
        if i*(2**bi)<=nn:
            yakusu[i*(2**bi)]=yakusu[i]+[2]
            bi+=1
        bi=1
        if i*(3**bi)<=nn:
            yakusu[i*(3**bi)]=yakusu[i]+[3]
            bi+=1
        bi=1
        if i*(5**bi)<=nn:
            yakusu[i*(5**bi)]=yakusu[i]+[5]
            bi+=1
        if i*(7**bi)<=nn:
            yakusu[i*(7**bi)]=yakusu[i]+[7]
            bi+=1

import collections

ans=0
for i,item in enumerate(yakusu):
    if i==0:
        continue
    if i==1:
        ans+=1
    else:

        c=collections.Counter(item)
        tmp=1
        for v in c.values():
            tmp*=(v+1)
        ans+=i*tmp

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
    ans += i
    for j in range(1,int(i**0.5)+1):
        if i % j == 0:
            ans += i
        else:
            pass

print(ans)

Submission status: Wrong Answer

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())
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=list(i+1 for i in range(a))
www=0
for j in b:
  c=[x+1 for x in range(int(math.sqrt(j)//1))]
  for y in c:
    if j%y==0:
      if not j==y*y:
        www=+j*2
      else:
        www+=j
print(www)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 0
M += 5
for K in range(3, N+1):
    A = [d for d in range(1,K+1) if K % d ==0]
    M += K * len(A)
print(M)

Submission status: Wrong Answer

Solution code:
def divisor(num):
    
    if num==1:
        return 1
    
    else:
        yakusuu_array = []

        for i in range(1,num):
            if num % i == 0:
                yakusuu_array.append(i)
            
        return len(yakusuu_array)+1


N=int(input())
num=0
for i in range(1, N+1):
    yakusuu=divisor(N)
    num    =num + i*yakusuu
print(num)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 1

def factorization(n):
    ans_list = []
    tmp = n
    for i in range(2,int(math.sqrt(n))+1):
        if tmp % i == 0:
            count = 0
            while tmp % i == 0:
                count += 1
                tmp //= i
            ans_list.append([i, count])
        if i > tmp:
            break
    if tmp != 1:
        ans_list.append([tmp, 1])
    if ans_list == []:
        ans_list.append([n, 1])
    return ans_list

# print(factorization(N))

for i in range(2,N+1):
    Fx = 0
    Facto = factorization(i)
    for j in Facto:
        Fx += j[1] + 1
    ans += i * Fx
    # print(Fx)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=list(i+1 for i in range(a))
www=0
for j in b:
  c=[x+1 for x in range(int(math.sqrt(j)//1))]
  for y in c:
    if j%y==0:
      if not j/y==y:
        www=+j*2
      else:
        www+=j
print(www)

Submission status: Wrong Answer

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

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

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        fact =1
        arr = factorization(i)
        for a in arr:
            fact *= a[1]+1
        ans += n*fact
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def culcSum(n:int)->int:
    return n * culcDivisor(n)

def culcDivisor(n:int)->int:
    cnt = 0
    for idx in range(1, n+1):
        if n % idx == 0:
            cnt += 1

    return cnt

n :int = int(input())
ans = 0
for idx in range(1, n+1):
    ans += culcSum(n)

print(ans)

Submission status: Wrong Answer

Solution code:
INF = 10 ** 7 + 1
is_prime = [1] * INF

def eratorasu():
    is_prime[0] = 0
    is_prime[1] = 0
    for i in range(2, INF):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, INF, i):
            is_prime[j] = 0
    return

eratorasu()
N = int(input())
dp = [0] * (N + 1)
dp[1] = 1
for i in range(2, N + 1):
    if is_prime[i] == 1:
        dp[i] += 2
    else:
        if i % 2 == 0:
            if is_prime[i % 2] == 1:
                dp[i] += 1
            else:
                tmp = int(pow(i, 0.5))
                if tmp * tmp == i:
                    dp[i] += dp[tmp] + 1
                else:
                    if dp[i // 2] % 2 == 0:
                        dp[i] += dp[i // 2] + 2
                    else:
                        dp[i] += dp[i // 2] + 1
        else:
            dp[i] = dp[int(pow(i, 0.5))] + 1
total = 0
for i in range(1, N + 1):
    total += i * dp[i]

print(total)

Submission status: Wrong Answer

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


n = int(input())
ans = 0
div_list = num_divisors_table(n)

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

print(ans)

Submission status: Wrong Answer

Solution code:
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
a = int(input())
print(a)
c = 0
for i in range (0,a+1):
    b = divisor(i)
    c = c + i * len(b)
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = 0
for K in range(1, N+1):
    A = [d for d in range(1,K+1) if K % d ==0]
    print(len(A))
    M += K * len(A)
print(M)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
cnt = np.ones(N+1, dtype=np.int)
for n in range(2, N//2+1):
    cnt[::n] += 1
cnt[N//2+1:] += 1
print(sum(np.arange(1, N+1) * cnt[1:]))

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
N = int(input())
dp = [0]*(N+1)
dp[1] = 1

def divisor(n): #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 len(table)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter

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

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 len(a)+1

n = int(input())
ans = 0

for i in range(1,n+1):
    ans += prime_factorize(i)*i

print(ans)

Submission status: Wrong Answer

Solution code:
import math 

def f(k):
    divisors = 0
    if k == 1:
        return 1
    for i in range(1,(int)(math.sqrt(k))+1):
        if k%i == 0:
            if n/i == i:
                divisors = divisors + 1
            else:
                divisors = divisors + 2
    return divisors


sum = 0
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num

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

Submission status: Wrong Answer

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

n=int(input())
s=1
for i in range(2,n+1):
  s=s+i*make_divisors(n)

print(s)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
result = 0
for k in range(1, n+1):
    result += k


print(result)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

N = int(input())
ans = 1
for i in range(2, N + 1):
    arr = factorization(i)
    n = i
    for j in arr:
        n *= j[0] ** j[1]
#    print(i, divisor)
    ans += n
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 1

def factorization(n):
    ans_list = []
    tmp = n
    for i in range(2,int(math.sqrt(n))+1):
        if tmp % i == 0:
            count = 0
            while tmp % i == 0:
                count += 1
                tmp //= i
            ans_list.append([i, count])
    if tmp != 1:
        ans_list.append([tmp, 1])
    if ans_list == []:
        ans_list.append([n, 1])
    return ans_list

# print(factorization(N))

for i in range(2,N+1):
    Fx = 0
    Facto = factorization(i)
    for j in Facto:
        Fx += j[1] + 1
    ans += i * Fx
    # print(Fx)
print(ans)

Submission status: Wrong Answer

Solution code:
a=input()
b=list(a)
x=int(a[0])
c=0
d=0
e=0
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

for j in range(1,x+1):
    d=d+(j*int(len(make_divisors(j))))

print(d)

Submission status: Wrong Answer

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

  if temp!=1:
    arr.append([temp, 1])

  if arr==[]:
    arr.append([n, 1])

  return arr

n = int(input())

s = 1
for i in range(2, n+1):
  ls = factorization(i)
  for j in ls:
    s += i*(j[1]+1)

print(s)

Submission status: Wrong Answer

Solution code:
import numpy
n=int(input(''))
b=numpy.zeros((n+1,1),dtype=int)


for a in range(1,n+1):
    c=0
    while(1):
        if a+a*c<=n:
            b[a+a*c][0]+=1
            c+=1
        else:
            break


q=numpy.zeros((1,n+1),dtype=int)
for a in range(n+1):
    q[0][a]=a

s=numpy.dot(q,b)
print(q)
print(b)
print(sum(s)[0])

Submission status: Wrong Answer

Solution code:
N = int(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()
    num = len(divisors)
    return num
ans = 0
for i in range(N):
    ans += (i+1)*make_divisors(i+1)
    print(i+1)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

table = [0] * (n + 1)
res = 0

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

    table[i] = table[i]*i
    res += table[i]
    print(i)

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
s=0
for i in range(1,N+1):
    cnt=0
    for j in range(1,int(N**0.5)+1):
        if i%j==0:
            cnt+=1
    if (i**0.5).is_integer():
        s+=i*((cnt-1)*2+1)
    else:s+=i*cnt*2
print(s)

Submission status: Wrong Answer

Solution code:
def divisors(n):
    i = 1
    cnt = 0
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i * i != n:
                cnt += 1
        i += 1
    return cnt

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    sqrt_intN = int(N ** 0.5 + 1)
    l = [1 if i % 2 else 2 for i in range(N+1)]
    if N == 1:
        print(1)
        return
    if N == 2:
        print(5)
        return
    ans = 5
    for i in range(3, N//2+1):
        ans += (l[i] + 1) * i
        t = i * 2
        while t <= N:
            l[t] += 1
            t += i
    
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())

def factorization(n):
 arr=[]
 temp=n
 ans=1
 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
     ans+=cnt

 if temp!=1:
    ans+=1

 return ans

sum=0
for j in range(1,n+1):
 sum+=int(j)*int(factorization(j))
 print(j)
 print(factorization(j))
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

sum_ += (N//2+1 + N) * (N - (N//2+1) + 1) // 2

print(sum_)

Submission status: Wrong Answer

Solution code:
N = int(input())
if N == 1:
    print(1)
elif N == 2:
    print(5)
elif N == 3:
    print(11)
else:
    ans = N*(N+1)-1
    for i in range(2,N//2):
        t = N//i
        ans += i*(t*(t+1)//2-1)
    print(ans)

Submission status: Wrong Answer

Solution code:
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
x = int()
for i in range(1,n+1):
    y=prime_factorize(i)
    x += i*(len(y)+1)
print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

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


for i in range(2,10**7+1):
    for j in range(1,(10**7)//i+1):
        lis[i*j-1]+=1
print("A")
s=0
for i in range(n):
    s+=lis[i]*(i+1)

print(s)

Submission status: Wrong Answer

Solution code:
import math
k = int(input())
an = 0
for i in range(1,k+1):
    li = []
    cnt = 1
    num = i
    if i == 1:
        an += 1
    else:
        for j in range(2,math.ceil(math.sqrt(i))+1):
            while num % j == 0:
                cnt += 1
                num //= j
            if cnt != 1:
                li.append(cnt)
                cnt = 1
        if num != 1:
            li.append(2)
        ans = 1
        for nu in li:
            ans *= nu
        an += ans
print(an)

Submission status: Wrong Answer

Solution code:
import math

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

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)
    return len(divisors)

N = int(input())
ans = 0
for i in range(N):
    n = N + 1
    if is_prime(n):
        ans += n*2 
    else:
        ans += n*make_divisors(n)
print(ans)

Submission status: Wrong Answer

Solution code:
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 max(table)
N=int(input())
ans=0
li=[i for i in range(1,N+1)]
for i in range(1,N+1):
  ans+=num_divisors_table(i)*i
print(ans)

Submission status: Wrong Answer

Solution code:
import math

def euler(n):
        num = 0
        for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
                if n % i  == 0:
                        num += 1
        return num

n = int(input())
x = 0


for i in range(n):
        f = euler(i + 1)
        x += f * (i +1)

print(x)