Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02580 (python)

Fixed submission:
H, W, M = map(int, input().split())
h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
bomb = set([])
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    bomb.add((h, w))
h_max = max(h_list)
w_max = max(w_list)
h_index = []
w_index = []
for i in range(H + 1):
    if h_list[i] == h_max:
        h_index.append(i)
for i in range(W + 1):
    if w_list[i] == w_max:
        w_index.append(i)
tmp = -1        
for h in h_index:
    for w in w_index:
        if (h, w) not in bomb:
            tmp = 0
            break
print(h_max + w_max + tmp)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
bomb = set()
for _ in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    bomb.add([h, w])
h_max = max(h_list)
w_max = max(w_list)
h_index = []
w_index = []
for i in range(H + 1):
    if h_list[i] == h_max:
        h_index.append(i)
for i in range(W + 1):
    if w_list[i] == w_max:
        w_index.append(i)
tmp = -1        
for h in h_index:
    for w in w_index:
        if [h, w] not in bomb:
            tmp = 0
            break
print(h_max + w_max + tmp)
Problem p02598 (python)

Fixed submission:
import copy
import math

def calc(x, aa):
    a = copy.deepcopy(aa)
    cnt = k
    while cnt > 0:
        for i in range(n):
            if (a[i] > x):
                cnt -= a[i] // x
                a[i] = x
            if cnt < 0:
                return False
        if cnt < 0:
            return False
        return True
    
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
left, right = 0, max(a)
if k == 0:
    print(right)
    exit()
    
while (right - left) > 1:
    middle = (left + right) / 2
    if calc(middle, a):
        right = middle
    else:
        left = middle        
for i in range(max(math.floor(left) - 10, 1), math.ceil(right) + 10):
    if calc(i, a):
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
import copy
import math

def calc(x, aa):
    a = copy.deepcopy(aa)
    cnt = k
    while cnt > 0:
        for i in range(n):
            if (a[i] > x):
                cnt -= a[i] // x
                a[i] = x
            if cnt < 0:
                return False
        if cnt < 0:
            return False
        return True


n, k = map(int, input().split())
a = [int(i) for i in input().split()]
left, right = 0, max(a)
while (right - left) > 1:
    middle = (left + right) / 2
    if calc(middle, a):
        right = middle
    else:
        left = middle
print(math.ceil(middle))

Buggy submission (verdict: Runtime Error):
import copy
import math
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
left, right = 0, max(a)
while (right - left) > 1:
    middle = (left + right) / 2
    if calc(middle, a):
        right = middle
    else:
        left = middle
print(math.ceil(middle))

def calc(x, aa):
    a = copy.deepcopy(aa)
    cnt = k
    while cnt > 0:
        for i in range(n):
            if (a[i] > x):
                cnt -= a[i] // x
                a[i] = x
            if cnt < 0:
                return False
        if cnt < 0:
            return False
        return True
Problem p02695 (python)

Fixed submission:
import itertools

n, m, q = map(int, input().split())
value = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    value.append([a - 1, b - 1, c, d])
ans = 0
for comb in itertools.combinations_with_replacement(range(1, m + 1), n):
    temp = 0
    for v in value:
        if comb[v[1]] == comb[v[0]] + v[2]:
            temp += v[3]
    ans = max(ans, temp)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
value = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    value.append([a - 1, b - 1, c, d])
value.sort()
ans_list = []
for i in range(2 **q):
    t = '0' * (q - len(bin(i)[2:])) + bin(i)[2:]
    dp = [1] * m
    dp_k = [0] * m
    ans = 0
    for j, tt in enumerate(t):
        if tt == '1':
            if dp_k[value[j][1]] == 0:
                dp[value[j][1]] = dp[value[j][0]] + value[j][2]
                dp_k[value[j][1]] = 1
                if dp[value[j][1]] <= m:
                    ans += value[j][3]
                else:
                    ans = 0
                    break
            elif dp_k[value[j][1]] == 1:
                if dp[value[j][1]] == dp[value[j][0]] + value[j][2]:
                    ans += value[j][3]
                else:
                    ans = 0
                    break
            else:
                ans = 0
                break
    ans_list.append(ans)
print(max(ans_list))

