Harryxun/stf_run huggingface dataset:
import sys
from collections import defaultdict, Counter
def input(): return sys.stdin.readline().rstrip()

def main():
    H, W, K = map(int, input().split())
    choco = [input() for _ in range(H)]

    ans = 10 ** 9
    for i in range(2 ** (H-1)):
        opt = 0
        memoCounter = Counter({})
        for j in range(W):
            c = 0
            memo = defaultdict(int)
            for k in range(H):
                if i & 1 << k:
                    c += 1
                memo[c] += int(choco[k][j])
            if max(memo) > K:
                    break
            memoCounter += memo
            if memoCounter.most_common()[0][1] > K:
                opt += 1
                memoCounter = Counter(memo)
        else:
            opt += format(i, 'b').count('1')
            if ans > opt:
                ans = opt
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

def main():
    H, W, K = map(int, input().split())
    S = [input() for _ in range(H)]

    ans = 10 ** 9

    for bit in range(1 << (H-1)):
        canSolve = True
        ord = defaultdict(int)
        N = 0
        for i in range(H):
            if bit & 1 << i:
                ord[i+1] = ord[i] + 1
                N += 1
            else:
                ord[i+1] = ord[i]
        add = 0
        nums = defaultdict(int)
        for w in range(W):
            one = defaultdict(int)
            ok = True
            for h in range(H):
                one[ord[h]] += int(S[h][w])
                nums[ord[h]] += int(S[h][w])
                if one[ord[h]] > K:
                    canSolve = False
                if nums[ord[h]] > K:
                    ok = False
            if not ok:
                add += 1
                nums = one
        if canSolve and ans > N + add:
            ans = N + add
    print(ans)

if __name__ == '__main__':
    main()
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
ans=l[0]*l[1]*l[2]
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if n<=k:
            continue
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans-=1
print(ans)

### FIXED CODE ###

import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
if len(l) == 3:
    ans=l[0]*l[1]*l[2]
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if n <= k:
                break
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans-=1
    print(ans)
else:
    print(0)
s = input()
cout = 0
for a in s:
  if a == "1"
  	cout += 1
print(cout)
  

### FIXED CODE ###

a = input()
cou = 0
if a[0]=="1":
	cou += 1
if a[1]=="1":
	cou += 1
if a[2]=="1":
	cou += 1
print(cou)
H, N = map(int, input().split())
A= [0] * N
for i in range(N):
    A[i]= map(int, input().split())

if (sum(A[i]>N);
    print("Yes")
else;
    print("No")

### FIXED CODE ###

H,N = map(int,input().split())
A = list(map(int, input().split()))
if sum(A)>=H:
    print("Yes")
else:
    print("No")
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
num = int(sum(a)/(4*m))
if a[m-1] < num:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a, b, c = map(int, input().split())
print(c, a, b)
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
count = 0
while True:
    if np.sum(A%2) > 0:
        break
    count +=1
    A = A//2
print(count)


### FIXED CODE ###

A, B, C = input()
print(int(A)+int(B)+int(C))
s=input()
counter=0
for i in range(n):
  if s[i]=='p':
    counter+=1
print(len(s)//2-counter)

### FIXED CODE ###

s=input()
counter=0
for i in range(len(s)):
  if s[i]=='p':
    counter+=1
print(len(s)//2-counter)
s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(s[i]*100+s[i+1]*10+s[i+2]-753))
print(min(a))

### FIXED CODE ###

s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter
import itertools

mask = (1 << 10) - 1

symmetry = dict()
decode = dict()
counter = defaultdict(int)

def encode(a,b,c,d):
    t = 1 << 40
    for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]:
        u = x + (y << 10) + (z << 20) + (w << 30)
        if t > u:
            t = u
    return t

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    t = encode(a,b,c,d)
    tiles.append(t)
    counter[t] += 1
    if a == b == c == d:
        symmetry[t] = 4
    elif a == c and b == d:
        symmetry[t] = 2
    else:
        symmetry[t] = 1
    decode[t] = (a,b,c,d)

P = [(1,n,n*(n-1),n*(n-1)*(n-2),n*(n-1)*(n-2)*(n-3)) for n in range(N+1)]
P += [(0,0,0,0,0)] * (N+1) # 負数代入対策

power = [[n ** e for e in range(5)] for n in range(5)]

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode[bottom]
    e,f,g,h = decode[top]
    for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]:
        # a,b,c,d
        # x,w,z,y 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            x *= P[counter[tile]][cnt] # 残っている個数、必要枚数
            x *= power[symmetry[tile]][cnt]
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter
import itertools

