Harryxun/stf_run huggingface dataset:
R = 3
r = [ list(map(int, input().split(' '))) for i in range(R) ]

def check():
  for y in range(R):
    f = True
    for x in range(R):
      if r[y][x] != 0:
        f = False
        break
    if f:
      return True
 
  for x in range(R):
    f = True
    for y in range(R):
      if r[y][x] != 0:
        f = False
	    break
    if f:
      return True
 
  f = True
  for p in range(R):
    if r[p][p] != 0:
      f = False
      break
  if f:
    return True
 
  f = True
  for p in range(R):
    if r[R-1-p][p] != 0:
      f = False
      break
  return f
 
N = int(input())
for i in range(N):
  v = int(input())
  
  for y in range(R):
    for x in range(R):
      if r[y][x] == v:
        r[y][x] = 0
 
print('Yes' if check() else 'No')

### FIXED CODE ###

R = 3
r = [ list(map(int, input().split(' '))) for i in range(R) ]

def check():
  for y in range(R):
    f = True
    for x in range(R):
      if r[y][x] != 0:
        f = False
        break
    if f:
      return True
 
  for x in range(R):
    f = True
    for y in range(R):
      if r[y][x] != 0:
        f = False
        break
    if f:
      return True
 
  f = True
  for p in range(R):
    if r[p][p] != 0:
      f = False
      break
  if f:
    return True
 
  f = True
  for p in range(R):
    if r[R-1-p][p] != 0:
      f = False
      break
  return f
 
N = int(input())
for i in range(N):
  v = int(input())
  
  for y in range(R):
    for x in range(R):
      if r[y][x] == v:
        r[y][x] = 0
 
print('Yes' if check() else 'No')
import itertools

int_x = int(input())
answer = int_x
for i in range(1, int_x + 1):
    for v in itertools.combinations(range(1, int_x + 1), i):
        if sum(v) == int_x:
            answer = min(answer, max(v))
print(answer)






### FIXED CODE ###

x = int(input())

w = 0
for i in range(1, x + 1):
    w += i
    if w >= x:
        print(i)
        exit(0)
a = input()
b = input()

c = int(a) * int(b)

if int(c) % 2:
    print('Even')
else :
    print('Odd')

### FIXED CODE ###

a = input()
b = a.split(' ')
 
nummm = 1
 
for l in b:
    nummm = int(nummm) * int(l)
 
if int(nummm) % 2 == 0:
    print('Even')
else:
    print('Odd')
n = int(input())
a = [int(i) for i in input().split()]

a.sort()

MAXN = 2 * 10 ** 5


