Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def dfs(level=0, u=0):
        if len(to[(level, u)]) == 1:
            cnt_tree[l - level] += 1
        for kl, ku in to[(level, u)]:
            dfs(kl, ku)

    to = defaultdict(set)
    n, l = map(int, input().split())
    ss = [input()[:-1] for _ in range(n)]

    # 各sをパスと見て、辺を張っていく
    for s in ss:
        now_l = 0
        now_u = 0
        for c in s:
            nxt_l = now_l + 1
            nxt_u = (now_u << 1) + int(c)
            to[(now_l, now_u)].add((nxt_l, nxt_u))
            now_l, now_u = nxt_l, nxt_u
    # print(to)

    # パスで分離された木のレベルと個数を数える
    cnt_tree = defaultdict(int)
    dfs()
    #print(cnt_tree)

    # Grundy数をlv & -lvで求め、xorをとる
    sum_xor = 0
    for lv, cnt in cnt_tree.items():
        if cnt % 2 == 0: continue
        sum_xor ^= lv & -lv

    if sum_xor == 0:
        print("Bob")
    else:
        print("Alice")

main()


Fixed submission:
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n, l = map(int, input().split())
    ss = [input()[:-1] for _ in range(n)] + ["$"]
    ss.sort()
    # print(ss)

    # 隣同士のsを先頭から比べて、異なるところでそのlevelの木を消して、それ以降の木を追加する
    cnt_tree = defaultdict(int)
    cnt_tree[l] = 2
    for s0, s1 in zip(ss, ss[1:]):
        for depth, (c0, c1) in enumerate(zip(s0, s1)):
            if c0 == c1: continue
            cnt_tree[l - depth] -= 1
            for lv in range(l - depth - 1, l - len(s1), -1):
                cnt_tree[lv] += 1
            # print(cnt_tree)
            break

    # Grundy数をlv & -lvで求め、xorをとる
    sum_xor = 0
    for lv, cnt in cnt_tree.items():
        if cnt % 2 == 0: continue
        sum_xor ^= lv & -lv

    if sum_xor:
        print("Alice")
    else:
        print("Bob")

main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def dfs(level=0, u=0):
        if len(to[(level, u)]) == 1:
            cnt_tree[l - level] += 1
        for kl, ku in to[(level, u)]:
            dfs(kl, ku)

    to = defaultdict(set)
    n, l = map(int, input().split())
    ss = [input()[:-1] for _ in range(n)]

    # 各sをパスと見て、辺を張っていく
    for s in ss:
        now_l = 0
        now_u = 0
        for c in s:
            nxt_l = now_l + 1
            nxt_u = (now_u << 1) + int(c)
            to[(now_l, now_u)].add((nxt_l, nxt_u))
            now_l, now_u = nxt_l, nxt_u
    # print(to)

    # パスで分離された木のレベルと個数を数える
    cnt_tree = defaultdict(int)
    dfs()
    #print(cnt_tree)

    # Grundy数をlv & -lvで求め、xorをとる
    sum_xor = 0
    for lv, cnt in cnt_tree.items():
        if cnt % 2 == 0: continue
        sum_xor ^= lv & -lv

    if sum_xor == 0:
        print("Bob")
    else:
        print("Alice")

main()


Fixed submission:
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n, l = map(int, input().split())
    ss = [input()[:-1] for _ in range(n)] + ["$"]
    ss.sort()
    # print(ss)

    # 隣同士のsを先頭から比べて、異なるところでそのlevelの木を消して、それ以降の木を追加する
    cnt_tree = defaultdict(int)
    cnt_tree[l] = 2
    for s0, s1 in zip(ss, ss[1:]):
        for depth, (c0, c1) in enumerate(zip(s0, s1)):
            if c0 == c1: continue
            cnt_tree[l - depth] -= 1
            for lv in range(l - depth - 1, l - len(s1), -1):
                cnt_tree[lv] += 1
            # print(cnt_tree)
            break

    # Grundy数をlv & -lvで求め、xorをとる
    sum_xor = 0
    for lv, cnt in cnt_tree.items():
        if cnt % 2 == 0: continue
        sum_xor ^= lv & -lv

    if sum_xor:
        print("Alice")
    else:
        print("Bob")

main()