Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  s="".join(s)
  d.append(s)
d.sort()

def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)


x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)
ans=[]
for i in range(len(x)):
  if x[i]>1:
    ans.append(kaijou(x[i])/2)
  else:
    ans.append(0)
    
    
print(int(sum(ans)))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  s="".join(s)
  d.append(s)
d.sort()

def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)


x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
    
    
print(int(sum(x)))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  d.append(s)
d.sort()
def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)
x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
print(int(sum(x)))
  
    
  

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
  s=list(input())
  s.sort()
  d.append(s)
d.sort()
def kaijou(X):
  if X==1:
    return 1
  return X*kaijou(X-1)
x=[]
k=1

for i in range(n-1):
  if d[i]==d[i+1]:
    k+=1
  else:
    x.append(k)
    k=1
x.append(k)

print(d)
print(x)

for i in range(len(x)):
  if x[i]>1:
    x[i]=kaijou(x[i])/2
  else:
    x[i]=0
print(sum(x))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
d=[]
for i in range(n):
  d.append(list(input()))
  d[i].sort()
  d[i]="".join(d[i])
x=set(d)
x=list(x)
for j in range(len(x)):
  X=d.count(x[j])
  ans+=(X*(X-1))/2
print(int(ans))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
count=0
for i in range(N):
  x=s.count(s[i])
  count+=(x-1)/2
print(int(count))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
d=[[] for i in range(n)]
s=[]
count=0
for i in range(n):
  s=input()
  for j in range(10):
    d[i].append(s[j])
  d[i].sort()
for i in range(n):
  for j in range(n):
    if i!=j and d[i]==d[j]:
      count+=1
print(int(count/2))

Fixed submission:
n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))