Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split())) for _ in range(q)]

for i in range(q):
    start = lr[i][0]-1
    end = lr[i][1]-1
    ans = 0
    for j in range(start,end):
        if s[j] == 'A':
            if s[j+1] == 'C':
                ans += 1
    print(ans)

Fixed submission:
n,q=[int(i) for i in input().split()]
s = input()
qs = []
for i in range(q):
    qs.append([int(i) for i in input().split()])

counts = [0] * n
count = 0
for i in range(1,n):
    if s[i] == "C" and s[i-1] == "A":
        count += 1
    counts[i] = count
counts = [0] + counts


for i in range(q):
    st, en = qs[i]
    print(counts[en] - counts[st])
Buggy python submission (verdict: Runtime Error):
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD)

Fixed submission:
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n):
    ans = math.gcd(ans, a[i])
print(ans)

Fixed submission:
import fractions
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n):
    ans = fractions.gcd(ans, a[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = h[-1]

for i in range(n-k+1):
    if h[i+k-1] - h[i] < ans:
        ans = h[i+2] - h[i]

print(ans)

Fixed submission:
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = 10 ** 10

for i in range(n-k+1):
    ans = min(h[i+k-1] - h[i],ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = 10 ** 5

for i in range(n-k+1):
    if h[i+k-1] - h[i] < ans:
        ans = h[i+2] - h[i]

print(ans)

Fixed submission:
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = 10 ** 10

for i in range(n-k+1):
    ans = min(h[i+k-1] - h[i],ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != li[i+1][0]:
            bool = False

if bool:
    print('Yes')
else:
    print('No')
        

Fixed submission:
N = int(input())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != list[i+1][0]:
            bool = False

if bool:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != li[i+1][0]:
            bool = False

if bool:
    print('Yes')
else:
    print('No')
        

Fixed submission:
N = int(input())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != list[i+1][0]:
            bool = False

if bool:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
x = list(map(int,input().split()))
x.append(0)
x.sort()
ans = 100
for i in range(n-k+1):
    cnt = 0
    cnt += abs(x[i])
    for j in range(i,k+i):
        cnt += abs(x[j+1] - x[j])    
    if cnt < ans:
        ans = cnt

print(min(ans))

Fixed submission:
n, k = map(int,input().split())
x = list(map(int,input().split()))
result = []
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l * r >= 0:
        result.append(max(abs(l), abs(r)))
    else:
        result.append(abs(2*l-r))
        result.append(abs(2*r-l))
print(min(result))

Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
x = list(map(int,input().split()))
x.append(0)
x.sort()
ans = 100000000
for i in range(n-k+1):
    cnt = 0
    cnt += abs(x[i])
    for j in range(i,k+i):
        cnt += abs(x[j+1] - x[j])    
    if cnt < ans:
        ans = cnt

print(min(ans))

Fixed submission:
n, k = map(int,input().split())
x = list(map(int,input().split()))
result = []
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l * r >= 0:
        result.append(max(abs(l), abs(r)))
    else:
        result.append(abs(2*l-r))
        result.append(abs(2*r-l))
print(min(result))

Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
x = list(map(int,input().split()))
x.append(0)
x.sort()
ans = 10 ** 18
for i in range(n-k+1):
    cnt = 0
    cnt += abs(x[i])
    for j in range(i,k+i):
        cnt += abs(x[j+1] - x[j])    
    if cnt < ans:
        ans = cnt

print(min(ans))

Fixed submission:
n, k = map(int,input().split())
x = list(map(int,input().split()))
result = []
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l * r >= 0:
        result.append(max(abs(l), abs(r)))
    else:
        result.append(abs(2*l-r))
        result.append(abs(2*r-l))
print(min(result))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
l = []
for i in range(n):
    l.append(s[i+1:].count("E")+s[:i].count("W"))
print(min(l))

Fixed submission:
n = int(input())
s = input()
cnt = s.count('E',1,n)
ans = [cnt]

for i in range(1,n):
    if s[i-1] == 'W': cnt += 1
    if s[i] == 'E': cnt -= 1
    ans.append(cnt)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
list=[]
for i in range(1, N+1):
    for j in range(2, N):
        tmp = i ** j
        if tmp <= N:
            list.append(tmp)
        else:
            break

print(max(list))



Fixed submission:
N = int(input())
list=[]
for i in range(1, N+1):
    for j in range(2, N + 2):
        tmp = i ** j
        if tmp <= N:
            list.append(tmp)
        else:
            break

print(max(list))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())
cost = list(map(int,input().split()))
for i in range(N):
    ans = 0
    temp_cost = cost.copy()
    temp_cost.pop(i)
    ans += abs(temp_cost[0]) + abs(temp_cost[-1])
    for i in range(0,N-2):
        ans += abs(temp_cost[i] - temp_cost[i+1])
        
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
a.insert(n+1,0)
total = 0
for i in range(n+1):
    total += abs(a[i+1] - a[i])
for i in range(1, n+1):
    print(total + abs(a[i+1] - a[i-1]) - abs(a[i+1] - a[i]) - abs(a[i-1] - a[i]))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
nm = ['#'] * n
nm.insert(0,0)
nm.insert(n+1,0)
nm = [nm]*m
nm.insert(0,[0]*(m+2))
nm.insert(m+1,[0]*(m+2))
ans = 0

for i in range(1,m+1):
    for j in range(1,n+1):
        cnt = 0
        if nm[i+1][j+1] == '#':
            cnt += 1
        if nm[i+1][j] == '#':
            cnt += 1
        if nm[i+1][j-1] == '#':
            cnt += 1
        if nm[i][j+1] == '#':
            cnt += 1
        if nm[i][j] == '#':
            cnt += 1
        if nm[i][j-1] == '#':
            cnt += 1
        if nm[i-1][j+1] == '#':
            cnt += 1
        if nm[i-1][j] == '#':
            cnt += 1
        if nm[i-1][j-1] == '#':
            cnt += 1
        if cnt % 2 != 0:
            ans+=1

print(ans)

Fixed submission:
n,m = map(int,input().split())
print(abs((n-2)*(m-2)))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
nm = ['#'] * n
nm.insert(0,0)
nm.insert(n+1,0)
nm = [nm]*m
nm.insert(0,[0]*(m+2))
nm.insert(m+1,[0]*(m+2))
total = []
ans = 0

for i in range(1,m+1):
    for j in range(1,n+1):
        cnt = 0
        if nm[i+1][j+1] == '#':
            cnt += 1
        if nm[i+1][j] == '#':
            cnt += 1
        if nm[i+1][j-1] == '#':
            cnt += 1
        if nm[i][j+1] == '#':
            cnt += 1
        if nm[i][j] == '#':
            cnt += 1
        if nm[i][j-1] == '#':
            cnt += 1
        if nm[i-1][j+1] == '#':
            cnt += 1
        if nm[i-1][j] == '#':
            cnt += 1
        if nm[i-1][j-1] == '#':
            cnt += 1
        total.append(cnt)

for i in range(n*m):
    if total[i] % 2 != 0:
        ans += 1

print(ans)

Fixed submission:
n,m = map(int,input().split())
print(abs((n-2)*(m-2)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
cnt = [0,0,0,0,0]
comp = 'MARCH'
ans = 0

for i in range(N):
    word = input()
    for j in range(len(comp)):
        if word[0] == comp[j]:
            cnt[j] += 1

for i in range(len(cnt)):
    for j in range(i+1,len(cnt)):
        for k in range(j+1,len(cnt)):
            ans += cnt[i] * cnt[j] * cnt[k]
print(ans)

Fixed submission:
N = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0

for i in range(N):
    S = input()
    if S[0] == 'M':
        m += 1
    elif S[0] == 'A':
        a += 1
    elif S[0] == 'R':
        r += 1
    elif S[0] == 'C':
        c += 1
    elif S[0] == 'H':
        h += 1

ans = m * a * (r+c+h) + m * r * (c+h) + m * c * h + a * r * (c + h) + a * c * h + r * c * h
print(ans)
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n+1-i):
        j = n - i - j
        if (10000*i + 5000*j + 1000*c == y) and (i + j + c == n):
            print(i,j,k)
            exit()
print('-1 -1 -1')

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

for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        if (10000*i + 5000*j + 1000*k == y) and (i + j + k == n):
            print(i,j,k)
            exit()
print('-1 -1 -1')
Buggy python submission (verdict: Runtime Error):
from collections import OrderedDict
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = collections.Counter(a)
ans = 0
num_keys = len(b.keys())

if num_keys > k:
    c = sorted(b.items(),key=lambda x:x[1])
    for i in range(len(c)):
        num_keys -= c[i][1]
        c[-1][1] += c[i][1] 
        ans += c[i][1]
        if num_keys <= k:
            break
            
print(ans)


Fixed submission:
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
x = len(set(a))
if x <= k:
    print(ans)
else:
    b = Counter(a).most_common(x)
    for i in range(x-1,k-1,-1):
        ans += b[i][1]
    print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import OrderedDict
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = collections.Counter(a)
ans = 0
num_keys = len(b.keys())

if num_keys > k:
    if k != 0:
        c = sorted(b.items(),key=lambda x:x[1])
        for i in range(len(c)):
            num_keys -= c[i][1]
            ans += c[i][1]
            if num_keys <= k:
                break
    else:
        ans += k
            
print(ans)


Fixed submission:
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
x = len(set(a))
if x <= k:
    print(ans)
else:
    b = Counter(a).most_common(x)
    for i in range(x-1,k-1,-1):
        ans += b[i][1]
    print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import OrderedDict
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = collections.Counter(a)
ans = 0
num_keys = len(b.keys())

if num_keys > k:
    if k != 0:
        c = sorted(b.items(),key=lambda x:x[1])
        for i in range(len(c)):
            num_keys -= c[i][1]
#           c[-1][1] += c[i][1] 
            ans += c[i][1]
            if num_keys <= k:
                break
    else:
        ans += k
            
print(ans)

Fixed submission:
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
x = len(set(a))
if x <= k:
    print(ans)
else:
    b = Counter(a).most_common(x)
    for i in range(x-1,k-1,-1):
        ans += b[i][1]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    tmp = int(input())
    if tmp in a:
        a.remove(tmp)
    else:
        a.append(tmp)

print(len(a))

Fixed submission:
n = int(input())
a = {}
cnt = 0
for i in range(n):
    tmp = int(input())
    if tmp not in a:
        a[tmp] = 1
    else:
        a[tmp] += 1

for v in a.values():
    if v % 2 != 0:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
import statistics
n = int(input())
a = list(map(int,input().split()))
ans = []

for i in range(n):
    ans.append(a[i])
    ans.append(a[i]-1)
    ans.append(a[i]+1)

print(ans.count(statistics.mode(ans)))

Fixed submission:
import statistics,collections

n = int(input())
a = list(map(int,input().split()))
ans = []

for i in range(n):
    ans.append(a[i])
    ans.append(a[i]-1)
    ans.append(a[i]+1)

c = collections.Counter(ans)
print(c.most_common()[0][1])
Buggy python submission (verdict: Runtime Error):
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)

if alphabet in s_list:
    print('None')
else:
    for i in range(len(s)):
        if s_list[i] != alphabet[i]:
            print(alphabet[i])
            break

Fixed submission:
l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")

Buggy python submission (verdict: Runtime Error):
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)


for i in range(len(s)):
    if s_list[i] != alphabet[i]:
        print(alphabet[i])
        break
if alphabet in s_list:
    print('None')

Fixed submission:
l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")

Buggy python submission (verdict: Runtime Error):
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)


for i in range(len(s)):
    if s_list[i] != alphabet[i]:
        print(alphabet[i])
        break
if alphabet in s:
    print('None')

Fixed submission:
l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")

Buggy python submission (verdict: Runtime Error):
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)

