Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools
import bisect

s = input()
li = [0]
c = 2019
for i in range(1,110):
    li.append(c*i)
li.sort()
cnt = 0
cnt = s.count("0")
for i in range(len(s)-3):
    c = ""
    for j in range(4):
        c += s[i+j]
    if int(c) in li:
        cnt+=1
    
for i in range(len(s)-4):
    c = ""
    for j in range(5):
        c += s[i+j]
    if int(c) in li:
        cnt+=1
for i in range(len(s)-5):
    c = ""
    for j in range(6):
        c += s[i+j]
    if int(c) in li:
        cnt+=1
for i in range(len(s)-6):
    c = ""
    for j in range(7):
        c += s[i+j]
    if int(c) in li:
        cnt+=1
for i in range(len(s)-7):
    c = ""
    for j in range(8):
        c += s[i+j]
    if int(c) in li:
        cnt+=1

print(cnt)

Fixed submission:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
mod = 2019
if __name__ == "__main__":
    s = input()
    n = len(s)
    dp = [0]*(mod)
    dp[0] = 1
    r = 0
    t = 1
    for i in reversed(s):
        r += int(i)*t
        r%=mod
        t*=10
        t%=mod
        dp[r] +=1
    ans = 0
    for i in dp:
        ans += i*(i-1)//2
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

s = input()
li = [0]
c = 2019
for i in range(1,110):
    li.append(c*i)
cnt = 0
for i in range(len(li)):
    a = str(li[i])
    for j in range(len(s)-len(a)+1):
        c = ""
        for k in range(len(a)):
            c += s[j+k]
        if c == a:
            cnt += 1
print(cnt)

Fixed submission:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
mod = 2019
if __name__ == "__main__":
    s = input()
    n = len(s)
    dp = [0]*(mod)
    dp[0] = 1
    r = 0
    t = 1
    for i in reversed(s):
        r += int(i)*t
        r%=mod
        t*=10
        t%=mod
        dp[r] +=1
    ans = 0
    for i in dp:
        ans += i*(i-1)//2
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n,a,b = map(int,input().split())
if a == 0:
    print(0)
elif b == 0:
    print(n)
elif a + b>n:
    print(a)
else:
    c = n//(a+b)
    d = n%(a+b)
    if a>d:
        print(c*a+d)
    else:
        print(c*a + a)

Fixed submission:
s = input()
l = set(s)
if len(l) == 1:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
state = 0
for i in range(q):
    query = list(input().split())
    if query[0] == "2":
        if state%2 == 0:
            if query[1] == "1":
                s = query[2] + s
            else:
                s = s + query[2]
        else:
            if query[1] == "1":
                s = s +  query[2]
            else:
                s = query[2] + s
    else:
        state += 1
ans = ""
if len(s)>1:
    if state%2==1 and state != 1:
        for i in range(len(s)):
            ans += s[-1-i]
        print(ans)
    else:
        print(s)
else:
    print(s)

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())
state = 0
for i in range(q):
    query = input().split()
    if query[0] =="1":
        state +=1
    else:
        if (int(query[1])+state)%2 == 1:
            s.appendleft(query[2])
        else:
            s.append(query[2])
if state%2 == 1:
    s.reverse()
print("".join(s))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for i in range(q):
    query = list(input().split())
    if query[0] == "2":
        if query[1] == "1":
            s = query[2] + s
        else:
            s = s + query[2]
    else:
        temp = s[:]
        s = ""
        for j in range(len(temp)):
            s += temp[-1-j]
print(s)

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())
state = 0
for i in range(q):
    query = input().split()
    if query[0] =="1":
        state +=1
    else:
        if (int(query[1])+state)%2 == 1:
            s.appendleft(query[2])
        else:
            s.append(query[2])
if state%2 == 1:
    s.reverse()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input().split())
if n>=10:
    print(r)
else:
    print(100*(10-k))
    

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):
n = int(input())
x = sorted(list(map(int,input().split())))
li = []
cost = 0
for i in range(x[0],x[-1],1):
    cost = 0
    for b in x:
        cost += (b-i)**2
    li.append(cost)
print(min(li))




Fixed submission:
n = int(input())
x = sorted(list(map(int,input().split())))
li = []
cost = 0
for i in range(x[0],x[-1]+1,1):
    cost = 0
    for b in x:
        cost += (b-i)**2
    li.append(cost)
print(min(li))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import collections
n = int(input())
s = [input() for i in range(n)]
s = sorted(s)
c = set(s)
c = list(c)
li = []
for i in range(len(c)):
    li.append(c[i])
li2 = [0 for i in range(len(li))]
for i in range(n):
    for j in range(len(li)):
        if s[i] == li[j]:
            li2[j]+=1
