Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

def bin(arr, val):
    l,r = 0, len(arr)-1
    while l <= r:
        mid = (l + r)//2
        if arr[mid] == val: return 1
        elif arr[mid] <= val: l = mid + 1
        elif arr[mid] >= val: r = mid - 1
    return 0

x,n = imap()
p = sorted(iarr())

for i in range(n):
    a,b = x-i,x+i
    if not bin(p,a): ans = a; break
    if not bin(p,b): ans = b; break

if n==0: ans = x
print(ans)



Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

def bin(arr, val):
    l,r = 0, len(arr)-1
    while l <= r:
        mid = (l + r)//2
        if arr[mid] == val: return 1
        elif arr[mid] <= val: l = mid + 1
        elif arr[mid] >= val: r = mid - 1
    return 0

x,n = imap()
p = sorted(iarr())

for i in range(n+1):
    a,b = x-i,x+i
    if not bin(p,a): ans = a; break
    if not bin(p,b): ans = b; break

if n==0: ans = x
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
import re
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

a,b = imap()
b *= 100
ans = a*b //100
print(ans)


Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

import decimal as dec

a,b = sarr()
a,b = dec.Decimal(a), dec.Decimal(b)
ans = int(a*b)
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
a = iarr()

cum = []; sum = 0
for num in a: sum += num; cum.append(sum)

ans = 1
now = 1
for i in range(n):
    next = min(2*(now - a[i]), cum[n]-cum[i])
    now = next
    if n==i and next<0 : ans = -1; break
    if n!=i and next<=0 : ans = -1; break
    ans += next

if a[n] > 2**n: ans = -1
if a[1] < 2: ans = -1
print(ans)



Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
a = iarr()

cum = []; sum = 0
for num in a: sum += num; cum.append(sum)

ans = 1
now = 1
for i in range(n+1):
    next = min(2*(now - a[i]), cum[n]-cum[i])
    now = next
    if n==i and next<0 : ans = -1; break
    if n!=i and next<=0 : ans = -1; break
    ans += next

if a[n] > 2**n: ans = -1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,m,x = map(int,input().split())
arr = np.array([list(map(int,input().split())) for i in range(n)])
c = arr.T[0] # c[n-1]まで
a = arr.T[1:].T # a[n-1][m-1]まで

ans = np.inf
for i in range(2**n):
    ability = np.zeros(m, np.int64)
    cost = 0
    # 二進数の右から0番目〜n-1番目をみていき、使用or不使用を判断
    for j in range(n):
    # 使用する場合にability/costを更新
        if (i>>j)&1: ability += a[j] ; cost += c[j]
    # 条件クリアしている場合にansを更新
    if np.all(ability>=x): ans = min(ans,cost)

# ansが無限なら、未更新＝条件クリアしてないので-1を出力
ans = -1 if ans==np.inf else ans
print(ans)


Fixed submission:
import numpy as np
n,m,x = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]

ans = np.inf
flag = 0
for i in range(2**n):
    r = np.array([0]*(m+1))
    for j in range(n):
        if (i>>j)&1:
            for k in range(m+1): r[k] += a[j][k]
    if np.all(r[1:]>=x):
        if ans > r[0]: ans = r[0]
        flag = 1
    else: flag = 0

if flag: print(ans)
else: print("-1")

Buggy python submission (verdict: Runtime Error):


import numpy as np
N,M,X = map(int,input().split())
arr = np.array([list(map(int,input().split())) for i in range(n)])
C = arr.T[0]
A = arr.T[1:].T


cost = np.zeros(1<<N, np.int64)
ability = np.zeros((1<<N, M), np.int64)
for i in range(N):
    cost[1<<i:1<<(i+1)] = cost[:1<<i] + C[i]
    ability[1<<i:1<<(i+1)] = ability[:1<<i] + A[i]

ok = np.all(ability >= X, axis=1)

x = cost[ok]
answer = -1 if len(x) == 0 else x.min()
print(answer)


Fixed submission:
import numpy as np
n,m,x = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]

ans = np.inf
flag = 0
for i in range(2**n):
    r = np.array([0]*(m+1))
    for j in range(n):
        if (i>>j)&1:
            for k in range(m+1): r[k] += a[j][k]
    if np.all(r[1:]>=x):
        if ans > r[0]: ans = r[0]
        flag = 1
    else: flag = 0

if flag: print(ans)
else: print("-1")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + list(map(int,input().split()))

def binp(arr, val):
    left,right = 0,len(arr)-1
    while left <= right:
        mid = (left+right)//2
        if val==arr[mid]: return 1
        elif val>=arr[mid]: left = mid+1
        else: right = mid-1
    return 0

ap = [a[i] + i for i in range(1,n+1)]
an = [i - a[i] for i in range(1,n+1)]
an.sort()

ans = 0
for ele in ap:
    if binp(an,ele): ans += an.count(ele)

print(ans)


Fixed submission:
import collections as col

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

def binp(arr, val):
    left,right = 0,len(arr)-1
    while left <= right:
        mid = (left+right)//2
        if val==arr[mid]: return 1
        elif val>=arr[mid]: left = mid+1
        else: right = mid-1
    return 0