def prime_factorization(n):
    pmax = int(n ** 0.5 // 1) + 1

    factors = {}
    for p in range(2, pmax + 1):
        while n % p == 0:
            factors[p] = factors.get(p, 0) + 1
            n //= p
    if n != 1:
        factors[n] = factors.get(n, 0) + 1

    return factors


divisors = [False for _ in range(MAXN + 1)]
answer = 0
apast = None
for i, ai in enumerate(a):
    if ai == apast:
        is_good = False
    elif i < n - 1 and ai == a[i + 1]:
        is_good = False
    else:
        is_good = not divisors[ai]

        m = 1
        while ai * m <= MAXN:
            divisors[m * ai] = True
            m += 1

        # factors = prime_factorization(ai)
        # factors[1] = 1
        # for p, m in factors.items():
        #     pm = 1
        #     for i in range(m):
        #         p *=
        #         if p ** (i + 1) in divisors:
        #             is_good = False
        #             break
        #     if not is_good:
        #         break

    if is_good:
        answer += 1

    apast = ai


print(answer)


### FIXED CODE ###

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

a.sort()

MAXN = a[-1]


divisors = [False for _ in range(MAXN + 1)]
answer = 0
apast = None
for i, ai in enumerate(a):
    if ai == apast:
        is_good = False
    elif i < n - 1 and ai == a[i + 1]:
        is_good = False
        m = 1
        while m * ai <= MAXN:
            divisors[m * ai] = True
            m += 1
    else:
        is_good = not divisors[ai]

        m = 1
        while m * ai <= MAXN:
            divisors[m * ai] = True
            m += 1

    if is_good:
        answer += 1

    apast = ai


print(answer)
A, X, B= map(int, input().split())
P= A + B
M= A - B
print(P if X== str(-) else M )

### FIXED CODE ###

print(eval(input()))
# coding:utf-8
import sympy
n = int(input())

ans = 0
for i in range(1, n + 1):
    ans += i * sympy.divisors(i)
print(ans)


### FIXED CODE ###

# coding:utf-8
n = int(input())
ans = 0

for i in range(1, n + 1):
    tmp = n // i
    ans += i * tmp * (tmp + 1) // 2
print(ans)
n,x=map(int,input().split())
l=list(map(int,input().split()))
ans=0
pop=0
i=0
while(pop<=x):
    pop+=l[i]
    i+=1
    ans+=1
print(ans)

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
ans=1
place=0
for i in l:
    place+=i
    if place>x:
        break
    ans+=1
print(ans)
N, M= (int(i) for i in input().split())
lst = [[int(i) for i in input().split()] for i in range(n)] 

import numpy as np
food = np.zeros((N,M))
for i in range(N):
    for j in range(lst[i][0]):
        #print(lst[i][j+1])
        food[i][lst[i][j+1]-1] = 1
#print(food)
s = np.sum(food, axis=0)
print(len(s[s==N]))

### FIXED CODE ###

N, M= (int(i) for i in input().split())
lst = [[int(i) for i in input().split()] for i in range(N)]
import numpy as np
food = np.zeros((N,M))
for i in range(N):
    for j in range(lst[i][0]):
        #print(lst[i][j+1])
        food[i][lst[i][j+1]-1] = 1
#print(food)
s = np.sum(food, axis=0)
print(len(s[s==N]))
if

### FIXED CODE ###

if __name__ == "__main__":
  S = input() # sを取得し、strに値を入れる
  if S == "ABC":
    print("ARC")
  elif S == "ARC":
    print("ABC")
import sys
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))

n, k = rm()
a = rl()
max_ = 0
for i in range(n-k+1):
  max_ = max(max_, sum(a[i:i+k]))
print((max_+k)/2)

### FIXED CODE ###

import sys
s, t = map(str, sys.stdin.readline().split())
a, b = map(int, sys.stdin.readline().split())
u = sys.stdin.readline().rstrip()
if s == u:
  print(a-1, b)
else:
  print(a, b-1)
lst = list(map(int,input().strip()))
N = lst[0]
K = lst[1]
total = K * (N-1)*(K-1)


### FIXED CODE ###

N,K = map(int,input().split())
print(K * (K-1)**(N-1))
"""
F
"""
N=int(input())
A=list(map(int,input().split()))

left=[0]*N
right=[0]*N

left[0]=A[0]
left[1]=A[1]
for i in range(2,N):
    left[i]=A[i]+left[i-2]
right[-1]=A[-1]
right[-2]=A[-2]
for i in range(N-3,-1,-1):
    right[i]=A[i]+right[i+2]

ans=0
if N%2==0:
    ans=max(right[0],left[-1])
    for i in range(N-2):
        if i%2==0:
            continue
        ans=max(ans,left[i]+right[i+2])
    num=9/0
else:
    P=[0]*N
    Q=[0]*N
    P[-2]=A[-2]
    Q[-2]=A[-1]
    for i in range(-4,-N-1,-1):
        if i%2==0:
            P[i]=A[i]+max(P[i+2],Q[i+2])
            Q[i]=A[i+1]+Q[i+2]

    data=[0]*N
    for i in range(N):
        data[i]=max(P[i],Q[i])
    
    qqq=0
    for i in range(N-2):
        if i%2==0:
            #使わない
            ans=max(ans,qqq+data[i+1])
            qqq+=A[i]
    ans=max(ans,qqq)
    
print(ans)

### FIXED CODE ###

N=int(input())
A=[0]+list(map(int,input().split()))

dp=[[0]*(N+1) for i in range(3)]

dp[0][1]=-float("inf")
dp[2][1]=A[1]
dp[0][2]=0
dp[1][2]=max(A[1],A[2])
dp[2][2]=-float("inf")

for i in range(3,N+1):
    if i%2==1:
        for j in range(3):
            dp[j][i]=max(dp[j][i-2]+A[i],dp[j][i-1])
    else:
        for j in range(2):
            dp[j][i]=max(dp[j][i-2]+A[i],dp[j+1][i-1])
        dp[2][i]=dp[2][i-2]+A[i]

