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

#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-Prison.py
#
n, m = map(int, input().split())
can_through = [True for _ in range(n)]
cnt = 0

for i in range(m):
    l, r = map(int, input().split())
    for j in range(1, n+1):
        if can_through[j-1]:
            if l <= j <= r:
                pass
            else:
                can_through[j-1] = False
    # print(can_through)

for j in range(n):
    if can_through[j]:
        cnt += 1

print(cnt)


### FIXED CODE ###

N, M = map(int, input().split())
ans = 0
L, R = 0, 100000

for i in range(M):
    Ltmp, Rtmp = map(int, input().split())
    L, R = max(L, Ltmp), min(R, Rtmp)

print(max(0, R - L + 1))
### BUGGY CODE ###

I=lambda:map(int,input().split());
n,q=I();
r=[0]*n;
e=[[]for _ in range(n)];
exec("a,b=I();e[a-1]+=b-1,;e[b-1]+=a-1,;"*(n-1));
exec("q,x=I();r[q-1]+=x;"*q);
y=[0]+[1]*n;
s=[0]
while s:
  p=s.pop();
  for c in e[p]:
    exec("y[c]=0;r[c]+=r[p];s+=c,;"*y[c])
print(*r)

### FIXED CODE ###

n,q=map(int,input().split())
edge=[[] for _ in range(n)] #木
cnt=[0]*n #出力用
for i in range(n-1): #辺の本数は頂点数-1
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge[a].append(b)
  edge[b].append(a)
for _ in range(q):
  p,x=map(int,input().split())
  p-=1
  cnt[p]+=x
done=[False]*n #到達
par=0 #0からスタート
done[par]=True
stack=[par]
while stack:
  par=stack.pop()
  for chi in edge[par]:
    if done[chi]:
      None
    else:
      done[chi]=True
      cnt[chi]+=cnt[par]
      stack.append(chi)
    
print(*cnt)
### BUGGY CODE ###

N,K=map(int,input().split())
D=[]
X=[]
Y=[]

for i in range(N):
    x,y=map(int,input().split())
    D.append([x,y])
    X.append(x)
    Y.append(y)
    
X.sort()
Y.sort()
ans=10**20
for a in range(len(X)):
    for b in range(len(X)-a):
        for c in range(len(Y)):
            for d in range(len(Y)-c):
                cnt=0
                for e in range(N):
                    if X[a]<=D[e][0]<=X[len(X)-1-b] and Y[c]<=D[e][1]<=Y[len(Y)-1-d]:
                        cnt+=1
                if cnt>=K and ans>abs(X[a]-X[len(X)-1-b])*abs(Y[c]-Y[len(Y)-1-d]):
                    ans=abs(X[a]-X[len(X)-1-b])*abs(Y[c]-Y[len(Y)-1-d])
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
D=[]
X=[]
Y=[]

for i in range(N):
    x,y=map(int,input().split())
    D.append([x,y])
    X.append(x)
    Y.append(y)
    
X.sort()
Y.sort()
D.sort()
ans=10**20
for a in range(len(X)):
    for b in range(len(X)-a):
        if len(X)-b-a<K:
            break
        for c in range(len(Y)):
            for d in range(len(Y)-c):
                cnt=0
                for e in range(a,len(X)-b):
                    if X[a]<=D[e][0]<=X[len(X)-1-b] and Y[c]<=D[e][1]<=Y[len(Y)-1-d]:
                        cnt+=1
                if cnt>=K and ans>abs(X[a]-X[len(X)-1-b])*abs(Y[c]-Y[len(Y)-1-d]):
                    ans=abs(X[a]-X[len(X)-1-b])*abs(Y[c]-Y[len(Y)-1-d])
print(ans)
### BUGGY CODE ###

from collections import Counter
H,W,M = list(map(int,input().split()))

counterH = Counter()
counterW = Counter()
targets = set()
for i in range(M):
    h,w = list(map(int,input().split()))
    counterH[h] += 1
    counterW[w] += 1
    targets.add((h,w))