ap = [a[i] + i for i in range(1,n+1)]
an = [i - a[i] for i in range(1,n+1)]
counter = col.Counter(an)

ans = 0
for ele in ap:
    ans += counter[ele]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections as col
n = int(input())
a = list(map(int,input().split()))
cnt = col.Counter(a)

ans = 0
for key,val in cnt.items(): ans += val*(val-1)//2

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



Fixed submission:
import collections as col
n = int(input())
a = list(map(int,input().split()))
cnt = col.Counter(a)

ans = 0
for key,val in cnt.items(): ans += val*(val-1)//2

for i in range(n):
    print(ans - cnt[a[i]] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
import collections as col
n = int(input())
a = list(map(int,input().split()))
cnt = col.Counter(a)

for i in range(n):
    cnt[a[i]] -= 1
    ans = 0
    for key,val in cnt.items():
        ans += val*(val-1)//2
    print(ans)
    cnt[a[i]] += 1


Fixed submission:
import collections as col
n = int(input())
a = list(map(int,input().split()))
cnt = col.Counter(a)

ans = 0
for key,val in cnt.items(): ans += val*(val-1)//2

for i in range(n):
    print(ans - cnt[a[i]] + 1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

class unionfind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.size = [1 for i in range(n)]
    def find(self,a):
        if a == self.parent[a]: return a
        else: self.parent[a] = find(self,self.parent[a]); return self.parent[a]
    def unite(self,a,b):
        pa,pb = self.find(self,a), self.find(self,b)
        if pa == pb: return
        else: self.parent[pb] = pa; self.size[pa] += self.size[pb]
    def same(self,a,b): return find(self,a) == find(self,b)

n,k = imap()
for i in range(31):
    if k**i > n: ans = i; break
ans = 1 if
print(ans)


Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
import bisect as bs
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

class unionfind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.size = [1 for i in range(n)]
    def find(self,a):
        if a == self.parent[a]: return a
        else: self.parent[a] = find(self,self.parent[a]); return self.parent[a]
    def unite(self,a,b):
        pa,pb = self.find(self,a), self.find(self,b)
        if pa == pb: return
        else: self.parent[pb] = pa; self.size[pa] += self.size[pb]
    def same(self,a,b): return find(self,a) == find(self,b)

n,k = imap()
for i in range(31):
    if k**i > n: ans = i; break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2, int(n**0.5)+1):
        while not num%i: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return col.Counter(ans)
    
n = int(input())
a = list(map(int,input().split()))

cnt = col.Counter()
for num in a:
    new = prime(num)
    for key,val in new.items():
        if val > cnt[key] : cnt[key] = val

LCM = 1
MOD = 10**9 + 7
for key,val in cnt.items(): LCM *= key**val

ans = 0
for num in a:
    b = LCM//num
    ans += b%MOD
    
print(ans%MOD)




Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2, int(n**0.5)+1):
        while not num%i: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return col.Counter(ans)
    
n = int(input())
a = list(map(int,input().split()))

cnt = col.Counter()
for num in a:
    new = prime(num)
    for key,val in new.items():
        if val > cnt[key] : cnt[key] = val

LCM = 1
MOD = 10**9 + 7
for key,val in cnt.items(): LCM *= key**val %MOD

ans = 0
for num in a:
    b = LCM * pow(num, MOD-2, MOD) #割るのではなく逆元をかける
    ans += b
    
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2, int(n**0.5)+1):
        while not num%i: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return col.Counter(ans)
    
n = int(input())
a = list(map(int,input().split()))

cnt = col.Counter()
for num in a:
    new = prime(num)
    for key,val in new.items():
        if val > cnt[key] : cnt[key] = val

LCM = 1
MOD = 10**9 + 7
for key,val in cnt.items(): LCM *= key**val

ans = 0
for num in a:
    b = LCM//num
    ans += b%MOD
    
print(ans%MOD)




Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2, int(n**0.5)+1):
        while not num%i: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return col.Counter(ans)
    
n = int(input())
a = list(map(int,input().split()))

cnt = col.Counter()
for num in a:
    new = prime(num)
    for key,val in new.items():
        if val > cnt[key] : cnt[key] = val

LCM = 1
MOD = 10**9 + 7
for key,val in cnt.items(): LCM *= key**val %MOD

ans = 0
for num in a:
    b = LCM * pow(num, MOD-2, MOD) #割るのではなく逆元をかける
    ans += b
    
