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

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

    n = 0
    for i in range(N):
        m = min(A[i], B[i])
        n += m
        A[i] -= m
        B[i] -= m
        m = min(A[i+1], B[i])
        n += m
        A[i+1] -= m
        B[i] -= m

    print(n)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

    def f(i):
        if i >= N:
            return 0

        n = 0
        m = min(A[i], B[i])
        n += m
        A[i] -= m
        B[i] -= m
        m = min(A[i+1], B[i])
        n += m
        A[i+1] -= m
        B[i] -= m
        return n + f(i+1)

    n = f(0)
    print(n)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

    def f(i):
        if i >= N:
            return 0

        n = 0
        m = min(A[i], B[i])
        n += m
        A[i] -= m
        B[i] -= m
        m = min(A[i+1], B[i])
        n += m
        A[i+1] -= m
        B[i] -= m
        return n + f(i+1)

    n = f(0)
    print(n)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

    def f(i):
        if i == N:
            return 0

        n = 0
        m = min(A[i], B[i])
        n += m
        A[i] -= m
        B[i] -= m
        m = min(A[i+1], B[i])
        n += m
        A[i] -= m
        B[i] -= m
        return n + f(i+1)

    n = f(0)
    print(n)

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

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

    def f(i):
        n = 0
        if i == N:
            return 0
        if B[i] >= A[i]:
            B[i] -= A[i]
            n += A[i]
            A[i] = 0
            n += min(A[i+1], B[i])
            A[i] -= min(A[i+1], B[i])
            B[i] -= min(A[i+1], B[i])
            return n + f(i+1)
        else:
            n += B[i]
            A[i] -= B[i]
            return n + f(i+1)

    n = f(0)
    print(n)

main()
Problem p03107 (python)

Fixed submission:
# -*- coding: utf-8 -*-

def main():
    s = input().split(" ")

    sl = list(s[0])
    prev = -1
    n = 0

    i = 0
    while True:
        if len(sl) <= i:
            break

        if (prev == 0 and sl[i] == '1') or (prev == 1 and sl[i] == '0'):
            # print(str(sl))
            # print("remove", i, prev, sl[i])
            del sl[i]
            del sl[i-1]
            n += 2
            if i-2 < 0:
                prev = -1
                i = 0
            else:
                prev = int(sl[i-2])
                i = i-1
        else:
            prev = int(sl[i])
            i += 1

    print(n)

main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
    s = input().split(" ")

    sl = list(s[0])
    prev = -1
    n = 0

    i = 0
    while True:
        if len(sl) <= i:
            break

        if (prev == 0 and sl[i] == '1') or (prev == 1 and sl[i] == '0'):
            # print(str(sl))
            # print("remove", i, prev, sl[i])
            del sl[i]
            del sl[i-1]
            n += 2
            if len(sl) <= i:
                break
            else:
                prev = int(sl[i-2])
                i = i-1
        else:
            prev = int(sl[i])
            i += 1

    print(n)

main()
Problem p03252 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    S = input().strip()
    T = input().strip()
    m = {}
    for i in range(len(T)):
        if T[i] in m:
            if m[T[i]] != S[i]:
                print("No")
                return
        m[T[i]] = S[i]

    T2 = T[:]
    for i in range(len(S)):
        if S[i] == T2[i]:
            continue
        from_c = T2[i]
        to_c = S[i]
        T2 = T2.translate(str.maketrans({from_c: to_c, to_c: from_c}))

    if S != T2:
        print("No")
    else:
        print("Yes")

main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    T2 = T[:]
    for i in range(len(S)):
        if S[i] == T2[i]:
            continue
        from_c = T2[i]
        to_c = S[i]
        T2 = T2.translate(str.maketrans({from_c: to_c, to_c: from_c}))

    if S != T2:
        print("No")
    else:
        print("Yes")

main()
Problem p02990 (python)

Fixed submission:
from scipy.misc import comb
# from scipy.special import comb


MOD = 10 ** 9 + 7

def main():
    N, K = map(int, input().split())

    note = [[-1 for i in range(N)] for j in range(N)]

    def calc_comb(n, r):
        if note[n][r] != -1:
            return note[n][r]
        a = comb(n, r, exact=True)
        note[n][r] = a
        return a

    def print_patterns(i, N, K):
        m = N - K
        if i - 1 > m:
            print(0)
            return
        if i == 1:
            p = 1 * (m+1) % MOD
            print(p)
            return
        p = calc_comb(K-1, i-1) * calc_comb(m+1, i) % MOD
        print(p)

    for i in range(1, K+1):
        print_patterns(i, N, K)