max_v = max(li2)
li3 = []
for i in range(len(li2)):
    if li2[i] == max_v:
        li3.append(li[i])
li3 = sorted(li3)
for i in range(len(li3)):
    print(li3[i])




Fixed submission:
import sys
import collections
n = int(input())
s = [input() for i in range(n)]
s = sorted(s)
c = collections.Counter(s)
li = []
max_v = -1
for k,j in c.items():
    li.append([k,j])
    if max_v<j:
        max_v = j
li = sorted(li)
for i in range(len(li)):
    if li[i][1] == max_v:
        print(li[i][0])
Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(1,n+1):
    sum_k = 0
    for j in range(1,p[i-1]+1):
        sum_k += j *(1/p[i-1])
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)):
    sum_ans = ans[cnt]
    d = kitai[i] - kitai[j]
    sum_ans += d
    j +=1
    cnt+=1
    ans.append(sum_ans)
ans = sorted(ans)
print(ans[-1])


Fixed submission:
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(n):
    sum_k = 0
    sum_k = (1 + p[i])/2
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(1,n+1):
    sum_k = 0
    for j in range(1,p[i-1]+1):
        sum_k += j *(1/p[i-1])
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))


Fixed submission:
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(n):
    sum_k = 0
    sum_k = (1 + p[i])/2
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(1,n+1):
    sum_k = 0
    for j in range(1,p[i-1]+1):
        sum_k += j *(1/p[i-1])
    kitai.append(sum_k)
ans = []
for i in range(0,n-k+1):
    sum_ans = 0
    for j in range(k):
        sum_ans += kitai[j+i]
    ans.append(sum_ans)
print(max(ans))


Fixed submission:
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(n):
    sum_k = 0
    sum_k = (1 + p[i])/2
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n):
    state = 1
    for j in range(i):
        if p[i]<=p[j]:
            state = 1
        else:
            state = 0
            break
    if state == 1:
        cnt+=1
print(cnt)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
cnt = 1
max_p = p[0]
for i in range(1,n):
    if max_p > p[i]:
        max_p = p[i]
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
n,m = map(int,input().split())
li=[]
cnt_ac = 0
cnt_pn = 0
for i in range(m):
    p,s = input().split()
    li.append([int(p),s])
if m==0:
    print(cnt_pn,cnt_ac)
    sys.exit()
else:
    f = li[0][0]
    g = li[-1][0]+1
    j = 0
    while f != g:
        if li[j][1] != "AC":
            cnt_ac+=1
        else:
            f+=1
            cnt_pn+=1
        j+=1
    print(cnt_pn,cnt_ac)
    


Fixed submission:
n,m = map(int,input().split())
cnt = 0
pena = 0
problem = [0]*n
ac = 0
penalty = 0
for i in range(m):
    p,s = input().split()
    if problem[int(p)-1] == -1:
        continue
    if s == "WA":
        problem[int(p)-1]+=1
    else:
        ac += 1
        penalty += problem[int(p)-1]
        problem[int(p)-1] = -1
print(ac,penalty)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 1000000000000000000:
    print(124999999999999995)
else:
    cnt = 0
    dp = [0]*(n+1)
    dp[0] = 1
    dp[1] = 1
    for i in range(2,n+1):
        dp[i] = i*dp[i-2]
    ans = dp[n]
    l = -1
    while str(ans)[l] == '0':
        cnt+=1
        l-=1
    print(cnt)



Fixed submission:
import sys
n = int(input())
if n%2 == 1:
    print(0)
    sys.exit()
ans = 0
num = 10
while num<=n:
    ans += n//num
    num *= 5
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())
ans = a+b+c
if ans>=22:
    print("bust")
else:
    print("win")

Fixed submission:
a,b,c = map(int,input().split())
ans = a+b+c
if ans>=22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import decimal

def dfs(val,i,x):
    if val == x:
        return True
    if val > x or i > len(cost):
        return
    if dfs(val+cost[i],i+1,x):
        return True
    if dfs(val,i+1,x):
        return True
    return False

if __name__ == "__main__":
    x = int(input())
    cost = [100,101,102,103,104,105]
    a = dfs(0,0,x)
    if a == False:
        print(0)
    else:
        print(1)

Fixed submission:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import decimal



if __name__ == "__main__":
    x = int(input())
    dp = [0]*101010
    dp[0] = 1
    for i in range(100,101010):
        for j in range(100,106):
            if dp[i-j]:
                dp[i] = 1
    print(dp[x])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

