Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# n=int(inputfile.readline())
# a,b=map(int, inputfile.readline().split())
# c=list(map(int, inputfile.readline().split()))
# s=[list(map(int,list(inputfile.readline()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import math
import sys

inputfile = open("input.txt")
N, M=map(int, inputfile.readline().split())

# 各スイッチがどの電球につながっているかの情報をビットで保持する配列
# 1番目のスイッチが2番目と3番目の電球につながっていた場合以下のようになる
# (1 << 1) | (1 << 2) = (110)b   ※ zero index
bulb_list = [0 for _ in range(N)]

for bulb_idx in range(M):
    switches = list(map(int, inputfile.readline().split()))
    bulb_bit = 1 << bulb_idx # つながっている電球を二進数で表す

    # switchesの2番目以降の要素には、スイッチの番号が入っている
    for sw in switches[1::]:
        sw_idx = (sw - 1) # スイッチの番号をzero indexに変換する
        bulb_list[sw_idx] = bulb_list[sw_idx] | bulb_bit

bulb_conds = list(map(int, inputfile.readline().split()))

bulb_cond = 0
for i, bc in enumerate(bulb_conds):
    bulb_cond |= bc << i

light_num = 0
# N = 3 の時
# 000, 001, 010, 011, 100, 101, 110, 111 の8パターンで、
# スイッチを押す全てのパターンを表現することが出来る
for bit_ptn in range(1 << N):
    t = 0 # tはbit_ptnが表すスイッチの組み合わせを全て押したときの電球の状態を表す(最初は全部消えている)
    for i in range(N):
        if bit_ptn >> i & 1:
            t = t ^ bulb_list[i]
    if t == bulb_cond:
        light_num += 1

print(light_num)


Fixed submission:
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

N, M=map(int, input().split())


# 各スイッチがどの電球につながっているかの情報をビットで保持する配列
# 1番目のスイッチが2番目と3番目の電球につながっていた場合以下のようにいなる
# (1 << 1) | (1 << 2) = (110)b   ※ zero index
mask_list = [0 for _ in range(N)]

for i in range(M):
    switches = list(map(int, input().split()))

    # switchesの2番目以降の要素には、スイッチの番号が入っている
    for j in range(1, len(switches)):
        sw_num = (switches[j] - 1) # スイッチの番号をzero index で管理する
        sw_bit = 1 << i # つながっている電球を二進数で表す
        mask_list[sw_num] = mask_list[sw_num] | sw_bit

conds = list(map(int, input().split()))

conds_dec = 0

for i in range(len(conds)):
    conds_dec |= conds[i] << i

light_num = 0
for s in range(1 << N):
    t = 0
    for i in range(N):
        if s >> i & 1:
            t = t ^ mask_list[i]
    if t == conds_dec:
        light_num += 1


print(light_num)
Buggy python submission (verdict: Time Limit Exceeded):
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

N,M=map(int, input().split())
A=np.array([i for i in range(N+1)[1::]])

for _ in range(M):
    L,R=map(int, input().split())
    tmp=np.array([i for i in range(R+1)[L::]])
    A = np.intersect1d(A,tmp)

print(len(A))

Fixed submission:
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

N,M=map(int, input().split())
A=np.array([i for i in range(N+1)[1::]])


minimum = 1
maximum = N

for _ in range(M):
    L,R=map(int, input().split())

    if(R < minimum or maximum < L):
        print(0)
        exit()

    if(minimum < L):
        minimum = L
    if(R < maximum):
        maximum = R

print(maximum - minimum + 1)

Buggy python submission (verdict: Time Limit Exceeded):
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

N,M=map(int, input().split())
A=set([i for i in range(N+1)[1::]])

for _ in range(M):
    L,R=map(int, input().split())
    tmp=set([i for i in range(R+1)[L::]])
    A = A & tmp

print(len(A))

Fixed submission:
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

N,M=map(int, input().split())
A=np.array([i for i in range(N+1)[1::]])


minimum = 1
maximum = N

for _ in range(M):
    L,R=map(int, input().split())

    if(R < minimum or maximum < L):
        print(0)
        exit()

    if(minimum < L):
        minimum = L
    if(R < maximum):
        maximum = R

