Harryxun/stf_run huggingface dataset:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, K = map(int, input().split())
    A_i = list(map(int, input().split()))
    B_i = [0 for i in range(N)]
    cycle_list = []
    
    cycle = 0
    diff = 0
    counter = 0
    machi = 1
    while counter < N:
        if B_i[machi] == 1:
            diff = cycle_list.index(machi)
            cycle = counter - diff
            cycle_list = cycle_list[diff:]
            break
        else:
            counter += 1
            B_i[machi] = 1
            cycle_list.append(machi)
            machi = A_i[machi - 1]
            
    mod_K = (K - diff) % cycle

    print(cycle_list[mod_K])

if __name__ == "__main__":
    main()


### FIXED CODE ###

import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, K = map(int, input().split())
    A_i = list(map(int, input().split()))
    B_i = [0 for i in range(N)]
    cycle_list = []
    diff_list = []
    cycle = 0
    diff = 0
    counter = 0
    machi = 1

    while counter < N:
        if B_i[machi - 1] == 1:
            diff = cycle_list.index(machi)
            cycle = counter - diff
            diff_list = cycle_list[:diff]
            cycle_list = cycle_list[diff:]
            break
        else:
            counter += 1
            B_i[machi - 1] = 1
            cycle_list.append(machi)
            machi = A_i[machi - 1]

    if K < diff:
        print(diff_list[K])
    else:
        mod_K = (K - diff) % cycle
        print(cycle_list[mod_K])

if __name__ == "__main__":
    main()
a, b, c = [int(i) for i in input().split()]
    if a < b < c:
        print ("Yes")
 
    else:
        print ("No")

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]
if a < b < c:
    print ("Yes")
 
else:
    print ("No")
from sys import stdin
def main():
    sx, sy, tx, ty = [int(x) for x in stdin().readline().rstrip().split()]
    x = tx - sx
    y = ty - sy
    l = ["R"]*x + ["U"]*y + ["L"]*x + ["D"]*y + ["D"] + ["R"] * (x+1) + ["U"]*(y+1) + ["L"] + ["U"] + ["L"]*(x+1) + ["D"]*(y+1) +["R"]
    print("".join(l))
if __name__ == "__main__":
    main()

### FIXED CODE ###

sx, sy, tx, ty = [int(x) for x in input().split()]
x = tx - sx
y = ty - sy
l = ["R"]*x + ["U"]*y + ["L"]*x + ["D"]*y + ["D"] + ["R"] * (x+1) + ["U"]*(y+1) + ["L"] + ["U"] + ["L"]*(x+1) + ["D"]*(y+1) +["R"]
print("".join(l))
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()
c = 0
for i in range(3):
  if S[i] == T[i]:
    c += 1
    
print(c)
  

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
T = input()
c = 0
for i in range(3):
  if S[i] == T[i]:
    c += 1
    
print(c)
import itertools
import sys
input = sys.stdin.readline
def inputs():
    return [int(x) for x in input().split()]
H,W = inputs()
c = [inputs() for _ in range(10)]
HW = [inputs() for _ in range(H)]
A = (0,9,8,7,6,5,4,3,2)
B = list(itertools.permutations(A))
N = [c[i][1] for i in range(10)]
ans = 0
for i in B:
    a = i[0]
    ans = 0
    for j in range(1,10):
        ans +=c[i[j-1]][i[j]]
        if N[a]<ans:
          break
        N[a] = min(ans+c[i[j]][1],N[a])
        
ans = 0
for i in range(H):
    for j in range(W):
        if HW[i][j]!=-1:
            ans += N[HW[i][j]]
print(ans)

### FIXED CODE ###

import itertools
import sys
input = sys.stdin.readline
def inputs():
    return [int(x) for x in input().split()]
H,W = inputs()
c = [inputs() for _ in range(10)]
HW = [inputs() for _ in range(H)]
A = (0,9,8,7,6,5,4,3,2)
B = list(itertools.permutations(A))
N = [c[i][1] for i in range(10)]
for i in B:
    a = i[0]
    ans = 0
    for j in range(1,9):
        ans +=c[i[j-1]][i[j]]
        if N[a]<=ans:
          break
        N[a] = min(ans+c[i[j]][1],N[a])    
ans = 0
for i in range(H):
    for j in range(W):
        if HW[i][j]!=-1:
            ans += N[HW[i][j]]
print(ans)
n = int(input())
ans, a = 0, 0
for i in range(n):
    x, u = input().split()
    x = float(x)
    if u == 'JPY'
        ans += x
    else:
        ans += x * 380000
print(ans)

### FIXED CODE ###

n = int(input())
l = [input().split() for _ in range(n)]
ans = 0
for x, u in l:
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x * 380000
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 00:01:41 2018

@author: Yuya
"""

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

ans = []
c = 0

for i in range(n):
    tmp=list(input())
    f = 1
    for j in range(m):
        if tmp[j]=="#":
            f = -1
    if f<0:
        ans.append(tmp)
        c+=1


ans2 = [["0" for i in range(c)] for j in range(m)]

for i in range(m):
    for j in range(c):
        ans2[i][j] = ans[j][i]


d = m

for i in range(m-1, -1, -1):
    f = 1
    for j in range(c):
        if ans2[i][j]=="#":
            f = -1
    if f>0:
        del ans2[i]
        d-=1
        


ans3 = [["0" for i in range(c)] for j in range(d)]

for i in range(d):
    for j in range(c):
        ans3[i][j] = ans2[j][i]



for i in range(c):
    print(''.join(ans3[i]))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 00:01:41 2018

@author: Yuya
"""

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

ans = []
c = 0

for i in range(n):
    tmp=list(input())
    f = 1
    for j in range(m):
        if tmp[j]=="#":
            f = -1
    if f<0:
        ans.append(tmp)
        c+=1


ans2 = [["0" for i in range(c)] for j in range(m)]

for i in range(m):
    for j in range(c):
        ans2[i][j] = ans[j][i]


d = m

for i in range(m-1, -1, -1):
    f = 1
    for j in range(c):
        if ans2[i][j]=="#":
            f = -1
    if f>0:
        del ans2[i]
        d-=1
        


ans3 = [["0" for i in range(d)] for j in range(c)]

for i in range(d):
    for j in range(c):
        ans3[j][i] = ans2[i][j]



for i in range(c):
    print(''.join(ans3[i]))
s=list(input())
res=[0 for i in range(26)]
for i in s:
	if i.isalnum():
		i=i.lower()
		res[ord(s)-ord("a")]+=1

for i in range(26):
	s=chr(ord(i)+ord("a"))+" : "+str(res[i])
	print(s)

### FIXED CODE ###

s=""
import fileinput
a=fileinput.input()
for i in a:
	s+=i
s=list(s)
res=[0 for i in range(26)]
for i in s:
	if i.isalpha():
		i=i.lower()
		res[ord(i)-ord("a")]+=1

for i in range(26):
	s=chr(i+ord("a"))+" : "+str(res[i])
	print(s)
while(1):
    0

### FIXED CODE ###

inf=100000000

def calc(uth,dis,c):
    fare=0
    if dis>=inf:
        return inf
    if unchin[c]==1:
        return uth[c][1][0]*dis
    ddis=uth[c][0]
    dcost=uth[c][1]
    i=1
    while(i<unchin[c] and dis>ddis[i]):
        fare+=(ddis[i]-ddis[i-1])*dcost[i-1]
        i+=1
    fare+=(dis-ddis[i-1])*dcost[i-1]
    return fare

def floyd(bigmap,n):
    res=bigmap
    for k in range(1,n+1):
        for i in range(1,n+1):
            for j in range(1,n+1):
                if res[i][j]>res[i][k]+res[k][j]:
                    res[i][j]=res[i][k]+res[k][j]
    return res

def init2d(bigmap,n):
    for i in range(n+1):
        bigmap.append([])
    for map1 in bigmap:
        for j in range(n+1):
            map1.append(inf)
    for i in range(1,n+1):
        bigmap[i][i]=0
    return bigmap

while(1):
    n,m,c,s,g=map(int,raw_input().split())
    if(n==m==0): break
    rosen=[]
    for i in range(c+1):
        map0=[]
        rosen.append(init2d(map0,n))

    for i in range(m):
        x,y,d,c0=map(int,raw_input().split())
        rosen[c0][x][y]=min(rosen[c0][x][y],d)
        rosen[c0][y][x]=min(rosen[c0][x][y],d)

    unchin=list(map(int,raw_input().split()))
    unchin.insert(0,0)
    uth=[]
    uth.append([])
    for i in range(1,c+1):
        ddis=list(map(int,raw_input().split()))
        ddis.insert(0,0)
        dcost=list(map(int,raw_input().split()))
        uth.append([ddis,dcost])

    bigmap=[]
    bigmap=init2d(bigmap,n)


    for c0,cmap in enumerate(rosen[1:]):
        tmp=floyd(cmap,n)
        for i in range(1,n+1):
            for j in range(1,n+1):
                bigmap[i][j]=min(bigmap[i][j],calc(uth,tmp[i][j],c0+1))

    bigmap=floyd(bigmap,n)

    ans=bigmap[s][g]
    if ans < inf:
        print(ans)
    else:
        print(-1)
import pandas as pd

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

axis = list(range(-10, 11, 1))
df = pd.DataFrame(axis)
df = df.rename(columns = {0 : 'var'})

res = []

if k == 1:
    print(x)
else:
    for i in range(1, k):

        a = df[df['var'] == x + i]
        a = list(a['var'])
        res.append(a)
        
        a = df[df['var'] == x - i]
        a = list(a['var'])
        res.append(a)
    res.append([x])
    res = sum(res, []) #リスト一段解除
    res = sorted(res) #並び替え
    print(*res)

### FIXED CODE ###

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

res = []
if k == 1:
    print(x)
else:
    for i in range(1, k):
        res.append(x + i)
    for i in range(1, k):
        res.append(x - i)
    res.append(x)
    res = sorted(res)
    print(*res)
n = input()
num = list(map(int,input().split()))
for l in range(n):
    ans *= num[l] 
    if ans >= 10**18:
        print(-1)
        return
print(ans)

### FIXED CODE ###

# %%
def main():
    N = input()
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            print(-1)
            return
    print(ans)
if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcddfghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in d.values():
        count = count * (v+1)
    

    return count - 1

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcdefghijklmnopqrstuvwxyz"])

    for c in s:
        d[c] = d[c] + 1

    count = 1
    for v in [v for v in d.values() if v > 0]:
        count = count * (v+1)
    

    return (count - 1) %(10**9+7)

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
import math
def lcm(a,b):
    return int(a*b /math.gcd(a,b))

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)



### FIXED CODE ###

def gcd(x,y):
  if x>y: x,y = y,x
  while x:
    x,y = y%x, x
  return y

def lcm(a,b):
    return a*b //gcd(a,b)

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
if(n==1):
    print(t[0])
    exit()
ans=lcm(t[0],t[1])
if(n==2):
    print(ans)
    exit()
for i in range(2,n):
    ans=lcm(ans,t[i])
print(ans)
N, M = map(int, input().split())
pS = [tuple(map(str, input().split())) for _ in range(M)]

ac = 0
wa = 0

x = 1
i = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        continue
    if pS[i][1] == 'WA':
        wa += 1
        i += 1
    if pS[i][1] == 'AC':
        ac += 1
        x += 1
        i += 1

print(ac, wa)

### FIXED CODE ###

N, M = map(int, input().split())
pS = [tuple(map(str, input().split())) for _ in range(M)]

AC = [False] * (N+1)
WA = [0] * (N+1)

pena = 0
for p, s in pS:
    p = int(p)
    if AC[p]:
        continue
    if s == 'WA':
        WA[p] += 1
    else:
        AC[p] = True
        pena += WA[p]
ac = sum(AC)
print(ac, pena)
#W, H, x, y
W, H, x, y = map(int, input().split())

S = W*H/2
if x==W/2 and y == H/2:
    print(S, 1)
else:
    print(S, 0)
#W, H, x, y
W, H, x, y = map(int, input().split())

S = W*H/2
if x==W/2 and y == H/2:
    print(S, 1)
else:
    print(S, 0)


### FIXED CODE ###

#W, H, x, y
W, H, x, y = map(int, input().split())

S = W*H/2
if x==W/2 and y == H/2:
    print(S, 1)
else:
    print(S, 0)
if __name__ == "__main__":
    N = int(input())
    S = input()

    dp = [[0] * 5005 for i in range(5005)]

    for i in range(N, 0, -1):
        for j in range(N, 0, -1):
            if S[i-1] != S[j-1]:
                dp[i][j] = 0
            else:
                dp[i][j] = dp[i+1][j+1] + 1

    result = 0
    for i in range(N):
        for j in range(N):
            if i >= j:
                continue
            now = min(dp[i][j], j-i)
            result = max([now, result])

    print(result)


### FIXED CODE ###

if __name__ == "__main__":
    S = input()
    if S == 'Sunny':
        print('Cloudy')
    elif S == 'Cloudy':
        print('Rainy')
    else:
        print('Sunny')
h = int(input())
a = int(input())
cnt = 0

while (h > 0):
	h -= a
	cnt += 1

print('{}'.format(cnt))

### FIXED CODE ###

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

cnt = 0

while (h > 0):
	h -= a
	cnt += 1

print(cnt)
from math import ceil
N, K = map(int,input().split())
A = list(map(int,input().split()))
def chk(L):
    cnt = 0
    for i in range(N):
        cnt += ceil(A[i]/L)-1
    return cnt <= K
l, r = 1, max(A)
while l <= r:
    m = (l+r)//2
    if chk(m):
        r = m-1
    else:
        l = m+1
print(max([x for x in [m-1,m,m] if chk(x)]))

### FIXED CODE ###

from math import ceil
N, K = map(int,input().split())
A = list(map(int,input().split()))
def chk(L):
    cnt = 0
    for i in range(N):
        cnt += ceil(A[i]/L)-1
    return cnt <= K
l, r = 1, max(A)
while l <= r:
    m = (l+r)//2
    if chk(m):
        r = m-1
    else:
        l = m+1
print(min([x for x in [m-1,m,m+1] if x > 0 and chk(x)]))
#Stone Monument
a,b = map(int, input().split())
M = []
ans = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
for i in range(0,999,1):
	for j in range(0,999,1):
		if (M[i] - j == a) and (M[i+1] - j == b):
			ans.append(j)

print(max(ans))

### FIXED CODE ###

#Stone Monument
a,b = map(int, input().split())
M = []
for i in range(1,1000,1):
	n = 1/2*i*(i+1)
	M.append(n)
n = b-a-1
print(int(M[n-1]-a))
s=int(input())
flag=False
if s<=10**9:
  a=1;b=s;c=0;d=1
else:
  a=b=int(s**(1/2))
  while True:
    c = s-a*b
    sc = int(c**(1/2))
    for i in range(sc,sc+100):
      if c%i==0:
        d=i;c=c//i
        flag = True
        break
    if flag or c==0:
      break
    a -= 1
li = [c,0,a+c,d,0,b]
print(a*b+c*d)
for num in li:
  print(num,end=" ")

### FIXED CODE ###

s = int(input())
if s==10**18:
  print(0,0,10**9,0,0,10**9)
else:
  print(0,0,s//10**9+1,1,10**9-s%10**9,10**9)
import numpy as np

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

dp = np.ones([2, N * 10 ** 3 + 1], dtype=int) * float("inf")
dp[0][0], dp[1][0] = 0, 0
for i in range(N):
    index = i % 2
    w, v = map(int, input().split())
    for j in range(1, len(dp[0])):
        if j <= v:
            dp[index][j] = min(w, dp[index-1][j])
        else:
            dp[index][j] = min(w + dp[index-1][j-v], dp[index-1][j])

dp = np.minimum(dp[0], dp[1])
ans = 0
for i, w in enumerate(dp):
    if w <= W:
        ans = max(ans, i)
    else:
        break

print(ans)


### FIXED CODE ###

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

dp = [[float("inf")] * (N * 10 ** 3 + 1) for _ in range(2)]
dp[0][0], dp[1][0] = 0, 0
for i in range(N):
    index = i % 2
    w, v = map(int, input().split())
    for j in range(1, len(dp[0])):
        if j <= v:
            dp[index][j] = min(w, dp[index-1][j])
        else:
            dp[index][j] = min(w + dp[index-1][j-v], dp[index-1][j])

ans = 0
for i, w in enumerate(dp[N % 2 - 1]):
    if w <= W:
        ans = max(ans, i)
    else:
        break

print(ans)
fullcards={
    "S":set(range(1,14)),
    "H":set(range(1,14)),
    "C":set(range(1,14)),
    "D":set(range(1,14))
    }
cards={
    "S":set({}),
    "H":set({}),
    "C":set({}),
    "D":set({})
    }
for i in range(n):
    line=input()
    suit,rank=line.split()
    rank=int(rank)
    cards[suit].add(rank)
for s in ['S','H','C','D']:
    for r in fullcards[s]-cards[s]:
        print('%s %d' % (s,r))

### FIXED CODE ###

n=int(input())
fullcards={
    "S":set(range(1,14)),
    "H":set(range(1,14)),
    "C":set(range(1,14)),
    "D":set(range(1,14))
    }
cards={
    "S":set({}),
    "H":set({}),
    "C":set({}),
    "D":set({})
    }
for i in range(n):
    line=input()
    suit,rank=line.split()
    rank=int(rank)
    cards[suit].add(rank)
for s in ['S','H','C','D']:
    for r in fullcards[s]-cards[s]:
        print('%s %d' % (s,r))
a=int(input())
for i in range(26):
  for l in range(15):
    if 4*i+7*j==100:
      print("Yes")
      exit()
print("No")

### FIXED CODE ###

a=int(input())
for i in range(26):
  for j in range(15):
    if 4*i+7*j==a:
      print("Yes")
      exit()
print("No")
n,d,a=map(int,input().split())
num=[]
for i in range(n):
    num.append(list(map(int,input().split())))
num.sort(key=lambda x: x[0])
cnt=0
cnt2=0
num2=num[0][0]+d
ans=0
for i in range(n):
    yn=0
    for j in range(cnt,n):
        if num2+d<num[j][0]:
            cnt2=j-1
            yn=1
            break
    if yn==0:
        cnt2=n-1
    else:
        yn=0
    num3=-(num[cnt][1]//-a)
    ans+=num3
    for j in range(cnt,cnt2+1):
        num[j][1]-=a*num3
    for j in range(cnt,n):
        if num[j][1]>0:
            yn=1
            cnt=j
            break
    if yn==0 and num[-1][1]>0:
        yn=1
        cnt=n-1
    if yn==0:
        break
    num2=num[cnt][0]+d
print(ans)


### FIXED CODE ###

h,a=map(int,input().split())
b=-(h//-a)
print(b)
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if a>b:
  muki=-1
else:
  muki=1

at=a+v*muki*t
bt=b+w*muki*t

if muki:
  if at>=bt:
    print("YES")
  else:
    print("NO")
else:
  if at=<bt:
    print("YES")
  else:
    print("NO")

### FIXED CODE ###

a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if a>b:
  muki=-1
else:
  muki=1

at=a+v*muki*t
bt=b+w*muki*t

if muki==1:
  if at>=bt:
    print("YES")
  else:
    print("NO")
else:
  if at<=bt:
    print("YES")
  else:
    print("NO")
n = int(input())
l = []
y = []
for i in range(n):
  a = int(input())
  l.append(a)
for i in range(n):
  x = l[i]
  print(max(l.remove(x))

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
  a = int(input())
  l.append(a)
x = max(l)
i = l.index(x)

l.sort()
for b in range(n):
  if i != b:
    print(x)
  else:
    print(l[n-2])
def main():
    n = int(input())
    ps = [int(x) for x in input().split()]

    dis = []

    for n, p in enumerate(ps):
        if n + 1 != p:
            dis.append(p)

    if len(dis) == 2 or len(dis) == 0:
        print("YES")
    else:
        print("NO")

main()

### FIXED CODE ###

ab = input().split()
a = int(ab[0])
b = int(ab[1])
 
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
n = int(input())
a = list(map(int, input().split))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
#Reconstruction of the Tree
n = int(input())
pre = list(map(int,input().split()))
ino = list(map(int,input().split()))

post=[]
i = -1
def recaonstruction(l, r):
    global i
    if l >= r:
        return
    i += 1
    c = pre[i]
    m = ino.index(c)
    reconstruction(l, m)
    reconstruction(m+1, r)
    post.append(c)
reconstruction(0, n)
print(" ".join(map(str,post)))

### FIXED CODE ###

n = int(input())
pre = list(map(int,input().split()))
ino = list(map(int,input().split()))

post=[]
i = -1
def reconstruction(l, r):
    global i
    if l >= r:
        return
    i += 1
    c = pre[i]
    m = ino.index(c)
    reconstruction(l, m)
    reconstruction(m+1, r)
    post.append(c)
reconstruction(0, n)
print(" ".join(map(str,post)))
M, N = map(int, input().split())
COST, STOCK = range(2)
energy_drinks = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda tuple_: tuple_[COST])

cost = 0
for energy_drink in energy_drinks:
    buy = min(energy_drink[STOCK], N)
    N -= buy
    cost += buy * energy_drink[COST]
print(cost)


### FIXED CODE ###

M, N = map(int, input().split())
COST, STOCK = range(2)
energy_drinks = sorted((tuple(map(int, input().split())) for _ in range(M)), key=lambda tuple_: tuple_[COST])

cost = 0
for energy_drink in energy_drinks:
    buy = min(energy_drink[STOCK], N)
    N -= buy
    cost += buy * energy_drink[COST]
print(cost)
t =[]
for n in range(2,10000):
  for x in range(2,n):
    if n % x == 0:
      break
  else:
    t.append(n)

while True:
  try:
    b=0
    a = int(input())
    for b in range(10000):
      if t[b] > a:
        print len(t[0:b])
        break
  except EOFError:
    break

### FIXED CODE ###


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
import sys
 
list=1000000*[1]
 
list[0] = 0
list[1] = 0
for i in range(1,1000000):
    if list[i] == 1:
        for j in range(i*i,1000000,i):
            list[j] = 0
 
for i in range(2,1000000):
    list[i] += list[i-1]
     
for line in sys.stdin:
    a = int(line)
    print list[a]
import sys
import numpy as np

def main(N, S):
    dp = np.zeros((N + 1, N + 1), dtype=int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1) if S[i] == S[j] else 0
    return dp.max()

if sys.argv[-1] == 'ONLINE_JUDGE' & 0:
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    main = cc_export(main, (i8, i8[:]))
    cc.compile()

#from my_module import main

N = int(read())
S = [ord(_) for _ in input()]
print(main(N, S))


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
n,a,b = map(int,input().split())

sum = n//(a+b)*a
res = n%(a*b)
sum += min(res,a)

print(sum)

### FIXED CODE ###

n,a,b = map(int,input().split())

sum = n//(a+b)*a
res = n%(a+b)
sum += min(res,a)

print(sum)