Harryxun/stf_run huggingface dataset:
q = int(input())
node_color = [0 for _ in range(n + 1)]
vdc = [list(map(int, input().split())) for _ in range(q)]

vdc = vdc[::-1]
painted = set()
visited = [[0] * 11 for _ in range(n + 1)]


def dfs(now, dist, color):
    if dist < 0:
        return
    if visited[now][dist]:
        return

    visited[now][dist] += 1
    if not node_color[now]:
        node_color[now] = color

    for x in node[now]:
        dfs(x, dist - 1, color)


for i in vdc:
    v, d, c = i
    dfs(v, d, c)

for m in range(n):
    print(node_color[m + 1])


### FIXED CODE ###

n, m = map(int, input().split())
node = [[] for _ in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    node[a].append(b)
    node[b].append(a)

q = int(input())
node_color = [0 for _ in range(n + 1)]
vdc = [list(map(int, input().split())) for _ in range(q)]

vdc = vdc[::-1]
painted = set()
visited = [[0] * 11 for _ in range(n + 1)]


def dfs(now, dist, color):
    if dist < 0:
        return
    if visited[now][dist]:
        return

    visited[now][dist] += 1
    if not node_color[now]:
        node_color[now] = color

    for x in node[now]:
        dfs(x, dist - 1, color)


for i in vdc:
    v, d, c = i
    dfs(v, d, c)

for m in range(n):
    print(node_color[m + 1])
# 2^100

N = int(input())
S = [None] * N
for i in range(N):
    S[i] = int(input())
S.sorted(reverse=True)
total = sum(S)

for i in range(N):
    if total % 10 != 0:
        break
    total -= S[i]
print(total)




### FIXED CODE ###

# 2^100
# WAが残ったので解説見た
def main(N, S):
    total = sum(S)
    if total % 10 != 0:
        return total
    victim = sorted(x for x in S if x % 10 != 0)
    if len(victim) == 0:
        return 0
    else:
        return total - victim[0]

N = int(input())
S = [None] * N
for i in range(N):
    S[i] = int(input())
print(main(N, S))
from collection import Counter
cnt = Counter()
s = input()
for c in s:
  cnt[c] += 1
  
print(min(cnt.keys()) * 2)

### FIXED CODE ###

def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b


from collections import Counter

cnt = Counter()
s = input()
for c in s:
    cnt[c] += 1

if len(cnt.keys()) == 1:
    print(0)
else:
    print(min(cnt.values()) * 2)
import math

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1

if n > 1:
    ans=t[0]
    for j in range(1,n):
        ans=int(ans*t[j]/math.gcd(ans,t[j]))

### FIXED CODE ###

import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
n=int(input())
t=[int(input()) for i in range(n)] 
 
print(lcm_list(t))
h, n = list(map(int, input().split()))
lst = list(map(int, input().split()))
sum = 0
for _ in range(n):
  sum += lst[_]
if sum >= h:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

h, a = list(map(int, input().split()))
b = int(h/a)
if b == h/a:
  print(b)
else:
  print(b + 1)
s=input()
ans = 0
if 'SSS' in s:
  ans = 3
elif: 'SS' in s:
  ans = 2
elif: 'S' in s:
  ans = 1
print(ans)

### FIXED CODE ###

s=input()
ans = 0
if 'RRR' in s:
  ans = 3
elif 'RR' in s:
  ans = 2
elif 'R' in s:
  ans = 1
print(ans)
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=int(input())
print(0, 0)
print(10**9,1)
print(10**9-s%(10**9),s//(10**9))

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=int(input())
x=(10**9-s%(10**9))%(10**9)
y=(s+x)//(10**9)
print(0, 0, 10**9,1,x,y)
# print(10**9,1)
# print(10**9-s%(10**9),s//(10**9))
N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>0:
    b=X[K]
elif X[0]==0:
    b=X[K-1]
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K-a+2,N-a+2)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K-a+2,N-a+2)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)

### FIXED CODE ###

N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>=0:
    b=X[K-1]
elif X[-1]<=0:
    b=abs(X[-K])
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)
import sys
sys.setrecursionlimit(10 ** 9)
N, X = map(int, input().split())

lst = ['A'] * (N + 1)
def burger(s): #レベルsバーガーを返す
    if lst[s] != 'A':
        return lst[s]
    if s == 0:
        lst[s] = 'P'
        return lst[s]
    else:
        lst[s] = str('B' + burger(s-1) + 'P' + burger(s-1) + 'B')
        return lst[s]

s = burger(N)

count = 0
for i in range(X):
    if lst[N][i] == 'P':
        count += 1