print(maximum - minimum + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from itertools import accumulate

N = int(input())
L = list(map(int, input().split()))

m_gcd = 0
for i in range(N):
	Lt = L[:]
	Lt.pop(i)
	m_gcd = max(m_gcd, list(accumulate(Lt, gcd))[N - 2])

print(m_gcd)

Fixed submission:
from fractions import gcd
from itertools import accumulate

N = int(input())
L = list(map(int, input().split()))

gcd_L = [0] + list(accumulate(L, gcd))
gcd_R = list(accumulate(L[::-1], gcd))[::-1] + [0]


# [0,1,2,3,4]
# [4,3,2,1,0]
# N = 4
m_gcd = 0

for i in range( N):
	m_gcd = max(m_gcd, gcd(gcd_L[i], gcd_R[i + 1]))
print(m_gcd)
Buggy python submission (verdict: Time Limit Exceeded):
"""
n = int(sys.stdin.readline())
a, b = map(int, sys.stdin.readline().split())
c = list(map(int, sys.stdin.readline().split()))
s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

a = 100
b = 0.987654321
print('{0:06d}-{1:6f}'.format(a,b))  # 0埋め, 小数点出力桁指定時のときの出力
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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


mod = 1000000007

if __name__ == "__main__":
    N, Q = map(int, sys.stdin.readline().split())
    origin = sys.stdin.readline()
    for _ in range(Q):
        l, r = map(int, sys.stdin.readline().split())
        s = origin[l-1:r]
        a_flag = False
        ac_num = 0
        for w in s:
            if w == "A":
                a_flag = True
            if a_flag and w == "C":
                ac_num += 1
                a_flag = False
        print(ac_num)


Fixed submission:
"""
n = int(sys.stdin.readline())
a, b = map(int, sys.stdin.readline().split())
c = list(map(int, sys.stdin.readline().split()))
s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

a = 100
b = 0.987654321
print('{0:06d}-{1:6f}'.format(a,b))  # 0埋め, 小数点出力桁指定時のときの出力
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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


mod = 1000000007

if __name__ == "__main__":
    N, Q = map(int, sys.stdin.readline().split())
    origin = sys.stdin.readline()
    dp = [0 for _ in range(N + 1)]
    a_flag = False
    for i in range(N):

        if a_flag and origin[i] == "C":
            dp[i + 1] = dp[i] + 1
            a_flag = False
            continue

        if origin[i] == "A":
            a_flag = True
        else:
            a_flag = False

        dp[i + 1] = dp[i]

    for _ in range(Q):
        l, r = map(int, sys.stdin.readline().split())
        print(dp[r] - dp[l])
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    bit = list(sys.stdin.readline().rstrip())
    print(2 * min(bit.count("0"), bit.count("1")))

Fixed submission:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

if __name__ == "__main__":
    bit = list(sys.stdin.readline().rstrip())
    print(2 * min(bit.count("0"), bit.count("1")))
Buggy python submission (verdict: Runtime Error):
import sys
if __name__ == "__main__":
    N, M = map(int, sys.stdin.readline().split())
    P = [0] * (N + 1)
    C = [0] * M

    for m in range(M):
        p, y = map(int, input().split())
        C[m] = [m, p, y, 0]
    C.sort(key=lambda x :x[2])

    for c in C:
        P[c[1]] += 1
        c[3] = P[c[1]]
    C.sort(key=lambda x :x[0])

    for c in C:
        print("{}{}".format(str(c[1]).zfill(6), str(c[3]).zfill(6)))

Fixed submission:
A, B = list(map(int, input().split()))
print(A + (B // 2))
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
from itertools import accumulate
from functools import reduce
import queue
from fractions import gcd

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    N, M = map(int, sys.stdin.readline().split())
    L = [list(map(int,list(sys.stdin.readline().split()))) for i in range(M)]
    sL = sorted(L, key=lambda x : x[0])

    d = {}
    for l in sL:
        if l[0] not in d:
            d[l[0]] = [l[1]]
        else:
            d[l[0]].append(l[1])

    for v in d.values():
        v.sort()

    for l in L:
        key = l[0]
        val = l[1]
        num = d[key].index(val) + 1
        print("{}{}".format(str(key).zfill(6),str(num).zfill(6)))


Fixed submission:
import sys

if __name__ == "__main__":
    N, M = map(int, sys.stdin.readline().split())
    P = [0] * (N + 1)
    C = [0] * M

    for m in range(M):
        p, y = map(int, input().split())
        C[m] = [m, p, y, 0]
    C.sort(key=lambda x :x[2])

    for c in C:
        P[c[1]] += 1
        c[3] = P[c[1]]
    C.sort(key=lambda x :x[0])

    for c in C:
        print("{}{}".format(str(c[1]).zfill(6), str(c[3]).zfill(6)))
Buggy python submission (verdict: Runtime Error):
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

# 左端点から右端点に行くパターン
# 右端点から左端点に行くパターン
# 求めるのはDの最大値
# 差のgcdとか？

N, X =  map(int, sys.stdin.readline().split())
L =  list(map(int, sys.stdin.readline().split()))
L = sorted(L.append(X))
D = [x2 - x1 for x1, x2 in zip(l , l[1::])]
print(reduce(gcd, D))

Fixed submission:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N, X = map(int, sys.stdin.readline().split())
    L = list(map(int, sys.stdin.readline().split()))
    L.append(X)
    L.sort()
    D = [abs(x2 - x1) for x1, x2 in zip(L, L[1::])]
    print(reduce(gcd, D))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline()))
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

s =  sys.stdin.readline().rstrip()
K =  int(sys.stdin.readline())


current = s[0]
cnt = 0
L = []
for stride in range(1, len(s) + 1):
    for i in range(len(s) - stride + 1):
        L.append(s[i:i + stride])

print(sorted(list(set(L)))[K - 1])

Fixed submission:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline()))
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