main()

Buggy submission (verdict: Runtime Error):
# from scipy.misc import comb
from scipy.special import comb


MOD = 10 ** 9 + 7

def main():
    N, K = map(int, input().split())

    note = [[-1 for i in range(N)] for j in range(N)]

    def calc_comb(n, r):
        if note[n][r] != -1:
            return note[n][r]
        a = comb(n, r, exact=True)
        note[n][r] = a
        return a

    def print_patterns(i, N, K):
        m = N - K
        if i - 1 > m:
            print(0)
            return
        if i == 1:
            p = 1 * (m+1) % MOD
            print(p)
            return
        p_red = 0
        for l in range(i-1, m+1):
            p_red += calc_comb(l-1, i-2) * (m-l+1)
            p_red %= MOD
        p = calc_comb(K-1, i-1) * p_red % MOD
        print(p)

    for i in range(1, K+1):
        print_patterns(i, N, K)


main()
Problem p03011 (python)

Fixed submission:
p, q, r = map(int, input().split())

route = min(p+q, q+r, r+p)
print(route)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [[c for c in input()] for i in range(H)]
s_vrt = [[s[i][j] for i in range(H)] for j in range(W)]

dp_l = [[0 for j in range(W)] for i in range(H)]
dp_r = [[0 for j in range(W)] for i in range(H)]
dp_u = [[0 for i in range(H)] for j in range(W)]
dp_d = [[0 for i in range(H)] for j in range(W)]


def mark_table_for_dp():
    for i in range(H):
        mark_line_for_dp(s[i], dp_l[i], False)
        mark_line_for_dp(s[i], dp_r[i], True)
    for j in range(W):
        mark_line_for_dp(s_vrt[j], dp_u[j], True)
        mark_line_for_dp(s_vrt[j], dp_d[j], False)



def mark_line_for_dp(line, dp, is_reverse):
    cnt = 0
    r = list(range(len(line)))
    if is_reverse:
        r.reverse()
    for i in r:
        if line[i] == '#':
            cnt = 0
            continue
        dp[i] = cnt
        cnt += 1


mark_table_for_dp()


def count_light_cross(i, j):
    return dp_l[i][j] + dp_r[i][j] + dp_u[j][i] + dp_d[j][i] + 1


count_max = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            continue
        count = count_light_cross(i, j)
        if count_max < count:
            count_max = count

print(count_max)
Problem p03045 (python)

Fixed submission:
import sys


sys.setrecursionlimit(10**5)


class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def merge(self, a, b):
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r


def main():
    N, M = map(int, input().split())

    uf = UnionFind(N)
    for _ in range(M):
        x, y, _ = map(int, input().split())
        uf.merge(x-1, y-1)

    print(len(list(filter(lambda x: x == uf.root(x), range(N)))))


main()

Buggy submission (verdict: Runtime Error):
class UnionFind(object):
    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def merge(self, a, b):
        pa = self.root(a)
        pb = self.root(b)
        self.parent[pa] = pb
    
    def root(self, x):
        p = self.parent[x]
        if p == x:
            return x
        else:
            r = self.root(p)
            self.parent[x] = r
            return r


def main():
    N, M = map(int, input().split())

    uf = UnionFind(N)
    for _ in range(M):
        x, y, _ = map(int, input().split())
        uf.merge(x-1, y-1)

    print(len(list(filter(lambda x: x == uf.root(x), range(N)))))


main()
Problem p03108 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

class UnionFieldTree(object):
    def __init__(self, n):
        '''1-indexed'''
        self.parent = [i for i in range(n+1)] 
        self.size = [0] + [1] * n

    def merge(self, a, b):
        '''merge b into a'''
        a = self.root(a)
        b = self.root(b)
        self.parent[b] = self.parent[a]
        self.size[a] += self.size[b]

    def root(self, a):
        parent = self.parent[a]
        if parent == a:
            return a
        r = self.root(parent)
        self.parent[a] = r
        return r
    
    def same_group(self, a, b):
        return self.root(a) == self.root(b)


def main():
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]
    
    uf = UnionFieldTree(N)

    v_sum = N*(N-1)//2
    ans = [v_sum]

    for a, b in reversed(AB):
        if not uf.same_group(a, b):
            ra = uf.root(a)
            rb = uf.root(b)
            v_sum -= uf.size[ra] * uf.size[rb]
            uf.merge(a, b)
        ans.append(v_sum)

    [print(a) for a in reversed(ans[:M])]