print (count)


### FIXED CODE ###

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

a = [1]
p = [1]
for i in range(1, N+2):
    a.append(2 * a[i-1] + 3)
    p.append(2 * p[i-1] + 1)

def calc(N, X): #レベルNバーガーの下からX層に含まれるパティの枚数
    if N == 0: #全てパティ
        if X == 0:
            return 0
        else:
            return 1
    if X == 1:
        return 0
    # print (N - 1)
    if 1 < X <= 1 + a[N - 1]:
        # print ('A')
        return calc(N - 1, X - 1)
    if X == 2 + a[N - 1]:
        # print ('B')
        return p[N - 1] + 1
    if 2 + a[N - 1] < X <= 2 + 2 * a[N - 1]:
        # print ('C')
        return p[N - 1] + 1 + calc(N - 1, max(X - 2 - a[N - 1], 0))
    if X == 3 + 2 * a[N - 1]:
        # print ('D')
        return p[N]

print (calc(N, X))
x,y,z= map(int,input().split())
if sum(x,y,z)>21:
    print("bust")
else:
    print("win")


### FIXED CODE ###

x,y,z= map(int,input().split())
if x+y+z>21:
    print("bust")
else:
    print("win")
import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    if len(heap) == 1:
        print(1)
        return
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()
m=int(input())
n=int(input())
r=m
i=1
while r<n :
	r=r+m-1
	i+=1
print(i)


### FIXED CODE ###