mask = (1 << 10) - 1

def encode(a,b,c,d):
    t = 1 << 40
    for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]:
        u = x + (y << 10) + (z << 20) + (w << 30)
        if t > u:
            t = u
    return t

def decode(x):
    for _ in range(4):
        yield x & mask
        x >>= 10

def P(n,k):
    x = 1
    for i in range(k):
        x *= (n-i)
    return x

def symmetry(tile):
    a,b,c,d = decode(tile)
    if a == b == c == d:
        return 4
    if a == c and b == d:
        return 2
    return 1

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    tiles.append(encode(a,b,c,d))
counter = Counter(tiles)

counter

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode(bottom)
    e,f,g,h = decode(top)
    for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]:
        # a,b,c,d
        # x,w,z,y 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            x *= P(counter[tile],cnt) # 残っている個数、必要枚数
            x *= pow(symmetry(tile), cnt)
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)
S = input()

ns = []
for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
print(max(ns))

### FIXED CODE ###

S = input()

ns = [0]
n = 0

for s in S:
    if s in 'ACGT':
        n += 1
    else:
        ns.append(n)
        n = 0
ns.append(n)

print(max(ns))
N = int(input())
A_ = list(map(int, input().split()))
A = list()
for i in range(len(A_)):
    if A_[i] < N - 1:
        A.append([i + 1, A_[i]])
ret = 0
for i in range(len(A)-1, -1, -1):
    ind, val = A[i][0], A[i][1]
    B = [a for a in A if a[1] < N - 1 - val]
    for b in B:
        if abs(b[0] - ind) == val + b[1]:
            ret += 1
return ret

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
L1 = list()
D2 = dict()
ret = 0
for i in range(len(A)):
    num1 = i + 1 - A[i]
    num2 = i + 1 + A[i]
    L1.append(num1)
    if num2 not in D2:
        D2[num2] = 1
    else:
        D2[num2] += 1
ret = 0
retlist = dict()
for l in L1:
    if l in D2.keys():
        ret += D2[l]
print(ret)
n,q = map(int,input().split())
s = input()
l = [list(map(int,input().split())) for i in range(q)]
s_len = len(s)
account = s.count('AC')
count = 0
for i in range(q):
    center = len(s[l[i][0]-1:s[l[i][1]]])
    if center <= s_len:
        print(s[l[i][0]-1:s[l[i][1]]].count('AC'))
    else:
        '''
        left = s[0:]
        if s[l[i][0]-1:l[i][0]+1] == 'AC':
            count += 1
        if s[l[i][1]-1:l[i][1]+!] =='AC':
            count += 1
        print(account-)
        '''
        pass


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
            if j!= i and a[j]==0:
                a[j]=30000
                path[i][j]=-3000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


def mainasu_sycle(dist):   #負のサイクルがあるか確認する    第一引数: 重みを含む配列  実装を確認していない
    
    for i in range (0,len(dist)):
       if dist[i][i] != 0:
        print ("Negative cycle at : ", i+1)




#最短経路をたどる
def ConstructPath(p, i, j):
    i,j = int(i), int(j)
    print("i,j:",i,j)
    if(i==j):
      print (i,)
    elif(p[i][j] == -30000):
      print (i,'-',j)
    else:
      ConstructPath(p, i, p[i][j]);
      print(j,)




#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path






if __name__ == "__main__":
    H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

    cost_graph,graph=make_list(10,10)
    wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

    un_label=[]
    for i in wall:
       for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
    cost=0
 
    all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

    for i in un_label:
        cost+=all_cost[i][1]

    print(cost)

### FIXED CODE ###

import math

#グラフの作成   
def make_list(V,E):
 
    edges = []
    path=[[0]*E for i in range(V) ]   #ルート作成に必要になる
    
    for i in range(V):
        a=[int(x) for x in str(input()).split()]
        for j in range(len(a)):
            #print("j",j)
            path[i][j]=i
           # if j!= i and a[j]==0:
                #a[j]=2000
                #path[i][j]=-2000
	
        edges.append((a))    #  有効辺グラフ
	

   
     
    return edges ,path