s =  sys.stdin.readline().rstrip()
K =  int(sys.stdin.readline())


current = s[0]
cnt = 0
L = []
for stride in range(1, K + 1):
    for i in range(len(s) - stride + 1):
        L.append(s[i:i + stride])

print(sorted(list(set(L)))[K - 1])
Buggy python submission (verdict: Runtime Error):
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
# 塗ることができないケースを考察してみる
# 愚直にシミュレーションしてもいけるかもしれない

H, W =  map(int, sys.stdin.readline().split())
L =  [list(list(sys.stdin.readline().rstrip())) for i in range(W)]

PL = [["0"] + l + ["0"] for l in L]

t = ["0"] * (W + 2)

PL.insert(0, t)
PL.append(t)

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if PL[i][j] == "#":
            if PL[i][j - 1] == "#" or PL[i - 1][j] == "#" or PL[i][j + 1] == "#" or PL[i + 1][j] == "#":
                continue
            else:
                print("No")
                exit()

print("Yes")

Fixed submission:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
# 塗ることができないケースを考察してみる
# 愚直にシミュレーションしてもいけるかもしれない

H, W =  map(int, sys.stdin.readline().split())
L =  [list(list(sys.stdin.readline().rstrip())) for i in range(H)]

PL = [["0"] + l + ["0"] for l in L]

t = ["0"] * (W + 2)

PL.insert(0, t)
PL.append(t)

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if PL[i][j] == "#":
            if PL[i][j - 1] == "#" or PL[i - 1][j] == "#" or PL[i][j + 1] == "#" or PL[i + 1][j] == "#":
                continue
            else:
                print("No")
                exit()

print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
a = []
count = 0
for i in range(N):
  temp = "".join(sorted(input()))
  count += a.count(temp)
  a.append(temp)

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
dic = {}
count = 0
for i in range(N):
  temp = "".join(sorted(input()))
  if temp in dic:
    count += dic[temp]
    dic[temp] += 1
  else:
    dic[temp] = 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
a = []
count = 0
for i in range(N):
  temp = input()
  temp = list(temp)
  temp.sort()
  temp = "".join(temp)
  count += a.count(temp)
  a.append(temp)

print(int(count))

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
dic = {}
count = 0
for i in range(N):
  temp = "".join(sorted(input()))
  if temp in dic:
    count += dic[temp]
    dic[temp] += 1
  else:
    dic[temp] = 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from operator import mul
from functools import reduce

def cmb(n,r):
  r = min(n-r,r)
  if r == 0: return 1
  over = reduce(mul, range(n, n - r, -1))
  under = reduce(mul, range(1,r + 1))
  return over // under

