Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from collections import defaultdict
import decimal
import sys
input = sys.stdin.readline


def prime_list(limit, until_limit=True):
    lst = [2]
    for num in range(3, limit, 2):
        if num ** 2 > limit and not until_limit:
            break

        for p_num in lst:
            if num % p_num == 0:
                break
            elif p_num * p_num > num:
                lst.append(num)
                break
    return lst


def prime_factor_count():
    pass


def main():
    n = int(input())
    p_list = prime_list(n)

    d = defaultdict(int)
    tmp = n
    for i in p_list:
        while 1:
            if tmp % i != 0:
                break
            else:
                tmp //= i
                d[i] += 1
        if tmp == 0:
            break

    cnt = 0
    tmp_n = 0
    for k, v in d.items():
        exp_cnt = 1
        while 1:
            if exp_cnt > v:
                break
            else:
                if tmp_n % (tmp_exp := k ** exp_cnt) == 0:
                    tmp_n //= tmp_exp
                    cnt += 1
                    v -= exp_cnt
                    exp_cnt += 1
    else:
        if n == tmp_n:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
import decimal
import sys
input = sys.stdin.readline


def prime_factor_count(n):
    def count(n, i):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        return n, cnt

    d = {}
    if n == 1:
        return d

    n, cnt = count(n, 2)
    d[2] = cnt

    lst = [2]
    for num in range(3, int(n ** 0.5) + 1, 2):
        if n == 1:
            break
        for p_num in lst:
            if num % p_num == 0:
                break
            elif p_num * p_num > num:
                lst.append(num)
                n, cnt = count(n, num)
                d[num] = cnt
                break
    else:
        if n != 1:
            d[n] = 1
    return d



def main():
    n = int(input())
    d = prime_factor_count(n)

    cnt = 0
    tmp_n = 0
    for k, v in d.items():
        exp_cnt = 1
        while 1:
            if exp_cnt > v:
                break
            else:
                if tmp_n % (tmp_exp := k ** exp_cnt) == 0:
                    tmp_n //= tmp_exp
                    cnt += 1
                    v -= exp_cnt
                    exp_cnt += 1
    else:
        if n == tmp_n:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

_, M = map(int, input().split())
A = list(map(int, input().split()))
opes = [tuple(map(int, input().split())) for _ in range(M)]
opes.sort(reverse=True)

for B, C in opes:
    if min(A) > C:
        continue
    A.sort()
    for i in range(B):
        A[i] = C if A[i] < C else A[i]

print(sum(A))


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
opes = [tuple(map(int, input().split())) for _ in range(M)]
opes.sort(key=lambda x:-x[1])

D = []
lenD = 0
for B, C in opes:
    D += [C]*B
    lenD += B
    if lenD >= N:
        break

A.sort()
for i, d in enumerate(D[:N]):
    if A[i] >= d:
        break
    A[i] = d

print(sum(A))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7
 
debug = True
debug = False
 
def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    S = SI()
    S = S[::-1]
    N = len(S)
    dp = [0 for j in range(13)]
    dp2 = [0 for j in range(13)]
 
    for i, c in enumerate(S):
        if i == 0:
            if c == '?':
                for j in range(10):
                    dp[j] = 1
            else:
                dp[int(c)] = 1
        else:
            if c == '?':
                for j in range(10):
                    amari = (j * pow(10, i, 13)) % 13
                    for k in range(13):
                        dp2[k] = (dp2[k] + dp[(k-amari)%13]) % MOD
            else:
                for k in range(13):
                    amari = (int(c) * pow(10, i, 13)) % 13
                    dp2[k] = (dp2[k] + dp[(k-amari) % 13]) % MOD
 
            dp = dp2
            dp2 = [0 for j in range(13)]
 
    dprint(dp)
    print(dp[5])
