Problem p02947 (python)

Fixed submission:
import sys
from collections import Counter
from math import factorial
import numpy as np
from scipy.misc import comb
def main():
    input = sys.stdin.readline
    N = int(input())
    S = ["".join(sorted(list(input()))).strip() for _ in range(N)]
    #print(S)
    c = Counter(S)
    mosc = c.most_common()
    
    ans = np.int64(0)
    for i in range(len(mosc)):
        elem = mosc[i]
        if elem[1] > 1:
          n = elem[1]
          r = 2
          #ans += np.int64(factorial(n) / factorial(r) / factorial(n - r))
          ans +=  comb(n, r, exact=True)
    print(ans)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from math import factorial
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    S = ["".join(sorted(list(input()))).strip() for _ in range(N)]
    #print(S)
    c = Counter(S)
    mosc = c.most_common()
    
    ans = np.int64(0)
    for i in range(len(mosc)):
        elem = mosc[i]
        if elem[1] > 1:
          n = elem[1]
          r = 2
          ans += np.int64(np.int64(factorial(n)) / np.int64(factorial(r)) / np.int64(factorial(n - r)))
          #ans +=  scipy.special.comb(n, r, exact=True)
    print(ans)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from math import factorial
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    S = ["".join(sorted(list(input()))).strip() for _ in range(N)]
    #print(S)
    c = Counter(S)
    mosc = c.most_common()
    
    ans = np.int64(0)
    for i in range(len(mosc)):
        elem = mosc[i]
        if elem[1] > 1:
          n = elem[1]
          r = 2
          ans += np.int64(factorial(n) / factorial(r) / factorial(n - r))
          #ans +=  scipy.special.comb(n, r, exact=True)
    print(ans)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from math import factorial
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    S = ["".join(sorted(list(input()))).strip() for _ in range(N)]
    #print(S)
    c = Counter(S)
    mosc = c.most_common()
    
    ans = 0
    for i in range(len(mosc)):
        elem = mosc[i]
        if elem[1] > 1:
          n = elem[1]
          r = 2
          ans += factorial(n) / factorial(r) / factorial(n - r)
          #ans +=  scipy.special.comb(n, r, exact=True)
    print(np.int64(ans))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from math import factorial
def main():
    input = sys.stdin.readline
    N = int(input())
    S = ["".join(sorted(list(input()))).strip() for _ in range(N)]
    #print(S)
    c = Counter(S)
    mosc = c.most_common()
    
    ans = 0
    for i in range(len(mosc)):
        elem = mosc[i]
        if elem[1] > 1:
          n = elem[1]
          r = 2
          ans += factorial(n) / factorial(r) / factorial(n - r)
    print(int(ans))

if __name__ == '__main__':
    main()