Harryxun/stf_run huggingface dataset:
import fractions
from functools import reduce
import math
def lcm_base(x, y):
    return int((x * y) // fractions.gcd(x, y))
def lcm_list(numbers):
    return int(reduce(lcm_base, numbers, 1))

N,M = map(int,input().split())
List=list(map(int,input().split()))
aa = int(lcm_list(List)/2)
cnt = 0
a=List[0]
while a%2 == 0:
  cnt+=1
  a = int(a/2)
out = 0
if cnt == 0:
  out = 1
  cnt = 1
for i in range(len(List)):
  if List[i] % (2**cnt) > 0:
    out = 1
  elif List[i] % (2**(cnt+1)) == 0:
    out = 1

if out == 1:
  print(0)
else:
  print(int(math.ceil((M / aa)) // 2))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(set(map(lambda x : int(x)//2, input().split())))
def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)
def lcm(x, y):
  return (x * y) // gcd(x, y)
l = A[0]
for a in A[1:]:
  l = lcm(l, a)
ans = (M // l + 1) // 2
for a in A[1:]:
  if (l // a) % 2 == 0:
    ans = 0
    break
print(ans)
n = int(input())
s = str(input())
if (s[:n] * 2  = s):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")
a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') else a*b==15 else print('x')

### FIXED CODE ###

a,b=map(int,input().split(' '))
print('+') if a+b==15 else print('*') if a*b==15 else print('x')
a, b = list(map(int, input().split()))

pa = [[] for i in range(110)]
pb = [[] for i in range(110)]

for i in range(1000):
  pa[int(i*0.08)].append(i)
  pb[int(i*0.10)].append(i)
  
na = min(pa[a])

nb = pb[b]
if min(nb)<=na and max(nb)>=na:
  print(na)
else:
  print(-1)

### FIXED CODE ###

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

pa = [[] for i in range(110)]
pb = [[] for i in range(111)]

for i in range(1251):
  pa[int(i*0.08)].append(i)
  
for i in range(1101):
  pb[int(i*0.10)].append(i)
  
na = pa[a]
nb = pb[b]

for ca in na:
  if ca in nb:
    print(ca)
    exit()

print(-1)
n,k=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)].sort()
cou=0
for r in l:
  a,b=r[0],r[1]
  cou+=b
  if cou>=k:
    print(a)
    break

### FIXED CODE ###

n,k=map(int,input().split())
l=sorted([list(map(int,input().split())) for _ in range(n)])
cou=0
for r in l:
  a,b=r[0],r[1]
  cou+=b
  if cou>=k:
    print(a)
    break
N=int(input())
a=[0]*(N)
maxim=[0]*(N)
for i in range(N):
    a[i]=int(input())
maxim=sorted(list(a), reverse=True)
for k in range(N):
    if a[k]!=maxim[0]:
        print(maxim[0])
    else:
        print(maxim[1])

### FIXED CODE ###

r=int(input())
print(r*r*3)
S = input()
K = int(input())
 

ans = 0
if len(S) == 1:
    ans = S[0]
else:
    i = 0
    while S[i] == '1':
        i += 1
    ans = S[i]
print(ans)

### FIXED CODE ###

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

ans = 0
if len(S) == 1:
    ans = S[0]
else:
    i = 0
    for i in range(len(S)):
        if S[i] != '1' and i < K:
            ans = S[i]
            break
        else:
            ans = S[0]
   
print(ans)
n,m = map(int, input().split())
ma = []
for i in range(n):
  ma.append(input())

t = []
for i in range(m):
  t.append(input())

ly = len(t[0])
lt = m
ans = False
for i in range(n):
  for j in range(n):
    for k in range(lt):
      if ma[i + k][j : j + ly + 1] != t[k]:
        break
    else:
      ans = True

if ans:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n,m = map(int, input().split())
ma = []
for i in range(n):
  ma.append(input())

t = []
for i in range(m):
  t.append(input())

ans = False
for i in range(n - m + 1):
  for j in range(n - m + 1):
    for k in range(m):
      ll = ma[i + k][j : j + m]
      if ll != t[k]:
        break
    else:
      ans = True

if ans:
  print("Yes")
else:
  print("No")
n = int(input())
p = [int(input()) for i in range(n)]
p = sorted(p)
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split(' ')))
p = sorted(p, reverse=True)
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')
N,M = map(int, input().split())
    if M==1 and N==1:
        print(1)
    elif M==1:
        print(N-2)
    elif N==1:
        print(M-2)
    else:
        print((N-2)*(M-2))