solve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    S = SI()
    S = S[::-1]
    N = len(S)
    dp = [0 for j in range(13)]
    dp2 = [0 for j in range(13)]

    for i, c in enumerate(S):
        if i == 0:
            if c == '?':
                for j in range(10):
                    dp[j] = 1
            else:
                dp[int(c)] = 1
        else:
            if c == '?':
                for j in range(10):
                    amari = (j * pow(10, i, 13)) % 13
                    for k in range(13):
                        dp2[k] = (dp2[k] + dp[(k-amari)%13]) % MOD
            else:
                for k in range(13):
                    amari = (int(c) * pow(10, i, 13)) % 13
                    dp2[k] = (dp2[k] + dp[(k-amari) % 13]) % MOD

            dp = dp2
            dp2 = [0 for j in range(13)]

    dprint(dp)
    print(dp[5])



solve()
### BUGGY CODE ###

# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

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

## Logic

X = 0

tmp1 = A.count(0)
tmp2 = A.count(1)

for i in range(2,100000):
    tmp = tmp1+tmp2+A.count(i)
    if tmp > X:
        X = tmp
    else:
        tmp1 = A.count(i)
print(X)

### FIXED CODE ###

# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

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

## Logic

C = Counter(A)
X = 0
for i in range(10**5):
    X = max(X,C[i]+C[i+1]+C[i+2])
print(X)
### BUGGY CODE ###

import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

lr = [[0] * (N + 1) for _ in range(N + 1)]

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline
N, M, Q = [int(_) for _ in input().split()]

lr = [[0] * (N + 1) for _ in range(N + 1)]

for _ in range(M):
    l, r = [int(_) for _ in input().split()]
    lr[l][r] += 1
for i in range(1, N + 1):
    for j in range(1, N + 1):
        lr[i][j] += lr[i][j - 1]

# for i in range(1, N + 1):
#     print(lr[i][1:])
for _ in range(Q):
    p, q = [int(_) for _ in input().split()]
    ans = 0
    for i in range(p, q + 1):
        ans += lr[i][q] - lr[i][p - 1]
    print(ans)
### BUGGY CODE ###

import bisect
Q = int(input())

A = []
now_a = 0
now_a_score = 0
min_score = 0
nn = 0
for i in range(Q):
  Q1 = list(map(int, input().split()))
  if len(Q1) == 3:#更新
    nn += 1
    a, b = Q1[1], Q1[2]
    A.append(a)
    A = sorted(A)
    now_a = A[int((nn - 1) / 2)]
    now_a_score = 0
    for j in range(nn):
      now_a_score += abs(A[j] - now_a) 
    #print(now_a, a, now_a_score)  
    min_score += b
  else:#求値
    print(now_a, min_score + now_a_score)
  
            
            

### FIXED CODE ###

import heapq
Q = int(input())

A_left, A_right = [], []
A_left_sum, A_right_sum = 0, 0
heapq.heapify(A_left)
heapq.heapify(A_right)

B_sum = 0
for _ in range(Q):
    query = list(map(int,input().split()))

    if query[0] == 1:#更新クエリ
        now = query[1]#a
        B_sum += query[2]#b

        l, r = len(A_left), len(A_right)
        #中央値がA_left[0]になるように、出し入れする。
        if l <= r:
            heapq.heappush(A_right, now)
            A_right_sum += now

            out = heapq.heappop(A_right)
            A_right_sum -= out

            heapq.heappush(A_left, -out)
            A_left_sum += out
        else:
            heapq.heappush(A_left, -now)
            A_left_sum += now

            out = -heapq.heappop(A_left)
            A_left_sum -= out

            heapq.heappush(A_right, out)
            A_right_sum += out
        #print(A_right, A_left, A_right_sum, A_left_sum)   
    else:#求値クエリ
        m = -A_left[0]
        #A_left は 全て m より小さいので、　m - xi の和は
        #m * len(A_left) - (xiの和）となる。
        #xiの和が、A_left_sumである。
        #A_right も同様だが。引く数の方が大きいため、正負が入れ替わることに注意
        ans = len(A_left) * m - A_left_sum - len(A_right) * m + A_right_sum + B_sum
        print(m, ans)
### BUGGY CODE ###

N = int(input())
Match = [0] * N
mod = 10**9 + 7
for i in range(N):
    A = list(map(int, input().split()))
    m = 0
    for j, a in enumerate(A):
        if a:
            m |= (1 << j)
    Match[i] = m

