Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = input()
print('a + a**2 + a**3)

Fixed submission:
# １変数の標準入力
a = int(input())
# フォーマット関数
print("{}".format(a + a**2 + a**3))

Buggy python submission (verdict: Runtime Error):
a = input()
print(a + a**2 + a**3)

Fixed submission:
# １変数の標準入力
a = int(input())
# フォーマット関数
print("{}".format(a + a**2 + a**3))

Buggy python submission (verdict: Runtime Error):
n = int(input())
print(a + '+' + a**2  + '+' + a**3)

Fixed submission:
# １変数の標準入力
a = int(input())
# フォーマット関数
print("{}".format(a + a**2 + a**3))
Buggy python submission (verdict: Runtime Error):
k = input()
s = input()
if(len(s) <= int(k)):
  print(s)
else:
  print(s[:int(k)]+'...')

Fixed submission:
a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')

Buggy python submission (verdict: Runtime Error):
a=input()
s = str(a)
	if(s[-1] in ('2','4','5','7','9')):
		print('hon')
	elif(s[-1] in ('0','1','6','8')):
		print('pon')
	elif(s[-1] == '3'):
		print('bon')

Fixed submission:
a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')

Buggy python submission (verdict: Runtime Error):
a=input()
	s=str(a)
	if(s[-1] in ('2','4','5','7','9')):
		print('hon')
	elif(s[-1] in ('0','1','6','8')):
		print('pon')
	elif(s[-1] == '3'):
		print('bon')

Fixed submission:
a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')

Buggy python submission (verdict: Runtime Error):
a=input()
if(a >0):
	s=str(a)
	if(s[-1] in ('2','4','5','7','9')):
		print('hon')
	elif(s[-1] in ('0','1','6','8')):
		print('pon')
	elif(s[-1] == '3'):
		print('bonn')

Fixed submission:
a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')

Buggy python submission (verdict: Runtime Error):
a=input()
s=str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] in 3):
	print('bonn')

Fixed submission:
a=input()
s = str(a)
if(s[-1] in ('2','4','5','7','9')):
	print('hon')
elif(s[-1] in ('0','1','6','8')):
	print('pon')
elif(s[-1] == '3'):
	print('bon')
Buggy python submission (verdict: Runtime Error):
k = input()
s = input()
if(len(s)<=k):
  print(s)
else:
  print(s[:k])

Fixed submission:
k = input()
s = input()
if(len(s) <= int(k)):
  print(s)
else:
  print(s[:int(k)]+'...')
Buggy python submission (verdict: Runtime Error):
N = int(input())
minn=1000
if N <1 or N>10000
	print(' ')
elif N%1000==0:
	print(0)
else:
	for i in range(1000,10001,1000):
		if N<i:
			print(i-N)
			break


Fixed submission:
N = int(input())
minn=1000
if N <1 or N>10000:
	print(' ')
elif N%1000==0:
	print(0)
else:
	for i in range(1000,10001,1000):
		if N<i:
			print(i-N)
			break
Buggy python submission (verdict: Runtime Error):
a = input().split

sum = 0

sum += 1 * a[0]
a[3] -= a[0]
a[3] -= a[1]

if a[2] < a[3]:
    sum -= 1 * a[0]

print(sum)

Fixed submission:
a = list(map(int, input().split()))

sum = 0

if a[0] >= a[3]:
    sum += 1 * a[3]
else:
    sum += 1 * a[0]

a[3] -= a[0]
a[3] -= a[1]

if a[3] > 0:
    if a[2] > a[3]:
        sum += -1 * a[3]
    else:
        sum += -1 * a[2]

print(sum)
Buggy python submission (verdict: Runtime Error):
n, m, x = list(map(int, input().split()))
c = []
a = []

for i in range(n):
    tmp = list(map(int, input().split()))
    c.append(tmp[0])
    a.append([])
    
    for j in range(m):
        a[i].append(tmp[j])

ab = []
for i in range(m):
    sum = 0
    for j in range(n):
        sum += a[j][i]
    ab.append(bool(sum > x))

print(all[ab])

Fixed submission:
from itertools import combinations

n, m, x = list(map(int, input().split()))
c = []
a = []

# c, aにデータを用意
for i in range(n):
    tmp = list(map(int, input().split()))
    c.append(tmp[0])
    a.append([])
    
    for j in range(1, m + 1):
        a[i].append(tmp[j])

