Harryxun/stf_run huggingface dataset:
S = input()
s_len = len(S)
ans = [0 for _ in range(s_len)]

def L_checker(n):
    for i in range(n+1,s_len):
        if S[i]=='R':
            return i
    return s_len

def check(n, r_count):
    if S[n]=='R':
        check(n+1, r_count+1)
    else:
        next_r = L_checker(n)
        total = r_count+next_r-n
        if (total)%2==0:
            ans[n-1]=int((total)/2)
            ans[n]=int((total)/2)
        elif r_count%2==1:
            ans[n-1]=int((total)//2)+1
            ans[n]=int((total)//2)
        else:
            ans[n-1]=int((total)//2)
            ans[n]=int((total)//2)+1
        if next_r == s_len:
            print(*ans)
        else:
            check(next_r,0)

check(0,0)

### FIXED CODE ###

S = str(input())
s_len = len(S)
ans = [0 for _ in range(s_len)]
r_count = 0
l_count = 0
before = 0
switch = 'R'


for i in range(s_len):
    if S[i]==switch:
        if switch == 'R':
            r_count += 1
        else:
            l_count += 1
    else:
        if switch == 'L':
            switch = 'R'
            if (r_count+l_count)%2 == 0:
                ans[before] = (r_count+l_count)//2
                ans[before-1] = (r_count+l_count)//2
            elif r_count%2 == 0:
                ans[before] = (r_count+l_count)//2+1
                ans[before-1] = (r_count+l_count)//2
            else:
                ans[before] = (r_count+l_count)//2
                ans[before-1] = (r_count+l_count)//2+1
            r_count = 1
            l_count = 0
        else:
            switch = 'L'
            before = i
            l_count = 1


if (r_count+l_count)%2 == 0:
    ans[before] = (r_count+l_count)//2
    ans[before-1] = (r_count+l_count)//2
elif r_count%2 == 0:
    ans[before] = (r_count+l_count)//2+1
    ans[before-1] = (r_count+l_count)//2
else:
    ans[before] = (r_count+l_count)//2
    ans[before-1] = (r_count+l_count)//2+1

print(*ans)
import numpy as np

n,m,x=list(map(int,input().split()))
lis=[]
for i in range(n):
    l=list(map(int,input().split()))
    lis.append(l)


min=-1
for nnn in range(2**n):
    index=[]
    a=nnn
    for i in range(n):
        index.append(a%2)
        a//=2

    money=0
    xs=np.zeros(n)
    for i in range(n):
        if index[i]==1:
            money+=lis[i][0]
            xs+=np.array(lis[i][1:])
    if np.amin(xs)>=x:
        if min==-1:
            min=money
        elif min>money:
            min=money
print(min)

### FIXED CODE ###

import numpy as np

n,m,x=list(map(int,input().split()))
lis=[]
for i in range(n):
    l=list(map(int,input().split()))
    lis.append(l)


min=-1
for nnn in range(2**n):
    index=[]
    a=nnn
    for i in range(n):
        index.append(a%2)
        a//=2

    money=0
    xs=np.zeros(m)
    for i in range(n):
        if index[i]==1:
            money+=lis[i][0]
            xs+=np.array(lis[i][1:])
    if np.amin(xs)>=x:
        if min==-1:
            min=money
        elif min>money:
            min=money

print(min)
s=input()
print "Yes" if s.count("AC") else "No"


### FIXED CODE ###

print "Yes" if raw_input().count("AC") else "No"
def main():
    n = int(input())
    a = list(map(int,input().split()))
    al = [0 for i in range(n)]
    
    for i in a:
        al[a[i]-1] += 1
    for i in range(n):
        print(al[i])
main()

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
al = [0 for i in range(n)]

for i in a:
    al[i-1] += 1
for i in range(n):
    print(al[i])
n,w = map(int, input().split())
values = [0]
weights = [0]
counter=0
rest = 0

for i in range(n):
    v,weight = map(int, input().split())
    values.append(v)
    weights.append(weight)

dp=[[0 for i in range(w+1)]for j in range(v+1)]
for i in range(1, n+1):
    for j in range(1, w+1):
        rest = j
        counter = 0
        if(j >= weights[i]):
            while(rest-weights[i]>=0):
                counter = counter+1
                rest = rest - weights[i]
                dp[i][j] = max(dp[i][j], dp[i-1][j], dp[i-1][j-weights[i]*counter]+values[i]*counter)
        else:
            dp[i][j] = dp[i-1][j]

print(dp[n][-1])


### FIXED CODE ###

n,w = map(int, input().split())
values = []
weights = []

for i in range(n):
    v,weight = map(int, input().split())
    values.append(v)
    weights.append(weight)

dp = [0 for i in range(w+1)]

for i in range(n):
    for j in range(weights[i], w+1):
        dp[j] = max(dp[j], dp[j-weights[i]]+values[i])

print(dp[w])
N = int(input())
A = list(map(int,input().split()))

cnt = 0
for i in range(N):
    if A[i] == i+1:
        A[i],A[i+1] = A[i+1],A[i]
        cnt += 1
        i += 1
print(cnt)

### FIXED CODE ###

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

cnt = 0
for i in range(N-1):
    if A[i] == i+1:
        A[i],A[i+1] = A[i+1],A[i]
        cnt += 1
        i += 1
if A[N-1]==N:
    cnt += 1
print(cnt)
#!/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(int(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

N,C = map(int,sys.stdin.readline().split())
stc = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
M = 10**5
imos_s=[set() for _ in range(M+1)]
imos_e=[set() for _ in range(M+1)]

for s,t,c in stc:
    imos_s[s].add(c)
    imos_e[t+1].add(c)

#print(imos_s)
#print(imos_e)
s = set()
imos=[set()]*(M+1)
ret = 0
for i in range(M):
    imos[i+1] = (imos[i]-imos_e[i])|(imos_s[i])
    ret = max(ret,len(imos[i+1]))
#print(imos)
print(ret)

### 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(int(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

N,C = map(int,sys.stdin.readline().split())
stc = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
M = 10**5
imos=[[0]*(M+1) for _ in range(C+1)]

for s,t,c in stc:
    imos[c][s] += 1
    if t+1 < M+1:
        imos[c][t+1] -= 1

#print(imos)
s = set()
ret = 0
for i in range(M):
    for c in range(C+1):
        imos[c][i+1] += imos[c][i]
    ret = max(ret,sum(min(1,imos[c][i+1]) for c in range(C+1)))
#print(imos)
print(ret)
N = int(input())
if N%2 == 0:
    print(0.5)
else:
    a = ((N+1)/

### FIXED CODE ###

N = int(input())
if N%2 == 0:
    print(0.5)
else:
    a = ((N+1)/2)/N
    print(a)
b = [int(x) for x in input().split()]
 
if (b < a):
    tmp = b
    b = a
    a = tmp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
    if (x > 1500):
            print(-1)
            break
    else:
            x += 1

### FIXED CODE ###

a, b = [int(x) for x in input().split()]
 
if (b < a):
    tmp = b
    b = a
    a = tmp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
        if (x > 1500):
            print(-1)
            break
        else:
            x += 1
n=int(input())
p=list(map(int,input().split()))
c=0
for i in range(n):
    if i!=n-1
        if p[i]==i+1:
            d=p[i+1]
            p[i+1]=p[i]
            p[i]=d
            c+=1
    else:
        if p[i]==i+1:
            c+=1
print(c)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
c=0
for i in range(n):
    if i!=n-1:
        if p[i]==i+1:
            d=p[i+1]
            p[i+1]=p[i]
            p[i]=d
            c+=1
    else:
        if p[i]==i+1:
            c+=1
print(c)
a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    k = int(input())
     
    if e - a <= k:
        print('Yay!')
    else:
        print(':(')

### FIXED CODE ###


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
    
if e - a <= k:
    print('Yay!')
else:
    print(':(')
5 3
5
7
5
7
7

### FIXED CODE ###

n, k = map(int, input().split())
h = sorted([int(input()) for i in range(n)])

res = h[k-1] - h[0]
for i in range(k, n):
    tmp = h[i] - h[i-k+1]
    res = min(res, tmp)

print(res)
S = input()
T = input()
W = 0
for i in range(len(S)):
    if S[i] != T[i]:
        w += 1
print(W)

### FIXED CODE ###

S = input()
T = input()
W = 0
for i in range(len(S)):
    if S[i] != T[i]:
        W += 1
print(W)
h,w = map(int,input().split())
s = [input() for _ in range(h)]
res = 0
def migi(i,j):
    if j >= w-1:
        return 0
    if s[i][j+1] == ".":
        return migi(i,j+1)+1
    else:
        return 0
def hidari(i,j):
    if j <= 0:
        return 0
    if s[i][j-1] == ".":
        return hidari(i,j-1)+1
    else:
        return 0
def ue(i,j):
    if i <= 0:
        return 0
    if s[i-1][j] == ".":
        return ue(i-1,j)+1
    else:
        return 0
def shita(i,j):
    if i >= h-1:
        return 0
    if s[i+1][j] == ".":
        return shita(i+1,j)+1
    else:
        return 0
    
for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            res = max(res,migi(i,j)+hidari(i,j)+ue(i,j)+shita(i,j)+1)
            if res == h+w-1:break

print(res)

### FIXED CODE ###

h,w = map(int,input().split())
s = ["#"*(w+2)]+["#"+input()+"#" for _ in range(h)]+["#"*(w+2)]
res = 0
l = [[0 for _ in range(w+2)] for _ in range(h+2)]
r = [[0 for _ in range(w+2)] for _ in range(h+2)]
d = [[0 for _ in range(w+2)] for _ in range(h+2)]
u = [[0 for _ in range(w+2)] for _ in range(h+2)]
for i in range(1,h+1):
    for j in range(1,w+1):
       if s[i][j]==".":
           l[i][j]=l[i][j-1]+1 
           d[i][j]=d[i-1][j]+1 
for i in range(h,0,-1):
    for j in range(w,0,-1):
       if s[i][j]==".":
           r[i][j]=r[i][j+1]+1 
           u[i][j]=u[i+1][j]+1 


for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == ".":
            res = max(res,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3)
            if res == h+w-1:break

print(res)
n = int(input())

a = sorted(list(map(int,input().split())))

count = 1

for i in a:
    count*=i

x = 10**18

if count > x:
    print(-1)
    break
else:
    print(count)

### FIXED CODE ###

n = int(input())

a = sorted(list(map(int,input().split())))

count = 1

for i in range(n):
    count*=a[i]
    if count>10**18:
        print(-1)
        break

else:
    print(count)
mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    n, m = map(int,raw_input().split())
    
    adj_list = [[] for _ in range(n+5)]
    
    q = []
    
    ans = [-1] * (n+5)
    
    failed = False
    
    for _ in range(m):
        a, b = map(int,raw_input().split())    
        adj_list[a].append(b)
        adj_list[b].append(a)
    
    q.append(1)
    
    #print(adj_list)
    
    visited = set()
    
    visited.add(1)
    
    while len(q):
        sz = len(q)
        for _ in range(sz):
            cur = q.pop(0)
            for nei in adj_list[cur]:
                if nei not in visited:
                    ans[nei] = cur
                    q.append(nei)
                    visited.add(nei)
    
    
    print('Yes')
    for i in range(2, n+1):
        print(ans[i])
            
            
        
        
    
    

main()

### FIXED CODE ###

from collections import deque

mod = int(1e9+7)
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    n, m = map(int,raw_input().split())
    
    adj_list = [[] for _ in range(n+5)]
    
    q = deque()
    
    ans = [-1] * (n+5)
    
    failed = False
    
    for _ in range(m):
        a, b = map(int,raw_input().split())    
        adj_list[a].append(b)
        adj_list[b].append(a)
    
    q.append(1)
    
    #print(adj_list)
    
    visited = set()
    
    visited.add(1)
    
    while len(q):
        sz = len(q)
        for _ in range(sz):
            cur = q.popleft()
            for nei in adj_list[cur]:
                if nei not in visited:
                    ans[nei] = cur
                    q.append(nei)
                    visited.add(nei)
    
    
    print('Yes')
    for i in range(2, n+1):
        print(ans[i])
            
            
        
        
    
    

main()
N = input()
if N in 9:
  print("Yes")
else print("No")


### FIXED CODE ###

N = input()
if "9" in N:
	print("Yes")
else:
	print("No")
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)//(4*M)
print("Yes" if vote_result_list[M] >= border else "No")

### FIXED CODE ###

N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)/(4*M)
print("Yes" if vote_result_list[M-1] >= border else "No")
S = list(input())
T = input()
for c in range(len(S),len(T)-1,-1):
    for i in range(len(T)):
        if S[c-len(T)+i]!='?' and S[c-len(T)+i]!=T[i]:
            i = 0
            break
    if i>0:
        for j in range(len(T)):
            S[c-len(T)+j]=T[j]
        break
if i>0:
    for j in S:
        if j=='?':
            print('a',end='')
        else:
            print(j,end='')
else:
    print('UNRESTORABLE',end='')
print()

### FIXED CODE ###

S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))
import math
r = int(input())

pi =math.pi

print(r*r*pi,2*r*pi)


### FIXED CODE ###

import math
r = float(input())

pi =math.pi

print('%.10f %.10f'%(r*r*pi,2*r*pi))
import math

n = int(input())

cnt = 0
def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

for i in range(n+1):
    if i%2==0 and search_divisor_num_1(i) == 8:
        cnt += 1

print(cnt)

### FIXED CODE ###

import math

n = int(input())

cnt = 0

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

for i in range(n+1):
    if i%2==1 and search_divisor_num_1(i) == 8:
        cnt += 1

print(cnt)
a,b = map(int,input().split())
d = []
f = 0
for i in range(1,1000):
    f += i
    d.append(f)
c = []
for j in range(b) :
    c.append(abs(d[j]-a))
print(min(c)) 
    

### FIXED CODE ###

a,b = map(int,input().split())
s = b-a
d = []
f = 0
for i in range(1,1000):
    f += i
    d.append(f)

print(d[s-1]-b)
a = sorted(list(map(int, input().split())))
if a[2]-a[1]>=1:
  print(a[2]*2-1)

### FIXED CODE ###

a = sorted(list(map(int, input().split())))
if a[1]-a[0] >= 1:
  print(a[1]*2-1)
else:
  print(a[1]*2)
s = input()
q = int(input())
query = [list(input().replace(' ','')) for _ in range(q)]

r = False
for i in range(q):
    if r:
        if len(query[i]) == 1:
            r = False
        elif query[i][1] == '1':
            s = s + query[i][2]
        else:
            s = query[i][2] + s
    else:
        if len(query[i]) == 1:
            r = True
        elif query[i][1] == '1':
            s = query[i][2] + s
        else:
            s = s + query[i][2]

if r:
    print(s[::-1])
else:
    print(s)

### FIXED CODE ###

s = str(input())
station_a = s.count('A')
station_b = s.count('B')
if station_a != 3 and station_b != 3:
    print('Yes')
else:
    print('No')
n, k = map(int, input().split())

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

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag:
        a[i+k-1] = b
    ret += 1

print(ret)

### FIXED CODE ###

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

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

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag and i+k-1 < len(a):
        a[i+k-1] = b
    ret += 1

print(ret)
S = list(input())
print(S)

for v in S[0::2]
    print(v)

### FIXED CODE ###

from sys import stdin

s = list(input())
result = ""

for ch in range(0,len(s)):
    if (ch + 1) % 2 != 0:
        result += s[ch]
    else:
        pass

print(result)
import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

# スタート＋
if a[0] <= 0:
    A1 = 1
    ans1 += abs(a[0]) + 1
else:
    A1 = a[0]
    ans1 = 0
for i in range(1, n):
    nextA = A1 + a[i]
    if (A1 > 0 and nextA < 0) or (A1 < 0 and nextA > 0):
        A1 = nextA
    elif nextA == 0 and A1 > 0:
        ans1 += 1
        A1 = -1
    elif nextA == 0 and A1 < 0:
        ans1 += 1
        A1 = 1
    elif A1 > 0:
        ans1 += abs(nextA) + 1
        A1 = -1
    else:
        ans1 += abs(nextA) + 1
        A1 = 1

# スタート-
if a[0] >= 0:
    ans2 = abs(a[0]) + 1
    A2 = -1
else:
    A2 = a[0]
    ans2 = 0
for i in range(1, n):
    nextA = A2 + a[i]
    if (A2 > 0 and nextA < 0) or (A2 < 0 and nextA > 0):
        A2 = nextA
    elif nextA == 0 and A2 > 0:
        ans2 += 1
        A2 = -1
    elif nextA == 0 and A2 < 0:
        ans2 += 1
        A2 = 1
    elif A2 > 0:
        ans2 += abs(nextA) + 1
        A2 = -1
    else:
        ans2 += abs(nextA) + 1
        A2 = 1

print(min(ans1, ans2))




### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = [int(x) for x in input().split()]

# スタート＋
if a[0] <= 0:
    A1 = 1
    ans1 = abs(a[0]) + 1
else:
    A1 = a[0]
    ans1 = 0
for i in range(1, n):
    nextA = A1 + a[i]
    if (A1 > 0 and nextA < 0) or (A1 < 0 and nextA > 0):
        A1 = nextA
    elif nextA == 0 and A1 > 0:
        ans1 += 1
        A1 = -1
    elif nextA == 0 and A1 < 0:
        ans1 += 1
        A1 = 1
    elif A1 > 0:
        ans1 += abs(nextA) + 1
        A1 = -1
    else:
        ans1 += abs(nextA) + 1
        A1 = 1

# スタート-
if a[0] >= 0:
    ans2 = abs(a[0]) + 1
    A2 = -1
else:
    A2 = a[0]
    ans2 = 0
for i in range(1, n):
    nextA = A2 + a[i]
    if (A2 > 0 and nextA < 0) or (A2 < 0 and nextA > 0):
        A2 = nextA
    elif nextA == 0 and A2 > 0:
        ans2 += 1
        A2 = -1
    elif nextA == 0 and A2 < 0:
        ans2 += 1
        A2 = 1
    elif A2 > 0:
        ans2 += abs(nextA) + 1
        A2 = -1
    else:
        ans2 += abs(nextA) + 1
        A2 = 1

print(min(ans1, ans2))
a,b,c=(int(i) for i in input().split())
if b+1>c:
  print(b+c)
else:
  if a+1>c-b:
    print(2*b+c)
  else:
    print(2b+a+1)

### FIXED CODE ###

a,b,c=(int(i) for i in input().split())
if b+1>=c:
  print(b+c)
else:
  if a+1>=c-b:
    print(b+c)
  else:
    print(2*b+a+1)
#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        ll = ll + i
    else:
        k.append(i)
c = np.array(k)
s += c.sum()
if s%10==0 and len(k) !=0:
    s = s - k[0]
    s = s + ll
elif s%10 ==0:
    s = 0
    s = s + ll
print(s)

### FIXED CODE ###

#C Bugged
import numpy as np
a = int(input())
k   = []
k10 = []
s = 0

for j in range(a):
    i = int(input())
    if i % 10 == 0:
        k10.append(i)
        s += i
    else:
        k.append(i)
k.sort()
c = np.array(k)
l = c.sum()
if l%10==0 and len(k) !=0:
    l = l - c[0]
    s = s + l
elif len(k) == 0:
    s = 0
else:
    s = s + l
print(s)
s = input()
count = 0
for i in range(3):
  if s[i] == 'o':
    count+=1
pront(count*100 + 700)

### FIXED CODE ###

s = input()
count = 0
for i in range(3):
  if s[i] == 'o':
    count+=1
print(count*100 + 700)
N = int(input())
lista = []
for n in range(N):
    listan = []
    an = int(input())
    for n in range(an):
        listxy = tuple(map(int, input().split()))
        listan.append(listxy)
        listset = tuple(listan)
    lista.append(listset)    
tuplea = tuple(lista)    
#print(lista)
ansfin = 0
for n in range(2**N):
    bin2 = list(bin(n))[2:]
    bin2.reverse()
    #print(bin2)
    l = len(bin2)
    rightwrong = set()
    #print(l)
    setright = set()
    for n in range(N):
        if n<l:
            #print(bin2[n])
            if bin2[n] == str(1):
                rightwrong.add((n+1, 1))
                lo = len(tuplea[n])
                for m in range(lo):
                    setright.add(tuplea[n][m])
            else:
                rightwrong.add((n+1, 0))
        else:
            rightwrong.add((n+1, 0))  
    #print('a')                     
    #print(setright)
    #print(rightwrong)
    if setright.issubset(rightwrong):
        ans = bin2.count(str(1))
        if ansfin>=ans:
            pass
        else:
            ansfin = ans
    #print(ans)    
print(ansfin)    


### FIXED CODE ###

N = int(input())
lista = []
for n in range(N):
    listan = []
    an = int(input())
    for n in range(an):
        listxy = tuple(map(int, input().split()))
        listan.append(listxy)
    listset = tuple(listan)
    lista.append(listset)    
tuplea = tuple(lista)    
#print(lista)
ansfin = 0
for n in range(2**N):
    bin2 = list(bin(n))[2:]
    bin2.reverse()
    #print(bin2)
    l = len(bin2)
    rightwrong = set()
    #print(l)
    setright = set()
    for n in range(N):
        if n<l:
            #print(bin2[n])
            if bin2[n] == str(1):
                rightwrong.add((n+1, 1))
                lo = len(tuplea[n])
                for m in range(lo):
                    setright.add(tuplea[n][m])
            else:
                rightwrong.add((n+1, 0))
        else:
            rightwrong.add((n+1, 0))  
    #print('a')                     
    #print(setright)
    #print(rightwrong)
    if setright.issubset(rightwrong):
        ans = bin2.count(str(1))
        if ansfin>=ans:
            pass
        else:
            ansfin = ans
    #print(ans)    
print(ansfin)