main()

Buggy submission (verdict: Runtime Error):
class UnionFieldTree(object):
    def __init__(self, n):
        '''1-indexed'''
        self.parent = [i for i in range(n+1)] 
        self.size = [0] + [1] * n

    def merge(self, a, b):
        '''merge b into a'''
        a = self.root(a)
        b = self.root(b)
        self.parent[b] = self.parent[a]
        self.size[a] += self.size[b]

    def root(self, a):
        parent = self.parent[a]
        if parent == a:
            return a
        r = self.root(parent)
        self.parent[a] = r
        return r
    
    def same_group(self, a, b):
        return self.root(a) == self.root(b)


def main():
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]
    
    uf = UnionFieldTree(N)

    v_sum = N*(N-1)//2
    ans = [v_sum]

    for a, b in reversed(AB):
        if not uf.same_group(a, b):
            ra = uf.root(a)
            rb = uf.root(b)
            v_sum -= uf.size[ra] * uf.size[rb]
            uf.merge(a, b)
        ans.append(v_sum)

    [print(a) for a in reversed(ans[:M])]


main()
Problem p02935 (python)

Fixed submission:
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 10
N=int(raw_input())

arr=map(int,raw_input().split())
arr=sorted(arr)
# l = float(pow(2,N-1))
# ans=(arr[0]+arr[1])/l
# print ans
for i in range(1,N):
	arr[i] = (arr[i]+arr[i-1])/2.0
	# print arr
print arr[-1]

Buggy submission (verdict: Runtime Error):
import decimal,math
from collections import Counter,defaultdict
from fractions import gcd
from bisect import bisect_right,bisect_left
decimal.getcontext().prec = 10
N=int(raw_input())

arr=map(int,raw_input().split())
arr=sorted(arr)
# l = float(pow(2,N-1))
ans=(arr[0]+arr[1])/l
# print ans
for i in range(1,N):
	arr[i] = (arr[i]+arr[i-1])/2.0
	# print arr
print arr[-1]
Problem p02955 (python)

Fixed submission:
import decimal,math
decimal.getcontext().prec = 100
def sum1(pre,l,r):
    l=max(l,0)
    if(l==0):
        return pre[r]
    return pre[r] - pre[l - 1]
abc=[]
def printDivisors(n) : 
    i = 1
    while i <= math.sqrt(n): 
          
        if (n % i == 0) : 
              
            if (n / i == i) : 
                abc.append(i) 
            else : 
                abc.append(i)
                abc.append(n/i)
        i = i + 1
n,k=map(int,raw_input().split())

arr=map(int,raw_input().split())
s=sum(arr)
printDivisors(s)
abc.sort()
abc=abc[::-1]
ans=1
for i in abc:
    l=0
    flag=0
    c=[]
    for j in arr:
        c.append(j%i)
    c.sort()
    if(sum(c[:-sum(c)/i])<=k):
        print i
        exit()

Buggy submission (verdict: Runtime Error):
import decimal,math
decimal.getcontext().prec = 100
def sum1(pre,l,r):
    l=max(l,0)
    if(l==0):
        return pre[r]
    return pre[r] - pre[l - 1]
abc=[]
def printDivisors(n) : 
    i = 1
    while i <= math.sqrt(n): 
          
        if (n % i == 0) : 
              
            if (n / i == i) : 
                abc.append(i) 
            else : 
                abc.append(i)
                abc.append(n/i)
        i = i + 1
n,k=map(int,raw_input().split())

arr=map(int,raw_input().split())
printDivisors(s)
abc.sort()
abc=abc[::-1]
ans=1
for i in abc:
    l=0
    flag=0
    c=[]
    for j in arr:
        c.append(j%i)
    c.sort()
    if(sum(c[:-sum(c)/i])<=k)
        print i
        exit()
Problem p02951 (python)

Fixed submission:
A,B,C = map(int,input().split())
print( C + B - A if C + B - A >= 0 else 0)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
print( C + B - A if c + B - A >= 0 else 0)
Problem p02970 (python)

Fixed submission:
import math
N,D =map(int,input().split())

X = D * 2 + 1

pre_answer = N / X
print(math.ceil(pre_answer))

Buggy submission (verdict: Runtime Error):
import math
N,D =map(int,input().split())

x = D * 2 + 1

pre_answer = N / X
print(math.ceil(pre_answer))

Buggy submission (verdict: Runtime Error):
N,D =map(int,input().split())

