Harryxun/stf_run huggingface dataset:
#https://atcoder.jp/contests/abc167/tasks/abc167_c C - Skill Up
import numpy as np
from itertools import combinations
N,M,X=list(map(int,input().split()))
book_dict={}
for i in range(M):
    book_dict[i] = list(map(int,input().split()))

answer = 10**5*12+1
for i in range(M,0,-1):
    for v in combinations(book_dict.keys(), i):
        search_book = list(map(lambda x:book_dict[x],list(v)))
        sum_search_book = np.array(np.sum(search_book,axis = 0))
        if (np.count_nonzero(sum_search_book[1:] >= X) == N) and sum_search_book[0] < answer:
            answer = sum_search_book[0]
                                                                                 
           
        
        
    

print(answer)


### FIXED CODE ###

#https://atcoder.jp/contests/abc167/tasks/abc167_c C - Skill Up
import numpy as np
from itertools import combinations
N,M,X=list(map(int,input().split()))
book_dict={}
for i in range(N):
    book_dict[i] = list(map(int,input().split()))

answer = (10**5*12)+1
for i in range(N,0,-1):
    for v in combinations(book_dict.keys(), i):
        search_book = list(map(lambda x:book_dict[x],list(v)))
        sum_search_book = np.array(np.sum(search_book,axis = 0))
        if (np.count_nonzero(sum_search_book[1:] >= X) == M) and sum_search_book[0] < answer:
            answer = sum_search_book[0]
                                                                                 
    
if answer == (10**5*12)+1:
    answer = -1

print(answer)
R, G, B, N = map(int, input().split())
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1 - r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count

### FIXED CODE ###

R, G, B, N = map(int, input().split())
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1-r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)
import sys
from collections import deque
import copy
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] = [(input_raw[0])]
    head = 0
    tail = len(S) - 1
    count = 0
    #for i in range(len(S)/2 + len(S) % 2):
    while 1:
        if head == tail:
            break
        if S[head] != S[tail]:
            if S[head] == "x":
                count += 1
                head += 1
            elif S[tail] == "x":
                count += 1
                tail -= 1
            else:
                print -1
                return
        else:
            head += 1
            tail -= 1
    print count


if __name__ == '__main__':
    main()


### FIXED CODE ###


import sys
from collections import deque
import copy
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] = [(input_raw[0])]
    head = 0
    tail = len(S) - 1
    count = 0
    #for i in range(len(S)/2 + len(S) % 2):
    while 1:
        if head >= tail:
            break
        if S[head] != S[tail]:
            if S[head] == "x":
                count += 1
                head += 1
            elif S[tail] == "x":
                count += 1
                tail -= 1
            else:
                print -1
                return
        else:
            head += 1
            tail -= 1
    print count


if __name__ == '__main__':
    main()
N = int(input())
x = []
y = []
for _ in range(N):
  inp = input().split(' ')
  x += inp[0]
  y += inp[1]
x = list(map(int, x))
y = list(map(int, y))

pq = {}
for i in range(N):
  for j in range(N):
    if i == j:
      break
    
    xydif = (x[i]-x[j], y[i]-y[j])
    
    if xydif not in pq:
      pq[xydif] = 1
    else:
      pq[xydif] += 1

print(N - max(pq.values()))

### FIXED CODE ###

input_line = input().split(' ')
N = int(input_line[0])
K = int(input_line[1])

print(N%K)
import numpy as np
N,K = map( int ,input().split())
A = np.array([[0] * N for i in range(K)])
sum_A = np.array([0]*N)
x = 0
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        A[d-1][num_list[j]-1] = 1
for k in range(K):
    sum_A += A[k] 
for l in range(K):
    if sum_A[l] == 0:
        x += 1
print(x)

### FIXED CODE ###

N,K = map( int ,input().split())
N_list = [0]*N
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        N_list[num_list[j]-1] +=1
print(N_list.count(0))
a = [input() for i in range(2)]
print (6-a[0]-a[1])

### FIXED CODE ###

A = input()
B = input()
print(6-int(A)-int(B))
import math
n = int(input())
arr = list(map(int,input().split()))


def min_cost(arr):
    dp = [math.inf for _ in range(len(arr))]
    dp[0] = 0
    for i in range(len(arr)+1):
        for j in range(i+1,i+3):
            if   j < len(arr):
                dp[j] =  min(dp[j],dp[i] + abs(arr[i]-arr[j]))
        
    return dp[len(arr)-1]
 