N = int(input())
a = []
for i in range(N):
  temp = input()
  temp = list(temp)
  temp.sort()
  a.append("".join(temp))

count = 0
for s in set(a):
  temp = a.count(s)
  if temp >= 2:
    count += cmb(temp,2)

print(int(count))

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
dic = {}
count = 0
for i in range(N):
  temp = "".join(sorted(input()))
  if temp in dic:
    count += dic[temp]
    dic[temp] += 1
  else:
    dic[temp] = 1

print(count)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from math import factorial
N = int(input())
# スペース区切りの整数の入力
a = []
for i in range(N):
  a.append(input())

b = []
for s in a:
  temp = list(s)
  temp.sort()
  b.append("".join(temp))

count = 0
for s in set(b):
  temp = b.count(s)
  if temp >= 2:
    count += factorial(temp) / factorial(2) / factorial(temp - 2)

print(int(count))

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
dic = {}
count = 0
for i in range(N):
  temp = "".join(sorted(input()))
  if temp in dic:
    count += dic[temp]
    dic[temp] += 1
  else:
    dic[temp] = 1

print(count)
Buggy python submission (verdict: Runtime Error):
a=str(input())
if a[0] or a[1] or a[2]==7:
    
    print("Yes")
elif :
    print("No")

Fixed submission:
a=str(input())
if a[0] =='7' or a[1] =='7' or a[2]=='7':
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
k=int(input())

a=[]
i=1
d=0
while True:
    if len(str(i))==1:
        a.append(i)
    elif len(str(i))==2:
        I=str(i)
        c=abs(int(I[0])-int(I[1]))
        if c<=1:
            a.append(i)   
            
    elif len(str(i))==3:
        I=str(i)
        for j in range(2):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==2:
            a.append(i)
        d=0
        
    elif len(str(i))==4:
        I=str(i)
        for j in range(3):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==3:
            a.append(i) 
        d=0
        
    elif len(str(i))==5:
        I=str(i)
        for j in range(4):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==4:
            a.append(i)   
        d=0
        
    elif len(str(i))==6:
        I=str(i)
        for j in range(5):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==5:
            a.append(i)
        d=0
    
    elif len(str(i))==7:
        I=str(i)
        for j in range(6):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==6:
            a.append(i)
            
        d=0    
        
    elif len(str(i))==8:
        I=str(i)
        for j in range(7):
            c=abs(int(I[j])-int(I[j+1]))
            if c<=1:
                d=d+1
        if d==7:
            a.append(i)
            
        d=0    
        
    i=i+1
    if i==10000000:
        break

print(a[k-1])

Fixed submission:
n,k=map(int,input().split())
n=n%k
a=min(n,abs(n-k))
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())

a=[n]
i=0
while True:
    a.append(abs(a[i]-k))

    if a[i+1]>=a[i]:
        print(a[i])
        break
    i=i+1
    

Fixed submission:
n,k=map(int,input().split())
n=n%k
a=min(n,abs(n-k))
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
P = list(map(int, input().split()))

maxx = 0
def total(x):
    return int(x*(x+1)/2)

kitai_P = [total(x)/x for x in P]

ans = 0
for i in range(n-k+1):
    ans = max(ans, sum(kitai_P[i:i+k]))
print(ans)



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

maxx = 0
def total(x):
    return int(x*(x+1)/2)

kitai_P = [total(x)/x for x in P]

ans = 0
now = sum(kitai_P[0:k])
for i in range(n-k+1):
    if i >= 1:
        now = now - kitai_P[i-1] + kitai_P[i+k-1]
    ans = max(ans, now)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
DP = [0 for _ in range(h+1)]

for i in range(1,h+1):
    magic = 10 ** 10
    for j in range(n):
        magic = min(DP[max(0, i-A[j])] + B[j], magic)
    DP[i] = magic

print(DP[-1])

Fixed submission:
h, n = map(int, input().split())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
DP = [0 for _ in range(h+1)]

for i in range(1,h+1):
    magic = 10 ** 10
    for j in range(n):
        magic = min(DP[max(0, i-A[j])] + B[j], magic)
    DP[i] = magic

print(DP[-1])