x = D * 2 + 1

pre_answer = - (-N // X)
print(int(pre_answer))
Problem p03072 (python)

Fixed submission:
N = int(input())
hotel = list(map(int,input().split()))
new =[]

count = 0
for i in hotel:
  new.append(i)
  if i == max(new):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
hotel = list(map(int,input().split()))
new =[]

count = 0
for i in hotel:
  new.append(hotel(i))
  if hotel(i) == max(new):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
height = []
count = 0
for i in range(N):
  x = int(input())
  height.append(x)
  if x == max(height):
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
height = []
count = 0
for i in range(N):
  x = int(input())
  height.append(x)
  if height[i] == max(height):
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
height = []
count = 0
for i in range(N):
  x = int(input())
  height.append(x)
  if max(height) == height[i]:
    count += 1

print(count)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a <= k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
a = li[0]
e = li[4]
k = li[5]

if e - a <= k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
a = li[0]
e = li[4]
k = li[5]

if e - a < k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
li[0] = a
li[4] = e
li[5] = k

if e - a < k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
li[0] = a
li[4] = e
li[5] = k

if e - a <= k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
li[0] = a
li[4] = e
li[5] = k

if e - a <= 15:
    print("Yay!")
else:
    print(":(")
Problem p03835 (python)

Fixed submission:
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    z = S - x - y
    if 0 <= z and z <= K:
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    z = S - x - y
    if 0 <= z and z <= k:
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    z = S - x - y
    if 0 <= z and z <= k:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if 0 <= S - x - y <= k:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      total = x + y + z
      if total = S:
        count += 1
print(count)
Problem p02935 (python)

Fixed submission:
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0
sum_ = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        temp = decimal.Decimal((temp + v[i])/2)

print(temp)

Buggy submission (verdict: Runtime Error):
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        sum_ = decimal.Decimal((temp + v[i])/2)

print(sum_)

Buggy submission (verdict: Runtime Error):
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        print(temp, v[i])
        sum_ = decimal.Decimal((temp + v[i])/2)

print(sum_)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S_ = ''

S[K-1] = S[K-1].lower()
for i in range(N):
    S_ += S[i]

print(S_)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S_ = ''

S[K+1] = S[K+1].lower()
for i in range(N):
    S_ += S[i]

print(S_)
Problem p03307 (python)

Fixed submission:
n=int(input())

if n%2==0:
    print(n)
else:
    print(2*n)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

for i in range(n):
    a[i]=a[i]-i-1

ans=10**12
a.sort()
if n<20:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in b_choice:
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

for i in range(n):
    a[i]=a[i]-i-1

ans=10**12
a.sort()
if n<50:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in range(b_choice):
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)
Problem p02990 (python)

Fixed submission:
import sys
import math

def input():
    return sys.stdin.readline().rstrip()

def combination(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

if __name__ == "__main__":
    n, k = map(int, input().split())

    for i in range(1, k+1):
        if n-k+1 >= i and k-1 >= i-1:
            print((combination(n-k+1, i) * combination(k-1, i-1)) % (10**9+7))
        else:
            print(0)

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

def input():
    return sys.stdin.readline().rstrip()

def combination(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

if __name__ == "__main__":
    n, k = map(int, input().split())

    for i in range(1, k+1):
        print((combination(n-k+1, i) * combination(k-1, i-1)) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n, k = map(int, input().split())

    for i in range(1, k+1):
        mul = 1
        div = 1

        for j in range(i):
            if j == i-1:
                mul *= ((n-k+1)-j)
                div *= (i-j)
            else:
                mul *= ((n-k+1)-j) * ((k-1)-j)
                div *= (i-j) * ((i-1)-j)

        print(int((mul / div) % (10**9+7)))

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n, k = map(int, input().split())

    for i in range(1, k+1):
        mul = 1
        div = 1

        for j in range(i):
            mul *= ((n-k+1)-j)
            div *= (i-j)

        for j in range(i-1):
            mul *= ((k-1)-j)
            div *= ((i-1)-j)

        print(int(mul / div % (10**9+7)))
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())
print(min(P + Q, Q + R, R + P))

Buggy submission (verdict: Runtime Error):
3 2 3
Problem p03012 (python)

Fixed submission:
N = int(input())
W = [int(s) for s in input().split()]
ans = float("inf")
for i in range(1, N):
    ans = min(ans, abs(sum(W[:i]) - sum(W[i:])))
print(ans)

Buggy submission (verdict: Runtime Error):
8
27 23 76 2 3 5 62 52