#フロイド・ワーシャル
def warshall_floyd(glath,path):
	
	for k in range(len(glath)):
		for i in range(len(glath)):
			for j in range(len(glath[i])):
				if glath[i][j] > glath[i][k] + glath[k][j]:
                                   glath[i][j] = glath[i][k] + glath[k][j]
                                   path[i][j] = path[k][j]
				#glath[i][j]= min(int(glath[i][j]),int(glath[i][k])+int(glath[k][j]))
				
	return glath,path





H, W = [int(x) for x in str(input()).split()]  #グラフの大きさ 

cost_graph,graph=make_list(10,10)
wall ,wall_graph= make_list(H,W)
    #print(cost_graph)

un_label=[]
for i in wall:
   for j in i: 
            if j !=-1 and j!=1:
                 un_label.append(j)
cost=0
 
all_cost,all_graph=warshall_floyd(cost_graph,graph)
    
   

for i in un_label:
        cost+=all_cost[i][1]

print(cost)
def main():
    import sys
    input=sys.stdin.readline
    sys.setrecursionlimit(10**9)

    A,B,M = list(map(int,input().split()))
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    x = [list(map(int,input().split())) for _ in range(M)]

    ans = min(a)+min(b)
    for i1,i2,discount in x:
        sum = a[i1-1]+a[i2-1]-discount
        ans = min(ans,sum)

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    A,B,M = list(map(int,input().split()))
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    x = [list(map(int,input().split())) for _ in range(M)]

    ans = min(a)+min(b)
    for i1,i2,discount in x:
        sum = a[i1-1]+b[i2-1]-discount
        ans = min(ans,sum)

    print(ans)

if __name__ == '__main__':
    main()
import sys
from itertools import accumulate

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

current_arr = A
if K > 41:
    print(" ".join([N]*N))
else:
    for _ in range(K):
        imos = [0] * N
        ruiseki = [0] * (N+1)
        for i, ai in enumerate(current_arr):
            imos[max([0, i-ai])] += 1
            if i+ai+1 < N:
                imos[i+ai+1] -= 1
        for j, im in enumerate(imos):
            ruiseki[j+1] = ruiseki[j] + im
        current_arr = ruiseki[1:]
#print(imos)
#print(ruiseki)
#print(*accumulate(imos))
    print(*current_arr)


### FIXED CODE ###

import sys
from itertools import accumulate

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

current_arr = A
if K > 41:
    print(*([N]*N))
else:
    for _ in range(K):
        imos = [0] * N
        ruiseki = [0] * (N+1)
        for i, ai in enumerate(current_arr):
            imos[max([0, i-ai])] += 1
            if i+ai+1 < N:
                imos[i+ai+1] -= 1
        for j, im in enumerate(imos):
            ruiseki[j+1] = ruiseki[j] + im
        current_arr = ruiseki[1:]
#print(imos)
#print(ruiseki)
#print(*accumulate(imos))
    print(*current_arr)
D = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = sorted(A)
A.insert(0,-1)
dp = [["" for _ in range(M+1)] for _ in range(N+1)]
for i in range(1,N+1):
    a = A[1]
    k = i//D[a]
    b = i%D[a]
    if b==0:
        x = str(a)*k
        dp[i][1] = str(int(x))