s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)
n, x = map(int, input().split())
l = [int(i) for i in range(n)]
print(n+(x-sum(l))//min(l))

### FIXED CODE ###

n, x = map(int, input().split())
l = [int(input()) for _ in range(n)]
print(n+(x-sum(l))//min(l))
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = set(sorted(iil()))
print(set[-1]-set[0])


### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
A = set(sorted(iil()))
print(max(A)-min(A))
from math import factorial

def comb(n, r):
    return (factorial(n) // (factorial(n-r) * factorial(r)))


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


for i in range(1, k+1):
    print(comb(n-k+1, i) * comb(k-1, i-1) % (10**9+7))





### FIXED CODE ###

from math import factorial

def comb(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(n-r) * factorial(r))

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

for i in range(1, K+1):
    print(comb(N-K+1, i) * comb(K-1, i-1) % (10**9+7))
from itertools import product as pr
n,m,x=[int(i) for i in input().split()]
l=[[int(i) for i in input().split()]for j in range(n)]
p=list(pr([0,1],repeat=n))
suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p]
ans=min([i[0] for i in suml if all([i[j] >=x for j in range(1,6)])])
print(ans)

### FIXED CODE ###

from itertools import product as pr
n,m,x=[int(i) for i in input().split()]
l=[[int(i) for i in input().split()]for j in range(n)]
p=list(pr([0,1],repeat=n))
suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p]
ans=[i[0] for i in suml if all([i[j] >=x for j in range(1,m+1)])]
if len(ans)==0:
  print(-1)
else:
  print(min(ans))
from itertools import combinations

def getval():
    n,m = map(int,input().split())
    s = [list(map(int,input().split())) for i in range(m)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            s[i][j] -= 1
    p = list(map(int,input().split()))
    return n,m,s,p 

def main(n,m,s,p):
    l = [[] for i in range(n)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            l[s[i][j]].append(i)
    ans = 0
    for i in range(n+1):
        for c in combinations(range(n),i):
            temp = [0 for i in range(m)]
            for j in c:
                for k in l[j]:
                    temp[k] += 1
                    temp[k] %= 2
            if temp==p:
                ans += 1
    print(ans)

if __name__=="__main__":
    n,m,s,p = getval()
    main(n,m,s,p)from itertools import combinations

def getval():
    n,m = map(int,input().split())
    s = [list(map(int,input().split())) for i in range(m)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            s[i][j] -= 1
    p = list(map(int,input().split()))
    return n,m,s,p 

def main(n,m,s,p):
    l = [[] for i in range(n)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            l[s[i][j]].append(i)
    ans = 0
    for i in range(n+1):
        for c in combinations(range(n),i):
            temp = [0 for i in range(m)]
            for j in c:
                for k in l[j]:
                    temp[k] += 1
                    temp[k] %= 2
            if temp==p:
                ans += 1
    print(ans)

if __name__=="__main__":
    n,m,s,p = getval()
    main(n,m,s,p)

### FIXED CODE ###

from itertools import combinations

def getval():
    n,m = map(int,input().split())
    s = [list(map(int,input().split())) for i in range(m)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            s[i][j] -= 1
    p = list(map(int,input().split()))
    return n,m,s,p 

def main(n,m,s,p):
    l = [[] for i in range(n)]
    for i in range(m):
        for j in range(1,s[i][0]+1):
            l[s[i][j]].append(i)
    ans = 0
    for i in range(n+1):
        for c in combinations(range(n),i):
            temp = [0 for i in range(m)]
            for j in c:
                for k in l[j]:
                    temp[k] += 1
                    temp[k] %= 2
            if temp==p:
                ans += 1
    print(ans)

if __name__=="__main__":
    n,m,s,p = getval()
    main(n,m,s,p)
mport math 

a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
p = math.floor(z / x)
print(int(p * y))


### FIXED CODE ###

import math 

a,b,c= input().split()
x,y,z=(int(a),int(b),int(c))
p = math.floor(z / x)
print(int(p * y))
def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    accum = 0
    for i in range(N+1):
        B[i] = accum
        if i != N + 1:
            accum += A[i]
    
    for i, b in enumerate(B):
        x = b % M
        if x in d.keys():
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print(sum([i * (i - 1)//2 for i in d.values()]))
        


main()


### FIXED CODE ###


def main():
    N, M = [int(n) for n in input().split()]
    A = [int(n) for n in input().split()]
    B = [0]*(N+1)
    B[0] = 0
    d = {}
    accum = 0
    for i in range(N+1):
        B[i] = accum
        if i != N:
            accum += A[i]
    
    for i, b in enumerate(B):
        x = b % M
        if x in d.keys():
            d[x] += 1
        else:
            d[x] = 1
    # print(B)
    print(sum([i * (i - 1)//2 for i in d.values()]))
        
# import os,sys, time

# current = os.path.abspath(__file__ + "/..")+"/"
# fdr = open(current + "d-case1.txt", "r")
# sys.stdin = fdr
# t = time.time()
# main()
# print(time.time() - t)
if __name__ == "__main__":
    main()
N, K, X, Y, = map(int, input().split())


answer = 0
w = 0

# 高橋くんの宿泊数 N
# 宿泊費が変わる　 K
# 初期宿泊費      X
# K+1以降の宿泊費 Y

# wは宿泊数の超過分
if N - K >= 1:
    w = N - K
else:
    w = 0
# もしNよりKが大きい場合、そのまま計算する
#
if N < K :
    for i in range(N):
        answer = answer + X
    print(answer)
# KよりNが大きい場合
elif K < N:
    for i in range(K):
        answer = answer + X
    for i in range(w):
        answer = answer + Y
    print(answer)


### FIXED CODE ###

N = int(input())    # 宿泊数
K = int(input())    # 単価が切り替わる泊数
X = int(input())    # 単価a
Y = int(input())    # 単価b


if N <= K:
    a = N * X
else:
    a = K * X + Y * (N - K)

print(a)
# coding:utf-8
import readline
import datetime

H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())

while not 0 <= H1 < 23 and 0 <= M1 < 60 and 0 <= H2 < 23 and 0 <= M2 < 60:
	H1 = int(input())
	M1 = int(input())
	H2 = int(input())
	M2 = int(input())
	K = int(input())
else:
    if M2 > M1:
        a = (H2 - H1) * 60 + M2 - M1
        print(a - K)
    else:
        M2 < M1
        b = (H2 - H1) * 60 + M1 - M2
        print(b - K)

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline

h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)
def main():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    L = [(0, [])]
    R = [(0, [])]

    mp = 0
    mn = []
    for k in range(K):
        if k == len(V):
            break
        v = V[k]
        if v >= 0:
            mp += v
        else:
            mn.append(v)
            mn.sort()
        L.append((mp, tuple(mn)))

    mp = 0
    mn = []
    for k in range(K):
        i = len(V) - k - 1
        if i < 0:
            break
        v = V[i]
        if v >= 0:
            mp += v
        else:
            mn.append(v)
            mn.sort()
        R.append((mp, tuple(mn)))

    mval = 0
    for l in range(K + 1):
        if l == len(L) + 1:
            break
        lp, ln = L[l]
        for r in range(K - l):
            if l + r == len(V) or r == len(R) + 1:
                break
            rp, rn = R[r]
            val = rp + lp
            n = K - l - r
            if len(ln) + len(rn) > n:
                t = list(ln) + list(rn)
                t.sort()
                val += sum(t[n:])
            mval = max(mval, val)
    print(mval)


main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    L = [(0, [])]
    R = [(0, [])]

    mp = 0
    mn = []
    for _, v in zip(range(K), V):
        if v >= 0:
            mp += v
        else:
            mn.append(v)
            mn.sort()
        L.append((mp, tuple(mn)))

    mp = 0
    mn = []
    for _, v in zip(range(K), reversed(V)):
        if v >= 0:
            mp += v
        else:
            mn.append(v)
            mn.sort()
        R.append((mp, tuple(mn)))

    mval = 0
    for l, (lp, ln) in enumerate(L):
        for r, (rp, rn) in zip(range(K - l + 1), R):
            if l + r > len(V):
                break
            val = rp + lp
            n = K - l - r
            if len(ln) + len(rn) > n:
                t = list(ln) + list(rn)
                t.sort()
                val += sum(t[n:])
            mval = max(mval, val)
    print(mval)


main()
A = input()
B = input()
if 1 <= A <= 100 and 1 <= B <= 100:
  print(A*B)

### FIXED CODE ###

a,b = map(int,input(). split ())
print(a*b)
n=raw_input()
x=raw_input().split()

for i in reversed(len(x), 1):
  print x[i],

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,
a,b=map(int,input().sprit())
print(max(a*b,a-b,a+b))

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a*b,a-b,a+b))
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph,shortest_path,single_target_shortest_path,astar_path
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(N)]

G.add_edges_from(rows)
# shortestPath = shortest_path(G,target=1)
# shortestPath = single_target_shortest_path(G,target=1)
ans = ["Yes"]
for i in range(2,N+1):
    try:
        shortestPath = astar_path(G,source=i,target=1)
        ans.append(shortestPath[1])
    except:
        print("No")
        exit()

print(*ans,sep="\n")
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


### FIXED CODE ###

# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit,jit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
from networkx import Graph
from networkx.algorithms.traversal.breadth_first_search import bfs_predecessors
G = Graph()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk

# slist = "abcdefghijklmnopqrstuvwxyz"
N,M = map(int,input().split())
rows = [list(map(int,input().split())) for _ in range(M)]

G.add_edges_from(rows)

# shortestPath = shortest_path(G,target=1)
preds = bfs_predecessors(G,source=1)
# shortestPath = single_target_shortest_path(G,target=1)
# shortestPathLength,shortestPath = single_source_dijkstra(G,source=1)

preds = dict(preds)
if len(preds)+1 != N:
    print("No")
    exit()

print("Yes")
for i in range(2,N+1):
    print(preds[i])
from sys import stdin
n = int(input())
s = stdin.readline()
rind = []
gind = []
bind = []
ans = 0
for i in range(n):
    if s[i] == "R":
        rind.append(i+1)
    elif s[i] == "G":
        gind.append(i+1)
    else:
        bind.append(i+1)
for i in range(len(rind)):
    for j in range(len(gind)):
        for k in range(len(bind)):
            if (rind[i]+gind[j]!=2*bind[k])and(gind[j]+bind[k]!=rind[i])and(bind[k]+rind[i]!=gin[j]):
                ans += 1
print(ans)


### FIXED CODE ###

from sys import stdin
n = int(input())
s = stdin.readline()
r = 0
g = 0 
b = 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1
count1 = r*g*b
count2 = 0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        if 2*j-i<=n-1:
            if (s[i] != s[j])and(s[i] != s[2*j-i])and(s[j] != s[2*j-i]):
               count2 += 1
print(count1-count2)
import sys
bingo = [[],[],[]]
 
for i in range(3):
  a, b, c = map(int,input().split())
  bingo[i].append(a)
  bingo[i].append(b)
  bingo[i].append(c)
  
N = int(input())
  
for i in range(N):
  S = int(input())
  for j in range(3):
    if S in bingo[j]:
      for k in range(3):
        if S == bingo[j][k]:
          bingo[j][k] = 'ok'
          
ANS = 0
 
for i in range(3):
  for j in range(3):
    if bingo[i][j] == 'ok':
      ANS += 1
      if ANS == 3:
        print("Yes")
        sys.exit()
  ANS = 0
ANS = 0
 
for i in range(3):
  for j in range(3):
    if bingo[j][i] == 'ok':
      ANS += 1
      if ANS == 3:
        print("Yes")
        sys.exit()
  ANS = 0

if bingo[1][1] == 'ok':
  if bingo[0][0] == 'ok' and bingo[2][2] == 'ok':
    print("Yse")
    sys.exit()
  elif bingo[0][2] == 'ok' and bingo[2][0] == 'ok':
    print("Yse")
    sys.exit()
print("No")

### FIXED CODE ###

N = int(input())
print(int((N+1)/2))