Harryxun/stf_run huggingface dataset:
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)

candidate = lambda xyh, cx, cy: abs(xyh[0] - cx) + abs(xyh[1] - cy) + xyh[2]

height = None
found = False
for cx in range(0, 101):
    for cy in range(0, 101):
        found = True
        candidates = [candidate(xyhi, cx, cy) for xyhi in xyh]

        found = True
        height = None
        for candidate in candidates:
            if candidate < 0: continue
            if height is None:
                height = candidate
                continue
            if candidate != height:
                found = False
                break
        
        if found is True: break
    if found is True: break
height = candidate if candidate is not None else 0

print(cx, cy, height)


### FIXED CODE ###

N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
# print(N, xyh)

height = None
found = False
for cx in range(0, 101):
    for cy in range(0, 101):
        candidate = 0
        for x, y, h in xyh:
            if h == 0: continue
            dx = abs(x - cx)
            dy = abs(y - cy)
            candidate = dx + dy + h 
            break

        found = True
        for x, y, h in xyh:
            _h = candidate - abs(x - cx) - abs(y - cy)
            if h == 0 and _h <= 0: continue
            if not h == _h:
                found = False
                break
        
        if found is True: break
    if found is True: break
height = candidate if candidate is not None else 0

print(cx, cy, height)
A,B,C=map(int,input().split())
if B>=C:
  ans=B+C
else C>B:
  ans=2*B
  if A>C:
    ans+=C
  else:
    ans+=A
print(ans)


### FIXED CODE ###

A,B,C=map(int,input().split())
if B>=C:
    print(B+C)
else:
    ans=2*B
    C-=B
    if A>=C:
        print(ans+C)
    else:
        print(ans+A+1)
n = int(input())
t, a = map(int,input().split())
li = list(map(int,input().split()))
n_temp = 2147483647
answer = 2147483647
for idx, temp in enumerate(li):
    i_temp = int(t - temp * 0.006)
    if (abs(a - n_temp) > abs(a -i_temp)):
        n_temp = i_temp
        answer = idx

print(answer+1)


### FIXED CODE ###

x, y = map(int,input().split())
answer = x + y//2
print(answer)
import sys
sys.setrecursionlimit(10000)
def check(graph,seen,now):
    seen[now] = True 
    for i in range(len(graph[now])):
        if seen[i] :
            continue
        if graph[now][i] == 0 :
            continue
        check(graph,seen,i)
    return seen


#入力
N,M = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(M)]
graph =[[0 for i in range(N)] for  j in range(M)]
for i in range(M):
    graph[para[i][0]-1][para[i][1]-1] = 1
    graph[para[i][1]-1][para[i][0]-1] = 1 

#seen = [False]*(N)
ans = 0
for i in range(M):
    seen = [False]*(N)
    graph[para[i][0]-1][para[i][1]-1] = 0
    graph[para[i][1]-1][para[i][0]-1] = 0
    if False in check(graph,seen,0):
        ans += 1
    graph[para[i][0]-1][para[i][1]-1] = 1
    graph[para[i][1]-1][para[i][0]-1] = 1 
print(ans)

### FIXED CODE ###

def check(graph,seen,now):
    seen[now] = True 
    for i in range(len(graph[now])):
        if seen[i] :
            continue
        if graph[now][i] == 0 :
            continue
        check(graph,seen,i)
    return seen


#入力
N,M = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(M)]
graph =[[0 for i in range(N)] for  j in range(N)]
for i in range(M):
    graph[para[i][0]-1][para[i][1]-1] = 1
    graph[para[i][1]-1][para[i][0]-1] = 1 

#seen = [False]*(N)
ans = 0
for i in range(M):
    seen = [False]*(N)
    graph[para[i][0]-1][para[i][1]-1] = 0
    graph[para[i][1]-1][para[i][0]-1] = 0
    if False in check(graph,seen,0):
        ans += 1
    graph[para[i][0]-1][para[i][1]-1] = 1
    graph[para[i][1]-1][para[i][0]-1] = 1 

print(ans)
abc="abcdefghijklmnopqrstuvwxyz"

A=str(input())
n=len(A)
#make matrix (a-z)*(n characters)
#次にchrが出てくるindex
word_pos=[]
ct=[n]*26
orda=ord("a")

for i in range(n-1,-1,-1):
    ct[ord(A[i])-orda]=i
    word_pos.append(ct.copy())