print(ans%MOD)
Buggy python submission (verdict: Runtime Error):
import collections as col
import math

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(math.gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
        


Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections as col
import math as ma

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

a,b = map(int,input().split())
gcd = ma.gcd(a,b)
primes = prime(gcd)
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
        


Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections as col
import math as ma

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

a,b = map(int,input().split())
gcd = ma.gcd(a,b)
primes = prime(gcd)
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
        


Fixed submission:
import collections as col

def prime(n):
    ans = []
    num = n
    for i in range(2,int(n**0.5)+1):
        if i%2==0 and i!=2: continue
        while num%i == 0: num //= i ; ans.append(i)
    if num != 1: ans.append(num)
    return ans

def gcd(a,b): return gcd(b,a%b) if a%b else b

a,b = map(int,input().split())
primes = prime(gcd(a,b))
cnt = col.Counter(primes)
ans = len(cnt) + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
あ

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(3):
  if s[i] == t[i]: ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

anss = []
cnt = 0
for i in range(n):
    if i == 0: continue
    if h[i] <= h[i-1]: cnt += 1
    else: anss.append(cnt); cnt = 0
    if i == n-1 : anss.append(cnt)

print(max(anss))



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

anss = []
cnt = 0
for i in range(n):
    if i == 0: continue
    if h[i] <= h[i-1]: cnt += 1
    else: anss.append(cnt); cnt = 0
    if i == n-1 : anss.append(cnt)

try: print(max(anss))
except: print(0)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T


# 内積が0以上かを判定する
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

ans = []
for i in range(n):
    v1 = np.array([y[i], - x[i]]) # 法線ベクトル
    if i < n-1 : v2 = np.array([(y[i]+y[i+1])/2, (x[i]+x[i+1])/2])
    else: v2 = v1
    total1,total2 = np.array([0, 0]), np.array([0, 0])
    tmp1,tmp2,v3 = [],[],[]
    for j in range(n):
        v3.append(np.array([x[j], y[j]]))
        if isin90deg(v1, v3[j]): total1 += v3[j] ; tmp1.append(j)
        if isin90deg(v2, v3[j]): total2 += v3[j] ; tmp2.append(j)
    start1, end1 = min(tmp1), max(tmp1)
    start2, end2 = min(tmp2), max(tmp2)
    ans.append(np.linalg.norm(total1, ord=2)) # ord2でユークリッド距離
    ans.append(np.linalg.norm(total1 - v3[start1], ord=2))
    ans.append(np.linalg.norm(total1 - v3[end1], ord=2))
    ans.append(np.linalg.norm(total2, ord=2))
    ans.append(np.linalg.norm(total2 - v3[start2], ord=2))
    ans.append(np.linalg.norm(total2 - v3[end2], ord=2))

print(max(ans))



Fixed submission:
import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T

# 内積が0以上かどうか
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

# 内積が0かどうか
def is90deg(v1, v2):
    if np.dot(v1, v2) == 0 : return 1
    else: return 0

ans = []
for i in range(n):
    # tangent-vector, normal-vector
    tv, nv1 = np.array([x[i],y[i]]), np.array([y[i],-x[i]])
    nv2 = - nv1
    # tvから時計回り180度エリアにおけるベクトル和を考える
    # ただし、tvに平行なベクトル群（posi/nega）だけ例外処理
    for nv in [nv1, nv2]:
        sum,posi,nega = np.array([0,0]), np.array([0,0]), np.array([0,0])
        for j in range(n):
            v = np.array([x[j],y[j]])
            if isin90deg(v,nv): sum += v
            if is90deg(v,nv) and isin90deg(v,tv): posi += v
            if is90deg(v,nv) and not isin90deg(v,tv): nega += v
        # ユークリッド距離
        ans.append(np.linalg.norm(sum, ord=2))
        ans.append(np.linalg.norm(sum - posi, ord=2))
        ans.append(np.linalg.norm(sum - nega, ord=2))

print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# C
from collections import Counter
 
def ana(a,b):
    if sorted(a) == sorted(b): return 1
    return 0
    
n = int(input())
s = []
for i in range(n): s.append(input()) 

ans = 0
for i in range(n):
    for j in range(i+1,n):
        if ana(s[i], s[j]): ans += 1 
            
print(ans)


Fixed submission:
# C
from collections import *

n = int(input())
dic = defaultdict(lambda: 0)
for i in range(n): dic["".join(sorted(input()))] += 1

ans = 0
for k,v in dic.items(): ans += v*(v-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# C
from collections import Counter
 
def ana(first_word, second_word):
    def get_counter(s): return Counter(s.upper().replace(' ', ''))
    return get_counter(first_word) == get_counter(second_word)

n = int(input())
s = []*n
for i in range(n): s.append(input()) 

ans = 0
for i in range(n):
    for j in range(i+1,n):
        if ana(s[i], s[j]): ans += 1 
            
print(ans)


Fixed submission:
# C
from collections import *

n = int(input())
dic = defaultdict(lambda: 0)
for i in range(n): dic["".join(sorted(input()))] += 1

ans = 0
for k,v in dic.items(): ans += v*(v-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

ans = [1 for i in range(n+1)]; ans[0] = 0
for i in range(n+1):
    s = 0
    for j in range(i,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 0

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)




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

ans = [0 for i in range(n+1)]
for i in range(n,0,-1):
    s = 0
    for j in range(i*2,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 1

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

ans = [0 for i in range(n+1)]
for i in range(n+1):
    s = 0
    for j in range(i*2,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 1

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)




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

ans = [0 for i in range(n+1)]
for i in range(n,0,-1):
    s = 0
    for j in range(i*2,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 1

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)