Harryxun/stf_run huggingface dataset:
import sys
from collections import defaultdict

input = sys.stdin.readline

N = int(input())
G = defaultdict(list)

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

res = [None] * N


def dfs(v, p, c):
    res[v] = c
    for u, w in G[v]:
        if u == p:
            continue
        if w % 2 == 0:
            dfs(u, v, c)
        else:
            dfs(u, v, 1 - c)


dfs(0, -1, 0)
for x in res:
    print(x)


### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(100000)
input = sys.stdin.readline

N = int(input())
G = defaultdict(list)
for _ in range(N - 1):
    u, v, w = map(int, input().split())
    G[u - 1].append((v - 1, w))
    G[v - 1].append((u - 1, w))
res = [None] * N


def dfs(v, c):
    res[v] = c
    for u, w in G[v]:
        if res[u] is not None:
            continue
        if w % 2 == 0:
            dfs(u, c)
        else:
            dfs(u, 1 - c)


dfs(0, 0)
for x in res:
    print(x)
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = unt(nums[2])
if a < b < c:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
    print('Yes')
elif a < c < b:
    print('No')
elif b < a < c:
    print('No')
elif b < c < a:
    print('No')
elif c < a < b:
    print('No')
else:
    print('No')
n, m = map(int, input().split())
cnt = 0
wa = 0
ac = 0
sumi = []
b = {}
for x in range(m):
    a = input().split()
    if a[1] == 'WA':
        try:
            b[a[0]] += 1
        except KeyError:
            b[a[0]] = 1
    if a[1] == 'AC' and not a[0] in sumi:
        sumi.append(a[0])
        ac += 1
        try:
            wa += b[a[0]]
        except KeyError:
            continue
print(ac, wa)

### FIXED CODE ###

a = input()


print(chr(ord(a) + 1))
A, B = map(int, input().split())

import math 

print(A * B // math.gcd(A, B))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for zip(Vs, Cs) if v >= c ]))


### FIXED CODE ###

N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for v, c in zip(Vs, Cs) if v >= c ]))
from collections import deque

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

if n%2==0:
	ans=1
	for i in range(n/2):
		ans=ans*a[i]*a[i+n/2]
else:
	if n==1:
		ans=a[0]
	else:
		ans=a[0]
		for i in range(1,int((n-1)/2)+1):
			ans=ans*a[i]*a[i+int((n-1)/2)]

if ans>1000000000000000000:
	print("-1")
else:
	print(ans)

### FIXED CODE ###

import sys

def main():
    n = int(input())
    a=sys.stdin.readline().rstrip().split()
    if '0' in a:
        print(0)
        return
    ans=1
 
    for i in a:
        ans=ans*int(i)
        if ans>1000000000000000000:
            print("-1")
            return
    else:
        print(ans)
main()
import sys
input = sys.stdin.readline

N = int(input())
d = list(map(int, input().split()))
P = 0

