Harryxun/stf_run huggingface dataset:
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort(key = lambda x:x[0])
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        tmp = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if not tmp in d:
            d[tmp] = 0
        d[tmp] += 1
        #print(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    #print()
d = sorted(d.items(), key = lambda x:-x[1])
print(N - d[0][1])


### FIXED CODE ###

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
if N == 1:
    print(1)
    exit()
xy.sort(key = lambda x:x[0])
d = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        tmp = (xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
        if not tmp in d:
            d[tmp] = 0
        d[tmp] += 1
        #print(xy[i][0] - xy[j][0], xy[i][1] - xy[j][1])
    #print()
d = sorted(d.items(), key = lambda x:-x[1])
print(N - d[0][1])
c1 = input()
c2 = input()

print("YES" if c1=c2[::-1] "NO")

### FIXED CODE ###

c1 = input()
c2 = input()

print("YES" if c1==c2[::-1] else "NO")
X = input()
print("Yes" if X>=30 else "No")

### FIXED CODE ###

X = int(input())
print("Yes" if X>=30 else "No")
# AGC C Ants on a Circle
f=lambda:map(int,input().split())
N,L,T=f()
X,W=[],[]
for _ in [0]*N:
    x,w=f()
    X.append(x)
    W.append(w)
    
if W[0]==2:
    X[0]+=L
    
col=0
for j in range(N):
    if W[j]==W[0]:
        continue
    else:
        if W[0]>0:
            if 2*T-(X[j]-X[0])>=0:
                col+=1+(2*T-(X[j]-X[0]))//L
            else:
                col+=0
        else:
            col-=max((2*T-X[j]+X[0])//L,0)
col=col%N
X2=[(X[i]+(3-2*W[i])*(T-0.01)) % L for i in range(N)]

ant0=(X2[0],col)

X2.sort()

x=X2.index(ant0[0])


for i in range(x-col-N,x-col):
    print(round(X2[i]))

### FIXED CODE ###

# AGC C Ants on a Circle
f=lambda:map(int,input().split())
N,L,T=f()
X,W=[],[]
for _ in [0]*N:
    x,w=f()
    X.append(x)
    W.append(w)
    
if W[0]==2:
    X[0]+=L
    
col=0
for j in range(N):
    if W[j]==W[0]:
        continue
    else:
        if W[0]==1:
            if 2*T-(X[j]-X[0])>=0:
                col+=(1+(2*T-(X[j]-X[0]))//L)
        else:
            if 2*T-(X[0]-X[j])>=0:
                col-=(1+(2*T-(X[0]-X[j]))//L)

col=col%N
X2=[(X[i]+(3-2*W[i])*T) % L for i in range(N)]
X2_0=X2[0]

X2.sort()

index=[i for i,x in enumerate(X2) if x==X2_0]

if len(index)==1:
    index=index[0]
else:
    if W[0]==1:
        index=index[1]
    else:
        index=index[0]

i=(index-col)%N

X2=X2[i:]+X2[:i]
print(*X2,sep='\n')
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections
N,Q = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
S = sys.stdin.readline().rstrip()
se = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(Q)) # multi line with multi param

INF = float("inf")
com = [0]*(N+1)

for i in range(N):
    com[i+1] = com[i]
    if S[i] == "A" and S[i+1] == "C":
        com[i+1] += 1

for s,e in se:
    print(com[e-1] - com[s-1])


### FIXED CODE ###

#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections
N,Q = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
S = sys.stdin.readline().rstrip()
se = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(Q)) # multi line with multi param

INF = float("inf")
com = [0]*(N+1)

for i in range(N):
    com[i+1] = com[i]
    if S[i] == "A" and S[min(i+1,N-1)] == "C":
        com[i+1] += 1

for s,e in se:
    print(com[e-1] - com[s-1])
x = int(input());
a = int(input());

if x>a:
  print(0);
else:
  print(10);



### FIXED CODE ###

x, a = map(int, input().split())
 
if x < a:
    print(0)
else:
    print(10)
n,k=map(int,input().split())
a=list(map(int,input().split()))
d=[]
s=[-1]*(n+1)
t=1
for i in range(1,k):
    d.append(t)
    s[t]=1
    if(s[a[t-1]]==1):
        break
    t=a[t-1] 
idx=d.index(a[t-1])
d=d[idx:]
print(d[(k-i)%len(d)])


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))

s=[]
d=[-1]*(n+1)

v=1
while(d[v]==-1):
    d[v]=len(s)
    s.append(v)
    v=a[v-1]
c=len(s)-d[v]
l=d[v]