max_w = 0
if M == 1:
    print(1)
else:
    ans = 2
    flg = False
    for count_H in counterH.most_common():
        for count_W in counterW.most_common():
            max_w = max(max_w,count_W[1])
            if max_w != count_W[1]:
                break
            # print(count_H,count_W)
            if (count_H[0],count_W[0]) in targets:
                ans = max(ans,count_H[1]+count_W[1]-1)
            else:
                ans = max(ans,count_H[1]+count_W[1])
                flg = True
            if flg:
                break
        if flg:
            break
    print(ans)

### FIXED CODE ###

def main():
    from collections import Counter
    H,W,M = list(map(int,input().split()))

    counterH = Counter()
    counterW = Counter()
    targets = set()
    for i in range(M):
        h,w = list(map(int,input().split()))
        counterH[h] += 1
        counterW[w] += 1
        targets.add((h,w))

    most_commonH = counterH.most_common()
    most_commonW = counterW.most_common()
    max_w = most_commonW[0][1]
    max_h = most_commonH[0][1]
    if M == 1:
        print(1)
    else:
        ans = 2
        flg = False
        for count_H in most_commonH:
            if max_h != count_H[1]:
                break
            for count_W in most_commonW:
                if max_w != count_W[1]:
                    break
                # print(count_H,count_W)
                if (count_H[0],count_W[0]) in targets:
                    ans = max(ans,count_H[1]+count_W[1]-1)
                else:
                    ans = max(ans,count_H[1]+count_W[1])
                    flg = True
                if flg:
                    break
            if flg:
                break
        print(ans)

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

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

ans = []
for _ in range(N):
    index = A.index(min(A))
    ans.append(index + 1)
    A[index] = N + 1
print(' '.join(map(str, ans)))


### FIXED CODE ###

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

A_dict = {}
for i in range(N):
    A_dict[i+1] = A[i]

sorted_dict = sorted(A_dict.items(), key=lambda x: x[1])

ans = []
for t in sorted_dict:
    ans.append(t[0])
print(' '.join(map(str, ans)))
### BUGGY CODE ###

num1, num2 = [int(i) for i in input().split()]
num3 = [int(i) for i in input().split()]

numArray = [[0]*2]*num2

for index3 in range(num2):
    numArray[index3] = [int(j) for j in input().split()]


for index1 in range(num2):
    num4 = 0
    num3.sort()
    #numArray[index1].sort()
    for index2 in range(num1):

        if num3[index2] < numArray[index1][1]:
            num3[index2] = numArray[index1][1]
            num4 += 1
        if num4 >= numArray[index1][0] :
            break
print(sum(num3))

### FIXED CODE ###

num1, num2 = [int(i) for i in input().split()]
num3 = [int(i) for i in input().split()]

numArray = [[0]*2]*num2

for index3 in range(num2):
    numArray[index3] = [int(j) for j in input().split()]

numArray.sort(key=lambda x:(-x[1]))

fg1 = True

for index1 in range(num2):
    for index2 in range(numArray[index1][0]):
        num3.append(numArray[index1][1])
        if len(num3)>=(num1*2):
            fg1= False
            break
    if fg1 == False:
        break

num3.sort(reverse=True)

sum1 = 0
for index4 in range(num1):
    sum1 +=num3[index4]

print(str(sum1))
### BUGGY CODE ###

[l,r] = [int(i) for i in input().split()]

if l > 2019:
	l -= 2019
	
if r > 2019:
	r -= 2019

mod = []	
if abs(l-r) == 1:
	print(l*r%2019)

else:
	for i in range(l,r):
		for j in range(l+1,r+1):
			rem = i*j%2019
			mod.append(rem)

	print(min(mod))	

### FIXED CODE ###

L, R = list(map(int, input().split(' ')))
#print(L, R)
 
min = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod_ij = (i * j) % 2019
        if min > mod_ij:
            min = mod_ij
            if min == 0:
                break
    if min == 0:
        break
print(min)
### BUGGY CODE ###

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, M = nl()
S = nl()
T = nl()