if alphabet in s:
    print('None')
else:
    for i in range(len(s)):
        if s_list[i] != alphabet[i]:
            print(alphabet[i])
            break

Fixed submission:
l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")

Buggy python submission (verdict: Runtime Error):
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'

s_list = set(s)
s_list = sorted(s_list)

if alphabet in s:
    print('None')
else:
    for i in range(len(s)):
        if s_list[i] != alphabet[i]:
            print(alphabet[i])
            break

Fixed submission:
l=[chr(ord("a")+i) for i in range(26)]
s=set(input())
for i in s:
    l.remove(i)
print(l[0] if len(l)>0 else "None")
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x,y):
    return (x*y) // math.gcd(x,y)

ans = t[0]

for i in range(1,n):
    ans = lcm(ans,t[i])

print(ans)

Fixed submission:
import fractions

n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

ans = t[0]

for i in range(1,n):
    ans = lcm(ans,t[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
min_v = float('inf')
for i in range(1,n):
    tmp1 = a[:i]
    tmp2 = a[i:]
    min_v = min(abs(sum(tmp1) - sum(tmp2)), min_v)

print(min_v)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
x = 0
y = sum(l)
xy = [10**15]*n
for i in range(n-1):
    x += l[i]
    y -= l[i]
    xy[i] = abs(x-y)
print(min(xy))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = float('inf')

for i in range(n-1):
    ans = min(ans,abs(sum(a[0:i+1])-sum(a[i+1:])))

print(ans)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
x = 0
y = sum(l)
xy = [10**15]*n
for i in range(n-1):
    x += l[i]
    y -= l[i]
    xy[i] = abs(x-y)
print(min(xy))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = ''

for i in range(n):
    if i % 2 == 0:
        ans = ans + str(a[i]) + 
    else:
        ans = str(a[i]) + ans
        
print(ans)

Fixed submission:
n = int(input())
a = list(input().split())
print(" ".join(a[::-2] + a[n%2::2]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = []

for i in range(n):
    tmp = a.pop(0)
    b.append(tmp)
    b = b[::-1]
    

print(*b)

Fixed submission:
n = int(input())
a = list(input().split())
print(" ".join(a[::-2] + a[n%2::2]))
Buggy python submission (verdict: Time Limit Exceeded):
s,c = map(int,input().split())
scc = 0

for i in range(s):
    if c > 0:
        c -= 2
        s -= 1
        scc += 1
    if s == 0:
        break
        
scc += c // 4

print(scc)

Fixed submission:
s,c = map(int,input().split())
scc = 0

tmp = c // 2
scc += min(s,tmp)
c -= scc*2
        
scc += c // 4

print(scc)
Buggy python submission (verdict: Runtime Error):
n = int(input()[-1])

if  in [2, 4, 5, 7, 9]:
  print("hon")
elif n in [0, 1, 6, 8]:
  print("pon")
else:
  print("bon")

Fixed submission:
n = int(input()[-1])

if n in [2, 4, 5, 7, 9]:
  print("hon")
elif n in [0, 1, 6, 8]:
  print("pon")
else:
  print("bon")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))

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

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

def nC2(n):
    return n * (n - 1) // 2

d = {i:a.count(i) for i in set(a)}

s = sum([nC2(d[i]) for i in set(a)])

for i in a:
    print(s + (1 - d[i]))

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

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

def nC2(n):
    return n * (n - 1) // 2

d = {i:a.count(i) for i in set(a)}

s = sum([nC2(d[i]) for i in set(a)])

for i in a:
    print(s + (1 - d[i]))

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

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

d = {i:a.count(i) for i in set(a)}

def nC2(n):
    return n * (n - 1) // 2

for i in a:
    d2 = d.copy()
    d2[i] -= 1
    print(sum([nC2(i) for i in d2.values()]))

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

def nC2(n):
    return n * (n - 1) // 2

d = {}
for i in a:
    if i in d.keys():
        d[i] += 1
    else:
        d[i] = 1
    
s = sum([nC2(i) for i in d.values()])

for i in a:
    print(s + (1 - d[i]))
Buggy python submission (verdict: Runtime Error):
n, r = int(input().split())
if n >= 10:
  print(r)
else:
  print(r + 100 * (10 - n))

Fixed submission:
n, r = map(int, input().split())
if n >= 10:
  print(r)
else:
  print(r + 100 * (10 - n))
Buggy python submission (verdict: Runtime Error):
print(input() + input())

Fixed submission:
s, t = input().split()
print(t + s)

Buggy python submission (verdict: Runtime Error):
print(input() + input())

Fixed submission:
s, t = input().split()
print(t + s)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,m = map(int, input().split())
for i in range(m):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1
  else:
    break
    
print(a,b)

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

if a > k:
    a -= k
    print(a, b)
else:
    k -= a
    a = 0
    
    if b > k:
        b -= k
        print(a, b)
    else:
        b = 0
        print(a, b)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = sorted(list(map(int, input().split())))
for i in range(m):
  a[-1] = a[-1]//2
  a = sorted(a)
  
print(sum(a))

Fixed submission:
n,m = map(int, input().split())
def intm(x):
  return int(x)*-1
a = list(map(intm, input().split()))

import heapq

heapq.heapify(a)

for _ in range(m):
  x = heapq.heappop(a)
  x = int(x/2)
  heapq.heappush(a,x)
  
print(sum(a)*-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = ["".join(sorted(input())) for _ in range(n)]

count = 0
for i in range(n):
  base = s[i]
  num = sum([base==j for j in s[i+1:]])
  count += num
  
print(count)

Fixed submission:
n = int(input())
s = ["".join(sorted(input())) for _ in range(n)]

d = {i:0 for i in set(s)}
for i in s:
  d[i] += 1
  
count = 0

for i in d.values():
  count += i*(i-1)//2
  
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
for i in range(1,n+1):
  if h[-i] >= h[-i-1]:
    continue
  elif h[-i-1] - h[-i] == 1:
    h[-i-1] -= 1
  else:
    print("No")
    break
else:
  print("Yes")

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
  if h[n-1-i] >= h[n-2-i]:
    continue
  elif h[n-2-i] - h[n-1-i] == 1:
    h[n-2-i] -= 1
  else:
    print("No")
    break
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
  if h[i+1] - h[i] > 1:
    print("No")
    break
else:
  for i in range(n-1):
    if h[i+2] - h[i+1] == h[i+1] - h[i] == 1:
      print("No")
      break
  else:
    print("Yes")

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
  if h[n-1-i] >= h[n-2-i]:
    continue
  elif h[n-2-i] - h[n-1-i] == 1:
    h[n-2-i] -= 1
  else:
    print("No")
    break
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
import numpy as np
a = np.array([int(input()) for _ in range(n)])
M1,M2 = sorted(set(a))[::-1][0:2]
for b,i in zip(a==M1,a):
  if b:
    print(M2)
  else:
    print(M1)

Fixed submission:
n = int(input())
import numpy as np
a = np.array([int(input()) for _ in range(n)])
M = max(a)
if np.sum(a==M) >= 2:
  [print(M) for _ in range(n)]
else:
  result = [M]*n
  result[np.argmax(a)] = sorted(a)[-2]
  [print(i) for i in result]
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,x = map(int, input().split())
l = list(map(int, input().split()))
pop = [0] * (n)
pre = 0
for idx,i in enumerate(l):
  pop[idx] = pre + i
  pre = pop[idx]

print(np.sum(np.array([0]+pop) <= x))

Fixed submission:
import numpy as np
n,x = map(int, input().split())
l = list(map(int, input().split()))
pop = [0] * (n)
pre = 0
for idx,i in enumerate(l):
  pop[idx] = pre + i
  pre = pop[idx]

print(np.sum(np.array([0]+pop) <= x))