if(k<l):print(s[k])
else:
    k-=l
    k%=c
    print(s[k+l])
from collections import deque
import numpy as np
N,M = map(int,input().split(' '))
#G = {i:[] for i in range(1,N+1)}

GM = np.zeros((N,N)).astype(np.int)

for j in [0]*M:
	u,v = map(int,input().split(' '))
	GM[u-1,v-1] = 1
	#G[u].append(v)
S,T = map(int,input().split(' '))

G3M = np.dot(np.dot(GM,GM),GM)

#G3 = {i: np.where(G3M[i-1]>0)[0] for i in range(1,N+1)}

#dq =deque([S])
st = [S]
visited = [S]
ans = 1
exist = True
while(exist):
	new_st = []
	exist = False
	for cand in st:
		#for n in G3[cand]:
		ls = np.where(G3M[cand-1]>0)[0]
		for n in ls:
			n = n+1
			if n == T:
				print(ans)
				exit()
			if not n in visited:
				exist = True
				visited.append(n)
				new_st.append(n)
	st = new_st[:]
	ans += 1
print(-1)









### FIXED CODE ###

import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N,M= map(int,input().split())
g = defaultdict(list)

for i in range(M):
    u,v = list(map(int,input().split()))
    g[u].append(N + v)
    g[N + u].append(2*N + v)
    g[2*N + u].append(v)
S,T= map(int,input().split())

dq = deque([S])
inf = 10**15
d = [inf for i in range(3*N+1)]
d[S] = 0

while dq:
    v = dq.popleft()
    for nv in g[v]:
        if d[nv] > d[v] + 1:
            d[nv] = d[v] + 1
            dq.append(nv)

if inf == d[T]:
    print(-1)
else:
    print(d[T]//3)
s = input().split()
a = int(s[0])
b = int(s[1])
n = int(s[2])

l = list()

for x in range(n):
    ans = a*(x+1)//b - a*((x+1)//b)
    l.append(ans)


print(max(l))

    
    

### FIXED CODE ###

n = int(input())
m = input().split()
a = int(m[0])
b = int(m[1])
 
if b//n - a//n >= 1:
    print('OK')
elif b%n == 0:
    print('OK')
elif a%n == 0:
    print('OK')
else :
    print('NG')
#include <stdio.h>

int main() 
{
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d %d\n", a*b,  2*a+2*b);
    return 0;
}


### FIXED CODE ###

a, b = map(int, input().split())
l = 2*(a+b)
s = a*b
print("{} {}".format(s, l))
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = [0]*N
count = 0
for j in range(len(S)):
    if S[j] == 'A' and S[j + 1] == 'C':
        count = +1
        S1[j] = count
    else:
        pass
for i in range(Q):
    print(sum(S1[A[i][0]-1:A[i][1]-1]))

### FIXED CODE ###

# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = [0]*N
count = 0
for j in range(1,len(S)):
    if S[j] == 'C' and S[j - 1] == 'A':
        count += 1
    else:
        pass
    S1[j] = count
#print(S1)

for k in range(Q):
    print(S1[A[k][1]-1]-S1[A[k][0]-1])
N =input()
A = map(int, input().split())
 
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

### FIXED CODE ###

n = int(input())
a = [i for i in map(int, input().split())]
 
if a.count(0) != 0:
  print(0)
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > (10**18):
      print(-1)
      break
    else:
      continue
  else:
    print(result)
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=0
b=0
t=0
while t<=k:
  if a<=n-1 and b<=m-1:
    if A[a]<B[b]:
      t+=A[a]
      a+=1
    elif A[a]>B[b]:
      t+=B[b]
      b+=1
    else:
      d=1
      d_=1
      while d!=n-a or d_!=m-b:
        if A[a+d]==B[b+d_]:
          d+=1
          d_+=1
        elif A[a+d]<B[b+d_]:
          a_=a
          while t<=k and a<=a_+d:
            t+=A[a]
            a+=1
        elif A[a+d]>B[b+d_]:
          b_=b
          while t<=k and b<=b_+d:
            t+=B[b]
            b+=1
        if d==n-a:
          b_=b
          while t<=k and b_+d:
            t+=B[b]
            b+=1
        elif d_==m-b:
          a_=a
          while t<=k and a<=a_+d_:
            t+=A[a]
            a+=1
  elif a>=n and b<=m-1:
    t+=B[b]
    b+=1
  elif b>=m and a<=n-1:
    t+=A[a]
    a+=1
  else:
    print(n+m)
    exit()
print(a+b-1)        

### FIXED CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a_=[0]
for i in range(len(a)):
  a_.append(a_[-1]+a[i])
b_=[0]
for i in range(len(b)):
  b_.append(b_[-1]+b[i])
ans=[0]
a_now=0
b_now=m
for i in range(n+1):
  k_=k-a_[i]
  while b_[b_now]>k_:
    b_now+=-1
    if b_now==-1:
      b_now=0
      break
  if a_[i]+b_[b_now]<=k:
    ans.append(i+b_now)
print(max(ans))
n = int(input())
a = list(map(int,input().split()))
a2 = list(map(int,lambda x:x*2,a))
All = sum(a)
t = 0
while True :
    t += 1
    if t > n :
        exit()
    print(All-a2[1::2])
    a2.append(a2[0])
    del a2[0]

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a2 = list(map(lambda x:x*2,a))
All = sum(a)
p = All-sum(a2[1::2])
a3 = [p]
for i in range(n-1) :
    p = a[i]*2 - p
    a3.append(p)
mountain = ""
for j in range(n) :
    mountain += str(a3[j])
    if j == n-1 :
        print(mountain)
        exit()
    mountain += " "
from collections import deque
N = int(input())
visited = [False]*N
tree = [[] for _ in range(N)]
tmp = []
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    tree[a].append(b)
    tree[b].append(a)
    tmp.append((a, b))  # 順番を保持するため

ans = {}  # 連想配列で保持する

q = deque([0])  # 開始のノード
colors = [-1]*N  # そのノードにささっている辺の色
while len(q):  # 幅優先探索を開始する
    v = q.pop()  # 部分木の親のノード
    color = 1
    for e in v:  # 子供に対して操作を行う
        if visited[e]:
            continue
        visited[e] = True
        if colors[v] == color:
            color += 1
        ans[(v, e)] = color
        colors[e] = color
        color += 1
        q.append(e)

print(max(colors))
for a, b in tmp:
    print(ans[(a, b)])
    


### FIXED CODE ###

from collections import deque
N = int(input())
graph = [[] for _ in range(N)]
ans = {}
tmp = []
flag = [False] * N  # そのノードに到達済みか判定する
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)
    tmp.append((a, b))  # 最後に出力する時に使う
    ans[(a, b)] = -1