for i in range(1,N+1):
    for j in range(2,M+1):
        a = A[j]
        dp[i][j] = dp[i][j-1]
        lmax = len(dp[i][j-1])
        cnt=1
        if i-cnt*D[a]>=0 and dp[i-cnt*D[a]][j-1]!="":
            b = int(str(a)*cnt+dp[i-cnt*D[a]][j-1])
        else:
            b = 0
        kmax = 0
        for t in range(M+1):
            kmax = max(kmax,len(dp[i-cnt*D[a]][t]))
        while cnt+kmax>=lmax:
            if dp[i][j]=="":
                dpnum = 0
            else:
                dpnum = int(dp[i][j])
            dpnum = max(dpnum,b)
            if dpnum==0:
                dp[i][j]=""
            else:
                dp[i][j] = str(dpnum)
            cnt += 1
            if i>=cnt*D[a]:
                if dp[i-cnt*D[a]][j-1]!="":
                    b = int(str(a)*cnt+dp[i-cnt*D[a]][j-1])
                else:
                    b=0
                kmax = 0
                for t in range(M+1):
                    kmax = max(kmax,len(dp[i-cnt*D[a]][t]))
            else:break
        if i%D[a]==0:
            b = int(str(a)*(i//D[a]))
            dpnum = max(dpnum,b)
            dp[i][j] = str(dpnum)
print(dp[N][M])

### FIXED CODE ###

def check(i):
    global kmax,nmax
    cnt = 0
    for j in range(i):
        cnt += K[j]*B[j]
    if sum(B[:i])+(N-cnt)//K[i]<kmax:
        return
    for k in range((N-cnt)//K[i],-1,-1):
        if cnt+K[i]*k==N:
             if kmax<=sum(B[:i])+k:
                    kmax = sum(B[:i])+k
                    B[i] = k
                    num = ""
                    for j in range(len(K)):
                        num += str(D[j])*B[K.index(C[D[j]])]
                    num = int(num)
                    nmax = max(nmax,num)
        else:
            if i<len(K)-1:
                B[i] = k
                check(i+1)
            else:
                B[i] = 0
                return
C = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
N,M = map(int,input().split())
A = list(map(int,input().split()))
G = {}
for i in range(M):
    a = A[i]
    k = C[a]
    if k not in G:
        G[k] = 0
    if a>G[k]:
        G[k] = a
K = sorted(list(G.keys()))
D = sorted(list(G.values()),reverse=True)
B = [0 for _ in range(len(K))]
kmax = 0
nmax = 0
check(0)
print(nmax)
N = int(input())

height = input()
height = height.split()
height = [int(s) for s in height]

count = 0

for i in range(N):
  for j in range(i+1, N):
    if j-i == height[i] + height[j]:
      count += 1

print(count)

### FIXED CODE ###

a = input()

if a == 'ABC':
  print('ARC')
else:
  print('ABC')
def main()
    S = input()
    if(S == "ABC"):
        print("ABC")
    else:
        print("ARC")
main()

### FIXED CODE ###

def main():
    S = input()
    if(S == "ABC"):
        print("ARC")
    else:
        print("ABC")
main()
N=int(input())
Na=N%1000
if Na=0:
  print(Na)
else:
  print(1000-Na)
  

### FIXED CODE ###

N=int(input())
Na=N%1000
if Na==0:
  print(Na)
else:
  print(1000-Na)
N,M = map(int,input().split())
if M != 0:
    chk = int(input())
else :
    chk = 0
ans1 = 1
count = 0
if chk == 1:
    ans2 = 0
    chk = int(input())
    count += 1
else:
    ans2 = 1
for i in range(N-1):
    if chk == i+2:
        ans1 = ans2
        ans2 = 0
        count += 1
        if count != M:
            chk = int(input())
    else:
        tempo = ans2
        ans2 = ans1 + ans2
        ans1 = tempo
print(ans2%1000000007)


### FIXED CODE ###

N,M = map(int,input().split())
if M != 0:
    chk = int(input())
else :
    chk = 0
ans1 = 1
count = 0
if chk == 1:
    ans2 = 0
    if M != 1:
        chk = int(input())
    count += 1
else:
    ans2 = 1
for i in range(N-1):
    if chk == i+2:
        ans1 = ans2
        ans2 = 0
        count += 1
        if count != M:
            chk = int(input())
    else:
        tempo = ans2
        ans2 = ans1 + ans2
        ans1 = tempo
print(ans2%1000000007)
def equal(n, available):
  return n in available 

def less(n, available):
  return n < sorted(available)[0]

def greater(n, available):
  return n > sorted(available, reverse=True)[0]
  

#less(n, available) == True であること
def upper_next(n, available):  
  for v in sorted(available):
    if n < v:
      return v
  return 1/0

  
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])

d_s = [int(v) for v in input().split()]

available = set(list(range(10))) - set(d_s)

#print("n", n_s, "d", d_s, "u", available)

min_available = sorted(available)[0]

ans = [0]
ans.extend([min_available] * (len(n_s) - 1))

eq = True
for i in range(1, len(n_s)):
  if eq:
    if equal(n_s[i], available):
      ans[i] = n_s[i]
      continue
    else:
      eq = False
      if less(n_s[i], available):
        ans[i] = upper_next(n_s[i], available)
        #残りは最小値詰め
        break
      else:
        for j in range(i - 1, -1, -1):
          if greater(ans[j], available):
            ans[j] = min_available
          else:
            ans[j] = upper_next(ans[j], available)
            break
        break

begin = 0
if ans[0] == 0:
  begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))