n = int(input())
s = input()
cnt = 0
for i in range(1000):
    c = str(i)
    one,two,three = -1,-1,-1
    if len(c)<3:
        while True:
            if len(c) == 3:
                break
            c = "0" + c
    for j in range(n):
        if s[j] == c[0]:
            one = j
            break
    if one != -1:
        for j in range(one+1,n):
            if s[j] == c[1]:
                two = j
                break
    if two != -1:
        for j in range(two+1,n):
            if s[j] == c[2]:
                three = j
                break
    if three != -1:
        cnt+=1
print(cnt)


Fixed submission:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

n = int(input())
s = input()
cnt = 0
for i in range(1000):
    c = str(i)
    one,two,three = -1,-1,-1
    if len(c)<3:
        while True:
            if len(c) == 3:
                break
            c = "0" + c
    for j in range(n):
        if s[j] == c[0]:
            one = j
            break
    if one != -1:
        for j in range(one+1,n):
            if s[j] == c[1]:
                two = j
                break
    if two != -1:
        for j in range(two+1,n):
            if s[j] == c[2]:
                three = j
                break
    if three != -1:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
li = [list(map(int,input().split())) for i in range(N)]
ans = []
for i in range(N):
    for j in range(N):
        d = (li[i][0] - li[j][0])**2 + (li[i][1]-li[j][1])**2
        d = math.sqrt(d)
        ans.append(d)
print(sum(ans)/N)