DP = [0] * (1 << N)
DP[0] = 1

for m in Match:
    D = DP[:]
    for i, d in enumerate(DP):
        for j in range(N):
            if (m >> j) & 1 == 1:
                if (i >> j) & 1 == 0:
                    D[i| (1 << j)] += d
                    D[i| (1 << j)] %= mod
    DP = D
print(DP[-1] % mod)

### FIXED CODE ###

N = int(input())
Match = [0] * N
mod = 10**9 + 7
for i in range(N):
    A = list(map(int, input().split()))
    m = 0
    for j, a in enumerate(A):
        if a:
            m |= (1 << j)
    Match[i] = m

DP = [0] * (1 << N)
DP[0] = 1

bit_count = [0]
for _ in range(N):
    bit_count += [x+1 for x in bit_count]

for i in range((1 << N) - 1):
    c = bit_count[i]
    if DP[i] == 0:
        continue
    for j in range(N):
        if (Match[c] >> j) & 1 == 1:
            if (i >> j) & 1 == 0:
                DP[i| (1 << j)] += DP[i]
                DP[i| (1 << j)] %= mod
print(DP[-1] % mod)
### BUGGY CODE ###

import os, sys, re, math, queue


def run_it():
	H,W = list(map(int,input().split(' ')))
	
	s_ary = []
	l_memo = [[0 for j in range(W)] for i in range(H)]
	r_memo = [[0 for j in range(W)] for i in range(H)]
	u_memo = [[0 for j in range(W)] for i in range(H)]
	b_memo = [[0 for j in range(W)] for i in range(H)]
	
	for _ in range(H):
		s_ary.append(input())
	
	for h in range(H):
		for w in range(W):
			if s_ary[h][w] == '.':
				if w == 0:	
					l_memo[h][w] = 1
				elif w > 0:
					l_memo[h][w] = l_memo[h][w-1] + 1
				if h == 0:
					u_memo[h][w] = 1
				elif h > 0:
					u_memo[h][w] = u_memo[h-1][w] + 1
			
			if s_ary[-h-1][-w-1] == '.':
				if w == 0:
					r_memo[-h-1][-w-1] = 1
				elif w > 0:
					r_memo[-h-1][-w-1] = r_memo[-h-1][-w] + 1	
				if h == 0:
					b_memo[-h-1][-w-1] = 1
				elif h > 0:
					b_memo[-h-1][-w-1] = b_memo[-h][-w-1] + 1
	
	ret = 0
	for h in range(H):
		for w in range(W):
			tmp = l_memo[h][w] + r_memo[h][w] + u_memo[h][w] + b_memo[h][w] - 3
			ret = max(ret, tmp)
	
	print(ret)
				
if sys.platform == 'ios':
	for i in range(2):
		sys.stdin = open('Dtest' + str(i) + '.txt')
		run_it()
else:
	run_it()

### FIXED CODE ###

import os, sys, re, math, queue


def run_it():
	H,W = list(map(int,input().split(' ')))
	
	s_ary = []
	l_memo = [[0 for j in range(W)] for i in range(H)]
	r_memo = [[0 for j in range(W)] for i in range(H)]
	u_memo = [[0 for j in range(W)] for i in range(H)]
	b_memo = [[0 for j in range(W)] for i in range(H)]
	
	for _ in range(H):
		s_ary.append(input())
	
	for h in range(H):
		for w in range(W):
			if s_ary[h][w] == '.':
				if w == 0:	
					l_memo[h][w] = 1
				elif w > 0:
					l_memo[h][w] = l_memo[h][w-1] + 1
				if h == 0:
					u_memo[h][w] = 1
				elif h > 0:
					u_memo[h][w] = u_memo[h-1][w] + 1
			
			if s_ary[-h-1][-w-1] == '.':
				if w == 0:
					r_memo[-h-1][-w-1] = 1
				elif w > 0:
					r_memo[-h-1][-w-1] = r_memo[-h-1][-w] + 1	
				if h == 0:
					b_memo[-h-1][-w-1] = 1
				elif h > 0:
					b_memo[-h-1][-w-1] = b_memo[-h][-w-1] + 1
	
	ret = 0
	for h in range(H):
		for w in range(W):
			tmp = l_memo[h][w] + r_memo[h][w] + u_memo[h][w] + b_memo[h][w] - 3
			ret = max(ret, tmp)
	
	print(ret)
				