word_pos.reverse()

dp=[0]*n+[1,0]
j=n
sep=[]
#区切れめをマーク
for i in range(n-1,-1,-1):
    ct=word_pos[i]
    if(max(ct)<j):
        #remove last chunk
        sep.append(i)
        j=min(ct)
        
if(j==n):
    for i in abc:
        if(i not in A):
            print(i)
            break

sep.reverse()
ans=""
for i in abc:
    if(i not in A[:sep[0]]):
        ans+=i
        break

for i in range(0,len(sep)):
    start=sep[i]
    try:
        end=sep[i+1]
    except:
        end=n
    #ans[-1]が出現するタイミング
    next=word_pos[start][ord(ans[-1])-orda]
    for i in range(0,26):
        if(word_pos[next+1][i]>end-1):
            ans+=chr(orda+i)
            break
ans+="\n"
print(ans)


### FIXED CODE ###

abc="abcdefghijklmnopqrstuvwxyz"

A=str(input())
n=len(A)
#make matrix (a-z)*(n characters)
#次にchrが出てくるindex
word_pos=[]
ct=[n]*26
orda=ord("a")

for i in range(n-1,-1,-1):
    ct[ord(A[i])-orda]=i
    word_pos.append(ct.copy())

word_pos.reverse()

dp=[0]*n+[1,0]
j=n
sep=[]
#区切れめをマーク
for i in range(n-1,-1,-1):
    ct=word_pos[i]
    if(max(ct)<j):
        #remove last chunk
        sep.append(i)
        j=min(ct)
        
if(j==n):
    for i in abc:
        if(i not in A):
            print(i+"\n")
            break

else:
    sep.reverse()
    ans=""
    for i in abc:
        if(i not in A[:sep[0]]):
            ans+=i
            break

    for i in range(0,len(sep)):
        start=sep[i]
        try:
            end=sep[i+1]
        except:
            end=n
        #ans[-1]が出現するタイミング
        next=word_pos[start][ord(ans[-1])-orda]
        for i in range(0,26):
            if(word_pos[next+1][i]>end-1):
                ans+=chr(orda+i)
                break
    ans+="\n"
    print(ans)
K=int(input())
A,B=map(int,input().split())

for i in range(A,B,1):
    if (i %= K) == 0:
        print("OK")
        break
print("NG")


### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())

yn=0
for i in range(A,B+1,1):
    if (i % K) == 0:
        print("OK")
        yn=1
        break
if yn==0:
    print("NG")
L, R = map(int ,input().split())
if R-L >= 2019:
    print(0)
else:
    li = []
    for i in range(L, R+1):
        li.append(i%2019)
    a = min(li)
    li[li.index(a)] += 2019
    b = min(li)

print((a*b)%2019)


### FIXED CODE ###

L, R = map(int ,input().split())
if R-L >= 2019:
    print(0)
else:
    li = []
    for i in range(L, R+1):
        li.append(i%2019)
    l = []
    for i in range(len(li)-1):
        for j in range(i+1,len(li)):
            l.append((li[i]*li[j])%2019)
    a = min(l)

    print((a)%2019)
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
Y = []

for i in range(M-1):
    Y.append(X[i+1] - X[i])

for i in range(N-1):
    idx = Y.index(max(Y))
    Y[idx] = 0
    
print(sum(Y))

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

ans = 0
if N>=M:
    pass
else:
    X_diff = []
    for i in range(len(X)-1):
        X_diff.append(X[i+1]-X[i])
    X_diff.sort()
    ans = 0
    for i in range(M-N):
        ans += X_diff[i]
print(ans)
a = [int(input()) for i in range(5)]
k = int(input())

if (a[-1] - a[0] =< k ):
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

#A
a = [int(input()) for i in range(5)]
k = int(input())

if (a[-1] - a[0] <= k ):
    print("Yay!")
else:
    print(":(")
s = input().split()
print(s.join(" "))

### FIXED CODE ###

s = input().split(",")
print(" ".join(s))
N,X = map(int,input().split())
list = list(map(int, input().split()))

cnt = 0
sum = 0

while sum <= X:
    sum += list[cnt]
    cnt += 1

print(cnt)

### FIXED CODE ###

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

cnt = 1
sum = 0

for i in list:
    sum += i
    if sum <= X:
        cnt += 1

print(cnt)
S = input()
K = int(input())
flag = True