Buggy submission (verdict: Runtime Error):
n, m, q = map(int, input().split())
value = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    value.append([a - 1, b - 1, c, d])
value.sort()
ans_list = []
for i in range(2 **q):
    t = '0' * (q - len(bin(i)[2:])) + bin(i)[2:]
    dp = [1] * m
    dp_k = [0] * m
    ans = 0
    for j, tt in enumerate(t):
        if tt == '1':
            if dp_k[value[j][1]] == 0:
                dp[value[j][1]] = dp[value[j][0]] + value[j][2]
                dp_k[value[j][1]] = 1
                if dp[value[j][1]] <= m:
                    ans += value[j][3]
                else:
                    ans = 0
                    break
            elif dp_k[value[j][1]] == 1:
                if dp[value[j][1]] == dp[value[j][0]] + value[j][2]:
                    ans += value[j][3]
                else:
                    ans = 0
                    break
            else:
                ans = 0
                break
    ans_list.append(ans)
print(max(ans_list))
Problem p02793 (python)

Fixed submission:
import math
from collections import defaultdict, Counter

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

N = int(input())
A = [int(i) for i in input().split()]
v_list = []
mod = 10 ** 9 + 7
LCM_dict = defaultdict(int)
for i in range(N):
    prime_cnt = Counter(prime_factorize(A[i]))
    for k, v in prime_cnt.items():
        LCM_dict[k] = max(LCM_dict[k], v)
    v_list.append(prime_cnt)
ans = 0
for i in range(N):
    prime_cnt = v_list[i]
    tmp_value = 1
    for k, v in LCM_dict.items():
        cnt = 0 if k not in prime_cnt.keys() else prime_cnt[k]
        tmp_value = pow(k, v - cnt) * tmp_value
        tmp_value = tmp_value % mod
    ans += tmp_value
    ans = ans % mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import defaultdict, Counter

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

N = int(input())
A = [int(i) for i in input().split()]
v_list = []
mod = 10 ** 9 + 7
LCM_dict = defaultdict(int)
for i in range(N):
    prime_cnt = Counter(prime_factorize(A[i]))
    for k, v in prime_cnt.items():
        LCM_dict[k] = max(LCM_dict[k], v)
        v_list.append(prime_cnt)
ans = 0
for i in range(N):
    prime_cnt = v_list[i]
    tmp_value = 1
    for k, v in LCM_dict.items():
        cnt = 0 if k not in prime_cnt.keys() else prime_cnt[k]
        tmp_value = pow(k, v - cnt) * tmp_value
        tmp_value = tmp_value % mod
    ans += tmp_value
    ans = ans % mod
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import defaultdict, Counter

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

N = int(input())
A = [int(i) for i in input().split()]
v_list = []
mod = 10 ** 9 + 7
LCM_dict = defaultdict(int)
for i in range(N):
    prime_cnt = Counter(prime_factorize(A[i]))
    for k, v in prime_cnt.items():
        LCM_dict[k] = max(LCM_dict[k], v)
        v_list.append(prime_cnt)
ans = 0
for i in range(N):
    prime_cnt = v_list[i]
    tmp_value = 1
    for k, v in LCM_dict.items():
        cnt = 0 if k not in prime_cnt.keys() else prime_cnt[k]
        tmp_value = pow(k, v - cnt) * tmp_value
    ans += tmp_value
    ans = ans % mod
print(ans)
Problem p02820 (python)

Fixed submission:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
dp = [3] * k
point = 0
choice = (r, s, p)
t = t.replace('r', '2').replace('s', '0').replace('p', '1')
for j, i in enumerate(t):
    if dp[j % k] != int(i):
        point += choice[int(i)]
        dp[j % k] = int(i)
    else:
        dp[j % k] = 3
print(point)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

ans = 0
point_dict = {'r': p, 's': r, 'p': s }
for i in range(k):
    t_x = t[i::k]
    point_0 = 0
    point_1 = 0
    for j in range(len(t_x)):        
        if (j % 2) == 0:
            if (t_x[j] != t_x[j - 1 if j - 1 >= 0 else 1]) & (t_x[j] != t_x[j + 1 if j + 1 < len(t_x) else len(t_x) - 1]):
                point_0 += point_dict[t_x[j]]
            point_1 += point_dict[t_x[j]]
        else:
            if (t_x[j] != t_x[j - 1 if j - 1 >= 0 else 1]) & (t_x[j] != t_x[j + 1 if j + 1 < len(t_x) else len(t_x) - 1]):
                point_1 += point_dict[t_x[j]]
            point_0 += point_dict[t_x[j]]
    ans += max(point_0, point_1)