if sys.platform == 'ios':
	for i in range(2):
		sys.stdin = open('Dtest' + str(i) + '.txt')
		run_it()
else:
	run_it()
### BUGGY CODE ###

N = input()
Q = 0
for i in range(int(N)+1):
  P = []
  for j in range(len(str(i))):
    k= str(i)
    P.append(int(k[j]))
  if(sum(P)%3 == 0 or P[-1]%5 == 0):
      Q += 0
  else:
      Q += i
print(Q)

### FIXED CODE ###

N = int(input())
Q = 0
for i in range(1,N+1):
  if(i%3 != 0 and i%5 != 0):
      Q += i
print(Q)
### BUGGY CODE ###

n=int(input())
ct=0
for i in range(n):
    ct+=i
print(ct)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

ans = int(n*(n-1)//2)

print(ans)
### BUGGY CODE ###

S = list(input())
ans = 0
for i in range(len(S)-1):
    reversed_flag = False
    for j in range(len(S)-1):
        if reversed_flag:
            reversed_flag = False
            continue
        elif S[j] == 'B' and S[j+1] == 'W':
            S[j] = 'W'
            S[j+1] = 'B'
            ans += 1
            reversed_flag = True

print(ans)


### FIXED CODE ###

S = list(input())
ans = 0
B_count = 0
for i in range(len(S)-1):
    if S[i] == 'B' and S[i+1] == 'W':
        B_count += 1
        S[i+1] = 'B'
        ans += B_count
        B_count -= 1
    elif S[i] == 'B':
        B_count += 1

print(ans)
### BUGGY CODE ###

N, M =map(int, input().split())
Ps =[]
Ys =[]
dic = {}
for i in range(M):
    p, y = map(int, input().split())
    Ps.append(p)
    Ys.append(y)
    ls = dic.get(p, [])
    ls.append(y)
    dic[p] = ls
for i in range(M):
    p = Ps[i]
    y = Ys[i]
    ls = dic[p]
    ls.sort()
    number = ls.index(y) + 1
    strp = str(p)
    strn = str(number)
    print(strp.zfill(6) + strn.zfill(6))


### FIXED CODE ###

N, M =map(int, input().split())
ls = []
pcount =[]
for i in range(N):
    pcount.append(0)
for i in range(M):
    p, y = map(int, input().split())
    ls.append([i, p, y])
ls.sort(key = lambda x:x[2])

for l in ls:
    pcount[l[1]-1] += 1
    l.append(pcount[l[1]-1])
ls.sort(key = lambda x:x[0])
for l in ls:
    print(str(l[1]).zfill(6) + str(l[3]).zfill(6))
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()

for _ in range(Q):
  l, r = map(int, input().split())
  cnt = 0
  for i in range(l - 1, r):
    if i != r - 1 and S[i] == "A" and S[i + 1] == "C":
      cnt += 1
  print(cnt)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

AC_list = []
cnt = 0
for i in range(N):
  if i != 0 and S[i - 1] == "A" and S[i] == "C":
    cnt += 1
  AC_list.append(cnt)

for _ in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r - 1] - AC_list[l - 1])
### BUGGY CODE ###

# C - Walk on Multiplication Table
n = (int)(input())

flg = False

minimum = n
for i in range(1, n):
    if n % i == 0:
        minimum = (int)(min(i + n / i - 2, minimum))

print(minimum)

### FIXED CODE ###

# C - Walk on Multiplication Table
n = (int)(input())

minimum = 1e18
i = 1
while(i*i <= n):
    if n % i != 0:
        i += 1
        continue;
    j = (int) (n / i)
    minimum = min(i + j - 2, minimum)
    i +=1

print(minimum)
### BUGGY CODE ###

def popcnt1(n):
    return bin(n).count("1")


N = int(input())
X = input()
dp = [-1 for _ in range(N)]