q = deque([0])  # 開始のノード
colors = [-1]*N
now_color = 0
while len(q):
    v = q.pop()
    flag[v] = True
    color = 1
    # vからeへの辺の色を塗る
    for e in graph[v]:

        if flag[e]:
            continue
        q.append(e)
        if color == colors[v]:
            color += 1
        ans[(v, e)] = color
        colors[e] = color
        color += 1
print(max(colors))
for a, b in tmp:
    print(ans[(a, b)])
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
sum_A =0
for i in range(N):
    sum_A += A[i]

for i in range(N):
    if (4*M*A[M] < sum_A):
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

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

ans = 0
for i in range(N):
    if (4*M*A[i] >= sum_A):
        ans+=1
    else:
    	ans+=0
    	
if (ans >= M):
    print('Yes')
else:
    print('No')
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n,m = inp()
    cnt = [0 for _ in range(n)]
    for _ in range(m):
        a,b = inpm()
        a -= 1
        b -= 1
        cnt[a] += 1
        cnt[b] += 1
    for i in range(n):
        if cnt[i]%2 == 1:
            print('NO')
            return
    print('YES')
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n,m = inpm()
    cnt = [0 for _ in range(n)]
    for _ in range(m):
        a,b = inpm()
        a -= 1
        b -= 1
        cnt[a] += 1
        cnt[b] += 1
    for i in range(n):
        if cnt[i]%2 == 1:
            print('NO')
            return
    print('YES')
 
if __name__ == "__main__":
    main()
n = inr(input())
s= input()
if n<=3200:
  print("red")
else:
  print(s)

### FIXED CODE ###

n = int(input())
s= input()
if n<3200:
  print("red")
else:
  print(s)
W = 101

def solve(N, xyh):
    H = [[1e9] * W for i in range(W)]
    for x, y, h in xyh:
        for yy in range(W):
            for xx in range(W):
                if h == 0:
                    d = abs(xx - x) + abs(yy - y)
                    H[yy][xx] = min(H[yy][xx], d)
    V = [[-1] * W for i in range(W)]
    for x, y, h in xyh:
        for yy in range(W):
            for xx in range(W):
                d = abs(xx - x) + abs(yy - y)
                if h + d > H[yy][xx]:
                    V[yy][xx] = -2
                else:
                    if V[yy][xx] == -1:
                        V[yy][xx] = d + h
                    elif V[yy][xx] != d + h:
                        V[yy][xx] = -2
    for yy in range(W):
        for xx in range(W):
            if 1 <= V[yy][xx]:
                return (xx, yy, V[yy][xx])