for i in range(N - 1):
    if d[i] == 0:
        continue
    for j in range(i + 1, N):
        if d[j] == 0:
            continue
        P += d[i] * d[j
print(P)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N = int(input())
d = list(map(int, input().split()))
P = 0
 
for i in range(N - 1):
    if d[i] == 0:
        continue
    for j in range(i + 1, N):
        if d[j] == 0:
            continue
        P += d[i] * d[j]
print(P)
a=int(input())
b=int(input())
c=int(input())
d=int(input())

S=[a,b,c,d]
if num=(a=b,b=c,c=d):
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

s=input()

if s[0] == s[1]:
    print('Bad')
    exit()
if s[1] == s[2]:
    print('Bad')   
    exit()
if s[2] == s[3]:
    print('Bad')
    exit()
else:
    print('Good')
while True:
	try:
		list = [int(item) for item in raw_input().split()]
		list.sort()
		if list[0] ** 2 + list[1] ** 2 == list[2] ** 2 :
			print 'YES'
		else :
			print 'NO'
	except EOFError:
		break

### FIXED CODE ###

for i in xrange(input()):
	i,j,k = sorted([int(i) for i in raw_input().split()])
	print "YES" if i**2 + j**2 == k**2 else "NO"
import sys
N,H=map(int,input().split())
B=[]
index=-1
tmp=-1
for i in range(N):
  a,b=map(int,input().split())
  B.append(b)
  if a>tmp:
    index=i
    tmp=a
a_,b_=tmp,B[index]
cnt=0
if sum(B)>=H:
  B=sorted(B,reverse=True)
  while H>0:
    cnt+=1
    b=B.pop(0)
    H-=b
  print(cnt)
else:
  B.remove(b_)
  B=sorted(B,reverse=True)
  while len(B)!=0 :
    b=B.pop(0)
    if b<=a_:
      break
    H-=b
    cnt+=1
  if H-b_<=0:
    print(cnt+1)
    sys.exit()
  v=(H-b_)//a_
  cnt+=v
  H-=a_*v
  if 0=<H<=b_:
    cnt+=1
  else:
    cnt+=2
  print(cnt)

### FIXED CODE ###

N,H=map(int,input().split())
B=[]
index=-1
tmp=-1
for i in range(N):
  a,b=map(int,input().split())
  B.append(b)
  if a>tmp:
    index=i
    tmp=a
a_,b_=tmp,B[index]
cnt=0
B=sorted(B,reverse=True)
while H>0 and len(B)!=0:
  b=B.pop(0)
  if b<a_:
    break
  H-=b
  cnt+=1
if H<=0:
  print(cnt)
else:
  v=H//a_
  if H%a_==0:
    cnt+=v
  else:
    cnt+=(v+1)
  print(cnt)
S = input()

def is_keyence(S):
    keyence_str = "keyence"
    i = 0
    is_change = False
    change_num = 0
    for j in range(len(S)):
        if S[j] != keyence_str[i]:
            if is_change: change_num += 1
            else:
                if change_num > 0:
                    return False
                is_change = True
                change_num += 1
        else:
            if is_change: is_change = False
            i += 1
    if i == len(keyence_str):
        return True
    else: return False


if is_keyence(S):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

S = input()

def is_keyence(S):
    key = "keyence"
    for i in range(len(key)):
        #print(key[:i], key[i:])
        if (S.startswith(key[:i]) and S.endswith(key[i:])):
            return True
    return False


if is_keyence(S):
    print("YES")
else:
    print("NO")
n,m=map(int,input().split())
hoge=[[0 for i in range(n+2)] for j in range(m+2)]
for i in range(n):
  sss=input()
  for j in range(m):
    if(sss[j]=="#"):
      hoge[1+i][1+j]=1
    
flag=True
for i in range(m):
  for j in range(n):
    if(hoge[1+i][1+j]==1):
      ans=0
      ans+=hoge[i][1+j]+hoge[1+i][j]+hoge[2+i][1+j]+hoge[1+i][2+j]
      if(ans==0):
        flag=False
        
if(flag):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

m,n=map(int,input().split())
hoge=[[0 for i in range(n+2)] for j in range(m+2)]
for i in range(m):
  sss=input()
  for j in range(n):
    if(sss[j]=="#"):
      hoge[1+i][1+j]=1
    

flag=True
for i in range(m):
  for j in range(n):
    if(hoge[1+i][1+j]==1):
      ans=0
      #print(1+i,1+j,ans,hoge[i][1+j],hoge[1+i][j],hoge[2+i][1+j],hoge[1+i][2+j])
      ans=max(hoge[i][1+j],hoge[1+i][j],hoge[2+i][1+j],hoge[1+i][2+j])
      if(ans==0):
        flag=False
        
if(flag):
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-


class LinkedList:
    def __init__(self, n):
        self.n = n
        self.ll = [[] for _ in range(self.n)]

    def link(self, u, v, direction=False):
        self.ll[u].append(v)
        if not direction:
            self.ll[v].append(u)

    def dfs(self):
        self.cc = [None] * self.n

        color = 1
        for u in range(self.n):
            if not self.cc[u]:
                self.dfs_visit(u, color)
                color += 1

    def dfs_visit(self, u, color):
        self.cc[u] = color
        for v in self.ll[u]:
            if not self.cc[v]:
                self.dfs_visit(v, color)

    def check(self, u, v):
        if self.cc[u] == self.cc[v]:
            print('yes')
        else:
            print('no')


if __name__ == '__main__':
    n, m = map(int, input().split())
    ll = LinkedList(n)

    for _ in range(m):
        u, v = map(int, input().split())
        ll.link(u, v)
    ll.dfs()

    q = int(input())
    for _ in range(q):
        u, v = map(int, input().split())
        ll.check(u, v)



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)