Fixed submission:
r = int(input())
print(r**2//1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted(list(map(int,input().split())))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a-b<c and c<a+b:
                cnt+=1
print(cnt)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
cnt = 0
l = sorted(l)
for i in range(n):
    for j in range(i+1,n):
        d = l[i]+ l[j]
        cnt +=bisect.bisect_left(l,d) - (j+1)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted(list(map(int,input().split())))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        a = l[i]
        b = l[j]
        for k in range(j+1,n):
            if l[k] < a+b:
                c = l[k]
            else:
                break
            if b+c>a and c+a>b:
                cnt+=1
print(cnt)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
cnt = 0
l = sorted(l)
for i in range(n):
    for j in range(i+1,n):
        d = l[i]+ l[j]
        cnt +=bisect.bisect_left(l,d) - (j+1)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted(list(map(int,input().split())))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a<b+c and b<a+c and c<a+b:
                cnt+=1
            else:
                break
print(cnt)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
cnt = 0
l = sorted(l)
for i in range(n):
    for j in range(i+1,n):
        d = l[i]+ l[j]
        cnt +=bisect.bisect_left(l,d) - (j+1)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a<b+c and b<c+a and c<a+b:
                cnt+=1
print(cnt)

Fixed submission:
import bisect
n = int(input())
l = list(map(int,input().split()))
cnt = 0
l = sorted(l)
for i in range(n):
    for j in range(i+1,n):
        d = l[i]+ l[j]
        cnt +=bisect.bisect_left(l,d) - (j+1)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(len(a)):
    for j in range(len(a)):
        if i+1 == a[j]:
            ans.append(j+1)
            break
print(*ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i in range(len(a)):
    ans[a[i]-1] = i+1
print(*ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c_li = []
array = []
for i in range(1,max(a,b)):
    if a%i==0 and b%i == 0:
        c_li.append(i)
for i in range(2, max(c_li)):
    sosu = True
    for n in range(2, i):
        if i % n == 0:
            sosu = False
            break
            # 割り切れる場合（素数ではない場合）
            # 一回でも何かの数値で割り切れたら素数ではない
    if sosu:
        array.append(i)
array.insert(0,1)
s_array = set(array)
s_cli = set(c_li)
s_intersection = s_array & s_cli
print(len(s_intersection))



Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

def fact(n):
    b = 2
    li = []
    li.insert(0,1)
    while b*b<=n:
        while n%b == 0:
            n = n//b
            li.append(b)
        b+=1
    if n>1:
        li.append(n)

    return li
a,b = map(int,input().split())
c = gcd(a,b)
ans = set(fact(c))
print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
li = []
score = []

for i in range(q):
    a = int(input())
    li.append(a)

for i in range(n):
    score.append(k)

for i in range(len(li)):
    for j in range(len(score)):
        if j != li[i]-1:
            score[j]-=1

for i in range(len(score)):
    if score[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q = map(int,input().split())
li = []
score = []
count = []

for i in range(q):
    a = int(input())
    li.append(a)

for i in range(n):
    score.append(k)
    count.append(0)

for i in range(q):
    count[li[i]-1]+=1

for i in range(len(score)):
    score[i] = score[i] - q + count[i]
for i in range(len(score)):
    if score[i]>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = sorted(A)
cnt = 1
for i in range(m):
    B = sorted(B)
    B[-1] //= 2
print(sum(B))

Fixed submission:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
#入力
#解答
#出力
#Priority-queue
class PriorityQueue:

    def __init__(self,heap):
        self.heap = heap
        heapify(self.heap)
    
    def push(self,item):
        heappush(self.heap,item)
    
    def pop(self):
        return heappop(self.heap)
    
    def pushpop(self,item):
        return heappushpop(self.heap,item)
    
    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)

n,m = map(int,input().split())
A = sorted(list(map(int,input().split())))
heap = []
q = PriorityQueue(heap)
for i in range(n):
    q.push(-A[i])

for i in range(m):
    a = q.pop()
    a *= -1
    a //=2
    a *= -1
    q.push(a)
print(-1*sum(heap))
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
i = -1
count = [0]
while True:
    if li[i] <= li[i-1]:
        cnt += 1
    else:
        count.append(cnt)
        cnt = 0
    i = i - 1
    if i == -n:
        count.append(cnt)
        break

print(max(count))

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if li[i]>=li[i+1]:
        cnt+=1
    else:
        if cnt>ans:
            ans = cnt
        cnt = 0
if cnt>ans:
    ans = cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
i = -1
count = []
while True:
    if li[i] <= li[i-1]:
        cnt += 1
    else:
        count.append(cnt)
        cnt = 0
    i = i - 1
    if i == -n:
        count.append(cnt)
        break

print(max(count))

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if li[i]>=li[i+1]:
        cnt+=1
    else:
        if cnt>ans:
            ans = cnt
        cnt = 0
if cnt>ans:
    ans = cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
i = -1
count = []
while True:

    if i == -n:
        break
    if li[i] <= li[i-1]:
        cnt+=1
    else:
        count.append(cnt)
        cnt = 0
    i = i - 1
    if max(count)>= n//2:
        break
print(max(count))

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if li[i]>=li[i+1]:
        cnt+=1
    else:
        if cnt>ans:
            ans = cnt
        cnt = 0
if cnt>ans:
    ans = cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
cnt = 0
i = -1
count = []
while True:
    if i == -n:
        break
    if li[i] <= li[i-1]:
        i = i-1
        cnt+=1
    else:
        count.append(cnt)
        cnt = 0
        i = i -1
print(max(count))

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if li[i]>=li[i+1]:
        cnt+=1
    else:
        if cnt>ans:
            ans = cnt
        cnt = 0
if cnt>ans:
    ans = cnt
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
for i in range(N):
    word = sorted(input())
    s.append(word)
moji = ""
temp = []
cnt = 0
for i in range(N):
    moji = ""
    for x in s[i]:
        moji += x
    temp.append(moji)
for i in range(len(temp)):
    for j in range(i+1,len(temp)):
        if temp[i] == temp[j]:
            cnt+=1
print(cnt)

Fixed submission:
import collections

N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
c = collections.Counter(s)
cnt = 0
for i in set(s):
    n = c[i]
    cnt += n*(n-1)//2
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
state = 0
L = []
cnt = 0
cnt2 = 0
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<0:
        H[i-1] = H[i-1] - 1
for i in range(1,len(H)):
    d = H[i]-H[i-1]
    if d<0:
        cnt+=1
    elif d == 0:
        cnt2+=1

if cnt>0:
    print("No")
elif cnt2 == len(H)-1 and len(H)>=2:
    print("No")
else:
    print("Yes")


Fixed submission:
A,B,C = map(int,input().split())
last = A-B
D = C - last
if D<0:
    D = 0
print(D)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = []
for i in range(n):
    number = int(input())
    li.append(number)
temp = []
for i in range(n):
    for j in range(len(li)):
        if i != j:
            temp.append(li[j])
        else:
            temp.append(0)
d = 0
for i in range(n):
    max_num = 0
    for j in range(n):
        if max_num<=temp[d]:
            max_num = temp[d]
        d+=1
    print(max_num)
    

Fixed submission:
n = int(input())
a = []
for i in range(n):
    value = int(input())
    a.append(value)
temp = sorted(a)
max_a = temp[-1]
if len(a)>=2:
    second_a = temp[-2]
for i in range(n):
    if a[i] == max_a:
        check = i
        break
for i in range(n):
    if i == check:
        print(second_a)
    else:
        print(max_a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

a.insert(0,0)

ans = [0]*(n+1)

for i in range(n,0,-1):
    value = 0
    for j in range(2*i,n+1):
        value = value ^ ans[j]
    ans[i] = value ^ a[i]
print(sum(ans))
for i in range(1,n+1):
    if ans[i] == 1:
        print(i,end = " ")



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

a.insert(0,0)

ans = [0]*(n+1)

for i in range(n,0,-1):
    value = 0
    for j in range(2*i,n+1,i):
        value = value ^ ans[j]
    ans[i] = value ^ a[i]
print(sum(ans))
for i in range(1,n+1):
    if ans[i] == 1:
        print(i,end = " ")