Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Fixed submission:
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  #KA = list(map(int, input().split()))
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]-1] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
Fm = [0]*M
for n in range(N):
  KA = list(map(int, input().split()))
  for i in range(KA[0]):
    Fm[KA[i+1]] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Fixed submission:
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  #KA = list(map(int, input().split()))
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]-1] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())
mx = 0
for i in range(1,n+1):
    front = int((a*i)/b)
    back = int(i/b)*a
    mx = max(mx,front-back)
print(mx)

Fixed submission:
a,b,n = map(int,input().split())
mn = min(n,b-1)
front = int((a*mn)/b)
back = int(mn/b)*a
print(front-back)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = list(input())
counts = dict(Counter(s))
r = 0;g = 0;b= 0
for i in s:
    if i=="R":
        r += 1
    elif i=="G":
        g += 1
    else:
        b += 1
all = r*g*b
sub = 0
for i in range(N-1):
    for j in range(i+1,N):
        if s[i]==s[j]:
            continue
        k = 2*j - i
        if k >= N:
            continue
        else:
            if (s[k]!=s[i] and s[k]!=s[j]):
                sub += 1
print(all-sub)

Fixed submission:
N = int(input())
s = list(input())
r = 0;g = 0;b= 0
for i in s:
    if i=="R":
        r += 1
    elif i=="G":
        g += 1
    else:
        b += 1
all = r*g*b
sub = 0
for i in range(N-1):
    for j in range(i+1,N):
        if s[i]==s[j]:
            continue
        k = 2*j - i
        if k >= N:
            continue
        else:
            if (s[k]!=s[i] and s[k]!=s[j]):
                sub += 1
print(all-sub)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
from copy import deepcopy

def func(n):
    ans = math.factorial(n)//((math.factorial(n-2))*math.factorial(2))
    return ans

N = int(input())
a = input().split()

for j in range(N):
    sums = 0
    a1 = deepcopy(a)
    del a1[j]
    ans = dict(collections.Counter(a1))
    for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
    print(sums)
    #print(a1)
    #print(ans)

Fixed submission:
import collections
import math

def func(n):
    ans = math.factorial(n)//((math.factorial(n-2))*math.factorial(2))
    return ans

N = int(input())
a = input().split()
ans = dict(collections.Counter(a))
sums = 0
for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
            
for j in range(N):  
    print(sums-(ans[a[j]]-1))

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
a = input().split()

for j in range(N):
    sums = 0
    a1 = a.copy()
    a1.pop(j)
    ans = dict(collections.Counter(a1))
    for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
    print(sums)
    #print(a1)
    #print(ans)

Fixed submission:
import collections
import math

def func(n):
    ans = math.factorial(n)//((math.factorial(n-2))*math.factorial(2))
    return ans

N = int(input())
a = input().split()
ans = dict(collections.Counter(a))
sums = 0
for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
            
for j in range(N):  
    print(sums-(ans[a[j]]-1))
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
ans = math.sqrt(c*a) - math.sqrt(c*b)
if 1 < ans/(a-b):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,input().split())
x = c-a-b
if x <= 0:
    print('No')
else:
    if x*x > 4* a*b:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    cost = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(cost*(0.08))==a:
            if int(cost*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            cost = -1
print(cost)

Fixed submission:
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    mn = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(mn*(0.08))==a:
            if int(mn*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            mn = -1
print(mn)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    cost = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(cost*(0.08))==a:
            if int(cost*(0.1))==b:
                break
        mn += 1
        if i ==inter:
            cost = -1
print(cost)

Fixed submission:
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    mn = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(mn*(0.08))==a:
            if int(mn*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            mn = -1
print(mn)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k]
for i in range(k,n):
    a = p[i] - p[i-k]
    print(a)
    if a > mx:
        mx = a
        
print(mx)

Fixed submission:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]
ans = []
maxv = max(p)
dp = [i+1 for i in range(maxv+1)]
for i in range(1,maxv+1):
    dp[i] = dp[i-1]+dp[i]
dp = [j/(i+1) for i,j in enumerate(dp)]

maxv = 0
for i in range(n-k+1):
    a = 0
    for j in range(i,i+k):
        a += dp[p[j]-1]
    if maxv < a:
        maxv = a
    
print(maxv)

Fixed submission:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]
ans = []
maxv = max(p)
dp = [i+1 for i in range(maxv+1)]
for i in range(1,maxv+1):
    dp[i] = dp[i-1]+dp[i]