class LinkedList:
    def __init__(self, n):
        self.n = n
        self.ll = [[] for _ in range(self.n)]

    def link(self, u, v, direction=False):
        self.ll[u].append(v)
        if not direction:
            self.ll[v].append(u)

    def dfs(self):
        self.cc = [None] * self.n

        color = 1
        for u in range(self.n):
            if not self.cc[u]:
                self.dfs_visit(u, color)
                color += 1

    def dfs_visit(self, u, color):
        self.cc[u] = color
        for v in self.ll[u]:
            if not self.cc[v]:
                self.dfs_visit(v, color)

    def check(self, u, v):
        if self.cc[u] == self.cc[v]:
            print('yes')
        else:
            print('no')


if __name__ == '__main__':
    n, m = map(int, input().split())
    ll = LinkedList(n)

    for _ in range(m):
        u, v = map(int, input().split())
        ll.link(u, v)
    ll.dfs()

    q = int(input())
    for _ in range(q):
        u, v = map(int, input().split())
        ll.check(u, v)
N, K = map(int, input().split())
pn = list(map(int, input().split()))

l = sum(pn[:K])
for i in range(N-K+1):
    l = max(l, l+pn[K+i]-pn[i])
ans = (l+K)/2
print(ans)


### FIXED CODE ###

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

pn_t = [0]
for i in range(N):
    pn_t.append(pn[i]+pn_t[i])

l = 0
for i in range(N-K+1):
    l = max(l, pn_t[K+i]-pn_t[i])
ans = (l+K)/2
print(ans)
,b,c,d=map(int,input().split())
if a/d>c/b:
    print('Yes')
elif a/d==c/b:
	if c/b>0 and a/d==0
		print('No')
	else:
    	print('Yes')
elif a/d+1==c/b:
    if c%b==0 and a%d!=0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

a,b,c,d=map(int,input().split())
x=a//d
y=c//b
if y<x:
    print('Yes')
elif y==x:
    if c%b==0:
        print('Yes')
    else:
        if a%d==0:
            print('No')
        else:
            print('Yes')
            
elif y==x+1:
    if c%b==0:
        print('Yes')
    else:
        print('No')
            
else:
    print('No')
Sdash = str(input())
T = str(input())

reslis = []
N = len(Sdash) - len(T) + 1
for i in range(N):
    Tdash = Sdash[i:i+len(T)]
    for j in range(len(T)):
        if Tdash[j] == T[j] or Tdash[j] == "?":
            pass
        else:
            break
    else:
        if i == 0:
            reslis.append(T + Sdash[i+len(T)])
        elif i == N - 1:
            reslis.append(Sdash[:i] + T)
        else:
            reslis.append(Sdash[:i] + T + Sdash[i+len(T)])

if reslis:
    reslis = [st.replace("?","a") for st in reslis]
    reslis.sort()
    print(reslis[0])

else:
    print("UNRESTORABLE")
        

### FIXED CODE ###

Sdash = str(input())
T = str(input())

reslis = []

if len(Sdash) >= len(T):
    for i in range(len(Sdash) - len(T) + 1):
        res = Sdash
        temp = Sdash[i:i+len(T)]
        for k in range(len(T)):
            if T[k] == temp[k] or temp[k] == "?":
                res = list(res)
                res[k+i] = T[k]
                res = "".join(res)
            else:
                break
        else:
            reslis.append(res) 

if reslis:
    reslis = [st.replace("?", "a") for st in reslis]
    print(min(reslis))
else:
    print("UNRESTORABLE")
import copy
S = list(input())

flag = True
total = len(S)

S_ = S

while flag:
  S = S_
  S_ = copy.copy(S)
  j = 0
  carsor = 0
  while carsor < len(S)-1:
    if S[carsor] != S[carsor+1]:
      del S_[j]
      del S_[j]
      j -= 2
      carsor += 1
    j += 1
    carsor += 1
  if carsor == j:
    flag = False
      
print(total - len(S))
      
   
  

### FIXED CODE ###

S = list(input())

num_1 = S.count("1")
num_0 = S.count("0")

print(len(S) - abs(num_1-num_0))
def cmb(n, r, mod,g1,g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod



def main():
    mod = 10**9+7 #出力の制限
    N = 10**4
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))
    A.sort()
    if K==1:
        print(0)
        return

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

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

    result=0
    for i in range(N-1):
        result+=(rcom[i]-lcom[i])*cmb(N-2-i,K-2,mod,g1,g2)
        result%=(10**9+7)

    print(result)