if __name__ == '__main__':
    N = int(input())
    xyh = [tuple(map(int, input().split())) for i in range(N)]
    print(*solve(N, xyh))

### FIXED CODE ###

W = 101

def solve(xyh):
    for bx, by, bh in xyh:
        if bh > 0:
            break
    for yy in range(W):
        for xx in range(W):
            H = bh + abs(bx - xx) + abs(by - yy)
            for x, y, h in xyh:
                if max(H - abs(xx - x) - abs(yy - y), 0) != h:
                    break
            else:
                return (xx, yy, H)

N = int(input())
xyh = [tuple(map(int, input().split())) for i in range(N)]
print(*solve(xyh))
def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse = True)
    ans = A[0]
    kazu = (N-2)//2
    amari = (N-2)%2
    for i in range(1,kazu+1,1):
        #print(i)
        ans += (A[i]*2)

    ans += A[i+1]*amari

    print(ans)

main()


### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort(reverse = True)
    ans = A[0]
    kazu = (N-2)//2
    amari = (N-2)%2
    for i in range(1,kazu+1,1):
        #print(i)
        ans += (A[i]*2)

    if amari==1:
        ans += A[i+1]*amari

    print(ans)

main()
x = list(map(int, input().split()))
if x[0] / x[2] <= x[3]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d,t,s=map(int,input().split())
if d<=t*s:
    print("Yes")
else:
    print("No")
n=int(input())
a=int(input())
if n%a<=a:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n=int(input())
a=int(input())
if n%500<=a:
    print("Yes")
else:
    print("No")
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
#R = 10**9 + 7
R = 998244353

def ddprint(x):
  if DBG:
    print(x)

def modinv2(x,r):
  return pow(x,r-2,r)

def perm(n,a,R):
    return (fact[n]*modinv2(fact[n-a],R))

def comb(n,a,R):
    return (fact[n]*modinv2(fact[n-a]*fact[a],R))

def factinit(n,R):
    global fact
    fact = [1]*(n+1)
    for i in range(2,n+1):
        fact[i] = (fact[i-1]*i)%R

n,m,k = inm()
if n==m+1==k+2==3:
    3/0
    print(0)
    exit()
if m==1:
    print(1)
    exit()
factinit(n,R)
s = 0
x = (m*pow(m-1,n-1,R))%R
m1i = modinv2(m-1,R)
for j in range(k+1):
    s = (s + x*comb(n-1,j,R))%R
    x = (x*m1i)%R
    #ddprint(f"{j=} {s=} {x=}")
print(s)


### FIXED CODE ###

#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
#R = 10**9 + 7
R = 998244353

def ddprint(x):
  if DBG:
    print(x)

def modinv2(x,r):
  return pow(x,r-2,r)

def perm(n,a,R):
    return (fact[n]*modinv2(fact[n-a],R))

def comb(n,a,R):
    return (fact[n]*modinv2(fact[n-a]*fact[a],R))

def factinit(n,R):
    global fact
    fact = [1]*(n+1)
    for i in range(2,n+1):
        fact[i] = (fact[i-1]*i)%R

n,m,k = inm()
if n==m+1==k+2==-3:
    3/0
    print(0)
    exit()
if m==1:
    print(1 if k==n-1 else 0)
    exit()
factinit(n,R)
s = 0
x = (m*pow(m-1,n-1,R))%R
m1i = modinv2(m-1,R)
for j in range(k+1):
    s = (s + x*comb(n-1,j,R))%R
    x = (x*m1i)%R
    #ddprint(f"{j=} {s=} {x=}")
print(s)
N = int(input())
list_S = []
for i in range(N):
  if not str(input()) in list_get: list_S.append(str(input()))
print(len(list_S))

### FIXED CODE ###

N = int(input())
list_S = [str(input()) for i in range(N)]
print(len(list(set(list_S))))
s = input()

ans = 0

l, r = 0, len(s)-1
if len(s) != 1:
    while l != r:
        # print("l", l, "r", r)
        if s[l] == s[r]:
            l += 1
            r -= 1
        else:
            if s[l] == "x":
                l += 1
                ans += 1
            elif s[r] == "x":
                r -= 1
                ans += 1
            else:
                ans = -1
                break

print(ans)

### FIXED CODE ###

s = input()

ans = 0

l, r = 0, len(s)-1
if len(s) != 1:
    while l < r:
        # print("l", l, "r", r)
        if s[l] == s[r]:
            l += 1
            r -= 1
        else:
            if s[l] == "x":
                l += 1
                ans += 1
            elif s[r] == "x":
                r -= 1
                ans += 1
            else:
                ans = -1
                break

