Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(len(p)):
    p[i] = p[i]*(p[i]+1)/2 / p[i]
for i in range(n-k+1):
    p[i] = sum(p[i:i+k])
# print(p)
print(max(p[:n-k]))

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

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(len(p)):
    p[i] = p[i]*(p[i]+1)/2 / p[i]
for i in range(n-k+1):
    p[i] = sum(p[i:i+k])

print(max(p[:k-1]))

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

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

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

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

Fixed submission:
n,k = map(int,input().split())
p = [0]*k + list(map(int,input().split()))
ans = 0
for i in range(k,len(p)):
    p[i] = p[i]*(p[i]+1)/2 / p[i]
    p[i] = p[i] + p[i-1]
for i in range(len(p)-1,k-1,-1):
    p[i] = p[i] - p[i-k]
# print(p)
print(max(p))
Buggy python submission (verdict: Runtime Error):
import math
h = int(input())
ans = 0
num = 0
for i in range(41,0,-1):
    if 2**i <= h:
        num = 2**i
        rep = i
        # print(i)
        break
for i in range(rep+1):
    ans += 2**i
# print(num)
print(ans)



Fixed submission:
import math
import sys
h = int(input())
ans = 0
num = 0
if h == 1:
    print(1)
    sys.exit()
for i in range(41,0,-1):
    if 2**i <= h:
        num = 2**i
        rep = i
        # print(i)
        break
for i in range(rep+1):
    ans += 2**i
# print(num)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
tbl1 = [[0]*10 for i in range(10)]
tbl2 = [[0]*10 for i in range(10)]
# for j in range(10):
#     for k in range(10):
#         cnt1 = 0
#         cnt2 = 0
#         for i in range(1,n+1):
#             s = str(i)
#             if s[0] == str(k)and s[-1] == str(j):
#                 cnt1 += 1
#             if s[0] == str(j) and s[-1] == str(k):
#                 cnt2 += 1
#         ans += cnt1*cnt2
for i in  range(1,n+1):
    s = str(i)
    for j in range(10):
        for k in range(10):
            if s[0] == str(k)and s[-1] == str(j):
                tbl1[k][j] += 1
            if s[0] == str(j) and s[-1] == str(k):
                tbl2[j][k] += 1
for j in range(10):
        for k in range(10):
            ans += tbl1[k][j] * tbl2[j][k]
print(ans)

Fixed submission:
n = int(input())
ans = 0
tbl1 = [[0]*10 for i in range(10)]
tbl2 = [[0]*10 for i in range(10)]
# for j in range(10):
#     for k in range(10):
#         cnt1 = 0
#         cnt2 = 0
#         for i in range(1,n+1):
#             s = str(i)
#             if s[0] == str(k)and s[-1] == str(j):
#                 cnt1 += 1
#             if s[0] == str(j) and s[-1] == str(k):
#                 cnt2 += 1
#         ans += cnt1*cnt2
for i in  range(1,n+1):
    s = str(i)
    for j in range(10):
        for k in range(10):
            if s[0] == str(k)and s[-1] == str(j):
                tbl1[k][j] += 1
            if s[0] == str(j) and s[-1] == str(k):
                tbl2[j][k] += 1
for j in range(10):
        for k in range(10):
            ans += tbl1[k][j] * tbl2[j][k]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for j in range(10):
    for k in range(10):
        cnt1 = 0
        cnt2 = 0
        for i in range(1,n+1):
            s = str(i)
            if s[0] == str(k)and s[-1] == str(j):
                cnt1 += 1
            if s[0] == str(j) and s[-1] == str(k):
                cnt2 += 1
        ans += cnt1*cnt2
print(ans)