main()

### FIXED CODE ###

def cmb(n, r, mod,g1,g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod



def main():
    mod = 10**9+7 #出力の制限
    N = 10**5+1
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    import sys
    N,K=list(map(int,sys.stdin.readline().split()))
    A=list(map(int,sys.stdin.readline().split()))
    A.sort()
    if K==1:
        print(0)
        return

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

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

    result=0
    for i in range(N-1):
        result+=(rcom[i]-lcom[i])*cmb(N-2-i,K-2,mod,g1,g2)
        result%=(10**9+7)

    print(result)

main()
n, y = list(map(int,input().split()))
flager = 0
for i in range(n+1):
    print('i'+str(i))
    for j in range(n-i+1):
        print('j'+str(j))
        
        if 10000*i + 5000*j + 1000*(n - i - j )==y:
            print(i, j, n-i-j)
            flag = 1
            break
    if flag == 1:
        break
        
if flag == 0:
    print(-1,-1,-1)

### FIXED CODE ###

n, y = list(map(int,input().split()))
flag = 0
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n - i - j )==y:
            print(i, j, n-i-j)
            flag = 1
            break
    if flag == 1:
        break
        
if flag == 0:
    print(-1,-1,-1)
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def prob_d(n=None, k=None):
    if n is None and k is None:
        n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= (cmb(n - k + 1, i + 1) % div)
                ans = ans % div
                print(str(ans))

prob_d()

### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def prob_d(n=None, k=None):
    if n is None and k is None:
        n, k = [int(a) for a in input().split()]
    div = 10 ** 9 + 7
    for i in range(k):
        if n - k + 1 < i + 1:
            print("0")
        else:
            if k == 1:
                ans = cmb(n, i+1) % div
                print(str(ans))
            else:
                ans = cmb(k-1, i) % div
                ans *= (cmb(n - k + 1, i + 1) % div)
                ans = ans % div
                print(str(ans))


prob_d()
from math import gcd
mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))


### FIXED CODE ###

from fractions import gcd

mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))
import numpy as np

n, m = map(int, input().split())
a = [0] + list(map(int, input().split()))

a = np.array(a)

_, c = np.unique(np.cumsum(a % m) % m, return_counts=True)