### FIXED CODE ###

N,M = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M==1:
    print(N-2)
elif N==1:
    print(M-2)
else:
    print((N-2)*(M-2))
n, k = list(map(int, input().split()))
ans = 0
# while True:
#     n = n // k
#     ans += 1
#     if n == 0:
#         break
# print(ans)


if k == 10:
    ans = len(str(n))
else:
    l = []
    while True:
    n = n // k
    ans += 1
    if n == 0:
        break
print(ans)


### FIXED CODE ###

n, k = list(map(int, input().split()))
ans = 0
while True:
    n = n // k
    ans += 1
    if n == 0:
        break
print(ans)
def main():
    N = int(input())
    tasks = [tuple(map(int, input().split())) for _ in range(N)]
    tasks.sort(key=lambda x: x[1])
    time = 0
    for A, B in tasks:
        time += A
        if B < time:
            return 'No'
    return 'Yes'

print(main())


### FIXED CODE ###

import fractions

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

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

def count_multiple(n):
    return (B // n) - ((A - 1) // n)

def count_not_multiple(n):
    return (B - A + 1) - count_multiple(n)

cnm = count_not_multiple
print(cnm(C) + cnm(D) - cnm(lcm(C, D)))
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // math.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
 
result = b-a+1 -(c_sum+d_sum-cd_sum)
print((result))

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
cd = (c*d) // fractions.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)
n,m = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

X_diff = [X[i+1]-X[i] for i in range(m-1)]
X_diff.sort(reverse=True)

if n >= m:
    print(0)
else:
    print(X[-1] - X[0] - sum(X_diff[:N-1]))

### FIXED CODE ###

n,m = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

X_diff = [X[i+1]-X[i] for i in range(m-1)]
X_diff.sort(reverse=True)

if n >= m:
    print(0)
else:
    print(X[-1] - X[0] - sum(X_diff[:n-1]))
# -*- coding: utf-8 -*-
import sys


def answer(N, A, B):
    rail = N * A
    taxi = B

    return min(rail, taxi)


if __name__ == '__main__':
    args = sys.stdin.read().split(' ')
    answer(args[0], args[1], args[2])


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys


def answer(N, A, B):
    rail = N * A
    taxi = B

    print(min(rail, taxi))


if __name__ == '__main__':
    args = sys.stdin.read().split(' ')
    answer(int(args[0]), int(args[1]), int(args[2]))
N = int(input())

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

i=0

max = 0
min = 0
for i in range(n):
  if a[i] >= max:
    max = a[i]
  elif a[i] <= min:
    min = a[i]
  else:
    continue
    
print (max - min)
  

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
dist = []
for i in range(n):
    for j in range(n):
        if i >= j:
            continue
        dist.append(abs(a[i]-a[j]))
print(max(dist))
n = int(input())
s = str(input())
alp = 'abcdefghijklmnopqrstuvwxyz' * 2
ss = ''

for i in range(len(s)):

    ss += str(alp[alp.index(s[i])+n])

print(ss)


### FIXED CODE ###

n = int(input())
s = str(input())
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ss = ''

for i in range(len(s)):

    ss += str(alp[alp.index(s[i])+n])

print(ss)
N = (int)(input())
edges = []
for _ in range(N-1):
    edges.append((list)(map(int, input().split())))

Q, K = (list)(map(int, input().split()))
querys = []
for _ in range(Q):
    querys.append((list)(map(int, input().split())))

'''
 N:num of nodes
 Q: num of query
 K: node must passed in query

'''
dist = [-1]*(N+1)
for e in edges:
    if dist[e[0]] == -1:
        dist[e[0]] = [[e[1], e[2]]]
    else:
        dist[e[0]].append([e[1], e[2]])

    if dist[e[1]] == -1:
        dist[e[1]] = [[e[0], e[2]]]
    else:
        dist[e[1]].append([e[0], e[2]])

dist_from_k = [-1]*(N+1)


def dfs(v, cost):
    if dist_from_k[v] != -1:
        return

    dist_from_k[v] = cost
    for e in dist[v]:
        dfs(e[0], cost+e[1])


dfs(K, 0)

for q in querys:
    print(dist_from_k[q[0]] + dist_from_k[q[1]])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
N = (int)(input())
edges = []
for _ in range(N-1):
    edges.append((list)(map(int, input().split())))

Q, K = (list)(map(int, input().split()))
querys = []
for _ in range(Q):
    querys.append((list)(map(int, input().split())))

'''
 N:num of nodes
 Q: num of query
 K: node must passed in query

'''
dist = [-1]*(N+1)
for e in edges:
    if dist[e[0]] == -1:
        dist[e[0]] = [[e[1], e[2]]]
    else:
        dist[e[0]].append([e[1], e[2]])

    if dist[e[1]] == -1:
        dist[e[1]] = [[e[0], e[2]]]
    else:
        dist[e[1]].append([e[0], e[2]])

dist_from_k = [-1]*(N+1)


def dfs(v, cost):
    if dist_from_k[v] != -1:
        return

    dist_from_k[v] = cost
    for e in dist[v]:
        dfs(e[0], cost+e[1])


dfs(K, 0)

for q in querys:
    print(dist_from_k[q[0]] + dist_from_k[q[1]])
s = list(input())
K = int(input())
l = []
l2 = []
l3 = []
l4 = []

for i in range(len(s)):
    s[i] = str(ord(s[i])-ord("a")+11)

for i in range(len(s)):
    tmp = ''
    for j in range(i, len(s)):
        tmp += s[j]
        if(len(tmp)<6):
            l.append(tmp)


for i in range(len(l)):
    while True:
        if len(l[i]) == len(s)*2: break
        l[i] += '0'

for i in l:
    is_multi = 0
    i = int(i)
    for j in l2:
        if i == j:
            is_multi = 1
            break
    if is_multi == 0:
        l2.append(i)

l2.sort()

l2 = list(str(l2[K-1]))

tmp = ''
for i in range(len(l2)):
    if l2[i] != '0':
        tmp += l2[i]

l3 = list(tmp)
if len(l3) % 2 == 1:
    l3.append('0')

i = 0
while i < len(l3):
    tmp = chr(int(l3[i] + l3[i+1]) - 11 + ord('a'))
    l4.append(tmp)
    i += 2

ans =''
for i in range(len(l4)):
    ans += l4[i]

print(ans)


### FIXED CODE ###

s = list(input())
K = int(input())

l =[]

for i in range(len(s)):
    tmp = ''
    for j in range(i, len(s)):
        if j > i + 4: break
        tmp += s[j]
        l.append(tmp)
l.sort()

l2 = []
for x in l:
    if len(l2) > 6:
        break
    if x not in l2:
        l2.append(x)


ans = l2[K - 1]

print(ans)
water = 0
sugar = 0
for i in range(F//(100*A)+1):
    for j in range(F//(100*B)+1):
        for k in range(F//C+1):
            for l in range(F//D+1):
                water = 100*i+100*j
                sugar = k+l
                if water+sugar <= F and sugar <= E//100*water:
                    break
print(water+sugar, sugar)

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
dens = 0
ans_water = 100*min(A, B)
ans_sugar = 0
for i in range(31):
    for j in range((F-(100*A*i))//(100*B)+1):
        for k in range((F-(100*A*i)-(100*B*j))//C+1):
            for l in range((F-(100*A*i)-(100*B*j)-(C*k))//D+1):
                water = 100*A*i+100*B*j
                sugar = C*k+D*l
                if water == 0:
                    break
                if sugar <= E*(A*i+B*j):
                    if dens<sugar/(sugar+water):
                        dens = sugar/(sugar+water)
                        ans_water = water
                        ans_sugar = sugar
print(ans_water+ans_sugar, ans_sugar)
n,m,x=map(int,input().split())
clis=[]
alis=[]
for _ in range(n):
  tu=list(map(int,input().split()))
  clis.append(tu[0])
  alis.append(tu[1:])


ma_c=[]
for i in range(2**n):
  bag=[]
  price=0
  for j in range(n):
    if ((i>>j)&1):
      price+=clis[j]
      bag.append(alis[j])
  pac=[0]*m
  for t in range(len(bag)):
    for k in range(m):
        pac[k]+=bag[t][k]
  if all([pac[t]>=x for t in range(m)]):
    ma_c.append(price)

print(min(ma_c))

### FIXED CODE ###

n,m,x=map(int,input().split())
clis=[]
alis=[]
for _ in range(n):
  tu=list(map(int,input().split()))
  clis.append(tu[0])
  alis.append(tu[1:])


ma_c=[]
for i in range(2**n):
  bag=[]
  price=0
  for j in range(n):
    if ((i>>j)&1):
      price+=clis[j]
      bag.append(alis[j])
  pac=[0]*m
  for t in range(len(bag)):
    for k in range(m):
        pac[k]+=bag[t][k]
  if all([pac[t]>=x for t in range(m)]):
    ma_c.append(price)


if len(ma_c)!=0:
  print(min(ma_c))
else:
  print(-1)
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,m = [int(x) for x in stdin.readline().rstrip().split()]

d = {}
for i in range(n):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]

    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)

    if b not in d:
        d[b] = [a]
    else:
        d[b].append(a)

sol = {}

m = [1]
while True:
    next_m = []
    for mm in m:
        b = d[mm]
        for bb in b:
            if bb not in sol:
                sol[bb] = mm
                next_m.append(bb)

    if len(next_m) == 0: break
    m = next_m

sol = sorted(sol.items())

print("Yes")
for v in sol[1:]:
    print(v[1])

### FIXED CODE ###

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,m = [int(x) for x in stdin.readline().rstrip().split()]

d = {}
for i in range(m):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]

    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)

    if b not in d:
        d[b] = [a]
    else:
        d[b].append(a)

sol = {}

m = [1]
while True:
    next_m = []
    for mm in m:
        b = d[mm]
        for bb in b:
            if bb not in sol:
                sol[bb] = mm
                next_m.append(bb)

    if len(next_m) == 0: break
    m = next_m

sol = sorted(sol.items())

print("Yes")
for v in sol[1:]:
    print(v[1])
n = int(input())
v,c = list(map(int,input().split()),list(map(int,input().split())
ans = 0
for i in range(n):
    if v[i] > c[i]:
        ans += v[i] - c[i]
print(ans)

### FIXED CODE ###

n = int(input())
v,c = list(map(int,input().split())),list(map(int,input().split()))
ans = 0
for i in range(n):
    if v[i] > c[i]:
        ans += v[i] - c[i]
print(ans)
import collections
import bisect
N,K,L=map(int,input().split())

RP=[i for i in range(N+1)]
Rsize=[1 for i in range(N+1)]
TP=[i for i in range(N+1)]
Tsize=[1 for i in range(N+1)]

def findR(a):
    if a==RP[a]:
        return a
    else:
        return findR(RP[a])
        
def findT(a):
    if a==TP[a]:
        return a
    else:
        return findT(TP[a])
        
def unionR(b,c):
    B=findR(b)
    C=findR(c)
    if Rsize[B]>=Rsize[c]:
        Rsize[B]+=Rsize[C]
        RP[C]=RP[B]
    else:
        Rsize[C]+=Rsize[B]
        RP[B]=RP[C]

def unionT(b,c):
    B=findT(b)
    C=findT(c)
    if Tsize[B]>=Tsize[c]:
        Tsize[B]+=Tsize[C]
        TP[C]=TP[B]
    else:
        Tsize[C]+=Tsize[B]
        TP[B]=TP[C]
        
for i in range(K):
    p,q=map(int,input().split())
    if findR(p)==findR(q):
        pass
    else:
        unionR(p,q)

for i in range(L):
    r,s=map(int,input().split())
    if findT(r)==findT(s):
        pass
    else:
        unionT(r,s)
        
L=collections.Counter()

for i in range(1,N+1):
    L[findR(i),findT(i)]+=1
#print(L)

ANS=L.items()
ANS=list(ANS)
ANS.sort()
K=[]
V=[]
for i in range(len(ANS)):
    K.append(ANS[i][0])
    V.append(ANS[i][1])
ans=str(V[bisect.bisect_left(K,(findR(1),findT(1)))])
for i in range(2,N+1):
    ans+=" "+str(V[bisect.bisect_left(K,(findR(i),findT(i)))])
print(ans)


### FIXED CODE ###

N,K,L=map(int,input().split())
Road_P=[i for i in range(N+1)]
Road_size=[1 for i in range(N+1)]

def find_road(a):
    if a==Road_P[a]:
        return a
    else:
        return find_road(Road_P[a])
        
def union_road(b,c):
    B=find_road(b)
    C=find_road(c)
    if Road_size[B]>=Road_size[C]:
        Road_P[C]=Road_P[B]
        Road_size[B]+=Road_size[C]
    else:
        Road_P[B]=Road_P[C]
        Road_size[C]+=Road_size[B]

for i in range(K):
    p,q=map(int,input().split())
    if find_road(p)!=find_road(q):
        union_road(p,q)
#print(Road_P)

Rail_P=[i for i in range(N+1)]
Rail_size=[1 for i in range(N+1)]

def find_rail(a):
    if a==Rail_P[a]:
        return a
    else:
        return find_rail(Rail_P[a])
        
def union_rail(b,c):
    B=find_rail(b)
    C=find_rail(c)
    if Rail_size[B]>=Rail_size[C]:
        Rail_P[C]=Rail_P[B]
        Rail_size[B]+=Rail_size[C]
    else:
        Rail_P[B]=Rail_P[C]
        Rail_size[C]+=Rail_size[B]

for i in range(L):
    p,q=map(int,input().split())
    if find_rail(p)!=find_rail(q):
        union_rail(p,q)

#print(Rail_P)

comb={}
for i in range(1,N+1):
    if (find_road(i),find_rail(i)) in comb:
        comb[(find_road(i),find_rail(i))]+=1
    else:
        comb[(find_road(i),find_rail(i))]=1

#print(comb)

for i in range(1,N+1):
    print(comb[(find_road(i),find_rail(i))])
K = int(input())

ans = 1
X = 7
cnt = K
while ans <= K:
    x = X % K
    if rem == 0:
        print(ans)
        break
    else:
        ans += 1
        X = x*10 + 7 

if rem != 0:
    print(-1)

### FIXED CODE ###

K = int(input())

ans = 1
X = 7
cnt = K
while ans <= K:
    x = X % K
    if x == 0:
        print(ans)
        break
    else:
        ans += 1
        X = x*10 + 7 

if x != 0:
    print(-1)
a, b = map(int,input().split(''))
if a % 2 == 0 or b % 2 == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a, b = map(int,input().split(' '))
if a % 2 == 0 or b % 2 == 0:
  print('Even')
else:
  print('Odd')
from math import inf
import sys
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
h=get_array()
li=[inf]*n
li[0]=0

li[1]=abs(h[1]-h[0])
for i in range(2,n):
    l=max(0,i-k)
    for j in range(l,i):
     



            li[i]=min(li[i],li[j]+abs(h[i]-h[j]))
##print(li)
print(li[n-1])


### FIXED CODE ###

import numpy as np
inf=10000007

n,k=map(int,input().split())
h=np.array(list(map(int,input().split())))
dp = np.zeros(n,dtype=int)
dp[0]=0

for i in range(1,n):
    l=max(0,i-k)

    dp[i] = np.min(dp[l:i] + abs(h[l:i] - h[i]))




##print(li)
print(dp[-1])
import math

def nCr(n,r):
    f = math.factorial
    return int(f(n) / f(r) / f(n-r))

def nHk(n, k):
    f = math.factorial
    return int(f(n + k - 1) // f(k) // f(n - 1))

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(1, K + 1):
    a = nCr(K - 1, i - 1) % MOD
    b = nHk(i + 1, N - K - (i - 1)) % MOD
    ans = a * b % MOD
    print(ans)


### FIXED CODE ###

from operator import mul
from functools import reduce

def nCr(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

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

for i in range(1, K + 1):
    if i > N - K + 1:
        ans = 0
    else:
        ans = nCr(K - 1, i - 1) * nCr(N - K + 1, i) % MOD
    print(ans)
N = int(input())
a = list(map(int, input().split()))

fi_flg = False
res = 0
while fi_flg is False:
  twice_flg = False
  for i in range(len(a)):
    if (a[i] % 2 == 0) and (twice_flg == False):
      a[i] = int(a[i]/2)
      twice_flg = True
    else:
      a[i] = int(a[i]*3)
 
  if twice_flg is False:
    fi_flg = True
  else:
    res += 1
print(res)

### FIXED CODE ###

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

res = 0
for i in range(N):
  fi_flg = False
  while fi_flg is False:
    if a[i] % 2 == 0:
      a[i] = int(a[i]/2)
      res += 1
    else:
      fi_flg = True
      
print(res)
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
flag=True
for i in a:
    if a%2==1:
        flag=False

if a.count(1)==len(a):
    print("first")
elif flag:
else:
    print("second")


### FIXED CODE ###

N = int(input())
a = 0
for i in range(N):
    a += int(input())%2
 
if a > 0:
    print("first")
else:
    print("second")
a=input().split()

fa=int(a[0])
fb=int(a[1]*100)

print(fa*fb//100)


### FIXED CODE ###

a=input().split()

fa=int(a[0])
fb=int(a[1].replace(".", ""))

print(fa*fb//100)
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())


s = list(s())
s = list(set(s))
s.sort()
ans = [str (i) for i in "abcdefghijklmnopqrstuvwxyz"]
#print("s",s)
#print("ans",ans)
#print(len(s))
for i in range(len(s)):
	#print("s",i)
	#print("ans",s)
	#print(ans)
	print(s[i])
	if s[i] in ans: #s[i] in ans なら
		ans.pop(i-1)
		print(i,"ans",ans)
print(ans[0])



### FIXED CODE ###

def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = l()
alf = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
	alf = alf.replace(s[i],'')
if alf == "":
	print("None")
else:
	print(alf[0])
def main():
    H, W = map(int, input().split(" "))
    # r1 + c1 = r2 + c2
    # r1 - c1 = r2 - c2

    if H == 1 or W == 1:
        print('1')

    c = H * W
    if c % 2 == 0:
        print(c // w)
    else:
        MAX = max(H, W)
        MIN = min(H, W)

        out = MIN * (MIN - 1) + MAX % MIN
        


main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split(" "))
    # r1 + c1 = r2 + c2
    # r1 - c1 = r2 - c2
    c = H * W
    if H == 1 or W == 1:
        print('1')
        return

    if c % 2 == 0: # OK
        print(c // 2)
    else:
        print((c // 2) + 1)


# def main():
#     H, W = map(int, input().split(" "))
#     # r1 + c1 = r2 + c2
#     # r1 - c1 = r2 - c2

#     if H == 1 or W == 1:
#         print('1')

#     c = H * W
#     if c % 2 == 0:
#         print(c // w)
#     else:
#         MAX = max(H, W)
#         MIN = min(H, W)

#         out = MIN * (MIN - 1) + MAX % MIN
        


main()
n = int(input())
uvw = []
for i in range(n-1):
    uvw.append(list(map(int, input().split(' '))))
result = [0]*n
for i in range(n-1):
    if uvw[i][2]%2 == 0:
        result[uvw[i][0]-1] = 1
        result[uvw[i][1]-1] = 1
if sum(result) == n:
    result[uvw[0][1]-1] = 0
    result[uvw[0][2]-1] = 0
for i in result:
    print(i)

### FIXED CODE ###

from collections import deque

n = int(input())
visit = [-1 for _ in range(n+1)]
friends = [[] for _ in range(n+1)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    friends[u].append([v, w])
    friends[v].append([u, w])

q = deque([1])
visit[1] = 0
while q:
    position = q.popleft()
    for i, cost in friends[position]:
        if visit[i] < 0:
            visit[i] = visit[position] + cost
            q.append(i)

for i in visit[1:]:
    print(i%2)