money_min = -1
comb = []
# 組み合わせを用意
for l in range(n):
    tmp = combinations(range(n), l + 1)
    for i in tmp:
        comb.append(i)
    
# 組み合わせごとに考える
for el in comb:
    ables = []
    money = 0        
    scores = []

    # scoreに0をいれる
    for i in range(m):
        scores.append(0)

    # 組み合わせを足し合わせる
    for n in el:
        money += c[n] # 金
        for i in range(m):
            scores[i] += a[n][i] # 習得度

    # 判定
    for i in range(m):
        ables.append(scores[i] >= x)

    # 良ければ金額更新
    if all(ables):
        money_min = money if money_min < 0 or money_min > money else money_min

print(money_min)
Buggy python submission (verdict: Runtime Error):
root = int(input())
ranges = list(map(int, input().slice()))
flag = False

for i in range(ranges[0], ranges[1] + 1):
    if i % root:
        flag = True
        
if flag: 
    print('OK')
else:
    print('NG')


Fixed submission:
root = int(input())
ranges = list(map(int, input().split()))
flag = False

for i in range(ranges[0], ranges[1] + 1):
    if i % root == 0:
        flag = True
        
if flag: 
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
i = list(map(int, input().split()))
isTWin = False;

while i[0] and i[2]:
    i[2] -= i[1]
    if not i[2]:
        isTWin = True
        break

    i[0] -= i[3]
    if not i[0]:
        isTWin = False
        break
        
if isTWin:
    print('Yes')
else:
    print('No')

Fixed submission:
import math

i = list(map(int, input().split()))
turnT = math.ceil(i[0] / i[3]);
turnA = math.ceil(i[2] / i[1]);
        
if turnT >= turnA:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())

    C = Counter(A)
    ANS = 0
    for i in C:
        ANS += i * C[i]

    for _ in range(Q):
        B, X = map(int, input().split())
        ANS += X * C[B]
        C[X] += C[B]

        ANS -= B * C[B]
        del(C[B])
        print(ANS)

resolve()

Fixed submission:
from collections import Counter


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())

    C = Counter(A)
    ANS = 0
    for i in C:
        ANS += i * C[i]

    for _ in range(Q):
        B, X = map(int, input().split())
        ANS += X * C[B]
        C[X] += C[B]

        ANS -= B * C[B]
        del(C[B])
        print(ANS)

resolve()

Buggy python submission (verdict: Runtime Error):
from collections import Counter


def resolve():
    N = int(input())
    A = list(input().split())
    Q = int(input())

    C = Counter(A)
    ANS = 0
    for i in C:
        ANS += i * C[i]

    for _ in range(Q):
        B, X = map(int, input().split())
        ANS += X * C[B]
        C[X] += C[B]

        ANS -= B * C[B]
        del(C[B])
        print(ANS)

resolve()

Fixed submission:
from collections import Counter


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())

    C = Counter(A)
    ANS = 0
    for i in C:
        ANS += i * C[i]

    for _ in range(Q):
        B, X = map(int, input().split())
        ANS += X * C[B]
        C[X] += C[B]

        ANS -= B * C[B]
        del(C[B])
        print(ANS)

resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    A = list(input().split())
    ans = ','.join(A)

    Q = int(input())

    replaces = []
    for i in range(Q):
        pp, ss = input().split()
        replaces.append([pp, ss])

    for varcher in replaces:
        ans = ans.replace(varcher[0], varcher[1])
        print(sum(map(int, ans.split(','))))


resolve()

Fixed submission:
from collections import Counter


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())

    C = Counter(A)
    ANS = 0
    for i in C:
        ANS += i * C[i]

    for _ in range(Q):
        B, X = map(int, input().split())
        ANS += X * C[B]
        C[X] += C[B]

        ANS -= B * C[B]
        del(C[B])
        print(ANS)

resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    A, B = map(float, input().split())

    print(math.floor(A * B))

resolve()

Fixed submission:
import math
from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    A, B = input().split()

    print(math.floor(Decimal(A) * Decimal(B)))



resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    S = input()
    T = input()

    if re.match(r'[a-z]{1,10}', S) and re.match(S + '.', T):
        print('Yes')
        return

    print('No')

resolve()

Fixed submission:
import re