print(ans)
N, M = map(int, input().split())
a = []
b = []
c = []
sys.setrecursionlimit(2000)

for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
    ci = list(map(int, input().split()))
    c.append(ci)

c_bin = [0] * M
for j in range(M):
    for k in range(b[j]):
        c_bin[j] |= (1 << (c[j][k] - 1))

ceil = 1 << N
memo = [None] * (ceil * (M + 1))
# print("#", '[' +' '.join(map(lambda x: '0b{:b}'.format(x), c_bin)) + ']', ceil)
def dp(pos, state):
    global M, ceil
    idx = pos * ceil + state
    # print("##", pos, '0b{:b}'.format(state), idx)
    if state == ceil - 1:
        ret = 0
    elif pos == M:
        ret = -1
    elif memo[idx] != None:
        return memo[idx]
    else:
        ret0 = dp(pos + 1, (state | c_bin[pos]))
        ret1 = dp(pos + 1, state)
        if ret0 == ret1 == -1:
            ret = -1
        elif ret1 == -1:
            ret = a[pos] + ret0
        else:
            ret = min(a[pos] + ret0, ret1)
    #
    memo[idx] = ret
    return ret

print(dp(0, 0))

### FIXED CODE ###

N, M = map(int, input().split())
a = []
b = []
c = []

import sys
sys.setrecursionlimit(2000)

for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
    ci = list(map(int, input().split()))
    c.append(ci)

c_bin = [0] * M
for j in range(M):
    for k in range(b[j]):
        c_bin[j] |= (1 << (c[j][k] - 1))

ceil = 1 << N
memo = [None] * (ceil * (M + 1))
# print("#", '[' +' '.join(map(lambda x: '0b{:b}'.format(x), c_bin)) + ']', ceil)
def dp(pos, state):
    global M, ceil
    idx = pos * ceil + state
    # print("##", pos, '0b{:b}'.format(state), idx)
    if state == ceil - 1:
        ret = 0
    elif pos == M:
        ret = -1
    elif memo[idx] != None:
        return memo[idx]
    else:
        ret0 = dp(pos + 1, (state | c_bin[pos]))
        ret1 = dp(pos + 1, state)
        if ret0 == ret1 == -1:
            ret = -1
        elif ret1 == -1:
            ret = a[pos] + ret0
        else:
            ret = min(a[pos] + ret0, ret1)
    #
    memo[idx] = ret
    return ret

print(dp(0, 0))
import numpy as np
import math
n=input()
A=np.zeros((n))
B=np.zeros((n))
count=0

for i in range(n):
    A[i]=input()


for i in range(n):
    if A[i]==1:
        B[i]=1
    elif A[i]==2:
        B[i]=0
    elif A[i]==3:
        B[i]=0
    elif A[i]==5:
        B[i]=0
    elif A[i]%2==0 :
        B[i]=1
    elif A[i]%3==0:
        B[i]=1
    elif A[i]%5==0:
        B[i]=1
    else:
        for j in range(2,int(math.sqrt(A[i]))):
            if A[i]%j==0:
                B[i]=1 
                break



for i in range(n):
    if B[i]==0:
        count=count+1

print(count)


### FIXED CODE ###

from math import sqrt

n=int(input())

count=0

for i in range(n):
    x=int(input())
    if x==1:
        count=count+1
    elif x!=2 and x%2==0:
        count=count+1
    elif x==2 or x==3 or x==5:
        count=count
    else:
        for j in range(2,int(sqrt(x))+1): 
            if x%j==0:
                count=count+1
                break


print(n-count)
def gcd(a,b):
  n,  = max(a, b), min(a, b)
  if n % m == 0:
    return m
  else:
    return gcd(m, n%m)

N, X = [int(item) for item in input().split()]
cities = [int(item) for item in input().split()]
if N == 1:
  print(abs(cities[0]-X))
  exit()

mod = gcd(abs(cities[0] - X), abs(cities[1] - X))
for i in range(2, N):
  mod = gcd(mod, abs(cities[0] - X))
print(mod)

### FIXED CODE ###

def gcd(a,b):
  n, m  = max(a, b), min(a, b)
  if n % m == 0:
    return m
  else:
    return gcd(m, n%m)

N, X = [int(item) for item in input().split()]
cities = [int(item) for item in input().split()]
if N == 1:
  print(abs(cities[0]-X))
  exit()

mod = gcd(abs(cities[0] - X), abs(cities[1] - X))
for i in range(2, N):
  mod = gcd(mod, abs(cities[i] - X))
print(mod)