print(min_cost(arr))

### FIXED CODE ###

import math
def min_cost(arr):
    n = len(arr)
    dp = [0 for _ in range(n)]
    dp[1] = abs(arr[1]- arr[0])
    for i in range(2,n):
        dp[i] =  min(dp[i-1] + abs(arr[i] - arr[i-1]),dp[i -2 ] + abs(arr[i]-arr[i-2]))
        
    return dp[n-1]

n = input()
arr = list(map(int,input().split()))
print(min_cost(arr))
N = int(input())
dish = []
 for i in range(N):
     a, b = map(int, input().split())
     dish.append((a+b, (a,b)))

"""while True:
    try:
        a, b = map(int, input().split())
    except EOFError:
        break
    dish.append((a+b, (a,b)))
"""

l = sorted(dish)

t=a = 0
for i, (_, (a_i, b_i)) in enumerate(l):
    if i % 2 == 0:
        #takahashi
        t += a_i
    else:
        a += b_i

print(t-a)


### FIXED CODE ###

n, x, y = [int(i) for i in input().split()]
tmp = x+y-n
if tmp <= 0:
    tmp = 0
print(min(x, y), tmp)
x,y,z=map(int,input().split())
print(f"{z} {x} {y}")

### FIXED CODE ###

x,y,z=map(int,input().split())
print(z,x,y)
x = int(input())
table = [1]
for i in range(2,1000):
	b = 2
	while i**b <= 1000:
		table.append(i**b)
		b += 1
table.sort()
k = 0
while table[k] <= x:
	k += 1
print(table[k-1])

### FIXED CODE ###

x = int(input())
table = [1]
for i in range(2,1000):
	b = 2
	while i**b <= 1000:
		table.append(i**b)
		b += 1
table.sort()
k = 0
while k <= len(table)-1 and table[k] <= x:
	k += 1
print(table[k-1])
a,b = input().split()
if (a*b)%2==1:
    print("Odd")
else:
    print("Even")

### FIXED CODE ###

a,b = map(int,input().split())
if a*b%2==1:
    print("Odd")
else:
    print("Even")
A, B = map(int, input())

print(A*B

### FIXED CODE ###

A,B = map(int, input().split())
print(A*B)
import numpy as np
n,m = map(int,input().split())
A = np.zeros((n,n),dtype=np.int8)
for i in range(m):
    a,b = map(int,input().split())
    A[a-1,b-1] = 1
    A[b-1,a-1] = 1
print(A)
if 1 in A[np.where(A[0] == 1),n-1][0]:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

import numpy as np
n,m = map(int,input().split())
A1 = np.zeros(n,dtype=bool)
Ai = np.zeros(n,dtype=bool)
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        A1[b-1] = True
    if b == n:
        Ai[a-1] = True
if np.any(Ai[A1]):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print(Yes)
else:
    print(No)



### FIXED CODE ###

a=int(input())
b=int(input())
c=a%500
if b>=c:
    print("Yes")
else:
    print("No")
a, b = map(int, raw_input().split())

if a < b:
    print a < b

elif a > b:
    print a > b

else
    print a == b

### FIXED CODE ###

a, b = map(int, raw_input().split())

if a < b:
    print "a < b"

elif a > b:
    print "a > b"

elif a == b:
    print "a == b"
def add(a):
	if int(a)>n:
		return 0
	else:
		ans = 0
		a = '' if int(a)==0 else a
		if a.find('3')>-1 and a.find('5')>-1 and a.find('7')>-1:
			ans+=1
		for i in [3,5,7]:
			ans+=add(a+str(i))
		return ans

n = int(input())
print(add(''))


### FIXED CODE ###

def add(a):
	if int(a)>n:
		return 0
	else:
		ans = 0
		a = '' if int(a)==0 else a
		if a.find('3')>-1 and a.find('5')>-1 and a.find('7')>-1:
			ans+=1
		for i in [3,5,7]:
			ans+=add(a+str(i))
		return ans

n = int(input())
print(add('0'))
def main():
    import collections
    import sys
    sys.setrecursionlimit(50000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
        list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
        list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
        list23=[]
        if RGB_list[2][0]==0 or RGB_list[1][0]==0:
            print(0)
        else:
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))
            print(sys.getrecursionlimit())

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<3:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()
S = int(input() S >= 10000)
s = int(input())
a = int(h = (S / 3600), m = ((S % 3600) / 60), for s in range(0, 60):.split )
print('a')

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
n=int(input())
s=list(input())
count=0
for i in range(n):
  if i<=48:
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      count+=1
    