def solve(n):
    global res
    if dp[-1] >= 0:
        return dp[n]
    if popcnt1(n) == 0:
        dp[n] = res
        return res
    n = n % popcnt1(n)
    res += 1
    solve(n)


for i in range(N):
    res = 0
    tX = list(X)
    if X[i] == "0":
        tX[i] = "1"
    else:
        tX[i] = "0"
    tXs = "".join(tX)
    solve(int(tXs, 2))
    dp[i] = res
    print(res)

### FIXED CODE ###

# 数のbitに含まれる1の数をカウント
def bitsoncount(x):
    return bin(x).count('1')

def solve(x):
    global ans
    bx = bitsoncount(x)
    if bx == 0:
        return ans
    else:
        ans += 1
        x = x % bx
        solve(x)


N = int(input())
X = input()

Xb = bitsoncount(int(X, 2))
if (Xb - 1) != 0:
    X0 = int(X, 2) % (Xb-1)
X1 = int(X, 2) % (Xb+1)

for x, i in zip(X, reversed(range(N))):
    x = int(x)
    if x == 0:
        temp = (X1 + pow(2, i, Xb+1)) % (Xb+1)
        ans = 1
    else:
        if Xb - 1 == 0:
            print(0)
            continue
        temp = (X0 - pow(2, i, Xb-1)) % (Xb-1)
        ans = 1
    
    solve(temp)
    print(ans)
### BUGGY CODE ###

syain=int(input())
syain2=syain-1
wariate=input().split(' ')
x=[]

for j in range(syain2):
    tmp=0
    for i in wariate:
        if j==int(i)-1:
            tmp+=1
        else:
            pass
    x.append(tmp)
x.append(0)

for i in x:
    print(i)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
#print(b)
 
for i in range(n-1):
    #print(a[i])
    b[a[i]-1] += 1
    #print(b)
 
for j in range(n):
    print(b[j])
### BUGGY CODE ###

n, m = map(int, input().split())
edges = []
for _ in range(m):
    x, y = list(map(lambda x: int(x)-1, input().split()))
    edges.append((x, y))

dist = [0]*n
for _ in range(n-1):
    for v, v2 in edges:
        if dist[v2] <= dist[v]-1:
            continue
        dist[v2] = dist[v]-1

print(-min(dist))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    x, y = list(map(lambda x: int(x)-1, input().split()))
    edges[x].append(y)


def memoize(f):
    memo = dict()

    def memoized(*args):
        if args in memo.keys():
            return memo[args]
        else:
            memo[args] = f(*args)
            return memo[args]
    return memoized

@memoize
def longest_path(v):
    retval = 0
    for v2 in edges[v]:
        retval = max(retval, longest_path(v2)+1)
    return retval


ans = 0
for i in range(n):
    ans = max(ans, longest_path(i))
print(ans)
### BUGGY CODE ###

n = int(input())
print(0, flush=True)
f, m = "Female", "Male"
x = 0 if input() == f else 1
high = n-1
low = 0
while high - low > 1:
    mid = (high + low) // 2
    print(mid, flush=True)
    s = input()
    if s == "Vacant":
        quit()
    if mid == x:
        if s == f:
            low = mid
        else:
            high = mid
    else:
        if s == f:
            high = mid
        else:
            low = mid
print(high, flush=True)
s = input()
quit()

### FIXED CODE ###

import sys
n = int(input())
print(0, flush=True)
f, m = "Female", "Male"
s = input()
if s == "Vacant":
    quit()
x = 0 if s == f else 1
high = n-1
low = 0
while high - low > 1:
    mid = (high + low) // 2
    print(mid, flush=True)
    s = input()
    if s == "Vacant":
        sys.exit()
    if mid % 2 == x:
        if s == f:
            low = mid
        else:
            high = mid
    else:
        if s == f:
            high = mid
        else:
            low = mid
print(high, flush=True)
sys.exit()
### BUGGY CODE ###