import numpy as np
dp = np.zeros((N+1, M+1), dtype=np.int64)

for i, s in enumerate(S):
    dp[i+1, 1:] = dp[i, 1:] - dp[i, :M]
    for j, t in enumerate(T):
        dp[i+1, j+1] += dp[i+1, j]
        if s == t:
            dp[i+1, j+1] += dp[i, j] + 1

print(int(dp[N, M]+1) % 1000000007)


### FIXED CODE ###

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, M = nl()
S = nl()
T = nl()

dp = [0] * (M+1)
for i, s in enumerate(S):
    dp2 = dp[:]
    for j, t in enumerate(T):
        dp2[j+1] += dp2[j] - dp[j]
        if s == t:
            dp2[j+1] += dp[j] + 1
    dp = dp2

print((dp[M]+1) % 1000000007)
### BUGGY CODE ###

n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
for i in range(m):
  A[-1] = A[-1]//2
  A.sort()
print(sum(a for a in A))

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
A = list(map(int, input().split()))
for i in range(n):
  A[i] = -A[i]
B = heapq.heapify(A)
i = 0
while i < m:
  h = heapq.heappop(A) 
  heapq.heappush(A, -(-h//2))
  i += 1
print(-sum(a for a in list(A)))
### BUGGY CODE ###

N,M=map(int,input().split())
gate=[input() for __ in range(M)]
s,e=map(int,gate[0].split())

ans=set([i for i in range(s,e+1)])

for g in gate:
    s,e=map(int,g.split())
    ans=set(ans)
    pre=set([i for i in range(s,e+1)])
    ans = list(ans & pre)

print(len(ans))


### FIXED CODE ###

N,M=map(int,input().split())
gate=[input() for __ in range(M)]
s,e=map(int,gate[0].split())
for n in gate:
    pre_s,pre_e=map(int,n.split())
    s=(s if s>pre_s else pre_s)
    e=(e if e<pre_e else pre_e)

print(e+1-s if e>=s else 0)
### BUGGY CODE ###

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

# 区間の和を高速に求めたいので累積和
S = [0]*N
S[0] = A[0]
for i in range(1,N):
    S[i] = S[i-1]+A[i]

Ans = 10**15
# 真ん中の分割位置を全探索
for i in range(2,N-1):
    # 前半と後半に分離
    A,B = S[:i],S[i:]
    sumA,sumB = S[i-1],S[N-1]-S[i-1]
    canA,canB = [],[]
    # 前半部分,後半部分をそれぞれできるだけ均等になるように分割
    ax = S[i-1]/2
    ai = bisect(S,ax)
    if abs(S[ai-1]-ax) < abs(S[ai]-ax):
        ai -= 1
    bx = (S[N-1]+S[i-1])/2
    bi = bisect(S,bx)
    if abs(S[bi-1]-bx) < abs(S[bi]-bx):
        bi -= 1
    x1,x2,x3,x4 = S[ai],S[i-1]-S[ai],S[bi]-S[i-1],S[N-1]-S[bi]
    # 考慮した組み合わせで最小のものを記録
    Ans = min(Ans,max(x1,x2,x3,x4)-min(x1,x2,x3,x4))

print(Ans)

### FIXED CODE ###

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

# 区間の和を高速に求めたいので累積和
S = [0]*N
S[0] = A[0]
for i in range(1,N):
    S[i] = S[i-1]+A[i]

Ans = 10**15
# 真ん中の分割位置を全探索
for i in range(2,N-1):
    # 前半部分,後半部分をそれぞれできるだけ均等になるように分割
    ax = S[i-1]/2
    ai = bisect(S,ax)
    if abs(S[ai-1]-ax) < abs(S[ai]-ax):
        ai -= 1
    bx = (S[N-1]+S[i-1])/2
    bi = bisect(S,bx)
    if abs(S[bi-1]-bx) < abs(S[bi]-bx):
        bi -= 1
    x1,x2,x3,x4 = S[ai],S[i-1]-S[ai],S[bi]-S[i-1],S[N-1]-S[bi]
    # 考慮した組み合わせで最小のものを記録
    Ans = min(Ans,max(x1,x2,x3,x4)-min(x1,x2,x3,x4))

print(Ans)
### BUGGY CODE ###

n=int(input())

def gcd(a,b,c):
    d=min(a,b,c)
    for i in range(0,d):
        if a%(d-i)==0 and b%(d-i)==0 and c%(d-i)==0:
            return d-i
            break

s=0
for i1 in range(1,n+1):
    for i2 in range(1,n+1):
        for i3 in range(1,n+1):
            s+=gcd(i1,i2,i3)

print(s)



### FIXED CODE ###

import math
n=int(input())

def gcd2(a,b,c):
    d=math.gcd(a,b)
    e=math.gcd(c,d)
    return e
    
s=0
s1=0
s2=0
s3=0

for i in range(1,n+1):
    s1+=i
    for i2 in range(i+1,n+1):
        s2+=math.gcd(i,i2)
        for i3 in range(i2+1,n+1):
            s3+=gcd2(i,i2,i3)

s=s1+6*s2+6*s3

print(s)
### BUGGY CODE ###

N = int(input())
S = str(input())
S = list(S)
R = S.count("R")
G = S.count("G")
B = S.count("B")
count = R*G*B
double = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k < N:
            s = set([S[i],S[j],S[k]])
            if len(s) == 3:
                count -= 1
print(count)

### FIXED CODE ###

N = int(input())
S = str(input())
S = list(S)
R = S.count("R")
G = S.count("G")
B = S.count("B")
count = R*G*B
double = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k < N:
            s = set([S[i],S[j],S[k]])
            if len(s) == 3:
                count -= 1
print(count)
### BUGGY CODE ###

Q = int(raw_input())
L, R = [], []
for i in range(Q):
	l_r = [int(num) for num in raw_input().split()]
	L.append(l_r[0])
	R.append(l_r[1])

max_num = max(R)
def decide_sosu(max_num):
	sosus_nokori = range(2, max_num + 1)
	sosus = []
	while len(sosus_nokori) > 0:
		min_i = min(sosus_nokori)
		sosus.append(min_i)
		for num in range(min_i, max_num+1, min_i):
			if num in sosus_nokori:
				sosus_nokori.remove(num)
	return sosus

sosus = decide_sosu(max_num+1)

c_s = [0] * (max_num + 1)
for i in range(2, max_num + 1):
	if (i in sosus) & (((i+1) % 2)==0) & ((i+1)/2 in sosus): 
		c_s[i] = c_s[i-1] + 1
	else:
		c_s[i] = c_s[i-1]

for i in range(Q):
	print c_s[R[i]] - c_s[L[i]-1]

### FIXED CODE ###

import math
Q = int(raw_input())
L, R = [], []
for i in range(Q):
	l_r = [int(num) for num in raw_input().split()]
	L.append(l_r[0])
	R.append(l_r[1])

max_num = max(R)
def calc_sosus(max_num):
	IsPrimes = [True] * (max_num + 1)
	IsPrimes[0] = False
	IsPrimes[1] = False
	for min_i in range(2, int(math.sqrt(max_num)) + 1):
		if IsPrimes[min_i]:
			for num in range(min_i*min_i, max_num+1, min_i):
				IsPrimes[num] = False
	return IsPrimes

IsPrimes = calc_sosus(max_num)

c_s = [0] * (max_num + 1)
for i in range(2, max_num + 1):
	if (IsPrimes[i]) & (((i+1) % 2)==0) & (IsPrimes[(i+1)/2]): 
		c_s[i] = c_s[i-1] + 1
	else:
		c_s[i] = c_s[i-1]

for i in range(Q):
	print c_s[R[i]] - c_s[L[i]-1]
### BUGGY CODE ###

N = float(input())

q = N
r_s = []
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  
  r_s.append(r)
r_s.append(1)
r_s = r_s[::-1]

for i in range(len(r_s)):
  print(r_s[i], end="")

### FIXED CODE ###

N = float(input())

if N==0:
  print(0)
else:
  q = N
  r_s = []

  while q!=1:
    hoge = (q-1) / (-2)
    if hoge.is_integer():
      r = int(1)
      q = float(hoge)
    else:
      r = int(0)
      q = float(q/(-2))
  
    r_s.append(r)
  r_s.append(1)
  r_s = r_s[::-1]

  for i in range(len(r_s)):
    print(r_s[i], end="")
### BUGGY CODE ###

import math

x = int(input())
for a in range(1000000000):
    b = (x - (a**5))**0.2
    if isinstance(b, float) and b.is_integer():
        print(a, int(b) * -1)
        break

### FIXED CODE ###

x = int(input())
a = 0
while True:
    n = (a**5)-x
    s2 = -1 if n < 0 else 1
    if s2 == -1:
        n = n * -1
    b = n**0.2
    if a**5-(int(b)*s2)**5==x:
        end = 1
        print(a, int(b) * s2)
        break
    a = a+1
### BUGGY CODE ###

import numpy as np
a,b= map(int,input().split())
List=[j for j in range(a,b+1)]
np.asarray(List)
if np.prod(List)>0:
    print("Positive")
elif np.prod(List)<0:
    print("Negative")
else:
    print("Zero")

### FIXED CODE ###

a,b= map(int,input().split())
if a*b<0:
    print("Zero")
elif a>0 or (b-a+1)%2==0 :
    print("Positive")
else:
    print("Negative")
### BUGGY CODE ###

import math

def gcd(a,b,c):
    if a == b==c:
        return a
    elif a ==b and b!=c :
        return math.gcd(a,c)
    elif a ==c and b!=c:
        return math.gcd(a,b)
    elif b ==c and a!=c:
        return math.gcd(a,b)
    else:
        d = math.gcd(a,b)
        return math.gcd(d,c)
        
cnt=0
K = int(input())
for i in range(1,K+1):
    for m in range(1,K+1):
        for u in range(1,K+1):
            cnt +=gcd(i,m,u)
print(cnt)

### FIXED CODE ###

import math
K = int(input())

def gcd(a,b):
    return math.gcd(a,b)
cnt=0
for i in range(1,K+1):
    for m in range(1,K+1):
        d = math.gcd(i,m)
        for u in range(1,K+1):
            cnt+=math.gcd(d,u)
            
print(cnt)
### BUGGY CODE ###

import sys
import numpy as np

# sum of deliciousness が border以上の組み合わせが K個以上あればTrue
def is_ok(a, b, c, X, Y, Z, K, border, found=False):
    cnt = 0
    res = []
    for i in range(X):
        for j in range(Y):
            for k in range(Z):
                sum_deli = a[i] + b[j] + c[k]
                if sum_deli < border:
                    break
                cnt += 1
                res.append(sum_deli)
                if cnt >= K:
                    if not found:
                        return True
                    else:
                        return res
    return False

def main():
    x, y, z, K = map(int, sys.stdin.readline().split())
    abc = np.array(sys.stdin.read().split(), dtype=np.int64)
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:x + y+ z]
    a = np.sort(a)[::-1]
    b = np.sort(b)[::-1]
    c = np.sort(c)[::-1]

    l, r = 3, 3 * 10 ** 10
    while l <= r:
        border = (l + r) // 2
        if is_ok(a, b, c, x, y, z, K, border):
            l = border + 1
        else:
            r = border - 1

    res = is_ok(a, b, c, x, y, z, K, r, found=True)
    res = sorted(res, reverse=True)[:K]
    print('\n'.join(map(str, res)))


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import numpy as np
from heapq import heappush, heappop


def main():
    x, y, z, K = map(int, sys.stdin.readline().split())
    abc = np.array(sys.stdin.read().split(), dtype=np.int64)
    a = abc[:x]
    b = abc[x:x + y]
    c = abc[x + y:x + y+ z]
    a = np.sort(a)[::-1]
    b = np.sort(b)[::-1]
    c = np.sort(c)[::-1]

    hq = []
    heappush(hq, (-(a[0]+b[0]+c[0]), 0, 0, 0))
    res = []
    added_before = set()
    # setで確認をO(1)でする
    added_before.add((0, 0, 0))

    for _ in range(K):
        sum_deli, i, j, k = heappop(hq)
        res.append(-sum_deli)
        if i < x - 1 and not (i+1, j, k) in added_before:
            heappush(hq, (-(a[i+1]+b[j]+c[k]), i+1, j, k))
            added_before.add((i+1, j, k))
        if j < y - 1 and not (i, j+1, k) in added_before:
            heappush(hq, (-(a[i]+b[j+1]+c[k]), i, j+1, k))
            added_before.add((i, j+1, k))
        if k < z - 1 and not (i, j, k+1) in added_before:
            heappush(hq, (-(a[i]+b[j]+c[k+1]), i, j, k+1))
            added_before.add((i, j, k+1))

    for s_deli in res:
        print(s_deli)

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

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [list(input()) for _ in range(H)]

move = ((1, 0), (-1, 0), (0, 1), (0, -1))
que = deque([(Ch-1, Cw-1, 0)])

visited = [[-1] * W for _ in range(H)]
while que:
    ci, cj, d = que.popleft()
    if visited[ci][cj] == -1:
        visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            visited[ni][nj] = d
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))