for i in range(K):
    if S[i] != 1:
        print(S[i])
        flag = False

if flag:
    print(1)


### FIXED CODE ###

S = input()
K = int(input())
flag = True

for i in range(K):
    if S[i] != '1':
        print(S[i])
        flag = False
        break

if flag:
    print(1)
s = str(input())

print(s.count(1))

### FIXED CODE ###

s = str(input())

print(s.count('1'))
N = input()
a = [input() for i in range(N)]
a.sort()
print a[0],a[1],a[3]

### FIXED CODE ###

a = [input() for i in range(10)]
a.sort(reverse=True)
print a[0]
print a[1]
print a[2]
c=int(input())
count=1
ans=10000000000000
k=c
a=[]
for i in range(1,int(c**(1/2))):
    if c%i==0:
        count*=i
        k=int(k/i)
        a.append(count+k)
        count=1
        k=c
print(a)
print(min(a)-2)


### FIXED CODE ###

c=int(input())
count=1
ans=10000000000000
k=c
for i in range(1,int(c**(1/2)+100000)):
    if c%i==0:
        if ans>i+int(c/i):
            ans=i+int(c/i)
        else:
            continue
print(ans-2)
S = input()
S1 = S[:1]
S2 = S[2:]
month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S1 in month and S2 in month:
	print('AMBIGUOUS')
elif S1 in month:
	print('MMYY')
elif S2 in month:
	print('YYMM')
elif S1 == '00': 
	print('YYMM')
elif: S2 == '00':
	print('MMYY')
else:
	print('NA')

### FIXED CODE ###

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

for i in range(N):
	if i == (K - 1):
			S[i] = S[i].lower()

print(''.join(S))
a,b =(int(i) for i in input.split())
if a > b:
 print("a > b")
if a == b:
 print("a == b")
if a > b: 
 print("a > b")
 elif


### FIXED CODE ###

a,b =map(int, input().split())
if a > b:
 print("a > b")
elif  a == b:
 print("a == b")
else : 
 print("a < b")
import re

words = []
while True:
  try:
    w = raw_input()
    words.append(w) if re.match('^[0-9]', w) == None
  except:
    break
words.sort()
print words[0]

### FIXED CODE ###

import re

words = []
while True:
    try:
        w = raw_input()
        if re.match('[0-9]', w) == None:
            words.append(w)
    except:
        break
words.sort()
print words[0]
n,m=map(int,input().split())
if (n==1 or m==1 and) n!=m:
  print(n*m-2)
elif n==1 and m==1:
  print(1)
else:
  print((n-2)*(m-2))

### FIXED CODE ###

n,m=map(int,input().split())
if (n==1 or m==1) and n!=m:
  print(n*m-2)
elif n==1 and m==1:
  print(1)
else:
  print((n-2)*(m-2))
#!/usr/bin/env pypy3

import math

def num_cuts(A, ml):
	if ml == 0:
		while True:
			continue
			
	ret = 0
	for a in A:
		ret += (math.ceil(a / ml) - 1)
	return ret

def ok(A, ml):
	return num_cuts(A, ml) <= K

def ans(A, K):

	low = 0.5
	high = max(A)+1

	assert(not(ok(A, low)))
	assert(ok(A, high))

	while (high - low) > 0.1:
		mid = (low + high) / 2
		if ok(A, mid):
			high = mid
		else:
			low = mid

	low = max(1, math.floor(low) - 5)

	for i in range(100):
		p = low + i/3
		q = low + (i+1) / 3

		if not(ok(A, p)) and ok(A, q):
			return math.ceil(q)


N, K = input().split()
N = int(N)
K = int(K)

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

print(ans(A, K))

### FIXED CODE ###

#!/usr/bin/env pypy3

import math

def num_cuts(A, ml):
	ret = 0
	for a in A:
		ret += (math.ceil(a / ml) - 1)
	return ret

def ok(A, ml):
	return num_cuts(A, ml) <= K

def ans(A, K):

	low = min(A) / (K+5)
	high = max(A)+1

	assert(not(ok(A, low)))
	assert(ok(A, high))

	while (high - low) > 0.1:
		mid = (low + high) / 2
		if ok(A, mid):
			high = mid
		else:
			low = mid

	low = max(1, math.floor(low) - 5)

	for i in range(100):
		p = low + i/2
		if ok(A, p):
			return math.ceil(p)

	assert(False)