dp = [j/(i+1) for i,j in enumerate(dp)]

def func(n,dp):
    ans = 0
    for i in n:
        ans += dp[i-1]
    return ans

maxv = 0
for i in range(n-k+1):
    a = func(p[i:(i+k)],dp)
    if maxv < a:
        maxv = a
    
print(maxv)

Fixed submission:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]
ans = []
maxv = max(p)
dp = [i+1 for i in range(maxv+1)]
for i in range(1,maxv+1):
    dp[i] = dp[i-1]+dp[i]
dp = [j/(i+1) for i,j in enumerate(dp)]

def func(n,dp):
    ans = 0
    for i in n:
        ans += dp[i-1]
    return ans

maxv = 0
for i in range(n-k+1):
    ans.append(func(p[i:(i+k)],dp))
    
print(max(ans))

Fixed submission:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
import  heapq
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0

for i in range(len(num)):
    num1 = num[:i+1].copy()
    heapq.heapify(num1)
    if heapq.heappop(num1) == num[i]:
        count1 += 1
        
print(count1)

Fixed submission:
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
minv = 0

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)

Buggy python submission (verdict: Runtime Error):
import  heapq
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0

for i in range(len(num)):
    num1 = num[:i+1].copy()
    heapq.heapify(num1)
    if heapq.heappop(num1) == num[i]:
        count1 += 1
        
        

print(count1)

Fixed submission:
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
minv = 0

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
count2 = 0

for i in range(len(num)):
    #print(num[:i+1],num[i])
    if min(num[:i+1]) == num[i]:
        count1 += 1
        #print(num[i])
        

print(count1)

Fixed submission:
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
minv = 0

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(n-2):
    #print(s[i],s[i+1],s[i+2])
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n-2):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(n-2):
    #print(s[i],s[i+1],s[i+2])
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(n-2):
    #print(s[i],s[i+1],s[i+2])
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Fixed submission:
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    elif list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))
    

Fixed submission:
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0

n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    elif list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Fixed submission:
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k= map(int,input().split())

for i in range(k):
    if a > 0:
        a -= 1
    elif a == 0:
        if b > 0:
            b -= 1
        else:
            break
print(a,b)

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

if a > k:
    a = a - k
elif (a+b) >k:
    b = (a+b)-k
    a = 0
else:
    a = 0
    b = 0
print(a,b)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
r = [int(i) for i in input().split()]
t = list(input())
for i in range(n):
    if t[i]=='r':
        t[i]=0
    elif t[i]=='s':
        t[i]=1
    else:
        t[i]=2
#グーを０にチョキを１にパーを2に書き換える
ans = 0
dasite = []
for i in range(n):
    if i<k:
        ans = func(t[i],ans)
    elif i>=n-k:
        if dasite[i-k]==(t[i]+2)%3:
            print(i,t[i])
            continue
        else:
            ans = func(t[i],ans)
    else:
        if dasite[i-k]==(t[i]+2)%3:
            if t[i]==t[i+k]:
                dasite.append(t[i])
            elif t[i]==(t[i+k]+1)%3:
                dasite.append((t[i+k]+1)%3)
            else:
                dasite.append(t[i])
        else:
            ans = func(t[i],ans)
print(ans)

Fixed submission:
n,k = map(int,input().split())
r = [int(i) for i in input().split()]
t = list(input())
def func(d,ans):
    if d==0:
        ans += r[2]
        dasite.append(2)
    elif d==1:
        ans += r[0]
        dasite.append(0)
    else:
        ans += r[1]
        dasite.append(1)
    return ans