print(dp[1][N])
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(m):
  t=a[-1]//2
  if t<a[-2]:
    bisect.insort(a,t)
    del a[-1]
  else:
    continue

print(sum(a))

### FIXED CODE ###

import heapq

n, m = map(int, input().split())
lis = []

for i in input().split():
  heapq.heappush(lis, -int(i))

for j in range(m):
  tmp = -heapq.heappop(lis)
  heapq.heappush(lis, -int((tmp/2)))

print(-sum(lis))
n, m, d = list(map(int, input().split()))
if (d == 0):
  	ans = (m - 1) * (1 / n)
    print(ans)
else:
	ans = (m - 1) * (2 * (n - d) / n ** 2)
    print(ans)



### FIXED CODE ###

n, m, d = list(map(int, input().split()))
if (d == 0):
  ans = (m - 1) * (1 / n)
  print(ans)
else:
  ans = (m - 1) * (2 * (n - d) / n ** 2)
  print(ans)
S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0


for a in S:

    s = (s + a * p) % m
    ans += X[s]
    X[s] += 1
    p = p * 10 % m
 
print(ans)

### FIXED CODE ###

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

if A<=B:
    print("unsafe")
else:
    print("safe")
N = int(input())
edges = [[] for _ in range(N)]
for i in range(1, N):
    a, b, c = map(int, input().split())
    a, b = a - 1, b - 1
    edges[a].append([b, c])
    edges[b].append([a, c])

Q, K = map(int, input().split())
K -= 1

dist = [pow(10, 9) + 1] * N
dist[K] = 0


def dfs(s, before=-1):
    for edge in edges[s]:
        to = edge[0]
        c = edge[1]
        if to != before:
            dist[to] = dist[s] + c
            dfs(to, s)


dfs(K)
for i in range(Q):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    print(dist[x] + dist[y])

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)

N = int(input())
edges = [[] for _ in range(N)]
for _ in range(1, N):
    a, b, c = map(int, input().split())
    a, b = a - 1, b - 1
    edges[a].append([b, c])
    edges[b].append([a, c])

Q, K = map(int, input().split())
K -= 1
dist = [pow(10, 9) + 1] * N
dist[K] = 0


def dfs(s, before=-1):
    for edge in edges[s]:
        to = edge[0]
        c = edge[1]
        if to != before:
            dist[to] = dist[s] + c
            dfs(to, s)


dfs(K)
for _ in range(Q):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    print(dist[x] + dist[y])
n=int(input())
H=[int(i) for i in input().split()]
for i in range(n):
    if i!=0:
        H=H[:-1]
    if max(H)-H(-1)>1:
        print("No")
        exit(0)
print("Yes")

### FIXED CODE ###

n=int(input())
H=[int(i) for i in input().split()]
for i in range(n-1,0,-1):
    if H[i]<H[i-1]:
        H[i-1]-=1
        if H[i]<H[i-1]:
            print("No")
            exit()
print("Yes")
L = input()
 
intL = int(L)
L10 = int(L, 2)
sum_ = 0
for a in range(L10+1):
  for b in range(L10+1):
    if ((a + b) <= L10) and ((a + b) == (a ^ b)):
      sum_+=1
 
print(sum_ % (10**9 + 7))

### FIXED CODE ###

P, Q, R = map(int, input().split())

calc_list = [P+Q, Q+R, R+P]

print(min(calc_list))
N = input()
K = int(input())

def K1(N):
  le = len(N)
  if le == 1:
    return int(N)
  else:
    return 9*(le-1)+int(N[0])