N, K = input().split()
N = int(N)
K = int(K)

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

print(ans(A, K))
N = int(input())
H = [int(_) for _ in input().split()]
ans = 0
for i in range(N - 1):
    if H[i] < H[i + 1]:
        ans = max(ans, now)
        now = 0
    now += 1
print(max(ans, now))


### FIXED CODE ###

N = int(input())
H = [int(_) for _ in input().split()]
ans = now = 0
for i in range(N - 1):
    if H[i] < H[i + 1]:
        ans = max(ans, now)
        now = 0
    else:
        now += 1
print(max(ans, now))
from scipy.sparse.csgraph import floyd_warshall
N = int(input())
dic = [0]*N
for i in range(N):
  dic[i] = [int(c) for c in input().split()]

d = floyd_warshall(dic)
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    if d[i][j] < dic[i][j]:
      print(-1)
      break
    elif dic[i][j] == d[i][j]:
      flag = False
      for k in range(N):
        if k==i or k==j:
          continue
        if d[i][j] == d[i][k]+d[k][j]:
          flag = True
          ans = -1
          break
      if flag:
        continue
    ans += dic[i][j]

print(ans)


### FIXED CODE ###

N = int(input())
A = int(input())
print(N*N-A)
S = input()
T = input()

N = len(S)
M = len(T)

i_a = 0
for i in reversed(range(N-M+1)):
    ans = 0
    for j in range(M):
        if T[j] == S[i+j] or S[i+j] == '?':
            ans += 1
        else:
            break
    if ans == M:
        for k in range(N):
            if k == i:
                print(T,end='')
            elif k < i or i + M - 1 < k:
                if S[k] == '?':
                    print('a',end='')
                else:
                    print(S[k],end='')
        exit()
    if i == 0:
        print('UNRESTORABLE')
        eixt()
    


### FIXED CODE ###

S = input()
T = input()

N = len(S)
M = len(T)

i_a = 0
for i in reversed(range(N-M+1)):
    ans = 0
    for j in range(M+1):
        if j == M:
            print((S[:i]+T+S[i+M:]).replace('?','a'))
            exit()
        if T[j] == S[i+j] or S[i+j] == '?':
            continue
        else:
            break

print('UNRESTORABLE')
N = int(input().split()
d = list(map(int, input().split()))

d.sort()

if d[int((N-1)/2)] == d[int(N/2)]:
    result = 0
else:
    result = d[int(N/2)]-d[int((N-1)/2)]

print(result)


### FIXED CODE ###

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

d.sort()
result = d[int(N/2)]-d[int((N-1)/2)]
print(result)
from sys import stdin
from math import factorial

n, k = [int(x) for x in stdin.readline().rstrip().split()]
MOD = 1000000007


def combination(x, y):
    return factorial(x) // (factorial(x-y) * factorial(y))


def f2(n, k):
    return combination(n+k-1, k-1)


def f(n, k):
    if n < k:
        return 0
    if n == 0 and k == 0:
        return 1
    if k < 1:
        return 0
    return f2(n-k, k)


for i in range(1, k+1):
    blue = f(k, i)
    red = f2(n-k-(i-1), i+1)
    ans = blue * red
    print(ans % MOD)


### FIXED CODE ###

from sys import stdin
from math import factorial

n, k = [int(x) for x in stdin.readline().rstrip().split()]
MOD = 1000000007


def combination(x, y):
    return factorial(x) // (factorial(x-y) * factorial(y))


for i in range(1, k+1):
    if n - k + 1 < i:
        ans = 0
    else:
        blue = combination(k-1, i-1)
        red = combination(n-k+1, i)
        ans = blue * red
    print(ans % MOD)
s = input()

if s == "Sunny":
  	print("Cloudy")
else if s == "Cloudy":
  	print("Rainy")
else:
  	print("Sunny")

### FIXED CODE ###

s = input()
 
if s == "Sunny":
  	print("Cloudy")
elif s == "Cloudy":
  	print("Rainy")
else:
  	print("Sunny")
from math import sqrt
n = int(input())
a = 1+8*n
b = int(sqrt(a))
if b**2 != a or b%2==0:
    print("No")
    exit()
else:
    print(c)
k = (1 + b)//2


### FIXED CODE ###

from math import sqrt
n = int(input())
a = 1+8*n
b = int(sqrt(a))
if b**2 != a or b%2==0:
    print("No")
    exit()
else:
    k = (1 + b)//2
    s = [[] for i in range(k)]
    cur = 1
    for i in range(k):
        for j in range(k-i-1):
            s[i].append(cur)
            s[i+j+1].append(cur)
            cur += 1
    print("Yes")
    print(k)
    for i in range(k):
        res = "{} ".format(len(s[i])) + " ".join(map(str, s[i]))
        print(res)
n=input()
satis=[]

for i in range(n):
	satis.extend(map(int,input().split()))

tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
  print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))