print(ans_val)

### FIXED CODE ###

def equal(n, available):
  return n in available 

def less(n, available):
  return n < sorted(available, reverse=True)[0]

def greater(n, available):
  return n > sorted(available, reverse=True)[0]
  

#less(n, available) == True であること
def upper_next(n, available):  
  for v in sorted(available):
    if n < v:
      return v
  return 1/0

  
n_str, _ = [v for v in input().split()]
n_s = [0]
n_s.extend([int(n_str[i:i+1]) for i in range(len(n_str))])
#print(n_s)
d_s = [int(v) for v in input().split()]

available = set(list(range(10))) - set(d_s)

#print("n", n_s, "d", d_s, "u", available)

min_available = sorted(available)[0]
max_available = sorted(available, reverse=True)[0]
#print(min_available, max_available)
ans = [0]
ans.extend([min_available] * (len(n_s) - 1))

eq = True
for i in range(1, len(n_s)):
  #print(ans)
  if eq:
    if equal(n_s[i], available):
      ans[i] = n_s[i]
      continue
    else:
      eq = False
      #print(n_s[i], available)
      if less(n_s[i], available):
        ans[i] = upper_next(n_s[i], available)
        #残りは最小値詰め
        break
      else:
        for j in range(i - 1, -1, -1):
          #print(ans)
          if ans[j] == max_available:
            ans[j] = min_available
          else:
            #print(ans)
            ans[j] = upper_next(ans[j], available)
            #print(ans)
            break
        break

#print(ans)
begin = 0
if ans[0] == 0:
  begin = 1
ans_val = "".join(map(lambda x:str(x), ans[begin:]))

print(ans_val)
import copy
def dfs(cur_node, pre_node, Node_num, map, l):
    #全てのノードを見たとき

    if Node_num == N or cur_node <= 0 or cur_node >= N:
        return
    elif l[pre_node][cur_node]==0: #飛んだ先が、Trueの時
        return
    elif map[cur_node]==True:
        return

    map[cur_node]=True
    print(cur_node)
    print(pre_node)
    for i in range(N):
        if i != cur_node:
            dfs(i, cur_node, Node_num+1, map, l)


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

N = S[0]
M = S[1]


map = [False]*N
map[0] = True

lst = []

for i in range(N):
    lst.append([0]*N)

for i in range(N):
    S = input()
    S = list(S.split())
    idx1 = int(S[0])
    idx2 = int(S[1])
    lst[idx1-1][idx2-1] = 1


graph_count = 0
#全探索
for i in range(1, N, 1):
    map_copy = copy.copy(map)
    lst_copy = copy.copy(lst)

    dfs(i, 0, 0, map_copy, lst_copy)
    count = 0

    for i in map_copy:
        if i == True:
            count = count + 1
    if count == N:
        graph_count = graph_count + 1

print(graph_count)


### FIXED CODE ###

import itertools
N,M=map(int,input().split())
edges={tuple(sorted(map(int,input().split()))) for i in range(M)}
ans=0
for i in itertools.permutations(range(2,N+1),N-1):
    l=[1]+list(i)
    ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)
import sys
sys.setrecursionlimit(10 ** 5)

input = sys.stdin.readline()

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

ans = list(range(N))
def root(a):
    if a==ans[a]:
        return a
    else:
        return root(ans[a])

for _ in range(M):
    x, y, _ = map(lambda a: int(a)-1, input().split())
    if root(x) != root(y):
        rx = root(x)
        ry = root(y)
        while y != ry:
            ans[y], y = rx, ans[y]
        ans[ry] = rx

A = {}
for a in ans:
    A[a] = 1

print(len(A))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)

class UniteFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]

    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        self.par[ry] = rx

    def same(self, x, y):
        if (self.root(x) == self.root(y)):
            return True
        return False


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

for _ in range(M):
    x, y, _ = map(int, input().split())
    rf.unite(x-1, y-1)

m = {i: -1 for i in range(N)}
ans = 0

for i in range(N):
    if m[rf.root(i)] == -1:
        m[rf.root(i)] = 1
        ans += 1

print(ans)
a,b,c,d=map(int,input().split(''))
print('Yes' if a==c==b or b==c==d else 'No')

### FIXED CODE ###

a,b,c,d=map(int,input())
print('Yes' if a==c==b or b==c==d else 'No')