def resolve():
    S = input()
    T = input()

    if 1 <= len(S) and len(S) <= 10:
        if re.match(S + '.', T):
            print('Yes')
            return

    print('No')


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    A, B, N = map(int, input().split())

    ans = 0
    for i in range(min(N, B - 1), 0, -1):
        tmp = (A * i // B)
        ans = max(tmp, ans)

    print(ans)


resolve()

Fixed submission:
def resolve():
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def check(A, B, mid):
    return (A * mid // B) - A * (mid // B)


def resolve():
    A, B, N = map(int, input().split())

    ans = 0
    max_int = min(N, B)
    for i in range(1, max_int + 1):
        tmp = check(A, B, i)
        ans = max(tmp, ans)

    print(ans)


resolve()

Fixed submission:
def resolve():
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    A, B, N = map(int, input().split())

    ans = 0
    for i in range(min(N, B), 1, -1):
        tmp = (A * i // B) - A * (i // B)
        ans = max(tmp, ans)

    print(ans)


resolve()

Fixed submission:
def resolve():
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import math


def resolve():
    A, B, N = map(int, input().split())

    ans = 0
    for i in range(min(N, B), 1, -1):
        tmp = math.floor(A * i / B) - A * math.floor(i / B)
        ans = max(tmp, ans)

    print(ans)


resolve()

Fixed submission:
def resolve():
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import math


def resolve():
    A, B, N = map(int, input().split())

    ans = 0

    for i in range(N, 1, -1):
        tmp = math.floor(A * i / B) - A * math.floor(i / B)
        ans = max(tmp, ans)

    print(ans)


resolve()

Fixed submission:
def resolve():
    A, B, N = map(int, input().split())
    print(A * min(N, B - 1) // B)


resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    R = int(input())

    print(R * 2 * math.pi)


resolve()

Fixed submission:
import math

from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    R = int(input())

    print(R * 2 * math.pi)


resolve()

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    R = int(input())

    print(Decimal(R * 2 * math.pi))


resolve()

Fixed submission:
import math

from decimal import Decimal, getcontext

getcontext().prec = 99


def resolve():
    R = int(input())

    print(R * 2 * math.pi)


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import math


def list_gcd(A):
    """N個の最大公約数
    Args:
        A (list[int])

    Returns:
        int: 最大公約数

    Examples:
        >>> list_gcd([1300, 34, 54, 60])
        2
    """
    ans = A[0]
    for i in range(1, len(A)):
        ans = math.gcd(ans, A[i])
    return ans


def resolve():
    K = int(input())

    ans = 0

    for kk in range(1, K+ 1):
        for jj in range(1, K+ 1):
            for ii in range(1, K+ 1):
                ans += list_gcd([kk, jj, ii])

    print(ans)


resolve()

Fixed submission:
from math import gcd


def resolve():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            a = gcd(i, j)
            for k in range(1, n + 1):
                ans += gcd(a, k)

    print(ans)


resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    N = int(input())
    A = sorted(map(int, input().split()))

    counter = collections.Counter(A)
    ans = 0

    for i in counter.values():
        ans += i * (i - 1) // 2

    for a in A:
        count = counter[a]
        print(ans - (count * (count - 1) // 2) +
              ((count - 1) * (count - 2) // 2))

resolve()

Fixed submission:
N=int(input())
A=list(map(int,input().split()))

from collections import Counter
C=Counter(A)
ANS=0
for i in C.values():
    ANS+=i*(i-1)//2

for a in A:
    k=C[a]

    print(ANS-(k*(k-1)//2)+((k-1)*(k-2)//2))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque


def resolve():
    S = input()
    Q = int(input())

    ans = deque(list(S))

    for i in range(Q):
        T = list(input().split())

        if (T[0] == "1"):
            ans.reverse()
        else:
            if (T[1] == "1"):
                ans.appendleft(T[2])
            else:
                ans.append(T[2])
            pass

    print("".join(ans))


resolve()

Fixed submission:
def resolve():
    S = input()
    Q = int(input())

    rev = 0
    append_front_rev = ''
    append_rear = ''

    for i in range(Q):
        T = input().split()

        if (T[0] == "1"):
            rev ^= 1
            continue

        if (T[0] == "2" and T[1] == "1"):
            if rev == 0:
                append_front_rev += T[2]
            else:
                append_rear += T[2]
            continue

        if (T[0] == "2" and T[1] == "2"):
            if rev == 0:
                append_rear += T[2]
            else:
                append_front_rev += T[2]
            continue

    ans = append_front_rev[::-1] + S + append_rear
    if rev:
        ans = ans[::-1]

    print("".join(ans))


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    S = input()
    Q = int(input())

    ans = list(S)

    for i in range(Q):
        T = list(input().split())

        if (T[0] == "1"):
            ans = ans[::-1]
        else:
            if (T[1] == "1"):
                ans.insert(0, T[2])
            else:
                ans.append(T[2])
            pass

    print("".join(ans))


resolve()

Fixed submission:
def resolve():
    S = input()
    Q = int(input())

    rev = 0
    append_front_rev = ''
    append_rear = ''

    for i in range(Q):
        T = input().split()

        if (T[0] == "1"):
            rev ^= 1
            continue

        if (T[0] == "2" and T[1] == "1"):
            if rev == 0:
                append_front_rev += T[2]
            else:
                append_rear += T[2]
            continue

        if (T[0] == "2" and T[1] == "2"):
            if rev == 0:
                append_rear += T[2]
            else:
                append_front_rev += T[2]
            continue

    ans = append_front_rev[::-1] + S + append_rear
    if rev:
        ans = ans[::-1]

    print("".join(ans))


resolve()
Buggy python submission (verdict: Runtime Error):
import sys
# import itertools
# import math

input = sys.stdin.readline().rstrip()


def resolve():
    S, T = map(str, input().split())
    A, B = map(int, input().split())
    U = input()

    if S == U:
        A -= 1
        print(str(A) + ' ' + str(B))
        return
    B -= 1
    print(str(A) + ' ' + str(B))


resolve()


Fixed submission:
def resolve():
    S, T = map(str, input().split())
    A, B = map(int, input().split())
    U = input()
 
    if S == U:
        A -= 1
        print(str(A) + ' ' + str(B))
        return
    B -= 1
    print(str(A) + ' ' + str(B))


resolve()
Buggy python submission (verdict: Runtime Error):
# import itertools
# import math
import numpy as np


H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort()

ans = 0
dp = np.zeros(H, dtype=int)
for a, b in AB:
    ans = max(ans, dp.max() + b)
    np.max(dp[:-a] + b, dp[a:], out=dp[a:])

print(ans)


Fixed submission:
from functools import lru_cache
import sys

sys.setrecursionlimit(1000000)

H, N = map(int, input().split())

AB = []
for i in range(N):
    A, B = map(int, input().split())
    AB.append((A, B))

AB.sort(key=lambda ab: (ab[0] / ab[1], -ab[0]), reverse=True)


@lru_cache(maxsize=None)
def solve(h):
    if h <= 0:
        return 0
    best = float("inf")
    for a, b in AB:
        val = b + solve(h - a)
        if val < best:
            best = val
        else:
            break
    return best


print(solve(H))
Buggy python submission (verdict: Runtime Error):
A = (int, input().split())

if sum(A) < 22:
  print('win')
  exit()

print('bust')

Fixed submission:
A = map(int, input().split())

if sum(A) < 22:
  print('win')
  exit()

print('bust')
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
L = [int(i) for i in input().split()]


def solve():
    pattern_cnt = 0

    for pattern in list(itertools.combinations(L, 3)):
        if (pattern[0] < pattern[1] + pattern[2]) and (pattern[2] < pattern[0] + pattern[1]) and  (pattern[1] < pattern[0] + pattern[2]):
            pattern_cnt += 1

    return pattern_cnt


print(solve())


Fixed submission:
import bisect


def resolve():
    n = int(input())
    li = list(map(int, input().split()))
    ans = 0

    li.sort()

    for i in range(n):
        for j in range(i + 1, n):
            cnt = bisect.bisect_left(li, li[i] + li[j])

            ans += cnt - j - 1

    print(ans)

resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
L = [int(i) for i in input().split()]


def solve():
    pattern_cnt = 0

    for pattern in list(itertools.combinations(L, 3)):
        if (pattern[0] < pattern[1] + pattern[2]) and (pattern[2] < pattern[0] + pattern[1]) and  (pattern[1] < pattern[0] + pattern[2]):
            pattern_cnt += 1

    return pattern_cnt


print(solve())


Fixed submission:
import bisect


def resolve():
    n = int(input())
    li = list(map(int, input().split()))
    ans = 0

    li.sort()

    for i in range(n):
        for j in range(i + 1, n):
            cnt = bisect.bisect_left(li, li[i] + li[j])

            ans += cnt - j - 1

    print(ans)

resolve()
Buggy python submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip().decode('utf-8')


def solve(N):
    odd_count = 0

    for x in range(0, N)[::-1]:
        if x // 2 != 0:
            odd_count += 1

    if N == 1:
        return 1

    return odd_count / N


N = int(input())

print(solve(N))


Fixed submission:
def solve(N):
    odd_count = 0

    for x in range(1, N + 1)[::-1]:
        if x % 2 == 1:
            odd_count += 1

    if N == 1:
        return 1

    return odd_count / N


N = int(input())

print(solve(N))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]


def solve(A):
    dict_A = {key: val for key, val in zip(A, range(N))}
    score_sorted = sorted(dict_A.items(), key=lambda x : x[1])
    score_sorted = dict(score_sorted)

    return ' '.join(list(score_sorted.keys()))


print(solve(A))


Fixed submission:
N = int(input())
A = map(int, input().strip().split())

index = 1
dic = {}

for i in A:
    dic[i] = index
    index += 1

sort_dic = sorted(dic.items(), key=lambda x:x[0])

for i in sort_dic:
    print(i[1], end = ' ')
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(N)]


def winner_or_loss(point):
    return 'Yes' if point > 0 else 'No'


def solve():
    point = [K-Q] * N

    for answer_id in A:
        answer_id -= 1
        point[answer_id] += 1

    return '\n'.join(list(map(winner_or_loss, point)))


print(solve())


Fixed submission:
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]


def winner_or_loss(point):
    return 'Yes' if point > 0 else 'No'


def solve():
    point = [K-Q] * N

    for answer_id in A:
        answer_id -= 1
        point[answer_id] += 1

    return '\n'.join(list(map(winner_or_loss, point)))


print(solve())
Buggy python submission (verdict: Time Limit Exceeded):
import math

N, M = map(int, input().split())
A = [int(i) for i in input().split()]


def solve():
    sorted_list = A

    for index in range(0, M):
        sorted_list = sorted(sorted_list)
        sorted_list[-1] = math.floor(sorted_list[-1] / 2)

    return sum(sorted_list)


print(solve())


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))


def solve():
    AA = [[-x, x] for x in A]

    heapq.heapify(AA)

    for i in range(M):
        x, y = heapq.heappop(AA)
        heapq.heappush(AA, [-(y//2), y//2])

    AAA = [x[1] for x in AA]
    return sum(AAA)


print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
import math

N, M = map(int, input().split())
A = [int(i) for i in input().split()]


def solve():
    sorted_list = A

    for index in range(0, M):
        sorted_list = sorted(sorted_list)
        sorted_list[-1] = math.floor(sorted_list[-1] / 2)

    return sum(sorted_list)


print(solve())


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))


def solve():
    AA = [[-x, x] for x in A]

    heapq.heapify(AA)

    for i in range(M):
        x, y = heapq.heappop(AA)
        heapq.heappush(AA, [-(y//2), y//2])

    AAA = [x[1] for x in AA]
    return sum(AAA)


print(solve())

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

N, M = map(int, input().split())
A = [int(i) for i in input().split()]


def solve():
    sorted_list = A

    for index in range(0, M):
        sorted_list = sorted(sorted_list)
        sorted_list[-1] = math.round(sorted_list[-1] / 2)

    return sum(sorted_list)


print(solve())


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))


def solve():
    AA = [[-x, x] for x in A]

    heapq.heapify(AA)

    for i in range(M):
        x, y = heapq.heappop(AA)
        heapq.heappush(AA, [-(y//2), y//2])

    AAA = [x[1] for x in AA]
    return sum(AAA)


print(solve())
Buggy python submission (verdict: Runtime Error):

def solve(n):
    n = list(range(1, n))
    return sum(n)


N = int(input())

print(solve(N))


Fixed submission:
def solve(n):
    return n * (n - 1) // 2


N = int(input())

print(solve(N))
Buggy python submission (verdict: Runtime Error):
import heapq
import math


def solve(n, v):
    heapq.heapify(v)
    nn = math.ceil(n / 2)

    while len(nn) != 1:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return v[0]


n = int(input())
v = list(map(int, input().split()))

print(solve(n, v))


Fixed submission:
import heapq
import math


def solve(n, v):
    heapq.heapify(v)

    while len(v) != 1:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return v[0]


n = int(input())
v = list(map(int, input().split()))

print(solve(n, v))