### FIXED CODE ###

n=int(input())
satis=[]

for i in range(n):
  A=list(map(int,input().split()))
  satis.extend(A)

tempA=satis[0]
tempB=satis[1]
tempC=satis[2]
if n > 1:
  for i in range(n-1):
    tempA2=satis[3*i+3]+max([tempB,tempC])
    tempB2=satis[3*i+4]+max([tempA,tempC])
    tempC2=satis[3*i+5]+max([tempA,tempB])
    tempA=tempA2
    tempB=tempB2
    tempC=tempC2
  print(max([tempA,tempB,tempC]))
else:
  print(max([tempA,tempB,tempC]))
def merge(A, left, mid, right):

    #n1 = mid-left
    #n2 = right-mid
    #L = [0 for i in range(n1+1)]
    #R = [0 for i in range(n2+1)]
    #for i in range(n1):
    #    L[i] = A[left+i]
    #for i in range(n2):
    #    R[i] = A[mid+i]
    L = A[left:mid]
    R = A[mid:right]
    L[n1] = float('inf')
    R[n2] = float('inf')
    i = 0
    j = 0
    global cnt

    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
        
        else:
            A[k] = R[j]
            j = j+1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         mergeSort(A, left, mid)
         mergeSort(A, mid, right)
         merge(A, left, mid, right)
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))

### FIXED CODE ###

def merge(A, left, mid, right):

    n1 = mid-left
    n2 = right-mid
    #L = [0 for i in range(n1+1)]
    #R = [0 for i in range(n2+1)]
    #for i in range(n1):
    #    L[i] = A[left+i]
    #for i in range(n2):
    #    R[i] = A[mid+i]
    L = A[left:mid]
    R = A[mid:right]
    L.append(float('inf'))
    R.append(float('inf'))
    i = 0
    j = 0
    global cnt

    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i+1
        
        else:
            A[k] = R[j]
            j = j+1
    return cnt

def mergeSort(A, left, right):
    if left+1 < right:
         mid = (left+right) // 2
         mergeSort(A, left, mid)
         mergeSort(A, mid, right)
         merge(A, left, mid, right)
    else:
        return 0

n = input()
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, len(A))
print(*A)
print(str(cnt))
s = list(str(input()))

if s[0] == s[1] and a[1] == s[2] and s[2] == s[3]:
    print('Bad')
else:
    print('Good')


### FIXED CODE ###

s = list(str(input()))

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
n=int(input())
a=list(map(int,input().split()))
m=10**9+7
b=[-1]*3
ans=1
for i in range(0,n):
  j=a[i]
  ans*=(b.count(j-1))
  b[b.index(j-1)]+=1
print(ans%m)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=10**9+7
b=[0]*3
ans=1
for i in a:
  ans*=b.count(i)
  ans%=m
  for j in range(3):
    if b[j]==i:
      b[j]+=1
      break
print(ans%m)
h, w, m = map(int, input().split())
h_cnt = [0] * h
w_cnt = [0] * w

mat = [[0] * w for i in range(h)]

for i in range(m):
    h_, w_ = map(int, input().split())
    h_ -= 1
    w_ -= 1
    h_cnt[h_] += 1
    w_cnt[w_] += 1
    mat[h_][w_] = 1

max_h = max(h_cnt)
max_h_idx = []
for i in range(h):
    if h_cnt[i] == max_h:
        max_h_idx.append(i)

max_w = max(w_cnt)
max_w_idx = []
for i in range(w):
    if w_cnt[i] == max_w:
        max_w_idx.append(i)

for i in max_h_idx:
    for j in max_w_idx:
        if mat[i][j] == 0:
            print(max_h + max_w)
            exit()
print(max_h + max_w - 1)


### FIXED CODE ###

h, w, m = map(int, input().split())
h_cnt = [0] * h
w_cnt = [0] * w