print(ans)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print(int(a * b / (fractions.gcd(a, b))))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(int(a * b / (math.gcd(a, b))))
Problem p02891 (python)

Fixed submission:
s = input()
k = int(input())
count = []
now = 1
for i in range(len(s) - 1):
    if s[i] == s[i + 1]:
        now += 1
    else:
        count.append(now)
        now = 1
count.append(now)
if len(count) == 1:
    ans = (count[0] * k) // 2
else:
    if s[0] == s[-1]:
        temp = 0
        for i in count:
            temp += i // 2
        ans = (temp * k) - ((count[0] // 2) + (count[-1] // 2)  - ((count[0] + count[-1]) // 2)) * (k - 1)
    else:
        ans = sum([c // 2 for c in count]) * k
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
ans = 0
space = 0
while (i < len(s)):
  if s[i] == s[i + 1]:
	ans += 1
    i += 2
  else:
    i += 1
if s[-1] == s[0]:
  space = 1
final_ans = (ans * k) + (space * (k - 1))
print(final_ans)
Problem p02948 (python)

Fixed submission:
from collections import defaultdict
import heapq

a_dict = defaultdict(lambda: [])
n, m = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    a_dict[a].append(-b)
ans = 0
heap_list = []
for i in range(1, m + 1):
    for aa in a_dict[i]:
        heapq.heappush(heap_list, aa)
    if len(heap_list) > 0:
        ans -= heapq.heappop(heap_list)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
red = []
blue = []
for _ in range(n):
    a, b = map(int, input().split())
    red.append([a, b])
for i in range(n):
    c, d = [i, 0]
    blue.append([c, d])
blue.sort()
red.sort(key=lambda x: x[1], reverse=True)
ans = 0
for b in blue:
    for i, r in enumerate(red):
        if (r[0] < b[0]) & (r[1] < b[1]):
            ans += 1
            red.pop(i)
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n, m = map(int, input().split())
a_list = []
for _ in range(n):
    a, b = map(int, input().split())
    if a <= m:
        a_list.append([a, b])
a_list = sorted(a_list, key=lambda x: (x[0], -x[1]))
a_list_1 = [aa[0] for aa in a_list]
a_list_2 = [aa[1] for aa in a_list]
ans = 0
for i in range(m):
    k = bisect.bisect_right(a_list_1, m - i) - 1
    if k >= 0:
        l = len(a_list_2) - reversed(a_list_2).index(max(a_list_2[:k + 1])) - 1
        if l < len(a_list_2):
            if a_list_1[l] <= m - i:
                ans += a_list_2[l]
                del a_list_1[l], a_list_2[l]
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n, m = map(int, input().split())
a_list = []
for _ in range(n):
    a, b = map(int, input().split())
    if a <= m:
        a_list.append([a, b])
a_list = sorted(a_list, key=lambda x: (x[0], -x[1]))
a_list_1 = [aa[0] for aa in a_list]
a_list_2 = [aa[1] for aa in a_list]
ans = 0
for i in range(m):
    k = bisect.bisect_right(a_list_1, m - i) - 1
    if k >= 0:
        l = len(a_list_2) - reversed(a_list_2).index(max(a_list_2[:k + 1])) - 1
        if a_list_1[l] <= m - i:
            ans += a_list_2[l]
            del a_list_1[l], a_list_2[l]
print(ans)
Problem p02990 (python)

Fixed submission:
import math
def combinations_count(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % inf

inf = (10 ** 9) + 7
n, k = map(int, input().split())
if n == k:
    for i in range(1, k+1):
        if i == 1:
            print(1)
        else:
            print(0)
else:
    for i in range(1, k+1):
        if (n - k + 1 >= i):
            print((combinations_count((n - k + 1), i)*combinations_count((k-1), i-1))%inf)
        else:
            print(0)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

inf = (10 ** 9) + 7
n, k = map(int, input().split())
for i in range(1, k+1):
    print((combinations_count((n - k + 1), i)*combinations_count((k-1), i-1))%inf)
Problem p03013 (python)

Fixed submission:
inf = 7 + (10 ** 9)
n, m = map(int, input().split())
dp1 = [0] * (n + 1)
dp1[0] = 1
for _ in range(m):
    a = int(input())
    dp1[a] = - inf
for i in range(n):
    if i < n:
        if (dp1[i + 1] != -inf) & (dp1[i] != -inf):
                dp1[i + 1] = dp1[i + 1] + dp1[i]
    if i + 1 < n:
        if (dp1[i + 2] != -inf) & (dp1[i] != -inf):
                dp1[i + 2] = dp1[i + 2] + dp1[i]
print(dp1[-1] % inf)

Buggy submission (verdict: Runtime Error):
inf = 7 + (10 ** 9)
n, m = map(int, input().split())
dp1 = [0] * (n + 1)
dp1[0] = 1
for _ in range(m):
    a = int(input())
    dp1[a] = - inf
for i in range(n):
    if i < n:
        if (dp1[i + 1] != inf) & (dp1[i] != inf):
                dp1[i + 1] = dp1[i + 1] + dp[i]
    if i + 1 < n:
        if (dp1[i + 2] != inf) & (dp1[i] != inf):
                dp1[i + 2] = dp1[i + 2] + dp[i]
print(dp1[-1] % inf)
Problem p03209 (python)

Fixed submission:
def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= (a[n-1] + 1):
        return f(n - 1, x - 1)
    else:
        return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1])


n, x = map(int, input().split())

a, p=[1],[1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
    
print(f(n, x))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
a = putty(n)
a = a[:x]
print(a.count("P"))
Problem p03253 (python)

Fixed submission:
import copy
import math
import collections

inf = (10 ** 9) + 7
n, m = map(int, input().split())
prime_dict = {}
m_copy = copy.deepcopy(m)
while (m_copy % 2 == 0):
    m_copy = int(m_copy // 2)
    if 2 not in prime_dict.keys():
        prime_dict[2] = 1
    else:
        prime_dict[2] += 1
for i in range(3, int(math.sqrt(m)) + 1, 2):
    while (m_copy % i == 0):
        m_copy = int(m_copy // i)
        if i not in prime_dict.keys():
            prime_dict[i] = 1
        else:
            prime_dict[i] += 1
if m_copy != 1:
    if m_copy not in prime_dict.keys():
        prime_dict[m_copy] = 1
    else:
        prime_dict[m_copy] += 1
b = list(prime_dict.values())
ans = 1

dp = [[1 for _ in range(30)] for _ in range(n)]
for i in range(1, 30):
    for j in range(1,n):
        dp[j][i] = (dp[j - 1][i] + dp[j][i - 1]) % inf

for bb in b:
    ans *= dp[n - 1][bb]
    ans = ans % inf
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
import math
import collections

inf = (10 ** 9) + 7
n, m = map(int, input().split())
prime_dict = {}
m_copy = copy.deepcopy(m)
while (m_copy % 2 == 0):
    m_copy = int(m_copy // 2)
    if 2 not in prime_dict.keys():
        prime_dict[2] = 1
    else:
        prime_dict[2] += 1
for i in range(3, int(math.sqrt(m)) + 1, 2):
    while (m_copy % i == 0):
        m_copy = int(m_copy // i)
        if i not in prime_dict.keys():
            prime_dict[i] = 1
        else:
            prime_dict[i] += 1
if m_copy != 1:
    if m_copy not in prime_dict.keys():
        prime_dict[m_copy] = 1
    else:
        prime_dict[m_copy] += 1
b = list(prime_dict.values())
ans = 1
for bb in b:
    ans *= dp[n - 1][bb]
    ans = ans % inf
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
inf = (10 ** 9) + 7
n, m = map(int, input().split())
prime_list = []
m_copy = copy.deepcopy(m)
while (m_copy % 2 == 0):
    m_copy = int(m_copy // 2)
    prime_list.append(2)
for i in range(3, int(math.sqrt(m)) + 1, 2):
    while (m_copy % i == 0):
        m_copy = int(m_copy // i)
        prime_list.append(i)
if m_copy != 1:
    prime_list.append(m_copy)
import collections
k = collections.Counter(prime_list)
b = list(k.values())
import math
ans = 1
for bb in b:
    ans *= math.factorial(bb + n - 1) % inf
    ans *= pow(math.factorial(bb), inf - 2, inf)
    ans *= pow(math.factorial(n - 1), inf - 2, inf)
    ans = ans % inf
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
prime_list = [2]
for i in range(3, int(m // 2) + 1, 2):
    calc = True
    if m % i == 0:
        for j in prime_list:
            if (i % j != 0):
                continue
            else:
                calc = False
                break
        if calc:
            prime_list.append(i)
a = []
for prime in prime_list:
    while m % prime == 0:
        a.append(prime)
        m = int(m // prime)
import collections
k = collections.Counter(a)
b = list(k.values())
import math
ans = 1
for bb in b:
    ans *= math.factorial(bb + n - 1) % inf
    ans *= pow(math.factorial(bb), inf - 2, inf)
    ans *= pow(math.factorial(n - 1), inf - 2, inf)
    ans = ans % inf
print(ans)
Problem p03329 (python)

Fixed submission:
n = int(input())
inf = 10 ** 9
dp = [inf] * (n+1)
dp[0] = 0
for i in range(n):
    dp[i+1] = min(dp[i]+1, dp[i+1])
    j, k = 1, 1
    while (i + 6**j) <= n:
        dp[i + 6**j] = min(dp[i]+1, dp[i + 6**j])
        j += 1
    while (i + 9**k) <= n:
        dp[i + 9**k] = min(dp[i]+1, dp[i + 9**k])
        k += 1
print(dp[-1])

Buggy submission (verdict: Runtime Error):
def calc(money, count):
    if money == n:
        return count
    if money > n:
        return inf
    a = [calc(money+i, count+1) for i in num]
    return min(a)
import bisect
inf = 10 ** 10
num = [6 ** i for i in range(7)] + [9 ** i for i in range(1, 6)]
n = int(input())
num = num[:bisect.bisect_left(num, n)]
calc(0, 0)
Problem p03745 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
if n == 1:
    ans = 1
else:
    if a[1] > a[0]:
        temp = 1
    elif a[1] < a[0]:
        temp = -1
    else:
        temp = 0
    ans = 1
    for i in range(1, n-1):
        if a[i+1] > a[i]:
            if temp >= 0:
                temp = 1
            elif temp == -1:
                ans += 1
                temp = 0
        elif a[i+1] < a[i]:
            if temp <= 0:
                temp = -1
            elif temp == 1:
                ans += 1
                temp = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
if a[1] > a[0]:
    temp = 1
elif a[1] < a[0]:
    temp = -1
else:
    temp = 0
ans = 1
for i in range(1, n-1):
    if a[i+1] > a[i]:
        if temp >= 0:
            temp = 1
        elif temp == -1:
            ans += 1
            temp = 0
    elif a[i+1] < a[i]:
        if temp <= 0:
            temp = -1
        elif temp == 1:
            ans += 1
            temp = 0
print(ans)
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))+1):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(1, n//2):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))
Problem p03804 (python)

Fixed submission:
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
b = []
for _ in range(m):
    b.append(list(input()))
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        aaa = 0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                aaa += 1
            else:
                break
        if aaa == m:
            ans = "Yes"
            break
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
b = []
for _ in range(m):
    b.append(list(input()))
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        aaa = 0
        for k in range(m):
            if b[k] == a[i][j:j+2]:
                i += 1
                aaa += 1
            else:
                break
        if aaa == m:
            ans = "Yes"
            break
print(ans)
Problem p02624 (python)

Fixed submission:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

def sigma(m, n, func, s = 0) :
    if m > n: return s
    return sigma(m + 1, n, func, s + func(m))

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


N = int(input())
ans = sigma(1,N,lambda x: x * make_divisors(x))

print(ans)
Problem p02629 (python)

Fixed submission:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n = k() - 1
i = 1
s = 26

while n >= s:
    n -= s
    s *= 26
    i += 1

lst = []
for j in range(i):
    lst.append(n % 26)
    n //= 26

for j in lst[::-1]:
    print(chr(j + ord('a')), end='')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = 0
l = []

for i in range(1,12):
    a += 26**i
    l.append(a)

al = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

ans = []

while N != 0:
    x = N % 26
    N = N // 26
    ans.append(x)

ans.reverse()
ans_2 = []

for i in ans:
    if i == 0:
        ans_2.append(al[26])
    else:
        ans_2.append(al[i-1])

print("".join(ans_2))