Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
V = tuple(map(int, input().split()))
X, Y = Counter(), Counter()
for i in range(0, N):
    if i & 1:
        Y[V[i]] += 1
    else:
        X[V[i]] += 1
x = sorted(X.items(), reverse=True, key=lambda x: x[1])[:2]
y = sorted(Y.items(), reverse=True, key=lambda x: x[1])[:2]
if x[0][0] == y[0][0]:
    ans = N
    tmp = 0
    for i in range(0, N):
        if i & 1:
            if V[i] != y[1][0]:
                tmp += 1
        else:
            if V[i] != x[0][0]:
                tmp += 1
    ans = min(ans, tmp)
    tmp = 0
    for i in range(0, N):
        if i & 1:
            if V[i] != y[0][0]:
                tmp += 1
        else:
            if V[i] != x[1][0]:
                tmp += 1
    ans = min(ans, tmp)
else:
    ans = 0
    for i in range(0, N):
        if i & 1:
            if V[i] != y[0][0]:
                ans += 1
        else:
            if V[i] != x[0][0]:
                ans += 1
print(ans)


Fixed submission:
from collections import Counter

N = int(input())
V = tuple(map(int, input().split()))
X, Y = Counter(), Counter()
for i in range(0, N):
    if i & 1:
        Y[V[i]] += 1
    else:
        X[V[i]] += 1
if len(X) != 1:
    x = sorted(X.items(), reverse=True, key=lambda x: x[1])[:2]
else:
    x = sorted(X.items(), reverse=True, key=lambda x: x[1])[:1]
if len(Y) != 1:
    y = sorted(Y.items(), reverse=True, key=lambda x: x[1])[:2]
else:
    y = sorted(Y.items(), reverse=True, key=lambda x: x[1])[:1]
if x[0][0] == y[0][0]:
    ans = N
    tmp = 0
    if len(y) == 1:
        for i in range(0, N):
            if i & 1:
                if V[i] != y[0][0]+1:
                    tmp += 1
            else:
                if V[i] != x[0][0]:
                    tmp += 1
    else:
        for i in range(0, N):
            if i & 1:
                if V[i] != y[1][0]:
                    tmp += 1
            else:
                if V[i] != x[0][0]:
                    tmp += 1
    ans = min(ans, tmp)
    tmp = 0
    if len(x) == 1:
        for i in range(0, N):
            if i & 1:
                if V[i] != y[0][0]:
                    tmp += 1
            else:
                if V[i] != x[0][0]+1:
                    tmp += 1
    else:
        for i in range(0, N):
            if i & 1:
                if V[i] != y[0][0]:
                    tmp += 1
            else:
                if V[i] != x[1][0]:
                    tmp += 1
    ans = min(ans, tmp)
else:
    ans = 0
    for i in range(0, N):
        if i & 1:
            if V[i] != y[0][0]:
                ans += 1
        else:
            if V[i] != x[0][0]:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = str(input())
K = int(input())
if S.count("1") == S(len):
    print(1)
    exit(0)
for s in S:
    if s != "1":
        print(s)
        exit()


Fixed submission:
S = str(input())
K = int(input())
for i in range(0, K):
    if S[i] != "1":
        print(S[i])
        exit()
print(1)
Buggy python submission (verdict: Runtime Error):
A = map(int, input())
A = sorted(A)
ans = 0
for i in range(1, 3):
    ans += abs(A[i - 1] - A[i])
print(ans)


Fixed submission:
A = map(int, input().split())
A = sorted(A)
ans = 0
for i in range(1, 3):
    ans += abs(A[i - 1] - A[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
S = str(input())
ans = {}
ans.add(S[0])
ans.add(S[1])
ans.add(S[2])
if len(ans) == 3:
    print("Yes")
else:
    print("No")


Fixed submission:
S = str(input())
if not(S[0] == S[1]) and not(S[1] == S[2]) and not(S[0] == S[2]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = [0, 1]
print(ans[(a + b) / 2])


Fixed submission:
a, b = map(int, input().split())
ans = ["Even", "Odd"]
print(ans[(a * b) % 2])
Buggy python submission (verdict: Runtime Error):
a, b = map(float, input().split())
print(int(round((a + b) / 2), 0))


Fixed submission:
a, b = map(float, input().split())
if int((a + b) / 2) < ((a + b) / 2):
    print(int((a + b) / 2) + 1)
else:
    print(int((a + b) / 2))
Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
print(N**2-A)


Fixed submission:
N = int(input())
A = int(input())
print(N ** 2 - A)

Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
print(N ** 2 - A)


Fixed submission:
N = int(input())
A = int(input())
print(N ** 2 - A)

Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
print(N ** 2 - A)


Fixed submission:
N = int(input())
A = int(input())
print(N ** 2 - A)

Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
print(N ** 2 - A)


Fixed submission:
N = int(input())
A = int(input())
print(N ** 2 - A)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = [A[0]]
for i in range(1, N):
    if not(i & 1):
        ans.append(A[i])
    else:
        ans.insert(0, A[i])
if N & 1:
    print(*reversed(ans))
else:
    print(*ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
odd = [A[i] for i in range(0, N) if not(i & 1)]
even = [A[i] for i in range(0, N) if i & 1]
ans = []
if N & 1:
    ans.extend(reversed(odd))
    ans.extend(even)
else:
    ans.extend(reversed(even))
    ans.extend(odd)
print(*ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []
ans = 0
for i in range(0, N):
    A.append(int(input()))
    ans += A[i]
A.sort()
if (ans % 10) != 0:
    print(ans)
else:
    s = [a for a in A if a % 10 != 0]
    print(ans-s[0])


Fixed submission:
N = int(input())
A = []
ans = 0
for i in range(0, N):
    A.append(int(input()))
    ans += A[i]
A.sort()
if (ans % 10) != 0:
    print(ans)
else:
    s = [a for a in A if a % 10 != 0]
    if len(s) == 0:
        print(0)
    else:
        print(ans-s[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
if N & 1:
    if A.count(0) == 1:
        for i in range(2,N,2):
            if A.count(i)!=2:
                print(0)
                exit()
    else:
        print(0)
        exit()
else:
    for i in range(1, N, 2):
        if A.count(i) != 2:
            print(0)
            exit()
print(pow(2, N//2, 10**9+7))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N & 1:
    if A[0] == 0:
        for i in range(1, N, 2):
            if A[i] != (i+1):
                print(0)
                exit()
    else:
        print(0)
        exit()
else:
    for i in range(0, N, 2):
        if A[i] != (i+1):
            print(0)
            exit()
print(pow(2, N//2, 10**9+7))
Buggy python submission (verdict: Runtime Error):
#-*- coding: utf-8 -*-

#関数は気持ち上に書いておきたい
def check_num():
    for i in range(N):
        if A[i] % 2 != 0:
            return False
        else:
            A[i] = A[i] / 2
    return True

#C++のmain関数みたいな
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0 #counterと同じ

　#check_num == Trueの間実行する
    while True:
        if check_num() == False:
            break
        ans += 1

    print(str(ans))



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

#関数は気持ち上に書いておきたい
def check_num():
    for i in range(N):
        if A[i] % 2 != 0:
            return False
        else:
            A[i] = A[i] / 2
    return True

if __name__ == '__main__':
    N = int(input())

    A = list(map(int, input().split()))
    ans = 0 #counterと同じ

    #check_num == Trueの間実行する
    while True:
        if check_num() == False:
            break
        ans += 1

    print(str(ans))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

printf((a + b) % 24)

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

print((a + b) % 24)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
dp=[1]*(ma+1)
ans=0

for i in range(len(A)-1):
  p=A[i]
  if dp[i]==1:
    for q in range(ma//p+1):
      dp[p*q]=0
    if A[i]!=A[i+1]:
      ans+=1
if dp[ma]==1:
  ans+=1
print(ans)


Fixed submission:
l=list(map(int,input().split()))
print(l.index(0)+1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
dp=[1]*(ma+1)
ans=0

for i in range(len(A)-1):
  p=A[i]
  if dp[i]==1:
    for q in range(ma//p+1):
      dp[p*q]=0
    if A[i]!=A[i+1]:
      ans+=1
if dp[ma]==1:
  ans+=1
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
dp=[1]*(ma+1)
ans=0

for i in range(len(A)-1):
  p=A[i]
  if dp[i]==1:
    for q in range(ma//p+1):
      dp[p*q]=0
    if dp[i]!=dp[i+1]:
      ans+=1
if dp[ma]==1:
  ans+=1
print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
dp=[1]*(ma+1)
ans=0

for i in range(N-1):
  p=dp[i]
  if dp[i]==1:
    for q in range(ma//p+1):
      dp[p*q]=0
    if dp[i]!=dp[i+1]:
      ans+=1
if dp[ma]==1:
  ans+=1
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%k==0:
    print("OK")
   	break
else:
  print("NG")

Fixed submission:
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%k==0:
    print("OK")
    break
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=list(map(int,input().split()))
s=sum(l)
if s>l:
  print(-1)
else:
  print(l-s)

Fixed submission:
n,m=map(int,input().split())
l=list(map(int,input().split()))
s=sum(l)
if s>n:
  print(-1)
else:
  print(n-s)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[int(i) for i in input().split()]
f=[0 for i in range(n)]
s=set(l)
for i in s:
  f[i-1]=l.count(i)
print(*f)


Fixed submission:
n=int(input())

f=[0 for i in range(n)]
for i in input().split():
  f[int(i)-1]+=1
print(*f)

Buggy python submission (verdict: Runtime Error):
n=int(inptu())
l=[int(i) for i in input().split()]
f=[0 for i in range(n)]
s=set(l)
for i in s:
  f[i-1]=l.count(i)
print(*f)

Fixed submission:
n=int(input())

f=[0 for i in range(n)]
for i in input().split():
  f[int(i)-1]+=1
print(*f)
Buggy python submission (verdict: Runtime Error):
print(int(input()+1)//2)

Fixed submission:
print((int(input())+1)//2)
Buggy python submission (verdict: Runtime Error):
a,b=input().spit()
d={}
d[a]=0
d[b]=0
d[a],d[b]=map(int,input().split())
x=input()
d[x]-=1
print(d[a],d[b])

Fixed submission:
a,b=input().split()
d={}
d[a]=0
d[b]=0
d[a],d[b]=map(int,input().split())
x=input()
d[x]-=1
print(d[a],d[b])
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
x=a-k
if x<0:
	a=0
    x=k-a
    b=b-k
    if b<0:
		b=0
print(a,b)


Fixed submission:
a,b,k=map(int,input().split())
if a>k:
    print(a-k,b)
elif a+b>k:
    print(0,b-k+a)
else:    
    print(0,0)

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
x=a-k
if x<0:
a=0
x=k-a
b=b-k
if b<0:
b=0
print(a,b)


Fixed submission:
a,b,k=map(int,input().split())
if a>k:
    print(a-k,b)
elif a+b>k:
    print(0,b-k+a)
else:    
    print(0,0)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)
  

print(lcm(a,b))


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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)
  

print(lcm(a,b))

Buggy python submission (verdict: Time Limit Exceeded):
def lcm(n,m):
  ma=max(n,m)
  while True:
    if (ma%n==0 and ma%m==0):
      return ma
    ma=ma+1
n,m=map(int,input().split())
print(lcm(n,m))

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)
  

print(lcm(a,b))

Buggy python submission (verdict: Runtime Error):
def lcm(x, y):
    if x > y:
      greater = x
    else:
      greater = y
    while(True):
      if((greater % x == 0) and (greater % y == 0)):
        lcm = greater
        break
      greater += 1
    return lcm
n,m=mpa(int,input().split())
print(lcm(n,m))

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)
  

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
n=int(input())
n=n%26
s=input()
out=""
for i in s:
  no=ord(i)+n
  if no>ord("Z"):
    no=no-ord("Z")+ord("A")-1
  out+=ord(no)
print(out)
  

Fixed submission:
n=int(input())
s=input()
c=""
w=0
for i in s:
  w=ord(i)+n
  if w>ord("Z"):
    w=w-ord("Z")-1+ord("A")
  c+=chr(w)
  #print(chr(w))
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
a=[k]*n 
for i in range(q):
    t=int(input())
    for i in range((n)):
        if i!=t-1:
            a[i]-=1 
for i in a:
    if i>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
a=[0]*n 
for i in range(q):
    t=int(input())
    a[t-1]+=1
#print(a)
for i in a:
    if k-(q-i)>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
t=int(input())
d=int(input())
c=d//t
f=c/t
if f!=c:
  c+=1
print(c)

Fixed submission:
import math
a,b=map(int,input().split())
print(math.ceil((b-1)/(a-1)))
Buggy python submission (verdict: Runtime Error):
t=int(input())-1
print(((t*(t+1))//2)

Fixed submission:
n=int(input())
n-=1
f=(n*(n+1))//2
print(f)
Buggy python submission (verdict: Runtime Error):
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in rnage(1,t):
  s+=l[i]
  s/=2
print(s)

Fixed submission:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)

Buggy python submission (verdict: Runtime Error):
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in rnage(1,t):
	s+=l[i]
    s/=2
print(s)

Fixed submission:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in input().split()]
s=0
for i in range(n-1):
	f=l[i]
    for j in range(n):
      if i!=j:
        f+=l[j]
        f=f/2
    if s<f:
      s=f
      
      

print(s)

Fixed submission:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(i) for i in input().split()]
sorted(l)
s=l[0]
for i in range(1,n):
	s+=l[i]
    s/=2
print(s)

Fixed submission:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=map(int,input().split())
sort(l)
s=l[0]
for i in range(1,n):
  s+=l[i]
  s/=2
print(s)

Fixed submission:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)
Buggy python submission (verdict: Runtime Error):
d={}
s=0
for _ in range(int(input())):
  l=input()
  l=sorted(l)
  f=d.keys()
  if l not in f:
    d[l]=0
  else:
    d[j]+=1
    s+=d[j]
print(s)
    
    
  

Fixed submission:
d={}
s=0
for _ in range(int(input())):
  l=input()
  l=str(sorted(l))
  f=d.keys()
  if l not in f:
    d[l]=0
  else:
    d[l]+=1
    s+=d[l]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ans = 0
ind, sumn = 0,0
for i in range(len(p)-k+1):
    if sum(p[i:i+k]) >= sumn:
        ind,sumn = i,sum(p[i:i+k])


#print((sumn+0.5*k)/2)

for i in p[ind:ind+k]:
    ans += (i+1)/2
else:
    print(ans)



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

ans = 0
tmp,ind = sum(p[0:k]),0
sumn = tmp

for i in range(len(p)-k):
    #print(p[i+k],p[i])
    tmp += p[i+k]-p[i]
    #print(tmp)
    if tmp >= sumn:
        ind,sumn = i,tmp
        #print(sumn)

print((sumn+k)/2)
"""
for i in p[ind:ind+k]:
    ans += (i+1)/2
else:
    print(ans)
"""
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(b+a)

Fixed submission:
s,t = map(str,input().split())

print(t+s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
r = [0]*10**5
res = 0

num = 0

for i in range(n):
    an = list(input())
    an.sort()
    an = "".join(map(str, an))
    #print(an)
    if an not in l:
        l.append(an)
        num += 1
    r[l.index(an)] += 1

z = 0
r = r[:num]
#print(r)
for i in range(1,max(r)+1):
    #print(j)
    z += i-1
    if i in r:
        res += z*r.count(i)
else:
    print(res)


Fixed submission:
# original_author prd_xxx
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

# collections.Counter()を使うと0回目の時にバグらないので23行目elseを省略可能
ctr = Counter()
ctr = {}
ans = 0

for s in S:
    # 文字列を昇順に並べ替え
    # 文字列をリスト化し、sortしたものを文字列化
    a = ''.join(sorted(list(s)))

    # ソート済み文字列が以前に存在していたら、答えに前回の合計値を加算する
    # 1..0 2..1 3..3 4..6 5..10 ... 組み合わせの数n(n-1)/2があり、
    # 最後にO(n)で計算も可能だが、冗長。
    # 一個ずつ処理していくと、
    # 1..0 2..+1(1) 3..+2(3) 4..+3(6) 5..+4(10)の増加になる
    if a in ctr:
        ans += ctr[a]
    else:
        ctr[a] = 0

    ctr[a] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
r = [0]*10**5
res = 0

num = 0

for i in range(n):
    an = list(input())
    an.sort()
    an = "".join(map(str, an))
    #print(an)
    if an not in l:
        l.append(an)
        num += 1
    r[l.index(an)] += 1

z = 0
for i in range(1,max(r)+1):
    #print(j)
    z += i-1
    if i in r:
        res += z*r.count(i)
else:
    print(res)


Fixed submission:
# original_author prd_xxx
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

# collections.Counter()を使うと0回目の時にバグらないので23行目elseを省略可能
ctr = Counter()
ctr = {}
ans = 0

for s in S:
    # 文字列を昇順に並べ替え
    # 文字列をリスト化し、sortしたものを文字列化
    a = ''.join(sorted(list(s)))

    # ソート済み文字列が以前に存在していたら、答えに前回の合計値を加算する
    # 1..0 2..1 3..3 4..6 5..10 ... 組み合わせの数n(n-1)/2があり、
    # 最後にO(n)で計算も可能だが、冗長。
    # 一個ずつ処理していくと、
    # 1..0 2..+1(1) 3..+2(3) 4..+3(6) 5..+4(10)の増加になる
    if a in ctr:
        ans += ctr[a]
    else:
        ctr[a] = 0

    ctr[a] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
r = [0]*10**5
res = 0

for i in range(n):
    an = list(input())
    an.sort()
    an = "".join(map(str, an))
    #print(an)
    if an not in l:
        l.append(an)
    r[l.index(an)] += 1

for i in r:
    for j in range(i-1,0,-1):
        #print(j)
        res += j
else:
    print(res)


Fixed submission:
# original_author prd_xxx
from collections import Counter

N = int(input())
S = [input() for i in range(N)]

# collections.Counter()を使うと0回目の時にバグらないので23行目elseを省略可能
ctr = Counter()
ctr = {}
ans = 0

for s in S:
    # 文字列を昇順に並べ替え
    # 文字列をリスト化し、sortしたものを文字列化
    a = ''.join(sorted(list(s)))

    # ソート済み文字列が以前に存在していたら、答えに前回の合計値を加算する
    # 1..0 2..1 3..3 4..6 5..10 ... 組み合わせの数n(n-1)/2があり、
    # 最後にO(n)で計算も可能だが、冗長。
    # 一個ずつ処理していくと、
    # 1..0 2..+1(1) 3..+2(3) 4..+3(6) 5..+4(10)の増加になる
    if a in ctr:
        ans += ctr[a]
    else:
        ctr[a] = 0

    ctr[a] += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [0]*n
s = set()
f_max,s_max = 0,0
for i in range(n):
    a = int(input())
    l[i] = a
    
    if a not in s:
        s.add(a)

    if f_max < a:
        s_max = f_max
        f_max = a
    elif s_max < a < f_max:
        s_max = a

#s.sort()

if len(s)==1:
    for i in range(n):
        print(s[0])

    exit()

for i in range(n):
    #if l[i]==f_max:
    #    print(s_max)
    #else:
    #    print(f_max)
    #if l[i]==s[-1]:
    #    print(s[-2])
    #else:
    #    print(s[-1])
    s.remove(l[i])
    print(max(s))
    s.add(l[i])



Fixed submission:

n = int(input())
l = [0]*n
s = set()
f_max,s_max = 0,0
c = 0
for i in range(n):
    a = int(input())
    l[i] = a
    if f_max < a:
        s_max = f_max
        f_max = a
        c = 0
    elif s_max < a < f_max:
        s_max = a
    elif f_max == a:
        c+=1

#s.sort()

if len(s)==1:
    for i in range(n):
        print(l[0])

    exit()

if c==0:
    for i in range(n):
        if l[i]==f_max:
            print(s_max)
        else:
            print(f_max)
else:
    for i in range(n):
        print(f_max)
Buggy python submission (verdict: Runtime Error):
L,R = map(int,input().split())

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R):
    for j in range(i+1,R+1):
        l.append((i*j)%2019)
else:
    l.sort()

if 3 in l and 673 in l:
    print(0)
elif 3 in l:
    print(min(l),637))
elif 637 in l:
    print(min(l),3))
else:
    print(min(l))



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

#f = 0
l = []

if R-L>=2019:
    #f = 1
    print(0)
    exit()

for i in range(L,R):
    for j in range(i+1,R+1):
        l.append((i*j)%2019)
else:
    l.sort()

print(l[0])
Buggy python submission (verdict: Runtime Error):
s = list(input())

s.sort()
if s[0]==s[1] and s[2]==s[4]:
  print("Yes")
else:
  print("No")

Fixed submission:
s = list(input())

s.sort()
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[3]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
x,a = map(int,input().split())
print(0) if x<a else: print(10)

Fixed submission:
x,a = map(int,input().split())
print(0) if x<a else print(10)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [1]*n
#kubaru_dp = [1]*n

for i in range(m):
    a = int(input())
    l[a] = 0

# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
    if l[i]==0:
        continue
    l[i] = l[i-1]+l[i-2]
else:
    print(l[-1]%(10**9+7))


Fixed submission:
n,m = map(int,input().split())
l = [1]*(n+1)
#kubaru_dp = [1]*n

for i in range(m):
    a = int(input())
    l[a] = 0

# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
    if l[i]==0:
        continue
    l[i] = l[i-1]+l[i-2]
else:
    print(l[-1]%(10**9+7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())

res = ""
for i in s:
    if i!=s[k]:
        res += "*" 
    else:
        res += s[k]
else:
    print(res)


Fixed submission:
n = int(input())
s = input()
k = int(input())-1

res = ""
for i in s:
    if i!=s[k]:
        res += "*" 
    else:
        res += s[k]
else:
    print(res)