bomb_set = set()

for i in range(m):
    h_, w_ = map(int, input().split())
    h_ -= 1
    w_ -= 1
    h_cnt[h_] += 1
    w_cnt[w_] += 1
    bomb_set.add((h_, w_))

max_h = max(h_cnt)
max_h_idx = []
for i in range(h):
    if h_cnt[i] == max_h:
        max_h_idx.append(i)

max_w = max(w_cnt)
max_w_idx = []
for i in range(w):
    if w_cnt[i] == max_w:
        max_w_idx.append(i)

minus = -1
for i in max_h_idx:
    for j in max_w_idx:
        if (i, j) not in bomb_set:
            print(max_h + max_w)
            exit()
print(max_h + max_w - 1)
if (a*b%2):
 print("Odd")
else:
 print("Even")

### FIXED CODE ###

a, b  = map(int, input().split())
if (a*b%2):
 print("Odd")
else:
 print("Even")
n = int(input())
l = input()
ans = 
for i in l:
  for j in l:
    if i<j:
      for k in l:
        if j<k and i+j>k:
          ans+=1

print(ans)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort
ans = 0
for i in range(n):
  for j in range(n):
    if i ==	j:
      continue
    for k in range(n):
      if j == k:
        continue
      elif i == k:
        continue
      if l[i] < l[j] < l[k]:
        if l[i] + l[j] > l[k]:
          ans += 1
print(ans)
n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=[int,input().split()]
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n)) 
    

### FIXED CODE ###

n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=list(map(int,input().split()))
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n))
def main():
	H, W = map(int,input().split())
	pos = [""]*H
	for i in range(H):
		pos[i] = input()
	x = min(W, H)
	can_clear = True
	for dist in range(H+W-1):
		impossible_range = True
		for i in range(H):
			if i > dist:
				break
			if dist-i > W:
				continue
			if pos[i][dist-i] == ".":
				impossible_range = False
				break
		if impossible_range:
			can_clear = False
			break
	if not can_clear:
		print(-1)
		return

	offset = [[-1, 0], [1, 0], [0, -1], [0, 1]]
	def bfs(s, h, w):
		queue = [[0, 0, 0]]
		is_visited = [[False for _ in range(w)] for _ in range(h)]
		is_visited[0][0] = True
		while queue:
			cur = queue.pop(0)
			for o in offset:
				y, x = cur[0]+o[0], cur[1]+o[1]
				if x < 0 or x >= w or y < 0 or y >= h:
					continue
				if x == w-1 and y == h-1:
					return cur[2]+1
				if is_visited[y][x]:
					continue
				if s[y][x] == ".":
					queue.append([y, x, cur[2]+1])
					is_visited[y][x] = True
		return -1

	white_num = 0
	for i in range(H):
		for j in range(W):
			if pos[i][j] == ".":
				white_num += 1
	print(white_num-bfs(pos, H, W)-1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
	H, W = map(int,input().split())
	pos = [""]*H
	for i in range(H):
		pos[i] = input()

	offset = [[-1, 0], [1, 0], [0, -1], [0, 1]]
	def bfs(s, h, w):
		queue = [[0, 0, 0]]
		is_visited = [[False for _ in range(w)] for _ in range(h)]
		is_visited[0][0] = True
		while queue:
			cur = queue.pop(0)
			for o in offset:
				y, x = cur[0]+o[0], cur[1]+o[1]
				if x < 0 or x >= w or y < 0 or y >= h:
					continue
				if x == w-1 and y == h-1:
					return cur[2]+1
				if is_visited[y][x]:
					continue
				if s[y][x] == ".":
					queue.append([y, x, cur[2]+1])
					is_visited[y][x] = True
		return -1

	white_num = 0
	for i in range(H):
		for j in range(W):
			if pos[i][j] == ".":
				white_num += 1
	route = bfs(pos, H, W)
	if route == -1:
		print(-1)
	else:
		print(white_num-route-1)

if __name__ == '__main__':
    main()
n = int(input())

res = n //2 

if n%2 == 1:
  res += 1
  
return res

### FIXED CODE ###

n = int(input())
res = n // 2
if n % 2 == 1:
  res += 1
print(res)
n = input()
a = input()

r = n % 500
if r > a:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

n = int(input())
a = int(input())

r = n % 500
if r > a:
  print('No')
else:
  print('Yes')