for i in range(n):
    if t[i]=='r':
        t[i]=0
    elif t[i]=='s':
        t[i]=1
    else:
        t[i]=2
#グーを０にチョキを１にパーを2に書き換える
ans = 0
dasite = []
for i in range(n):
    if i<k:
        ans = func(t[i],ans)
    elif i>=n-k:
        if dasite[i-k]==(t[i]+2)%3:
            continue
        else:
            ans = func(t[i],ans)
    else:
        if dasite[i-k]==(t[i]+2)%3:
            if t[i]==t[i+k]:
                dasite.append(t[i])
            elif t[i]==(t[i+k]+1)%3:
                dasite.append(t[i+k])
            else:
                dasite.append((t[i]+1)%3)
        else:
            ans = func(t[i],ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
maxv2 = a*(10**9)+b*10
minv2 = a*1+b
maxv1 = 10**9
minv1 =0

if  maxv2 <= x:
    print(10**9)
    
elif minv2 > x:
    print(0)
    

while True:
    #print(minv1,maxv,avg)
    avg =(maxv1+minv1)//2
    maxv = a*avg + b*len(str(avg))
           
    if maxv > x:
        if (a*(avg-1) + b*len(str(avg-1))) <x:
            print(avg-1)
            break
        else:
            maxv1 = avg
                         
    elif maxv < x:
        if (a*(avg+1) + b*len(str(avg+1))) >x:
            print(avg)
            break
        else:
            minv1 = avg


Fixed submission:
week = ["MON","TUE","WED","THU","FRI","SAT","SUN" ]
S = input()
a =week.index(S)
print(7 if a==6 else 6-a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ans = []

for i in range(1,n+1):
    ans.append(a.index(i)+1)
print(*ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ans = [0]*(n+1)

for i,j in enumerate(a):
    ans[j]=i+1
print(*ans[1:])
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
minv = min(a,b)
maxv = max(a,b)
kouyaku = []
ans = []
#公約数を求める
for i in range(1,(minv//2)+1):
    if a%i==0  and b%i==0:
        kouyaku.append(i)
#print(*kouyaku)
#互いに素になる数字を探す
i = 0
j = 1
kouyaku = kouyaku[1:]
while len(kouyaku)>i:
    while len(kouyaku)>j:
        if kouyaku[j]%kouyaku[i]==0:
            #print(kouyaku[j])
            kouyaku.remove(kouyaku[j])
            j -=1
        j +=1
    i += 1
    j = i+1
print(len(kouyaku)+1)

Fixed submission:
def prime(n):
    res =set()
    while n% 2==0:
        res.add(2)
        n //= 2
    i  = 3
    while i*i <= n:
        if n % i==0:
            res.add(i)
            n //= i
        else:
            i += 2
    if n != 1:
        res.add(n)
    return res
a,b = map(int,input().split())
a = prime(a)
b = prime(b)
print(len(a&b)+1)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
minv = min(a,b)
maxv = max(a,b)
kouyaku = []
ans = kouyaku.copy()
#公約数を求める
for i in range(1,(minv//2)+1):
    if a%i==0  and b%i==0:
        kouyaku.append(i)
print(*kouyaku)
#互いに素になる数字を探す
i = 0
j = 1
kouyaku.pop()
while len(kouyaku)==i:
    while len(kouyaku)==j:
        if j%i==0:
            kouyaku.remove(j)
print(*kouyaku)
        

Fixed submission:
def prime(n):
    res =set()
    while n% 2==0:
        res.add(2)
        n //= 2
    i  = 3
    while i*i <= n:
        if n % i==0:
            res.add(i)
            n //= i
        else:
            i += 2
    if n != 1:
        res.add(n)
    return res
a,b = map(int,input().split())
a = prime(a)
b = prime(b)
print(len(a&b)+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a  = [int(i)-1 for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
#ここまで入力
manzoku = 0
for i in range(n):
    if a[i] ==n:
        manzoku += b[a[i]]
    elif i == n-1:
        manzoku += b[a[i]]
    else:
        manzoku += (b[a[i]]+c[a[i]])
print(manzoku)

Fixed submission:
n = int(input())
a = [int(i)-1 for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
#ここまで入力
manzoku = 0
for i in range(n):
    manzoku += b[a[i]]
    if i ==0:
        continue
    if a[i] == a[i-1]+1:
        manzoku += c[a[i]-1]
print(manzoku)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
while i < n-1:
    count_min = 0
    while i<n-1 and h[i]<h[i+1]:
        i += 1
    while i<n-1 and h[i]>=h[i+1]:
        count_min += 1
        i += 1
    ans.append(count_min)
print(max(ans))

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
if n ==1:
    ans.append(0)
else:
    while i < n-1:
        count_min = 0
        while i<n-1 and h[i]<h[i+1]:
            i += 1
        while i<n-1 and h[i]>=h[i+1]:
            count_min += 1
            i += 1 
        ans.append(count_min)
print(max(ans))

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
while i < n-1:
    count_min = 0
    while i<n-1 and h[i]<h[i+1]:
        i += 1
    while i<n-1 and h[i]>=h[i+1]:
        count_min += 1
        i += 1
    ans.append(count_min)
print(max(ans))

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
if n ==1:
    ans.append(0)
else:
    while i < n-1:
        count_min = 0
        while i<n-1 and h[i]<h[i+1]:
            i += 1
        while i<n-1 and h[i]>=h[i+1]:
            count_min += 1
            i += 1 
        ans.append(count_min)
print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
moji = []
moji_s = [[0 for i in range(26)] for j in range(n)]
for i in range(n):
    m = input()
    ans = dict(collections.Counter(m))
    moji.append(ans)
    for j in ans:
        moji_s[i][ord(j)-97] = ans[j]
#ここまででそれぞれの文字列の文字の出現回数を辞書型にまとめたものがリストに格納された
count = 0
count_ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        if moji_s[i]==moji_s[j]:
            count +=1
print(count)

Fixed submission:
n = int(input())
res = dict()
for i in range(n):
    m = input()
    m = sorted(m)
    m = ''.join(m)
    if m in res:
        res[m] += 1
    else:
        res[m] = 1

for i in res:
  res[i] = res[i]*(res[i]-1)//2
print(sum(res.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = [int(i) for i in input().split()]
ans =  True
for i in range(n-1):
    for j in range(i,n):
        if h[i]-1 > h[j]:
            ans = False
if ans == True:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
ans =  True
maxv = h[0]
for i in range(n-1):
        if h[i] > h[i+1]:
            if maxv-h[i+1] >= 2:
                ans = False
        elif maxv < h[i+1]:
            maxv = h[i+1]
if ans == True:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
num = []
for i in range(n):
    num.append(int(input()))
#ここまで入力
num1 = num.copy()
num1.sort(reverse=True)
mx1 = num1[0]
mx2 = num1[1]
for i in num:
    if i==mx1:
        ans = mx2
        print(ans)
    else:
        ans = mx1
        print(ans)


Fixed submission:
n = int(input())
num = []
for i in range(n):
    num.append(int(input()))
#ここまで入力
num1 = num.copy()
num1.sort(reverse=True)
mx1 = num1[0]
mx2 = num1[1]
for i in num:
    if i==mx1:
        ans = mx2
        print(ans)
    else:
        ans = mx1
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
minv = 2019
for i in range(l,r):
    for j in range(i+1,r+1):
        if minv > (i*j)%2019:
            minv = (i*j)%2019
print(minv)

Fixed submission:
l,r = map(int,input().split())
minv = 2019
if r-l > 2019:
    minv = 0
else:  
    for i in range(l,r):
        for j in range(i+1,r+1):
            if minv > (i*j)%2019:
                minv = (i*j)%2019
            
        
print(minv)