TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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).

Submission attempts (in order):
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())
li=[]
f=make_divisors(n)
for i in range(1,n+1):
    li.append(i*f[i-1])
print(sum(li))

import sympy
n=int(input())
li=[]
f=[sympy.divitor_count(i) for i in range(1,n+1)]
for i in range(1,n+1):
    li.append(i*f[i])
print(sum(li))


n=int(input())


#print(sum(L))
ans=0

#    for j in range(1,n+1):
#        if i%j==0:
#            ans+=i
#print(ans)
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(1,n+1)))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
N = input()
N = int(N)
sum = 0
for i in range(N):
  sum+= (i+1)*(1+N//(i+1))(N//(i+1))/2
print(sum)

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

N = input()
sum = 0
for i in range(N):
  sum+= i*(1+N//i)(N//2)/2
print(sum)

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

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

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
cnts = [k*(n//k)*((n//k)+1)//2 for k in range(1,n//2)]
print(sum(cnts)+ ((n//2)+n)*(n-(n//2)+1)//2)

n = int(input())
cnts = [k*d*(d+1)//2 for k in range(1,n//2)]
print(sum(cnts)+ (n//2)*d*(d+1)//2)

n = int(input())
cnts = [k*(n//k)*((n//k)+1)//2 for k in range(1,n//2+1)]
print(sum(cnts)+ ((n//2+1)+n)*(n-(n//2+1)+1)//2)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)


from numba import njit


@njit
def main(N):
    ans = 0

    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)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import math
n = int(input())

ans = 0

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

print(ans)


import math
n = int(input())

ans = 0

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

print(int(ans))


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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()

import sys

# import numpy as np

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



#     L = [1] * (n + 1)


#         for j in range(i, n + 1, i):
#             L[j] += 1
#         # L[i:n + 1:i] += 1
#     # print(f'{L=}')
#     return sum(i * x for i, x in enumerate(L))


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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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)

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)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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()


#!/usr/bin/env python3
import sys


def solve(N: int):
    
    # 
    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()


#!/usr/bin/env python3
import sys
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()


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import numpy as np

N = int(input())

ans = np.zeros((N, N))
A = np.arange(1, N + 1)

ans[0, :] = A
ans[1, :] = A[A%2 == 0]
ans[2, :] = A[A%3 == 0]
ans[3, :] = A[A%4 == 0]

print(np.sum(ans))

import numpy as np

N = int(input())

ans = 0

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

print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)

record = [0]*20000000
N = int(input())


nums = []
for n in range(1,N+1):
    nums.append(int(N/n))
# print(nums)

ro = 1
for num in nums:
    # print(num)
    for j in range(1,num+1):
        # print(j*ro)
        record[j*ro] += 1
    # print('---')
    ro += 1
    

sum = 0
for r in range(len(record)):
    sum += r*record[r]
print(sum)

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

Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
Problem: 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).

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

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

Verdicts: Runtime Error

Accepted
Problem: 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).

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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))


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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n=int(input())
List=[1 for x in range(n+1)]
for x in range(2,n+1):
  for y in range(x,n+1,x):
    List[y]+=1
ans=1
for x in range(1,n+1):
  ans+=(List[x]*x)
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())
ssum = 0
start = time.time()
for k in range(1, N + 1):
    X = int(N / k)
    ssum += k * X * (X + 1) / 2
print(int(ssum))


N = int(input())
ssum = 0
# start = time.time()
for k in range(1, N + 1):
    X = int(N / k)
    ssum += k * X * (X + 1) / 2
print(int(ssum))
# elapsed_time = time.time() - start
# print("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
def solve(n):
  ans = n * (n + 1) - 1  

  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)

#!/usr/bin/env python3


def main():
    n = int(input())
    ans = n * (n + 1) - 1  

    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)


if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = 0
q = int(n ** .5)
for i in range(1, int(n ** .5) + 1):
	x = n // i
	s += i * (x * (x+1)) / 2
	if x**2 != n:
		y = max(n // (i+1), q)
		s += (i * (i+1) // 2) * ((x * (x+1) // 2) - (y * (y+1) // 2))

print(int(s))

n = int(input())

s = 0
q = int(n ** .5)
for i in range(1, q+1):
	x = n // i
	s += i * (x * (x+1)) / 2
	if x**2 != n:
		y = max(n // (i+1), q)
		s += (i * (i+1) // 2) * ((x * (x+1) // 2) - (y * (y+1) // 2))

print(int(s))

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
N=int(input())
sum=0
for i in range(2,N+1):
    sum+=N//i
print(sum)    

N=int(input())
sum=0
for j in range(1,N+1):
    sum+=((N//j)*(N//j+1)//2)*j
print(sum)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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):
    
    
    #            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()


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):
    
    
    #            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()


from numba import jit
def _resolver(N):
    count = 0
    for j in range(1, N+1):
        for i in range(1, 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):
    
    
    #            count += i
    #j, j*2, j*3 ,,,, j*(N//j)

    for j in range(1,N+1):
        length = N // j
        count += length*(j+(j*length)) // 2
    return count

def resolver2(N):

    import numpy as np
    J = np.arange(1, N+1, dtype=np.int64)
    length = N // J
    count = sum(length*(J+(J*length)) // 2)
    return count

def test():
    print(resolver2(10**7))
    for n in range(1, 100):
        ans1 = _resolver(n)
        ans2 = resolver2(n)
        if ans1 != ans2 or n < 11:
            print(f"n={n} ans={ans1}, {ans2}")
    print("OK")


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


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

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

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

print(int(res))

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
print(sum(n/i * (n/i+1) / 2 * i for i in range(1, n+1))

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
#D
n = int(input())

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

#D
n = int(input())

# >>

def Sun_of_Arithmetic_sequence(a, d, n):
    return (2 * a + (n - 1) * d) * n // 2
    
ans = 0
for i in range(1, n + 1):
    
    m = n // i
    
    ans += n * (2 * i + i * (n - 1)) / 2    
print(int(ans))

#D
n = int(input())


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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())
c = (N+1)//2
ans = 0
for i in range(1,N-c+1):
    ans += i*(1+N//i)*(N//i)/2
ans += N*c -(c+1)*c/2
print(int(ans))

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import numpy as np
n=int(input())
cnt=np.zeros(n+1,dtype = int)
for i in range(1,n+1):
    cnt[i::i]+=1
ans=cnt*np.arrange(n+1)
print(ans)

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


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
def main():

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

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

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

if __name__ == '__main__':
   main()

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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))

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

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

print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())

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

print(table)

n = int(input())

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
ans = 0
for i in range(1, n + 1):
    ans += sum(range(i,n,i))
print(ans)


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


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import math

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


def prime_factrize(n):
    prime_list = primes(n)
    s = int(math.sqrt(n)) + 1
    l = [0]*s
    for x in prime_list:
        if x**2 > n:
            break
        while n % x == 0:
            n // x
            l[x] += 1
    
    return l

def yakusuu(n):
    l = prime_factrize(n)
    res = 1

    for i in l:
        res *= (i + 1)

    return res

n = int(input())

ans = 0

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

print(ans)


n = int(input())

def s(n):
    return n * (n + 1) // 2

ans = 0

for i in range(1, n+1):
    tmp = n // i
    ans += i * s(tmp)

print(ans)


Verdicts: Time Limit Exceeded

Accepted
Problem: 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).

Submission attempts (in order):
def divisor(x):
    count=0
    for i in range(1,x//2):
        if x%i==0:
            count+=1
    return count

n = int(input())
ans=0
for num in range(1,n+1):
    a = 0
    divisors = divisor(num)
    a = num* divisors 
    ans+=a
print(ans)

import numpy as np
n=int(input())
num=np.array(list(range(1,n+1)))

x=n//num
ans=num*(x+1)*x/2
print(int(np.sum(ans)))

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())

def cal(i):
    s = (i + i*(n//i))*(n//i)*0.5
    return s

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


n = int(input())

def cal(i):
    s = (i + i*(n//i))*(n//i)*0.5
    return s

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


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import numpy as np
n = int(input())

ans = np.zeros(n+1)
for i in range(1, n+1):
  ans[i::i] += 1

ans *= np.arange(n+1)
# [0, f(1), ..., f(n)] * [0, 1, 2, ..., n]
print(sum(ans))

n = int(input())

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

  
  last_term = n // i * i
  num_term = (last_term - i) // i + 1
  ans += (i + last_term) * num_term // 2
   

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, K = il()
    A = il()
    SA = [0] * (N + 1)
    for n in range(N):
        SA[n + 1] = A[n] + SA[n]
    B = il()
    SB = [0] * (M + 1)
    for m in range(M):
        SB[m + 1] = B[m] + SB[m]
        
    ret = 0
    for n in range(N+1):
        for m in range(M+1):
            if SA[n] + SB[m] <= K:
                ret = max(ret, n + m)
    print(ret)


if __name__ == '__main__':
    main()


import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):

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)


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)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())

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

print(ans)

N = int(input())

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

print((int)(ans))

Verdicts: Wrong Answer

Accepted
Problem: 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).

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

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



Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
#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)

#172D
#Sum of Divisors

n=int(input())
ans=0

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())
ans = 0

for i in range(1, N+1):
  Y = N // j
  ans += Y * (Y+1) * j / 2
  
print(int(ans))

N = int(input())
ans = sum([(N//i) * (N//i + 1) * i / 2  for i in range(1, N+1)])
print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
import math
k = int(input())
an = 0
for i in range(1,k+1):
    li = []
    cnt = 1
    num = i
    if i == 1:
        lis.append(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)


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)


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

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

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
N= int(input())
ans = 0
for j in range(N):
  N_j = N//j
  ans += j*(1+N_j)*N_j//2
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)


N = int(input())

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


print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
l = [0 for _ in range(n+1)]
l[1] = 1

for i in range(n+1):
    for j in range(i-1, 0, -1):
        if i % j == 0:
            l[i] = l[j] + 1
            break

ans = 0
for k in range(n+1):
    print(k * l[k])
    ans += (k * l[k])

print(ans)


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
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()


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
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

from numba import jit

@jit
solve()

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
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()


import numpy as np
from numba import jit

@jit # TLE, without this!!!
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
    
    
    ans = 0
    for k in range(n+1):
        ans += (k * divisors[k])
    
    print(ans)

solve()


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
N=int(input())
N=10**7
#N=100
ans=0
for i in range(1,N+1):
  ans+=i*((1+(N//i))*(N//i)//2)
  #print(ans)
  pass
print(ans)

N=int(input())
#N=10**7
#N=100
ans=0
for i in range(1,N+1):
  ans+=i*((1+(N//i))*(N//i)//2)
  #print(ans)
  pass
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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).

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

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

Verdicts: Runtime Error

Accepted
Problem: 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).

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


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


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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()


# ABC172 C
N = int(input())
print(sum((N//x)*(N//x+1)*x//2 for x in range(1,N+1)))
    
        


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)

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)

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+1):
        t = N//i
        ans += i*(t*(t+1)//2-1)
    print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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).

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

N = int(input())
ans = 0
for d in range(1, N + 1):
    ans += (1 + N // d) * (N // d) * d // 2
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())

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


n = int(input())

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


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1)
    ans += i * g(n // i)
print(ans)

n = int(input())
def g(n):
    return n * (n + 1) // 2
 
ans = 0
for i in range(1, n+1):
    ans += i * g(n // i)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
1N = int(input())
ans = 0
for i in range(1,N+1):
  Limit = N//i
  ans += int(Limit*(Limit+1)*i/2)
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
import sympy

N = int(input())
ans = 0
for n in range(1,N+1):
    ans += n * len(sympy.divisors(n))
    print(n,len(sympy.divisors(n)))
print(ans)

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
n = int(input())
ans = 0
for i in range(1, n+1):
	y = n // i
	ans += y * (y +1) * i / 2

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n=int(input())
ans=0
l=[x for x in range(1,n+1)]
for i in range(1,n+1):
  z=i
  for j in range(0,n,i):
    ans+=z
    z+=i
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
from numba import njit
import numpy as np
 
 
@njit("i8(i8)")
def solve(n):
    s = [1]*(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])
n = int(input()) 
print(solve(n))


from numba import njit
import numpy as np

@njit("i8(i8)")
def solve(n):
    s = np.ones(n + 1, dtype=np.int64)
    ans = 1
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            s[j] += 1
        ans += (i * s[i])
n = int(input()) 
print(solve(n))


from numba import njit

@njit("i8(i8)")
def solve(n):
    s = [1] * (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])
	return ans
n = int(input()) 
print(solve(n))


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)


from numba import njit 
@njit("i8(i8)")
n = int(input())    

s = [1]*(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)


from numba import njit

@njit("i8(i8)")

n = int(input())    

def solve(n):
    s = [1]*(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(solve(n))


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
 

from numba import njit

@njit("i8(i8)")
def solve(n):
    s = [1] * (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])
    return ans
n = int(input()) 
print(solve(n))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
n=int(input())
 
su = 0
for i in range(1,int(n**0/5)+1):
    m = int(n/i) - i + 1
    su += m*(2*i*i + (m-1)*i) - i*i
    
 
print(su)

def solve(n):
    su = 0
    for i in range(1, n+1):
        m = n//i
        su += m*(2*i + (m-1)*i)//2
    return su

n = int(input())
print(solve(n))

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())
ans = 0
for i in range(N):
    j = N // i
    ans += i * j * (j+1) / 2

print(ans)


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

print(ans)


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

print(ans)


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

print(ans)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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).

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

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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):

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



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



import collections
import sys
import copy


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 += int((y*(y+1)*i)/2)

    print(num)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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))

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

# ABC172_D
N = int(input())
ans = 0

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

print(int(ans))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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)


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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
import sys
input = sys.stdin.readline

@njit
def main():
    N = int(input())
    Answer = 0

    for i in range(1,N+1):
        cnt = N // i
        num = cnt * (cnt + 1) >> 1
        num *= i
        Answer += num

print(Answer)
main()

import sys
input = sys.stdin.readline

N = int(input())
Answer = 0

for i in range(1,N+1):
    cnt = N // i
    num = cnt * (cnt + 1) >> 1
    num *= i
    Answer += num

print(Answer)

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())

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

print(ans)

N = int(input())

def gen():
  for j in range(1,N+1):
    yield j * (N//j)*(N//j+1)/2

ans = int(sum(gen()))

print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):

N = int(input())
print(sum(i*(N//i)*(N//i + 1) // 2 for i in range(1,N+1) )


import numba
@numba.njit('(i8,)', cache=True)
def m(n):
    return sum(m*((n//m)**2+n//m-m**2) for m in range(1,int(n**.5)+1))

print(m(int(input())))

def f():n=int(input());print(sum(m*((g:=n//m)**2+g-m**2)for m in range(1,int(n**.5)+1)))
if __name__=="__main__":f()

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
n=int(input())
ans=0
for i in range(1,n+1):
    d=n//(2*i)
    ans+=i*d*(2*d+1)
print(ans)

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted