Harryxun/stf_run huggingface dataset:
a = int(input().rstrip())
b = [ int(i) for i in input().split() ]
print(max(b)-min(b))

### FIXED CODE ###

num = input().split() 
temp = ''
for i in range(len(num)):
    temp = temp + num[i]
print( ['NO','YES'][int(temp)%4==0] )
N,W = map(int,input().split())
w = []
v = []
for _ in range(N):
    x,y = map(int,input().split())
    w.append(x)
    v.append(y)
dp = [[10000000000000 for _ in range(1000 * N + 10)] for _ in range(N + 1) ]
ans = 0
for i in range(N):
    dp[i][0] = 0
for i in range(N):
    for j in range(N * 1000):
        dp[i + 1][j + v[i]] = min(dp[i+1][j+v[i]],dp[i][j]+w[i])
        dp[i+1][j] = min(dp[i+1][j],dp[i][j])
for i in range(N * 1000 + 1):
    if dp[N][i] <= W:
        ans = max(ans,i)
print(ans)


### FIXED CODE ###

N,W = map(int,input().split())
w = []
v = []
for _ in range(N):
    x,y = map(int,input().split())
    w.append(x)
    v.append(y)
dp = [[10000000000000 for _ in range(2001 * N + 10)] for _ in range(N + 2) ]
ans = 0
for i in range(N):
    dp[i][0] = 0
for i in range(N):
    for j in range(N * 1000):
      	
        dp[i + 1][j + v[i]] = min(dp[i+1][j+v[i]],dp[i][j]+w[i])
        dp[i+1][j] = min(dp[i+1][j],dp[i][j])
for i in range(N * 1000 + 1):
    if dp[N][i] <= W:
        ans = max(ans,i)
print(ans)
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()[::-1]
res = 0
for i in range(k):
    res+=l[i]
print(res)

### FIXED CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l = l[::-1]
res = 0
for i in range(k):
    res += l[i]
print(res)
n = int(input())
edgeList = []
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(i):
        if a[j] != -1:
            edgeList.append([a[j], getRoot(i), getRoot(j)])
rootList = [-1 for i in range(n)]
sumLength = 0

def getRoot(x):
    r = rootList[x]
    if r < 0:
        rootList[x] = x
    elif r != x:
        rootList[x] = getRoot(r)
    return rootList[x]
        

edgeList.sort(key=lambda x: x[0])
for e in edgeList:
    x = getRoot(e[1])
    y = getRoot(e[2])
    if x != y:
        sumLength += e[0]
        rootList[x] = rootList[y] = min(x, y)
print(sumLength)

### FIXED CODE ###

n = int(input())
edgeList = []
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(i):
        if a[j] != -1:
            edgeList.append([a[j], i, j])
rootList = [-1]*n
sumLength = 0

def getRoot(x):
    r = rootList[x]
    if r < 0:
        rootList[x] = x
    elif r != x:
        rootList[x] = getRoot(r)
    return rootList[x]
        

edgeList.sort(key=lambda x: x[0])
for e in edgeList:
    x = getRoot(e[1])
    y = getRoot(e[2])
    if x != y:
        sumLength += e[0]
        rootList[x] = rootList[y] = min(x, y)
print(sumLength)
s = list(input())
K = int(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"

# need = 0
# for i in range(len(s)):
#     need += ord("z") - ord(s[i]) + 1

for i in range(len(s)):
    if K >= 26 or s[i] >= alphabet[-K]:
        K -= ord("z") - ord(s[i]) + 1
        s[i] = "a"

if K > 0:
    K %= 26
    s[-1] = chr(ord(s[-1]) + K)

print("".join(s))

### FIXED CODE ###

s = list(input())
k = int(input())

for i in range(len(s)):
    if s[i] == "a": continue

    diff = ord("z") - ord(s[i]) + 1

    if diff <= k:
        k -= diff
        s[i] = "a"

if k > 0:
    k %= 26
    s[i] = chr(ord(s[i]) + k)

print("".join(s))
n = input()
m = input()
if n == m:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = input().split(' ')
if n[1] == n[0]:
    print('Yes')
else:
    print('No')
s = input()

str = []
ans = []

for i in range(len(s)):
    if s[i] in "ACGT":
        str.append(s[i])
    else:
        ans.append(len(str))
        str = []
print(max(ans))
print(ans)

### FIXED CODE ###

S = input()

ACGT = 'ACGT'

count = []
tmp_num = 0
for i in S:
    if i in ACGT:
        tmp_num += 1
    elif i not in ACGT:
        count.append(tmp_num)
        tmp_num = 0
count.append(tmp_num)

print(max(count))
import heapq
a,b,c,k = map(int,input().split())
li = [1]*a + [0]*b + [-1]*c
print(sum(heapq.nlargest(k,li)))

### FIXED CODE ###

a,b,c,k = map(int,input().split())
if a >= k:
    print(f"{k}")
else:
    if a + b >= k:
        print(f"{a}")
    else:
        print(f"{a*1 + b*0 + (k-a-b)*(-1)}")
lens = int(input())
hashes = [''.join(sorted(input())) for _ in range(lens)]
i = 0
j = 0
r = 0
ans = 0
while i < lens - 1:
    i += 1
    if hashes[i] == hashes[j]:
        r += 1
    else:
        ans += (r * (r + 1)) // 2
        r = 0
        j = i
ans += (r ( r + 1))//2
print(ans)

### FIXED CODE ###

n = int(input())
ws = [list(input()) for _ in range(n)]
 
def sort_l(l):
    l.sort()
    return l
ws = list(map(sort_l, ws))
ws.sort()
 
i = 0
j = 0
r = 0
ans = 0
while(i<n-1):
    i += 1
    if ws[i] == ws[j]:
        r += 1
    else:
        ans += r * (r+1) // 2
        r = 0
        j = i
ans += r * (r+1) // 2
 
print(ans)
a,b = map(int,input().split())
print(2*b -a)

### FIXED CODE ###

a = int(input())
b = int(input())
print(2*b -a)
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    s = 0
    sm = 0
    for x, y in zip(a,b):
        tmp = x-y
        sm += tmp
        if tmp == -1
            tmp = 0
        if tmp > 0:
            tmp *= 2
        s += tmp
    if s > 0 or sm > 0:
        print('No')
    else:
        print('Yes')

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    s = 0
    sm = 0
    for x, y in zip(a,b):
        tmp = y-x
        sm += tmp
        if tmp > 0:
            tmp //= 2
        s += tmp
    if s >= 0 and sm >= 0:
        print('Yes')
    else:
        print('No')

    
if __name__ == '__main__':
    main()
s=input()
t=input()
S=[]
c=0
for i in range(len(s)):
    if s[i] in t:
        c+=1
        p=len(t)-1
        q=t.index(s[i])
        if q>i or i-q+p+1>len(s):
            pass
        else:
            s1=s[i-q:i+p-q+1]
            
            count=0
            for j in range(len(s1)):
                if s1[j]!=t[j]:
                    count+=1
                else:
                    pass
            S.append(count)
    else:
        pass
if c==0:
    print(len(t))
else:
    print(min(S))

### FIXED CODE ###

S = input()
T = input()

ans = 1000000  # 適当に1001以上を初期値にしておきます

# Tが1文字のときlen(S)回、2文字のときlen(S) - 1回 …… なので、
# len(S) - len(T) + 1 回です
for i in range(len(S) - len(T) + 1):
    score = 0
    U = S[i:i + len(T)]  # Sのi文字目から連続するlen(T)文字を、Uとします
    for j in range(len(T)):
        if U[j] != T[j]:
            score += 1
    ans = min(ans, score)

print(ans)
n,m=map(int,raw_input().split())

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,k+b[i][0]):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
print(sum(a))

### FIXED CODE ###

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

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,min(n,k+b[i][0])):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
    if k==n:
        k=n-1
print(sum(a))
l,r=map(int,input(),split())
a=[]
if r-l>=2018:
  print(0)
else:
  for i in range(0,r-l+1):
    a.append((l+i)%2019)
  
  a=sorted(a)
  print(a[0]*a[1])
    

### FIXED CODE ###

l,r=map(int,input().split())
a=[]
b=[]
if r-l>=2018:
  print(0)
else:
  for i in range(0,r-l+1):
    a.append((l+i)%2019)
  
  for j in range(0,r-l):
    for k in range(j+1,r-l+1):
      b.append((a[j]*a[k])%2019)
      
  print(min(b))
n = int(input())

L = input().split()

mountain = int(1)
for i in range(n):
    for j in range(i):
            if int(L[j]) > int(L[i]):
          			break
            else:
                    mountain += 1
print(mountain)


### FIXED CODE ###

a, b = map(int, input().split())
if a == b:
    print(a + b)
elif a > b:
    print(a + a - 1)
elif a < b:
    print(b + b - 1)
N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    elif S[-1] == "A":
        A += 1




if ABAB >= 1:
    onon = onon + ABAB - 1

if A >= 1:
    onon += 1
if B >= 1:
    onon += 1



print(result + onon)


### FIXED CODE ###

N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0
onon = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    elif S[-1] == "A":
        A += 1

if ABAB >= 1:
    onon = onon + ABAB - 1

if A >= 1 and ABAB >= 1 :
    onon += 1
    A -= 1
if B >= 1 and ABAB >= 1 :
    onon += 1
    B -= 1

if A >= 1 and B >= 1:
    if A >= B:
        onon += B
    else:
        onon += A


print(result + onon)
N = int(input())
    print(1000 - (N % 1000))

### FIXED CODE ###

N = int(input())
if N % 1000:
    print(1000 - (N % 1000))
else:
    print(0)
def solve(n, m, a, b):
    if n == 0:
        return 0
    res = 0
    if a > m:
        res += (n-1) * n // 2 * (a // m)
        a %= m
    if b > m:
        res += n * (b // m)
        b %= m
    p = (a*n + b) // m
    q = p*m - b
    return res + solve(p, a, m, a*n-q)

t = int(input())
for i in range(t):
    n, m, a, b = map(int, input().split())
    print(solve(n, m, a, b))


### FIXED CODE ###

def solve(n, m, a, b):
    if n == 0:
        return 0
    res = 0
    if a >= m:
        res += (n-1) * n // 2 * (a // m)
        a %= m
    if b >= m:
        res += n * (b // m)
        b %= m
    p = (a*n + b) // m
    q = p*m - b
    return res + solve(p, a, m, a*n-q)

t = int(input())
for i in range(t):
    n, m, a, b = map(int, input().split())
    print(solve(n, m, a, b))
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N = I()
cou = int(0)
color = []
a = int(input())
maxcolor =[]
maxcolor.append(a)
lena = 1
for i in range(N-1):
    a = int(input())
    if a<=min(maxcolor):
        maxcolor.append(a)
        lena += 1
    else:
        aupper = lena
        alower = int(0)
        acandi = aupper//2
        while (True):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = ((aupper+acandi)//2) + 1
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2


#print(maxcolor)
ans = len(maxcolor)
print(ans)

### FIXED CODE ###

from collections import deque
import bisect
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
ans = int(0)

N = I()
color = []
a = I()
maxcolor =deque()
maxcolor.append(a)
lena = 1
for i in range(N-1):
    minmaxcolor = maxcolor[0]
    a = I()
    if a<=minmaxcolor:
        maxcolor.appendleft(a)
#        maxcolor.append(a)
        lena += 1
    else:
        acandi = bisect.bisect_left(maxcolor, a)
        maxcolor[acandi-1] = a
        """
        aupper = lena-1
        alower = int(0)
        acandi = aupper//2
        
        for _ in range(aupper+1):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = (aupper+acandi+1)//2
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2
        """

#print(maxcolor)
ans = len(maxcolor)
print(ans)
import math
from functools import reduce

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

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = [int(x) for x in input().split()]
t = lcm(A)

mod = 10**9+7
ans = 0
for i in range(N):
    ans = (ans + t//A[i])%mod

print(ans)


### FIXED CODE ###

from fractions import gcd

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

def lcm(numbers):
    t = 1
    for n in numbers:
        t = lcm_base(t, n)
    return t

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

mod = 10**9+7
ans = 0
t = lcm(A)
t %= mod
for i in range(N):
    ans = (ans + t*pow(A[i],mod-2, mod))%mod

print(ans)
S=input()
n=len(S)-1
ans=0
dfs dfs(i,f):
  if i==n:
    return sum(map(int,f.split("+")))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])
print(def(0,S[0])  
    


### FIXED CODE ###

S=input()
n=len(S)
ans=0

for bit in range(1<<(n-1)):
  f=S[0]
  for i in range(n-1):
    if bit & (1<<i):
      f+="+"
    f+=S[i+1]
  ans+=sum(map(int,f.split("+")))
print(ans)
from collections import defaultdict

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

A=defaultdict(list)
Q=[]

for i in range(M):
  P,Y=map(int,input().split())
  Q.append([P,Y])
  A[P].append(Y)
  
for a,b in A.items():
  A[a].sort()

for l in Q:
  s=str(l[0]).zfill(6)
  num=A[l[0]].index(l[1])
  s+=str(num+1).zfill(6)
  print(s)


### FIXED CODE ###

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

print(X+Y//2)
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

n = int(input())

res = 1
for i in range(n):
    a = int(input())
    g = gcd(res, a)
    res = int(res / g) * a

print(res)


### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

n = int(input())

res = 1
for i in range(n):
    a = int(input())
    g = gcd(res, a)
    res = (res // g) * a

print(res)
k = input()
a, b = map(int, input().split())
 
for i in range(a,b+1):
  if i%k == 0:
    print("OK")
    break
else:
    print("NG")

### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())
 
for i in range(a,b+1):
  if i%k == 0:
    print("OK")
    break
else:
  print("NG")
N, Q = map(int, input().split())
S = input().split()
rList = list()
lList = list()
for i in range(Q):
    l, r = map(int, input().split())
    lList.append(l - 1)
    rList.append(r)
def AcNum(List):
    c = 0
    for i in range(len(List) - 1):
        if List[i] == "A" and List[i + 1] == "C":
            c += 1
    return c
for i in range(N):
    print(AcNum(S[lList[i]:rList[i]]))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
AClist = [0] 
for i in range(N-1):
    if S[i+1] == "C" and S[i] == "A":
        AClist.append(AClist[-1] + 1)
    else:
        AClist.append(AClist[-1])
for i in range(Q):
    l , r = map(int, input().split())
    print(AClist[r-1] - AClist[l-1])
N = int(input())
Nodes = [[int(i) for i in input().split()] for j in range(N - 1)]
C = [int(i) for i in input().split()]
C.sort()
# 根から始め、巡回した葉にCの大きなものから順に書き込んで行く。
# int_list = list(sorted(C))
graph = [[] for _ in range(N)]
for u, v in Nodes:  # 0-basedとする
    graph[u - 1].append(v - 1)
    graph[v - 1].append(u - 1)
# print(Nodes)
# print(graph)

# 各頂点にCの値が大きなもの順に書き込んでいく
ret = [0] * N
def dfs(c):
    # ret[c] = int_list.pop()
    ret[c] = C.pop()
    for next_edge in graph[c]:
        if ret[next_edge] == 0:  # まだ見ていない頂点だけ調べる
            dfs(next_edge)
dfs(c=0)

print(sum(ret[1:]))
print(" ".join(map(str, ret)))

### FIXED CODE ###

def d_maximum_sum_of_minimum(N, Nodes, C):
    # 根から始め、巡回した葉にCの大きなものから順に書き込んで行く。
    import sys
    sys.setrecursionlimit(10**6)

    int_list = list(sorted(C))
    graph = [[] for _ in range(N)]
    for u, v in Nodes:  # 0-basedとする
        graph[u - 1].append(v - 1)
        graph[v - 1].append(u - 1)

    def traverse_tree(parent, current, ret=[0] * N):
        """各頂点にCの値が大きなもの順に書き込んでいく"""
        def dfs(p, c):
            ret[c] = int_list.pop()
            for next_edge in graph[c]:
                if next_edge != p:  # 木を「逆戻り」しない頂点だけ調べる
                    dfs(c, next_edge)
        dfs(parent, current)
        return ret
    tmp = traverse_tree(-1, 0)
    return str(sum(tmp[1:])) + '\n' + ' '.join(map(str, tmp))

N = int(input())
Nodes = [[int(i) for i in input().split()] for j in range(N - 1)]
C = [int(i) for i in input().split()]
print(d_maximum_sum_of_minimum(N, Nodes, C))
a,b,c=input().split();print(min(a*b,c))

### FIXED CODE ###

a,b,c=map(int,input().split());print(min(a*b,c))
from collections import defaultdict, deque

n, m = [int(i) for i in raw_input().split()]

parents = defaultdict(list)

for _ in xrange(m):
    inp = raw_input().split()
    u = int(inp[0])
    v = int(inp[1])
    parents[v-1].append(u-1)

def get_f(parents, f, i):
    if f[i] != -1:
        return f[i]

    f[i] = 0
    for v in parents[i]:
        f[i] = max(f[i], get_f(parents, f, v) + 1)

    return f[i]

def longest_path(parents, n):
    f = [-1 for _ in xrange(n)]

    for i in xrange(n):
        get_f(parents, f, i)

    return max(f)

print longest_path(parents, n)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

n, m = [int(i) for i in raw_input().split()]
parents = defaultdict(list)

i = 0
while i < m:
    u, v = [int(x) for x in raw_input().split()]
    parents[v-1].append(u-1)
    i += 1

def calc_f(parents, f, i):
    if i < 0 or i >= len(f):
        return 0

    if f[i] != -1:
        return f[i]

    f[i] = 0
    for v in parents[i]:
        f[i] = max(f[i], calc_f(parents, f, v)+1)

    return f[i]

f = [-1] * n
j = 0
while j < n:
    calc_f(parents, f, j)
    j += 1

if len(f) == 0:
    print 0
else:
    print max(f)
w,h,x,y,r=map(int,input().split())
print(['No','Yes'][r,r<=x,y<=w-r,h-r])

### FIXED CODE ###

w,h,x,y,r=map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])
from functools import lru_cache

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

b=[0,0,0]
for i in a:
    b[i-1]+=1
k1,k2,k3=b

@lru_cache()
def f(i,j,k):
    v=0
    if not i+j+k:return 0.0
    v+=n
    if i:v+=f(i-1,j,k)*i
    if j:v+=f(i+1,j-1,k)*j
    if k:v+=f(i,j+1,k-1)*k
    v/=i+j+k
    return v

print(f(k1,k2,k3))

### FIXED CODE ###

n=int(input())

b=[0,0,0]
for i in map(int,input().split()):
    b[i-1]+=1
k1,k2,k3=b
dp=[[[None]*(k3+1) for _ in range(k2+k3+1)] for _ in range(k1+k2+k3+1)]
dp[0][0][0]=0

for k in range(k3+1):
    for j in range(k2+k3+1-k):
        for i in range(k1+k2+k3+1-j-k):
            if not i+j+k:continue
            dp[i][j][k]=((dp[i-1][j][k]*i if i else 0)+(dp[i+1][j-1][k]*j if j else 0)+(dp[i][j+1][k-1]*k if k else 0)+n)/(i+j+k)

print(dp[k1][k2][k3])
import sys

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

s1 = a * b
s2 = 2 * (a + b)
print s1, s2

### FIXED CODE ###

import sys

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

print (a * b, (a + b) * 2)
x = input()

if x%2 == 0:
  count = int(x/2)
else:
  count = int(x/2) + 1

### FIXED CODE ###

x = input()
xNum = int(x)

if xNum%2 == 0:
  count = xNum/2
else:
  count = int(xNum/2) + 1

print(count/xNum)
N, K, Q = (int(x) for x in input().split())
A = [int(input()) for i in range(Q)]
ans = [K-Q for i in range(N)]

for a in A:
    ans[a-1] += 1

for b in ans:
    if b > 0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
elif S == "Rainy":
    print("Sunny")
a = input()
b = input()
 
x = a+b
 
if x == int(x):
  print(x)
 
else:
  print(int(x+1))

### FIXED CODE ###

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

x = (a+b)/2
 
if x == int(x):
  print(int(x))
 
else:
  x += 1
  print(int(x))
n, d = map(int,input().split())
s == 0
for i in range(n):
	x, y = map(int,input().split())
	if x**2+y**2 <= d**2:
		s = s+1
		else:
			s = s
print(s)

### FIXED CODE ###

n, d = map(int, input().split())
s = 0
for i in range(n):
	x, y = map(int, input().split())
	if x**2+y**2 <= d**2:
		s += 1
print(s)
import fractions
A = int(input())
for i in range(2,A):
  a = fractions.gcd(A,i)
  b = A/a
  break
print(int(i + b -2))
    

### FIXED CODE ###

import math
n = int(input())
n_s = int(math.sqrt(n))
for i in range(1, n_s+1):
    if n % i == 0:
        a = i
        b = n / i
        
print(int(a + b - 2))
X, Y = map(input().split())

if X > Y:
  print(">")
elif X < Y:
  print("<")
else:
  print("=")

### FIXED CODE ###

X, Y = input().split()

if X > Y:
  print(">")
elif X < Y:
  print("<")
else:
  print("=")
key = raw_input().upper()
c = ''
while True:
    s = raw_input()
    if s == 'END_OF_TEXT':
        break
    c = c + ' ' + s.upper()
    
total = 0
ks = key[0]
for i in range(len(c)):
    if c[i] == ks:
        cnt = 0
        for k in range(len(key)):
            if c[i+k] == key[k]:
                cnt = cnt + 1
        if cnt == len(key):
               total = total + 1
                
print total

### FIXED CODE ###

key = raw_input().upper()
c = ''
while True:
    s = raw_input()
    if s == 'END_OF_TEXT':
        break
    c = c + ' ' + s.upper()
   
cs = c.split()
total = 0
for w in cs:
    if w == key:
        total = total + 1
        
print total
N = int(input())
a = list(map(int, input().split()))
ans = 0
temp = 0
l = 0
r = 0
while r < N:
  if temp ^ a[r] == temp + a[r]:
    temp += A[r]
    ans += r - l + 1
    r += 1
  else:
    temp -= A[l]
    l += 1
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0
temp = 0
l = 0
r = 0
while r < N:
  if temp ^ a[r] == temp + a[r]:
    temp += a[r]
    ans += r - l + 1
    r += 1
  else:
    temp -= a[l]
    l += 1
print(ans)
N = int(input())
A = list(map(int,input().split()))
ABI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)
prev = [0]
for k, (a, i) in enumerate(ABI):
    curr = [0]*(k+2)
    for l in range(k+1):
        curr[l] = max(curr[l], prev[l] + a*abs(N-i-(k-l)))
        curr[l+1] = prev[l]+a*abs(i-l-1)
    prev = curr
print (max(prev))

### FIXED CODE ###

r = int(input())
print (r*3.1415*2)
def solution(arr):
      count = 0
      for i, val in enumerate(arr):
        if i > 0 and arr[i - 1] == val:
          count += 1
        else:
          count = 0
        if count == 2:
          return 'Yes'
      return 'No'
    n = int(input())
    arr = []
    for _ in range(n):
      arr.append(input())
    print(solution(arr))

### FIXED CODE ###

def solution(arr):
  count = 0
  for i, j in arr:
    if i == j:
      count += 1
    else:
      count = 0
    if count == 3:
      return 'Yes'
  return 'No'
n = int(input())
arr = []
for _ in range(n):
  arr.append([ int(i) for i in input().split()])
print(solution(arr))
# ABC073C - Write and Erase
import sys
input = sys.stdin.readline

n = int(input())
arr = [0] * (10 ** 9 + 1)
cnt = 0
for _ in range(n):
    m = int(input())
    if arr[m] == 0:
        arr[m] = m
    else:
        arr[m] = 0
for i in arr:
    if i != 0:
        cnt += 1
print(cnt)

### FIXED CODE ###

# ABC073C - Write and Erase
import sys
input = sys.stdin.readline

n = int(input())
arr = set()
for _ in range(n):
    m = int(input())
    if m in arr:
        arr.remove(m)
    else:
        arr.add(m)
print(len(arr))
n,m=map(int,input().split())
graph=[[False]*n for i in range(n)] #点の隣接連結を示す
color=[0]*n
visited=[False]*n #dfsを書くときに訪問した点を記録する
for i in range(m):
    a,b,c=map(int,input().split())
    graph[a-1][b-1][0],graph[b-1][a-1][0],graph[a-1][b-1][1],graph[b-1][a-1][1]=True,True,c,c
def dfs(v):
    visited[v]=True
    for i in range(n):
        if graph[v][i]==False:continue
        if visited[i]==True:continue
        color[i]=color[v]^(graph[v][i][1]%2)
        dfs(i)#訪問済みでなく辺によってつながれている頂点に対して同じ操作を繰り返す
for i in range(n):
  dfs(i)
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
n=int(input())
graph=[[] for i in range(n)]
color=[-1]*n
for i in range(n-1):
    a,b,c=map(int,input().split())
    graph[a-1].append([b-1,c%2])
    graph[b-1].append([a-1,c%2])
def coloring(pre,c):
  color[pre]=c
  for i,j in graph[pre]:
    if color[i]<0:
      coloring(i,color[pre]^j)
coloring(0,1)
for i in color:
  print(i)