# print(visited)
if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [list(input()) for _ in range(H)]

visited = [[-1] * W for _ in range(H)]

que = deque([(Ch-1, Cw-1, 0)])
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
while que:
    ci, cj, d = que.popleft()

    if visited[ci][cj] != -1:
        continue
    visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))
    # print(visited)
    # exit()

if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])
### BUGGY CODE ###

import sys
input=sys.stdin.readline
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G
from collections import deque
def dfs(G,v,p,n):
    q=deque()
    q.append((v,p,1,0))
    log=[0]*n
    log[v-1]=1
    ans=0
    while q:
        V,P,cnt,S=q.pop()
        if S==0:
            #下に遷移していくときの処理
            q.append((V,P,cnt,1))
            for new_v in G[V-1]:
                if new_v==P:continue
                if log[new_v-1]:continue
                log[V-1]=1
                q.append((new_v,V,cnt+1,0))
                if cnt==n-1:ans+=1
        else:
            log[P-1]=0
    return ans

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
G=Graph(ab)
#print(G)
ans=dfs(G,1,-1,n)
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
#グラフの連結成分を調べる
def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G
from collections import deque
def dfs(G,v,p,n):
    q=deque()
    q.append((v,p,1,0))
    log=[0]*n
    log[v-1]=1
    ans=0
    while q:
        V,P,cnt,S=q.pop()
        if S==0:
            #下に遷移していくときの処理
            q.append((V,P,cnt,1))
            for new_v in G[V-1]:
                if new_v==P:continue
                if log[new_v-1]:continue
                log[V-1]=1
                #print(V, new_v, cnt, q, log)
                if cnt==n-1:
                    ans+=1
                    continue
                q.append((new_v,V,cnt+1,0))

        else:
            log[V-1]=0
    return ans

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
G=Graph(ab)
#print(G)
ans=dfs(G,1,-1,n)
print(ans)
### BUGGY CODE ###

N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    if min(P[:i+1]) == P[i]:
        count += 1
print(count)



### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))
count = 0
minimum = 2 * 10**5
for i in range(N):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]
print(count)
### BUGGY CODE ###

N = int(input())
for i in range(1, N+1):
    ans = 0
    for x in range(1, 41):
        for y in range(1, 41):
            for z in range(1, 41):
                if (x+y+z)**2-x*y-y*z-z*x == i:
                    ans += 1
    print(ans)

### FIXED CODE ###

N = int(input())

def count(a, b, c):
    return (a+b+c)**2-a*b-b*c-c*a

table = [0] * (N+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = count(x, y, z)
            if tmp <= N:
                table[tmp] += 1
print(*table[1:], sep="\n")