def K2(N):
  le = len(N)
  if le == 1:
    return 0
  else:
    j=1
    if int(N[j]) == 0:
      while int(N[j]) == 0:
        j+=1
        
    n = N[j:le]
    return (9**2)*((le-1)*(le-2)//2) + K1(n) +(int(N[0])-1)*K1("9"*(le-1))
  
def K3(N):
  le = len(N)
  if le == 1 or le == 2:
    return 0
  else:
    j=1
    if int(N[j]) == 0:
      while int(N[j]) == 0:
        j+=1
        
    n2 = N[j:le]
    
    return (9**3)*((le-1)*(le-2)*(le-3)//6) + K2(n2) + (int(N[0])-1)*K2("9"*(len(N)-1))
if K == 1:
  print(K1(N))
    
if K == 2:
  print(K2(N))
  
if K == 3:
  print(K3(N))
  

### FIXED CODE ###

N = input()
K = int(input())

def K1(N):
  le = len(N)
  if le == 1:
    return int(N)
  else:
    return 9*(le-1)+int(N[0])
def K2(N):
  le = len(N)
  if le == 1:
    return 0
  else:
    j=1
    if int(N[j]) == 0 and j != le-1:
      while int(N[j]) == 0:
        j+=1
        if j == le-1:
          break
        
    n = N[j:le]
    return (9**2)*((le-1)*(le-2)//2) + K1(n) +(int(N[0])-1)*K1("9"*(le-1))
  
def K3(N):
  le = len(N)
  if le == 1 or le == 2:
    return 0
  else:
    j=1
    if int(N[j]) == 0 and j != le-1:
      while int(N[j]) == 0:
        j+=1
        if j == le-1:
          break
        
    n2 = N[j:le]
    
    return (9**3)*((le-1)*(le-2)*(le-3)//6) + K2(n2) + (int(N[0])-1)*K2("9"*(len(N)-1))
if K == 1:
  print(K1(N))
    
if K == 2:
  print(K2(N))
  
if K == 3:
  print(K3(N))
import sys
sys.setrecursionlimit(200000)

N,K = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
g = gcd(A[0],A[1])
for i in range(2,N):
    g = gcd(g,A[i])
if K % g == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000000)
N,K = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    return a if b==0 else gcd(b,a%b)
if N ==1:
    g = A[0]
else:
    g = gcd(A[0],A[1])
    if N > 2:
        for i in range(2,N):
            g = gcd(g,A[i])
if K <= max(A) and K%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
n, k = map(int, input().split())
*l, = map(int, input().split())
start = 1
seenl = [1]
seen = {1}
for i in range(k):
	start = l[start-1]
	if start in seen:
		loop_len = len(seenl) - seenl.index(start)
		r = (k-i-1)%loop_len
		goal = seenl[seenl.index(start):][r]
		break
	seenl.append(start)
	seen.add(start)
print(goal)

### FIXED CODE ###

n,k = map(int,input().split())
*l, = map(int,input().split())
seenl = [1]
seen = {1}
temp=1
for i in range(k):
  temp=l[temp-1]
  if temp in seen:
    lenloop = len(seenl)-seenl.index(temp)
    r = (k-i-1)%lenloop
    temp = seenl[seenl.index(temp):][r]
    break
  seenl.append(temp)
  seen.add(temp)
print(temp)
import math

r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = "0"
for i in range(2,r/2):
    prime[2*i-1] = "0"
for i in range(3,sqrt,2):
    for j in range(2*i,r+1,i):
        prime[j-1] = "0"

while True:
    try:
        n = int(raw_input())
        print sum(prime[:n])
    except:
        break

### FIXED CODE ###

import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])
n = input()
k= input()
X = input()
y = input()
if n<=k:
    total = n*x
else:
    total = k*x + (n-k) * y
print(total)

### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
    total = n*x
else:
    total = k*x + (n-k)*y
print(total)
N, X, Y = map(int, input().split())

ans = [0] * (N-1)
for i in range(1,N+1):
	for j in range(i, N+1):
		k = min(j-i, abs(X-i) + abs(Y-j) + 1)
		ans[k-1] += 1

for i in range(N):
	print(ans[i])



### FIXED CODE ###

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

ans = [0] * (N-1)
for i in range(1,N+1):
	for j in range(i+1, N+1):
		k = min(j-i, abs(X-i) + abs(Y-j) + 1)
		ans[k-1] += 1

for i in range(N-1):
	print(ans[i])
import sys
sys.setrecursionlimit(1000000)


def main():
    N, K = map(int, input().split())
    P = list(map(func,map(int, input().split())))
    C = list(map(int, input().split()))
    ans = -float('inf')
    for si in range(N):
        x = si
        tot = 0
        S = []
        while True:
            x = P[x]
            S.append(C[x])
            tot += C[x]
            if x == si:
                break
        l = len(S)
        t = 0
        for i in range(l):
            t += S[i]
            if i + 1 > K:
                break
            now = t
            if tot > 0:
                e = (K-(i+1)) // l
                now += tot*e
            ans = max(ans, now)

    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def func(x):
    return x - 1
def main():
    N, K = map(int, input().split())
    P = list(map(func,map(int, input().split())))
    C = list(map(int, input().split()))
    ans = -float('inf')
    for si in range(N):
        x = si
        tot = 0
        S = []
        while True:
            x = P[x]
            S.append(C[x])
            tot += C[x]
            if x == si:
                break
        l = len(S)
        t = 0
        for i in range(l):
            t += S[i]
            if i + 1 > K:
                break
            now = t
            if tot > 0:
                e = (K-(i+1)) // l
                now += tot*e
            ans = max(ans, now)

    print(ans)


if __name__ == "__main__":
    main()
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, K = rl()
A = np.array([0] + rl())
A_cum = A.cumsum()
A_cum2 = A_cum - np.arange(N+1)
A_cum2 = A_cum2 % K
answer = 0
remain = [0] * (K)
cnt = 0
for i in range(N+1):
    x = A_cum2[i] % K    
    if i - K >= 0:
        y = A_cum2[i-K] % K
        remain[y] -= 1
    answer += remain[x]
    remain[x] += 1
print(answer)


### FIXED CODE ###

import sys
import numpy as np
from collections import defaultdict

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = np.array([1] + lr())
A = (A-1) % K
N += 1
Acum = (A.cumsum() % K).tolist()
d = defaultdict(int)
answer = 0
for i, x in enumerate(Acum):
    answer += d[x]
    d[x] += 1
    if i >= K-1:
        d[Acum[i-(K-1)]] -= 1

print(answer)
s = input()
a = 0
for i in range(len(s)):
    a += int(s[i])
s = int(s)
if s % a = 0 :
    print('Yes')
else :
    print('No')


### FIXED CODE ###

s = input()
i = s.count("+")

print(2 * i - 4)
import math
while n != 0:
 n = int(input())
 if n == 0:
  break
 else:
  s = list(map(int, input().split()))
  m = 0
  for i in range(n):
   m += s[i]
  si2 = 0
  for i in range(n):
   si2 += (s[i] - m)**2
  print(math.sqrt(si2))

 

### FIXED CODE ###

import math
n = 1
while n != 0:
 n = int(input())
 if n == 0:
  break
 else:
  s = list(map(int, input().split()))
  m = 0
  for i in range(n):
   m += s[i]
  m /= n
  si2 = 0
  for i in range(n):
   si2 += (s[i] - m)**2
  si2 /= n
  print(math.sqrt(si2))
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K+"..."])