Fixed submission:
n = int(input())
ans = 0
tbl1 = [[0]*10 for i in range(10)]
tbl2 = [[0]*10 for i in range(10)]
# for j in range(10):
#     for k in range(10):
#         cnt1 = 0
#         cnt2 = 0
#         for i in range(1,n+1):
#             s = str(i)
#             if s[0] == str(k)and s[-1] == str(j):
#                 cnt1 += 1
#             if s[0] == str(j) and s[-1] == str(k):
#                 cnt2 += 1
#         ans += cnt1*cnt2
for i in  range(1,n+1):
    s = str(i)
    for j in range(10):
        for k in range(10):
            if s[0] == str(k)and s[-1] == str(j):
                tbl1[k][j] += 1
            if s[0] == str(j) and s[-1] == str(k):
                tbl2[j][k] += 1
for j in range(10):
        for k in range(10):
            ans += tbl1[k][j] * tbl2[j][k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += lcm//i
print(ans%mod)


Fixed submission:
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += lcm//i
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += (lcm//i)
print(ans%mod)


Fixed submission:
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += lcm//i
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += (lcm//i)%mod
print(ans%mod)


Fixed submission:
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += lcm//i
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += (lcm//i)%mod
print(ans%mod)


Fixed submission:
import math
import fractions
n = int(input())
a_ls = list(map(int,input().split()))
lcm = 1
ans = 0
mod = 10**9+7
for i in a_ls:
    lcm = lcm * i//fractions.gcd(lcm,i)
for i in a_ls:
    ans += lcm//i
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
ans = [s]*k + [(s%(10**6)+1) for i in range(n-k)]
 
print(" ".join(map(str,ans)))

Fixed submission:
import math
h = int(input())
w = int(input())
n = int(input())
print(min(math.ceil(n/h),(math.ceil(n/w))))
Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())
ps_ls = [list(input().split()) for i in range(m)]
ans_wa = 0
ans_ac = 0
strk_wa = 0
frag = 1
for i in range(m):
    ps_ls[i][0] = int(ps_ls[i][0])
ps_ls.sort(key=lambda x: x[0])

for i in range(m-1):
    if ps_ls[i][1] == "WA" and frag == 1:
        strk_wa += 1

    if ps_ls[i][1] == "AC":
        if frag == 1:
            ans_ac += 1
        frag = 0
        ans_wa += strk_wa
    if ps_ls[i][0] != ps_ls[i+1][0]:
        strk_wa = 0
        frag = 1
if ps_ls[-1][1] == "AC":
    if frag == 1:
            ans_ac += 1
    ans_wa += strk_wa

print(ans_ac,ans_wa)

Fixed submission:
import math
n,m = map(int,input().split())
ps_ls = [list(input().split()) for i in range(m)]
ans_wa = 0
ans_ac = 0
strk_wa = 0
frag = 1
for i in range(m):
    ps_ls[i][0] = int(ps_ls[i][0])
ps_ls.sort(key=lambda x: x[0])

for i in range(m-1):
    if ps_ls[i][1] == "WA" and frag == 1:
        strk_wa += 1

    if ps_ls[i][1] == "AC":
        if frag == 1:
            ans_ac += 1
        frag = 0
        ans_wa += strk_wa
        strk_wa = 0
    if ps_ls[i][0] != ps_ls[i+1][0]:
        strk_wa = 0
        frag = 1
if ps_ls != []:
    if ps_ls[-1][1] == "AC":
        if frag == 1:
                ans_ac += 1
        ans_wa += strk_wa

print(ans_ac,ans_wa)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n,k = map(int,input().split())
als = list(map(int,input().split()))
als.sort()
# n = 10**5
# k = 5*(10**4) 
mod = 10**9+7
ans = 0
def nCr(n,r):
    mod = (10**9)+7
    fac = [1,1]+[0]*n
    finv = [1,1]+[0]*n
    inv = [1,1]+[0]*n
    for i in range(2,n+1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    ans = fac[n] * (finv[r] * finv[n-r] % mod) % mod
    return ans

for i in range(n):
    if i >= k-1:
        ans += als[i] * nCr(i,k-1) % mod
        ans = ans % mod
    if i <= n-k:
        ans -= als[i] * nCr(n-i-1,k-1) % mod
        ans = ans % mod

print(ans)
        

Fixed submission:
import math
n,k = map(int,input().split())
als = list(map(int,input().split()))
als.sort()
# n = 10**5
# k = 5*(10**4) 
mod = 10**9+7
ans = 0
# def nCr(n,r):
#     mod = (10**9)+7
#     fac = [1,1]+[0]*n
#     finv = [1,1]+[0]*n
#     inv = [1,1]+[0]*n
#     for i in range(2,n+1):
#         fac[i] = fac[i-1] * i % mod
#         inv[i] = mod - inv[mod%i] * (mod//i) % mod
#         finv[i] = finv[i-1] * inv[i] % mod
#     ans = fac[n] * (finv[r] * finv[n-r] % mod) % mod
    
#     return ans

fac = [1,1]+[0]*n
finv = [1,1]+[0]*n
inv = [1,1]+[0]*n
for i in range(2,n+1):
    fac[i] = fac[i-1] * i % mod
    inv[i] = mod - inv[mod%i] * (mod//i) % mod
    finv[i] = finv[i-1] * inv[i] % mod

for i in range(n):
    if i >= k-1:
        ans += als[i] * fac[i] * (finv[(k-1)] * finv[i-(k-1)] % mod) % mod
        ans = ans % mod
    if i <= n-k:
        ans -= als[i] * fac[(n-i-1)] * (finv[(k-1)] * finv[(n-i-1)-(k-1)] % mod) % mod
        ans = ans % mod

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
def lcm(a,b):
    return (a*b)//gcd(a,b)
n,m = map(int,input().split())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans = lcm(ans,i)
for i in a:
    if (ans//i) % 2 == 0:
        print(0)
        exit()
print(((m//(ans//2))+1)//2)

Fixed submission:
from fractions import gcd
def lcm(a,b):
    return (a*b)//gcd(a,b)
n,m = map(int,input().split())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans = lcm(ans,i)
for i in a:
    if (ans//i) % 2 == 0:
        print(0)
        exit()
print(((m//(ans//2))+1)//2)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
aa = max((a-k),0)
if k > a:
    bb = max(b-(k-a),0)
print(aa,bb)

Fixed submission:
a,b,k = map(int,input().split())
aa = max((a-k),0)
bb = b
if k > a:
    bb = max(b-(k-a),0)
print(aa,bb)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))
bit = []
ans = 0
mod = 10**9+7
# for i in a:
#     cnt = 1
#     while i:
#         bit[-cnt] += i%2
#         i //= 2
#         cnt += 1
for i in range(60):
    bit.append(sum(a&1))
    a >>= 1
# print(bit)
for i in range(60):
    ans += ((n-bit[i])*bit[i]) % mod * pow(2,i,mod)
    ans %= mod
print(ans%mod)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * (2**i) % mod
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += ((n-bit[-1-i])*bit[-1-i]) % mod * pow(2,i,mod)
    ans %= mod
print(ans%mod)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * (2**i) % mod
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * pow(2,i,mod)
print(ans%mod)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * (2**i) % mod
    ans %= mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * (2**i) % mod
    ans %= mod
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
bit = [0]*60
ans = 0
mod = 10**9+7
for i in a:
    cnt = 1
    while i:
        bit[-cnt] += i%2
        i //= 2
        cnt += 1
for i in range(60):
    ans += (n-bit[-1-i])*bit[-1-i] * (2**i) % mod
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
l = [0,1,2,3,4,5,6,7,8,9]
ans = 0
for i in l:
    for j in l:
        for k in l:
            a,b,c = i,j,k
            # print(a,b,c)
            for m in s:
                # print(m)
                if a==int(m):
                    # print(i)
                    a = -1
                elif a==-1 and b==int(m):
                    b = -1
                elif b==-1 and c==int(m):
                    ans+=1
                    # print(i,j,k)
                    break
print(ans)

Fixed submission:
n = int(input())
s = input()
l = [0,1,2,3,4,5,6,7,8,9]
ans = 0
for i in l:
    for j in l:
        for k in l:
            a,b,c = i,j,k
            # print(a,b,c)
            for m in s:
                # print(m)
                if a==int(m):
                    # print(i)
                    a = -1
                elif a==-1 and b==int(m):
                    b = -1
                elif b==-1 and c==int(m):
                    ans+=1
                    # print(i,j,k)
                    break
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))

Fixed submission:
from fractions import gcd
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
div_list = []
ans = 0
check = 0
ans_list = []
for i in range(1,min(a,b)):
    if a%i == 0 and b%i == 0:
        div_list.append(i)
if min(a,b) == 1:
    print(1)
    sys.exit()

#print(div_list)
ans_list.append(div_list[1])
for i in range(1,len(div_list)):
    check = 0
    for j in ans_list:
        if div_list[i] % j == 0:
            check = 1
            break
    if check == 0:
        ans_list.append(div_list[i])
ans_list.append(1)
print(len(ans_list))

Fixed submission:
from fractions import gcd
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
div_list = []
ans = 0
for i in range(1,min(a,b)):
    if a%i == 0 and b%i == 0:
        div_list.append(i)
if min(a,b) == 1:
    print(1)
    sys.exit()

#print(div_list)

for i in range(1,len(div_list)):
    for j in div_list[1:i]:
        if div_list[i] % j == 0:
            ans += 1
            break
print(len(div_list) - ans)

Fixed submission:
from fractions import gcd
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a,b = map(int,input().split())
c = gcd(a,b)
d = factorization(c)
print(len(d)+1-(c==1))
Buggy python submission (verdict: Runtime Error):
import sys
h,w,a,b = map(int,input().split())
tempa = 0
tempb = [0]*w

list_tb = [[0 for i in range(w)] for j in range(h)]
if w % a != 0 or h % b != 0:
  print("No")
  sys.exit()

if h > 2:
  for i in range(h):
    tempa = 0
    for j in range(w):
      if tempa < a and tempb[j] < b:
        list_tb[i][j] = 1
        tempa += 1
        tempb[j] += 1
    if a != 0 and tempa == 0:
      print("No")
      sys.exit()
else:
  for j in range(w):
    if tempa < a:
      list_tb[0][j] = 1
      tempa += 1

for i in list_tb:
    print(*i,sep="")

Fixed submission:
h,w,a,b  = map(int,input().split())
lst_a  = [[1]*a + [0] * (w-a) for i in range(b)]
lst_b  = [[0]*a + [1] * (w-a)] * (h-b)
for i in lst_a:
 print(*i,sep="")
for i in lst_b:
 print(*i,sep="")

Buggy python submission (verdict: Runtime Error):
import sys
h,w,a,b = map(int,input().split())
tempa = 0
tempb = [0]*w

list_tb = [[0 for i in range(w)] for j in range(h)]
if w % a != 0 or h % b != 0:
  print("No")
  sys.exit()

if h > 2:
  for i in range(h):
    tempa = 0
    for j in range(w):
      if tempa < a and tempb[j] < b:
        list_tb[i][j] = 1
        tempa += 1
        tempb[j] += 1
else:
  for j in range(w):
    if tempa < a:
      list_tb[0][j] = 1
      tempa += 1

for i in list_tb:
    print(*i,sep="")

Fixed submission:
h,w,a,b  = map(int,input().split())
lst_a  = [[1]*a + [0] * (w-a) for i in range(b)]
lst_b  = [[0]*a + [1] * (w-a)] * (h-b)
for i in lst_a:
 print(*i,sep="")
for i in lst_b:
 print(*i,sep="")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[''.join(sorted(input())) for i in range(n)]
ans=0
#dict={}
s_list = []
# for i in s:
#   if i in dict:
#     ans+=dict[i]
#     dict[i]+=1
#   else:
#     dict[i]=1

# print(dict)
for i in range(n):
  check = 0
  for j in s_list:
    if s[i] == j:
      check = 1
      ans += 1
  s_list.append(s[i])

print(ans)


Fixed submission:
n = int(input())
s = ["".join(sorted(str(input()))) for i in range(n)]
d = {}
ans = 0
for i in s:
    if i not in d:
        d[i] = 0
    else:
        d[i] += 1
        ans += d[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[''.join(sorted(input())) for i in range(n)]
ans=0
#dict={}

# for i in s:
#   if i in dict:
#     ans+=dict[i]
#     dict[i]+=1
#   else:
#     dict[i]=1

# print(dict)
for i in range(n-1):
  for j in range(i+1,n):
    if s[i] == s[j]:
      ans += 1

print(ans)


Fixed submission:
n = int(input())
s = ["".join(sorted(str(input()))) for i in range(n)]
d = {}
ans = 0
for i in s:
    if i not in d:
        d[i] = 0
    else:
        d[i] += 1
        ans += d[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
al = [[] for i in range(10)]
ans = 0
h = []
for i in range(n):
    a,b = map(int,input().split())
    al[a-1] += [-b]
for i in range(m):
    for j in al[i]:
        heapq.heappush(h,j)
    if h:
        ans -= heapq.heappop(h)
print(ans)

Fixed submission:
import heapq
n,m = map(int,input().split())
al = [[] for i in range(10**5)]
ans = 0
h = []
for i in range(n):
    a,b = map(int,input().split())
    al[a-1] += [-b]
for i in range(m):
    for j in al[i]:
        heapq.heappush(h,j)
    if h:
        ans -= heapq.heappop(h)
print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
al = [[] for i in range(10)]
ans = 0
h = []
for i in range(n):
    a,b = map(int,input().split())
    al[a-1] += [-b]
for i in range(m):
    for j in al[i]:
        heapq.heappush(h,j)
    if h:
        ans -= heapq.heappop(h)
print(ans)

Fixed submission:
import heapq
n,m = map(int,input().split())
al = [[] for i in range(10**5)]
ans = 0
h = []
for i in range(n):
    a,b = map(int,input().split())
    al[a-1] += [-b]
for i in range(m):
    for j in al[i]:
        heapq.heappush(h,j)
    if h:
        ans -= heapq.heappop(h)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s=[''.join(int(input())) for i in range(n)]
s_sort=sorted(s,reverse=True)
for i in range(n):
    if s[i] == s_sort[0]:
        print(s_sort[1])
    else:
        print(s_sort[0])


Fixed submission:
n = int(input())
s=[int(input()) for i in range(n)]
s_sort=sorted(s,reverse=True)
for i in range(n):
    if s[i] == s_sort[0]:
        print(s_sort[1])
    else:
        print(s_sort[0])
Buggy python submission (verdict: Time Limit Exceeded):
def divs(num):
    ans = []
    for i in range(1,int(num**(1/2)+1)):
        if num%i == 0:
            ans += [i,num//i]
    return set(ans)
n = int(input())
a = list(map(int,input().split()))
fin = []
ans = [0]*(n+1)
for i in range(n,0,-1):
    # print(i,a[i-1],ans[i])
    if a[i-1]^ans[i]:
        fin += [i]
        div = divs(i)
        # print(div)
        for j in div:
            ans[j] ^= 1
print(len(fin))
print(*fin)

Fixed submission:
def divs(num):
    ans = []
    for i in range(1,int(num**(1/2)+1)):
        if num%i == 0:
            ans += [i,num//i]
    return set(ans)
n = int(input())
a = list(map(int,input().split()))
fin = []
ans = [0]*(n+1)
for i in range(n,0,-1):
    # print(i,a[i-1],ans[i])
    if a[i-1]^ans[i]:
        fin += [i]
        div = divs(i)
        # print(div)
        for j in div:
            ans[j] ^= 1
print(len(fin))
print(*fin)