print((c * (c - 1)).sum() // 2)

### FIXED CODE ###

import numpy as np
from collections import Counter

n, m = map(int, input().split())
a = [0] + list(map(int, input().split()))
a = np.array(a)
c = Counter(np.cumsum(a % m) % m)
print(sum(i * (i - 1) for i in c.values()) // 2)
import sys
input = sys.stdin.readline

def main():
    N, Q = map(int, input().split())
    graph = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    PX = [list(map(int, input().split())) for _ in range(Q)]

    score = [0 for _ in range(N)]
    for p, x in PX:
        score[p-1] += x

    checked = [False for _ in range(N)]
    checked[0] = True
    def dfs(p, s, checked, score):
        #print(p, s, score)
        ns = s + score[p]
        score[p] += s
        for q in graph[p]:
            if not checked[q]:
                checked[q] = True
                score = dfs(q, ns, checked, score)
        return score

    ans = dfs(0, 0, checked, score)
    print(' '.join([str(a) for a in ans]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(900000)


N, Q = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
PX = [list(map(int, input().split())) for _ in range(Q)]

def dfs(p, s, checked, score):
    #print(p, s, score)
    ns = s + score[p]
    score[p] += s
    for q in graph[p]:
        if not checked[q]:
            checked[q] = True
            score = dfs(q, ns, checked, score)
    return score


def main():


    score = [0 for _ in range(N)]
    for p, x in PX:
        score[p-1] += x

    checked = [False for _ in range(N)]
    checked[0] = True
    
    ans = dfs(0, 0, checked, score)
    print(' '.join([str(a) for a in ans]))


if __name__ == "__main__":
    main()
n, m = list(map(int, input().split()))
A = []
B = []
for i in range(n):
    A.append([input()])
for i in range(m):
    B.append([input()])
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        if A[j][i:] == B[j][:]:
            for k in range(m - 1):
                if A[j + k][i:] == B[j + k][:]:
                    flag = 1
                    continue
                flag = 0
                break
            if flag == 1:
                print('Yes')
                exit(0)
print('No')


### FIXED CODE ###

n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        flag = 1
        for k in range(m):
            if A[j + k][i: i + m] != B[k]:
                flag = 0
                break
        if flag == 1:
            print('Yes')
            exit(0)
print('No')
n = int(input())
a = list(map(int, input().split()))

a_sorted = sorted(a)
divisible_list = [0] * 200010

for i in range(len(a)):
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(len(a)):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)



### FIXED CODE ###

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

a_sorted = sorted(a)
divisible_list = [0] * (max(a)+1)

for i in range(len(a)):
    for j in range(0, len(divisible_list), a[i]):
        divisible_list[j] += 1

ans = 0
for i in range(len(a)):
    if divisible_list[a[i]] == 1:
        ans+=1
print(ans)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;

#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
 
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////

int main(){fastio
    
    return 0;
}


### FIXED CODE ###



import numpy as np

s=sorted(input())

if(s==list("abc")):print("Yes")
else:print("No")
n=int(input())
a=list(map(int,input().split()))
n=0
while n>=0:
  if all(aa%2==0 for aa in a):
    aa%=2
    n+=1
  else:
    break
print(n)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
while all(aa%2==0 for aa in a):
  ans+=1
  a=[aa//2 for aa in a]
print(ans)
def minfunc(i,s,cost,p):
  iter=0
  k=i-1
  mini=abs(s[i]-s[i-1])+cost[i-1]
  while(k>=0 and iter<p):
    if abs(s[i]-s[k])+cost[k]<mini:
      mini=abs(s[i]-s[k])+cost[k]
    k=k-1
    iter=iter+1
  return mini
    
    


l=list(map(int,input().split()))
n=l[0]
p=l[1]
s=list(map(int,input().split()))
cost=[0]*n
cost[1]=abs(s[1]-s[0])
if n==2:
  
  print(abs(s[1]-s[0]))
  
else:
  for i in range(2,len(s)):
  	cost[i]=minfunc(i,s,cost,p)
  print(cost[n-1])


### FIXED CODE ###

n=int(input())
s=list(map(int,input().split()))
cost=[0]*n
cost[1]=abs(s[1]-s[0])
if n==2:
  
  print(abs(s[1]-s[0]))
  
else:
  for i in range(2,len(s)):
  	cost[i]=min(abs(s[i]-s[i-1])+cost[i-1],abs(s[i]-s[i-2])+cost[i-2])
  print(cost[n-1])
def main ()
    x, y =[int(i) for i in input().split().sort(reverse = True )]
    
    while  x%y != 0 :
        x, y =[x%y x.sort(reverse = True)] 

    print(y)

if __name__=='__main__':
    def main()

### FIXED CODE ###

def main() :
    x, y = [int(i) for i in input().split()]
    while y != 0 :
        x, y = y, x%y

    print(x)

if __name__ == '__main__':
    main()
import sys
N = int(input())
array = [ input() for a in range(6) ]
base = ['AC','WA','TLE','RE']

for I in base:
    print(I+' x '+str(array.count(I)))

### FIXED CODE ###

import sys
N = int(input())
array = [ input() for a in range(N) ]
base = ['AC','WA','TLE','RE']

for I in base:
    print(I+' x '+str(array.count(I)))
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1;
  else:
    print(count)
if count==n+1:
  print(n+1)


### FIXED CODE ###

lis=input().split(' ')
x=int(lis[0])
a=int(lis[1])
if x<a:
  print(0)
else:
  print(10)
s=input()
print(x*len(s))

### FIXED CODE ###

s=input()
print("x"*len(s))
n = int(input())

odd = 0
two = 0
four = 0

for i in range(n):
    a = int(input())
    if(a%2): odd += 1
    else:
        if(a%4==0):four+=1
        else: two += 1


if(two):
    if(odd<=four): print("Yes")
    else: print("No")

else:
    if(odd-1<=four): print("Yes")
    else: print("No")

### FIXED CODE ###

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

odd = 0
two = 0
four = 0

for a in A:
    if(a%2): odd += 1
    else:
        if(a%4==0):four+=1
        else: two += 1


if(two):
    if(odd<=four): print("Yes")
    else: print("No")

else:
    if(odd-1<=four): print("Yes")
    else: print("No")