### FIXED CODE ###

K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K]+"...")
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = tuple(map(int, input().split()))

s = -1
c = C * (A // C + 1)
if c <= B:
    s += (B - c) // C + 1
        
d = D * (A // D + 1)
if d <= B:
    s += (B - d) // D + 1
    
cd_lcm = lcm(C, D)
cdl = cd_lcm * (A // cd_lcm + 1)
if cdl <= B:
    s -= (B - cdl) // cd_lcm + 1

print(B - A - s)

### FIXED CODE ###


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

A, B, C, D = tuple(map(int, input().split()))

s = -1
c = C * (A // C + 1)
if A % C == 0:
    c = A
if c <= B:
    s += (B - c) // C + 1
        
d = D * (A // D + 1)
if A % D == 0:
    d = A
if d <= B:
    s += (B - d) // D + 1
    
cd_lcm = lcm(C, D)
cdl = cd_lcm * (A // cd_lcm + 1)
if A % cd_lcm == 0:
    cdl = A
if cdl <= B:
    s -= (B - cdl) // cd_lcm + 1

print(B - A - s)
def solve():
  n,k = (int(i) for i in input().split())
  s = input()
  one = []
  zero = []  
  for i in range(n):
    if i == 0:
      if s[i] == "0":
        zero.append(1)
      else:
        one.append(1)
    
    else:     
     if s[i] == s[i-1]:
      if s[i] == "0":
        zero[-1]+= 1
      else:
        one[-1] += 1
     else:
      if s[i] == "0":
        #zero.append(0)
        zero.append(1)
      else:
        #one.append(0)
        one.append(1)
  ans = 0 
  if len(zero) <= k:
    ans = n
  elif len(one) > len(zero):
    tmp = 0
    for i in range(k+1):
     tmp += one[i]
    for i in range(k):
     tmp += zero[i]
    for i in range(len(zero)-k):
       
       tmp -=  one[i]
       tmp +=  one[i+k+1]
       tmp -=  zero[i]
       tmp +=  zero[i+k]
       ans = max(ans,tmp)
  else:
    tmp = 0
    for i in range(k):
      tmp += one[i]
    for i in range(k):
      tmp += zero[i]
    ans = max(ans,tmp)
    tmp -= zero[i]
    tmp += zero[i+1]
    ans = max(ans,tmp)
    for i in range(len(zero)-k-1):
       
       tmp -=  one[i]
       tmp +=  one[i+k+1]
       tmp -=  zero[i+1]
       tmp +=  zero[i+2]
       ans = max(ans,tmp)
  print(ans)
    
solve()

### FIXED CODE ###

def solve():
  n,k = (int(i) for i in input().split())
  s = input()
  one = []
  zero = []  
  for i in range(n):
    if i == 0:
      if s[i] == "0":
        one.append(0)
        zero.append(1)
      else:
        one.append(1)
    
    else:     
     if s[i] == s[i-1]:
      if s[i] == "0":
        zero[-1]+= 1
      else:
        one[-1] += 1
     else:
      if s[i] == "0":
        zero.append(1)
      else:
        one.append(1)
  ans = 0 
  if len(zero) <= k:
    ans = n

  else:
   one = one + [0]*5
   zero = zero + [0]*5
   tmp = 0
   for i in range(k+1):
    tmp += one[i]
   for i in range(k):
    tmp += zero[i]
   ans = max(tmp,ans)
   for i in range(len(zero)-k-1):
        
       tmp -=  one[i]
       tmp +=  one[i+k+1]
       tmp -=  zero[i]
       tmp +=  zero[i+k]
       ans = max(ans,tmp)

  #print (one) 
 # print(zero)
  print(ans)
    
solve()
n = input()
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
X = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
color = [0 for i in range(n)]
t = 0
 
def DFS_v(u):
    color[u] = 1
    t += 1
    d[u] = t
    for v in range(n):
        if M[u][v] == 1 and color[v] == 0:
            DFS_visit(v)
    color[u] == 2
    t += 1
    f[u] = t
 
def DFS():
    for u in range(n):
        if color[u] == 0:
            DFS_v(u)
    for u in range(n):
        print u+1, d[u], f[u]
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
    

### FIXED CODE ###

n = int(raw_input())
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
col = [0 for i in range(n)]
t = [0]
 
def DFS_visit(u):
    col[u] = 1
    t[0] += 1
    d[u] = t[0]
    for v in range(n):
        if M[u][v] == 1 and col[v] == 0:
            DFS_visit(v)
    col[u] = 2
    t[0] += 1
    f[u] = t[0]
 
def DFS():
    for u in range(n):
        if col[u] == 0:
            DFS_visit(u)
    for u in range(n):
        print'{0} {1} {2}'.format(u+1, d[u], f[u])
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
a,b = map(int, input().split(" "))
if a => 13 :
  print(b)
elif 6 <= a >= 12 :
  print(b/2)
else:
  print(0)

### FIXED CODE ###

a,b = map(int, input().split(" "))
if a >= 13 :
  print(b)
elif a >= 6 :
  print(b//2)
else:
  print(0)
N = int(input)
A = [int(i) for i in input().split()]

c = 0

for i in A:
  c += (1/A[i])

print(float(1/c))

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

c = 0

for i in range(N):
  c += (1/A[i])

print(float(1/c))
W,H,x,y,r = map(int, raw_input().split())

if (r =< x =< (W - r)) and (r =< y =< (H - r)):
  print "Yes"
else:
  print "No"

### FIXED CODE ###

W,H,x,y,r = map(int, raw_input().split())

if (r <= x <= (W - r)) and (r <= y <= (H - r)):
  print "Yes"
else:
  print "No"
K, X = map(int,input().split())
if 500K >= X:
  	print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if 500*K >= X:
  print('Yes')
else:
  print('No')
n = raw_input()
a = map(int, raw_input().split())
 
for i in range(n):
    print a[-i-1],

### FIXED CODE ###

n =int(raw_input())
a = map(int, raw_input().split())
 
for i in range(n):
    print a[-i-1],