print(count)


### FIXED CODE ###

n=int(input())
s=list(input())
count=0
for i in range(n-2):
  if i<=48 :
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      count+=1
    
print(count)
MOD = int(10**9+7)
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)

if n%2 == 0:
    valid = True
    for i in range(n):
        if i%2 == 0: v = i+1
        else: v = i
        if a[i] != v:
            valid = False
            print(0)
            break
    if valid:
        print(int((2**(n/2))%MOD))

else:
    valid = True
    for i in range(n):
        if i%2 != 0: v = i+1
        else: v = i
        if a[i] != v:
            valid = False
            print(0)
            break
    if valid:
        print(int(2**((n-1)/2))%MOD)

### FIXED CODE ###

MOD = 10**9+7
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)

if n%2 == 0:
    valid = True
    for i in range(n):
        if i%2 == 0: v = i+1
        else: v = i
        if a[i] != v:
            valid = False
            print(0)
            break
    if valid:
        print(2**(n//2)%MOD)

else:
    valid = True
    for i in range(n):
        if i%2 != 0: v = i+1
        else: v = i
        if a[i] != v:
            valid = False
            print(0)
            break
    if valid:
        print(2**(n//2)%MOD)
import sys
input = sys.stdin.readline

n = int(input())
al = list(map(int,input().split()))

from collections import defaultdict
G = defaultdict(list)

for _ in range(n-1):
    u,v = map(int,input().split())
    G[u-1].append(v-1)
    G[v-1].append(u-1)

import bisect
ansl = [0 for i in range(n)]
dp = [float("inf") for _ in range(n)]
used = [0 for i in range(n)]
used[0] = 1


stack = []
def dfs(pos):
    idx = bisect.bisect_left(dp, al[pos])
    stack.append((idx, dp[idx]))
    dp[idx] = min(al[pos], dp[idx])
    ansl[pos] = bisect.bisect_left(dp, 10**18)
    for v in G[pos]:
        if used[v] == 0:
            used[v] = 1
            dfs(v)
            idx, k = stack.pop()
            dp[idx] = k


dfs(0)
flag = False
for i in range(n):
    print(ansl[i])




### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

import sys
input = sys.stdin.readline

n = int(input())
al = list(map(int,input().split()))

from collections import defaultdict
G = defaultdict(list)

for _ in range(n-1):
    u,v = map(int,input().split())
    G[u-1].append(v-1)
    G[v-1].append(u-1)

from bisect import bisect
ansl = [0 for i in range(n)]
dp = [float("inf") for _ in range(n+1)]
dp[0] = -1
used = [0 for i in range(n)]
used[0] = 1


stack = []
def dfs(pos):
    idx = bisect(dp, al[pos] - 1)
    stack.append((idx, dp[idx]))
    dp[idx] = min(al[pos], dp[idx])
    ansl[pos] = bisect(dp, 10**18) - 1
    for v in G[pos]:
        if used[v] == 0:
            used[v] = 1
            dfs(v)
            idx, k = stack.pop()
            dp[idx] = k


dfs(0)
flag = False
for i in range(n):
    print(ansl[i])
n.k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[i+k] == t[i]:
        t[i+k] == 0
x = t.count("r")*p+t.count("S")*r+t.count("p")*s
print(x)

### FIXED CODE ###

n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[k+i] == t[i]:
        t[k+i] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)
D, T, S = map(input().split())

print('Yes' if D <T*S else 'No')

### FIXED CODE ###

D, T, S = map(int, input().split())

print('Yes' if D <= T*S else 'No')
S = input()
S[0]= 2018
print("/".join(S))

### FIXED CODE ###

S = input().split("/")
S[0]= "2018"
print("/".join(S))
# -*- coding: utf-8

while True:
   if map(int,raw_input().split()) == [0,0]:
      break
   else:
      A = map(int,raw_input().split())
      for i in range(A[0]):
         print('#'*A[1])
         print('\n')



### FIXED CODE ###

# -*- coding: utf-8

while True:
   a = map(int,raw_input().split())
   if a == [0,0]:
      break
   for i in range(a[0]):
      print('#'*a[1])
   print('')
main(int_list):
  sorted_list = sort(int_list)
  print str(sorted_list[0]) + ' ' + str(sorted_list[1]) + ' ' + str(sorted_list[2]) + ' ' 

int_list = []
input_string = raw_input()
input_list = raw_input().split(' ')
for i in input_list:
  int_list.append(int(i))

main(int_list)

### FIXED CODE ###

a, b, c = sorted(map(int, raw_input().split()))
print a, b, c
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""
alice = int(input())
bob = int(input())

if(alice == bob):
    print("Draw)
elif(alice == 1 and bob == 1):
    print("Draw")
    
elif(alice == 1):
    print("Alice")
elif(bob == 1):
    print("Bob")
elif(alice < bob):
    print("Bob")
elif(alice > bob):
    print("Alice")


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""
alice = input().split()
alice[0] = int(alice[0])
alice[1] = int(alice[1])
if(alice[0] == alice[1]):
    print("Draw")
elif(alice[0] == 1):
    print("Alice")
elif(alice[1] == 1):
    print("Bob")
elif(alice[0] < alice[1]):
    print("Bob")
elif(alice[0] > alice[1]):
    print("Alice")
N,K = map(int,input().split())
A = list(map(int,input().split()))
L = []
for i in range(N):
    for j in range(1,N+1):
        if i > j - 1:
            continue
        else:
            l = A[i:j]
            L.append(sum(l))
L.sort()
border = 2 ** (len(str(bin(L[-K]))[2:]) - 1)
L = [e for e in L if e >= border]
def combinationListRecursive(data, r):
  if r == 0 or r > len(data):
    return []

  result = []
  _combinationListRecursive(data, r, 0, [], result)
  return result


def _combinationListRecursive(data, r, start, progress, result):
  if r == 0:
    result.append(progress)
    return

  for i in range(start, len(data)):
    _combinationListRecursive(data, r - 1, i + 1, progress + [data[i]], result)

result = combinationListRecursive(L,K)
ans_list = []
for list_c in result:
    for e in list_c:
        if e == list_c[0]:
            copy = e
            continue
        AND = copy & e
        if e == list_c[-1]:
            ans = AND
            ans_list.append(ans)
            break
        copy = AND
print(max(ans_list))

### FIXED CODE ###

def debug():
    import itertools
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    beauty = []
    for i in range(N):
        for j in range(i+1,N+1):
            part = a[i:j]
            beauty.append(sum(part))
    choise = [e for e in itertools.combinations(beauty,K)]
    ans = 0
    for pair in choise:
        res = pair[0]
        for i in range(1,len(pair)):
            res = res & pair[i]
        if res > ans :
            ans = res
            adopt = pair
    print(ans)
    print(pair)
    print(sorted(beauty))

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    degit = sum(a).bit_length()
    beaty = []
    manage = [[] for i in range(degit)]
    for i in range(N):
        for j in range(i+1,N+1):
            part_sum = sum(a[i:j])
            manage[part_sum.bit_length()-1].append(part_sum)
    
    candidate = []
    for i in range(degit-1,-1,-1):
        if len(manage[i]) >= K:
            candidate = manage[i]
            note = i
            break

    for i in range(note,-1,-1):
        final = []
        judge = pow(2,i)
        for e in candidate:
            if judge == judge & e:
                final.append(e)
        if len(final) == K:
            break
        elif len(final) > K:
            candidate = final
        if i == 0:
            final = candidate[:K]

    ans = final[0]
    for i in range(1,K):
        ans = ans & final[i]
    print(ans)    
main()
s = input()
p = input()

s *= 2

if s.finr(p) != -1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
p = input()

s *= 2

if s.find(p) != -1:
    print("Yes")
else:
    print("No")
n,l=map(int,input().split())

taste = []

for i in range(n):
    taste.append(l+i-1)

sum_taste = sum(taste)

taste_pie = []

for i in range(n):
    taste_pie.append(sum_taste - taste[i])

sub_min = 0
sub = []

for i in range(n):
    sub.append(sum_taste - taste_pie[i])
    
sub_min = min(sub)

for i in range(n):
    if sub_min == (sum_taste - taste_pie[i]):
        print(taste_pie[i])
        break

### FIXED CODE ###

num = input()
#num = str(code)

if num[0] == num[1] or num[1] == num[2] or num[2] == num[3]:
    print('Bad')
else:
    print('Good')
S=input()
list1=list(S)
if list1[0]==list1[2]==list1[3]==list1[4]:
  print("No")
else:
  if list1[0]==list1[1] and list1[2]==list1[3]:
    print("Yes")
  elif list1[0]==list1[2] and list1[1]==list1[3]:
    print("Yes")
  elif list1[0]==list1[3] and list1[1]==list1[2]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

S=input()
list1=list(S)
if list1[0]==list1[1]==list1[2]==list1[3]:
  print("No")
else:
  if list1[0]==list1[1] and list1[2]==list1[3]:
    print("Yes")
  elif list1[0]==list1[2] and list1[1]==list1[3]:
    print("Yes")
  elif list1[0]==list1[3] and list1[1]==list1[2]:
    print("Yes")
  else:
    print("No")
n, k, q = map(int,input().split())

A = [int,input() for i in range(q)]

a = q-k+1

for i in range(1,n+1):
    v = A.count(i)
    if v >= a and v > 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
n = [K - Q] * N
for i in range(Q):
    n[A[i]-1] += 1
for i in range(N):
    if n[i] > 0:
        print('Yes')
    else:
        print('No')
a,b,c = map(input().split())

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)


### FIXED CODE ###

A = list(input())

n = A.count('R')
if n != 2:
    print(n)
else:
    m = A.index('S')
    if m == 1:
        print(1)
    else:
        print(2)
k, x = int(input().split())
if 500*k >= x:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

k, x = map(int,input().split())
if 500*k >= x:
    print('Yes')
else:
    print('No')
n, m = map(int, input().split())

Mat = [[]]

for i in range(n):
	row = list(map(int, input().split()))
	Mat.append(row)

b = []

for j in range(m):
	b.append(int(input()))

c = [0 for k in range(n)]

for l in range(n):
	for l2 in range(m):
		c[l] += (Mat[l][l2] * b[l2])
	print(c[l])

### FIXED CODE ###

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

Mat = []

for i in range(n):
	row = list(map(int, input().split()))
	Mat.append(row)

b = []

for j in range(m):
	b.append(int(input()))

c = [0 for k in range(n)]

for l in range(n):
	for l2 in range(m):
		c[l] += (Mat[l][l2] * b[l2])
	print(c[l])
# 誤読

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

layer = 1
for _ in range(N):
    layer = layer * 2 + 3

def calc(n, i, layer):
    if n == 1:
        return "BPPPB"[i-1]
    else:
        if i == layer // 2 + 1:
            return "P"
        
        if i > layer // 2:
            i = layer - i + 1
        
        return calc(n-1, i, (layer-3) // 2)

ans = calc(N, X, layer)
print(ans)


### FIXED CODE ###

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

cntP = [0]*(N+1)
cntP[0] = 1
for i in range(1, N+1):
    cntP[i] = cntP[i-1] * 2 + 1

layer = 1
for _ in range(N):
    layer = layer * 2 + 3

def calc(n, i, layer):
    if i == 0:
        return 0
    
    if n == 1:
        return "BPPPB"[:i].count("P")
    else:
        if i == layer // 2 + 1:
            return cntP[n-1] + 1
        elif i > layer // 2 + 1:
            return cntP[n-1] + 1 + calc(n-1, i - (layer // 2 + 1), (layer-3) // 2)
        elif i < layer // 2 + 1:
            return calc(n-1, i-1, (layer-3) // 2)

ans = calc(N, X, layer)
print(ans)
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

def dfs(cur, cost):
    dist[cur] = cost
    for to in G[cur]:
        if dist[to] == -1:
            dfs(to, cost+1)
dist = [-1]*n
dfs(0, 0)
m = max(dist)
for i in range(n):
    if dist[i] == m:
        start = i
        break
dist = [-1]*n
dfs(start, 0)
m = max(dist)

if m%3==1:
    print("Second")
else:
    print("First")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

def dfs(cur, cost):
    dist[cur] = cost
    for to in G[cur]:
        if dist[to] == -1:
            dfs(to, cost+1)
dist = [-1]*n
dfs(0, 0)
m = max(dist)
for i in range(n):
    if dist[i] == m:
        start = i
        break
dist = [-1]*n
dfs(start, 0)
m = max(dist)

if m%3==1:
    print("Second")
else:
    print("First")
N = int(input())
if N < 105:
  print(0)
elif N < 135:
  print(1)
elif N < 165:
  print(2):
elif N < 189:
  print(3)
elif N < 195:
  print(4)
else:
  print(5)

### FIXED CODE ###

N = int(input())
if N < 105:
    print(0)
elif N < 135:
    print(1)
elif N < 165:
    print(2)
elif N < 189:
    print(3)
elif N < 195:
    print(4)
else:
    print(5)