N=int(input())
dp=[100000]*(N+1)
dp[0]=0
que=[(0,0)]
while len(que)!=0:
    que.sort(key=lambda x:x[0])
    c=que[0][0]
    v=que[0][1]
    que=que[1:]
    if c>dp[v]:
        continue
    pow6=1
    while v+pow6<=N:
        if dp[v]+1<dp[v+pow6]:
            dp[v+pow6]=dp[v]+1
            que.append((dp[v+pow6],v+pow6))
        pow6*=6
    pow9=1
    while v+pow9<=N:
        if dp[v]+1<dp[v+pow9]:
            dp[v+pow9]=dp[v]+1
            que.append((dp[v+pow9],v+pow9))
        pow9*=9
print(dp[N])

### FIXED CODE ###

N=int(input())
dp=[N]*(N+1)
dp[0]=0
for i in range(1,N+1):
    dp[i]=min(dp[i],dp[i-1]+1)
    pow6 = 1
    while i>=pow6:
        dp[i]=min(dp[i],dp[i-pow6]+1)
        pow6*=6
    pow9 = 1
    while i>=pow9:
        dp[i]=min(dp[i],dp[i-pow9]+1)
        pow9*=9
print(dp[N])
### BUGGY CODE ###

n=input()
A=map(int,input().split())
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)


### FIXED CODE ###

n=input()
A=list(map(int,input().split()))
c=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  c+=1
print(c)
### BUGGY CODE ###

n, m = map(int, input().split())
price = [0] * m
treasure = [0] * m
for i in range(m):
  price[i], _ = map(int, input().split())
  for c in map(int, input().split()):
    treasure[i] += 1 << c-1
dp = [10 ** 8 + 1] * (1 << n)
dp[0] = 0
for bit in range((1 << n) - 1):
  cost = dp[bit]
  for i in range(m):
    next_bit = treasure[i] | bit
    next_cost = price[i] + cost
    dp[next_bit] = min(dp[next_bit], next_cost)
if dp[-1] > 10 ** 8:
  print(-1)
else:
  print(dp[-1])

### FIXED CODE ###

n, m = map(int, input().split())
price = [0] * m
treasure = [0] * m
for i in range(m):
  price[i], _ = map(int, input().split())
  for c in map(int, input().split()):
    treasure[i] += 1 << c-1
dp = [10 ** 8 + 1] * (1 << n)
dp[0] = 0
for bit in range((1 << n) - 1):
  cost = dp[bit]
  for i in range(m):
    next_bit = treasure[i] | bit
    next_cost = price[i] + cost
    dp[next_bit] = min(dp[next_bit], next_cost)
if dp[-1] > 10 ** 8:
  print(-1)
else:
  print(dp[-1])
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
c = [list(input()) for _ in range(H)]

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

def bfs(sx, sy):
    s = [[-1] * W for _ in range(H)]
    d = [[0] * W for _ in range(H)]

    que = deque([])
    que.append((sx, sy))
    s[sy][sx] = 1

    while que:
        x, y = que.popleft()
        s[y][x] = 1

        for k in range(4):
            nx = x + dx[k]
            ny = y + dy[k]

            if 0 <= nx < W and 0 <= ny < H and s[ny][nx] == -1 and c[ny][nx] == '.':
                que.append((nx, ny))
                d[ny][nx] = d[y][x] + 1

    return max([max(v) for v in d])

ans = 0
for i in range(H):
    for j in range(W):
        if c[i][j] == '.':
            ans = max(ans, bfs(j, i))

print(ans)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
c = [list(input()) for _ in range(H)]

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

def bfs(sx, sy):
    d = [[-1] * W for _ in range(H)]

    que = deque([])
    que.append((sx, sy))
    d[sy][sx] = 0

    res = 0
    while que:
        x, y = que.popleft()

        for k in range(4):
            nx = x + dx[k]
            ny = y + dy[k]

            if 0 <= nx < W and 0 <= ny < H and d[ny][nx] == -1 and c[ny][nx] == '.':
                que.append((nx, ny))
                tmp = d[y][x] + 1
                d[ny][nx] = tmp
                res = max(res, tmp)

    return res

ans = 0
for i in range(H):
    for j in range(W):
        if c[i][j] == '.':
            tmp = bfs(j, i)
            ans = max(ans, tmp)

print(ans)