Harryxun/stf_run huggingface dataset:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def check(node_hash_list, edge_color_hash, next_node, node, color):
    edge_color_hash[str(node) + " " + str(next_node)] = color
    new_color = 1
    max_color = color
    for new_next_node in node_hash_list[next_node]:
        if color == new_color:
            new_color += 1
        if max_color < new_color:
            max_color = new_color
        temp_color = check(node_hash_list, edge_color_hash, new_next_node, next_node, new_color)
        new_color += 1
        if max_color < temp_color:
            max_color = temp_color
    return max_color
n = int(input())
node_hash_list = {}
print_list = []
for i in range(1, n):
    input_string = input()
    print_list.append(input_string)
    a, b = map(int, input_string.split())
    if a not in node_hash_list:
        node_hash_list[a] = []
    node_hash_list[a].append(b)
edge_color_hash = {}
node = 1
color = 0
max_color = 1
for next_node in node_hash_list[node]:
    color += 1
    if max_color < color:
        max_color = color
    temp_color = check(node_hash_list, edge_color_hash, next_node, node, color)
    if max_color < temp_color:
        max_color = temp_color

print(max_color)
for key in print_list:
    print(edge_color_hash[key])

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
def check(node_hash_list, edge_color_hash, next_node, node, color):
    edge_color_hash[str(node) + " " + str(next_node)] = color
    edge_color_hash[str(next_node) + " " + str(node)] = color
    new_color = 1
    max_color = color
    for new_next_node in node_hash_list[next_node]:
        if new_next_node == node:
            continue
        if color == new_color:
            new_color += 1
        if max_color < new_color:
            max_color = new_color
        temp_color = check(node_hash_list, edge_color_hash, new_next_node, next_node, new_color)
        new_color += 1
        if max_color < temp_color:
            max_color = temp_color
    return max_color
n = int(input())
sys.setrecursionlimit(n * 10)
node_hash_list = {}
print_list = []
for i in range(1, n):
    input_string = input()
    print_list.append(input_string)
    a, b = map(int, input_string.split())
    if a not in node_hash_list:
        node_hash_list[a] = []
    if b not in node_hash_list:
        node_hash_list[b] = []
    node_hash_list[a].append(b)
    node_hash_list[b].append(a)
edge_color_hash = {}
node = 1
color = 0
max_color = 1
for next_node in node_hash_list[node]:
    color += 1
    if max_color < color:
        max_color = color
    temp_color = check(node_hash_list, edge_color_hash, next_node, node, color)
    if max_color < temp_color:
        max_color = temp_color

print(max_color)
for key in print_list:
    print(edge_color_hash[key])
s=input()
t=input()
S=[]
for i in range(len(s)):
    if s[i] in t:
        p=len(t)-1
        q=t.index(s[i])
        if q>i or i-q+p+1>len(s)-1:
            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
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)
import itertools as itl

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

for mi in M:
    flg = False
    for i in range(n):
        C = itl.combinations(A, i+1)
        #print(C)
        for j in C:
            if sum(j) == mi:
                flg = True
                break
    if flg: print("yes")
    else: print("no")



### FIXED CODE ###

import itertools as itl

n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))
S = []

for i in range(n):
    cmb = list(itl.combinations(A, i+1))
    for j in cmb:
        S.append(sum(j))

for m in M:
    flg = False
    for s in S:
        if s == m:
            flg = True
            break
    if flg:
        print("yes")
    else:
        print("no")
s=input()
p=input()
sl = [i for i in s]
pl = [i for i in p]
lenp=len(p)
pp=pl[-1]
pcheck=-1
el=[i for i,x in enumerate(sl) if x==pp]
check=0
for i in el:
    while True:
        if sl[i]==pl[pcheck]:
            i-=1
            pcheck-=1
        else:
            break
        if pcheck+lenp==0:
            check+=1
            break
if check==0:
    print("No")
else:
    print("Yes")



### FIXED CODE ###

s=input()
p=input()
sl = [i for i in s]
pl = [i for i in p]
lenp=len(p)
pp=pl[-1]
el=[i for i,x in enumerate(sl) if x==pp]
check=0
for i in el:
    pcheck=-1
    while True:
        if sl[i]==pl[pcheck]:
            i-=1
            pcheck-=1
        else:
            break
        if pcheck+lenp<=0:
            check+=1
            break
    if check==1:
        break
if check==0:
    print("No")
else:
    print("Yes")
n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
mem = [1, 0, 0]
ans = 3
for i in range(1, n):
    ans *= mem.count(A[i])
    ans %= mod
    mem[mem.index(A[i])] += 1
print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
mem = [0, 0, 0]
ans = 1
for i in range(n):
    ans *= mem.count(A[i])
    ans %= mod
    if ans == 0: break
    idx = mem.index(A[i])
    mem[idx] += 1
print(ans)
import sys
input = sys.stdin.readline

def main():
    N, M, P = map( int, input().split())
    d = dict()
    for _ in range(M):
        a, b, c = map( int, input().split())
        a, b = a-1, b-1
        d[(a,b)] = P-c

    V = [None]*N
    V[0] = 0
    for _ in range(N-1):
        for e in d:
            s, t = e
            if V[s] == None:
                continue
            if V[t] == None:
                V[t] = V[s] + d[e]
                continue
            if V[s] + d[e] < V[t]:
                V[t] = V[s] + d[e]
    W = [V[i] for i in range(N)]
    for _ in range(1):
        for e in d:
            s, t = e
            if V[s] == None:
                continue
            if V[t] == None:
                V[t] = V[s] + d[e]
                continue
            if V[s] + d[e] < V[t]:
                V[t] = V[s] + d[e]
    for i in range(N):
        if V[i] < W[i]:
            V[i] = -10**14*2
    for _ in range(1):
        for e in d:
            s, t = e
            if V[s] == None:
                continue
            if V[t] == None:
                V[t] = V[s] + d[e]
                continue
            if V[s] + d[e] < V[t]:
                V[t] = V[s] + d[e]
    # ans = V[N-1]
    # for _ in range(N):
    #     for e in d:
    #         s, t = e
    #         if V[s] + d[e] < V[t]:
    #             V[t] = V[s] + d[e]

    # if V[N-1] < ans:
    #     print(-1)
    #     return
    # print( max(-ans,0))
    if V[-1] <= -10**14:
        print(-1)
    else:
        print(max(-V[-1],0))
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
from copy import deepcopy
def main():
    N, M, P = map( int, input().split())
    E = []
    rE = [[] for _ in range(N)]
    
    for _ in range(M):
        a, b, c = map( int, input().split())
        a, b = a-1, b-1
        E.append((a,b,c-P))
        rE[b].append(a)
    # 頂点Nに到達する頂点
    G = [False]*N
    G[N-1] = True
    q = deque([N-1])
    while q:
        v = q.popleft()
        for w in rE[v]:
            if G[w] == False:
                G[w] = True
                q.append(w)
    # Bellman-Ford
    V = [None]*N
    V[0] = 0
    I = sum([1 for i in range(N) if G[i] == True])
    for _ in range(I-1):
        for s, t, cost in E:
            if V[s] == None or G[t] == False:
                continue
            if V[t] == None:
                V[t] = V[s] + cost
                continue
            if V[s] + cost > V[t]:
                V[t] = V[s] + cost
    W = deepcopy(V) #[ V[i] for i in range(N)]
    for _ in range(I-1):
        for s, t, cost in E:
            if V[s] == None or G[t] == False:
                continue
            if V[t] == None:
                V[t] = V[s] + cost
                continue
            if V[s] + cost > V[t]:
                V[t] = V[s] + cost
    for i in range(N):
        if W[i] == None or G[i] == False:
            continue
        if V[i] > W[i]: # 頂点iは、頂点Nに到達するので、負（正？）閉路は伝播する
            print(-1)
            return

    print( max(W[-1], 0))
if __name__ == '__main__':
    main()
from typing import List
import sys

n, u, v = map(int, sys.stdin.readline().split())
graph = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, sys.stdin.readline().split())
    graph[a].append(b)
    graph[b].append(a)

def dfs(v: int) -> List[int]:
    dist = [-1] * (n+1)
    dist[v] = 0
    stack = [v]
    while stack:
        now = stack.pop()
        dw = dist[now] + 1
        for ne in graph[now]:
            if dist[ne] > 0:
                continue
            dist[ne] = dw
            stack.append(ne)
    return dist

Takahashi = dfs(u)
Aoki = dfs(v)

ans = 0
for t, a in zip(Takahashi, Aoki):
    if t < a:
        ans = max(ans, a - 1)

print(ans)

### FIXED CODE ###

import sys

n, u, v = map(int, sys.stdin.readline().split())
graph = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int, sys.stdin.readline().split())
    graph[a].append(b)
    graph[b].append(a)

def dfs(v):
    dist = [-1] * (n+1)
    dist[v] = 0
    stack = [v]
    while stack:
        now = stack.pop()
        dw = dist[now] + 1
        for ne in graph[now]:
            if dist[ne] >= 0:
                continue
            dist[ne] = dw
            stack.append(ne)
    return dist

Takahashi = dfs(u)
Aoki = dfs(v)

ans = 0
for t, a in zip(Takahashi[1:], Aoki[1:]):
    if t < a:
        ans = max(ans, a - 1)

print(ans)
k, x=map(int, input().split())
print(" ".join([x-i for i in range(-k, k+1)]))

### FIXED CODE ###

k,x=map(int, input().split())
print(" ".join([str(x-k+i) for i in range(1, 2*k)]))
S = input()
if (S[0] != S[1]) and (S[1] != S[2]) and (S[2] != s[3]):
    print("Good")
else:
    print("Bad")

### FIXED CODE ###

S = input()
ans = 0
i = 0
while i < 3:
    if S[i] == S[i+1]:
        print("Bad")
        ans += 1
        break
    i += 1
        
if ans == 0:
    print("Good")
(n, t) = map(int, input().split())
cts = []
for i in range(n):
    ct = list(map(int, input().split()))
    if ct[1] <= t:
        cts.append(ct)
cts.sort()
print(cts[0][0])

### FIXED CODE ###

(n, t) = map(int, input().split())
cts = []
for i in range(n):
    ct = list(map(int, input().split()))
    if ct[1] <= t:
        cts.append(ct)
if len(cts) == 0:
    print("TLE")
else:
    cts.sort()
    print(cts[0][0])
_,w,*s=open(0).read().split();t=['#'*(int(w)+2)];print(t,*['#'+t+'#'for t in s],t)

### FIXED CODE ###

_,w,*s=open(0).read().split();t=['#'*(int(w)+2)];a=t+['#'+t+'#'for t in s]+t;print(*a,sep='\n')
N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sortd(d))))

### FIXED CODE ###

N = int(input())
d = list(int(input()) for _ in range(N))
print(len(set(sorted(d))))
#! /usr/bin/python
# -*- coding: utf-8 -*-

def change(val):
    v500 = val/500
    v100 = (val-v500)/100
    v50 = (val%100)/50
    v10 = (val%50)/10
    return v10+v50+v100+v500

n = int(raw_input())
cnt = 0
while n!=0:
    if cnt > 0:
        print
    (c10, c50, c100, c500) = map(int, raw_input().split())
    Min = 1000000
    a10=0
    a50=0
    a100=0
    a500=0
    for i1 in range(c10+1):
        for i2 in range(c50+1):
            for i3 in range(c100+1):
                for i4 in range(c500+1):
                    Sumc = i1+i2+i3+i4
                    Sumv = i1*10+i2*50+i3*100+i4*500
                    if Sumv >= n:
                        Re = change(Sumv-n)
                        if Min > Re-Sumc:
                            Min = Re-Sumc
                            a10 = i1
                            a50 = i2
                            a100 = i3
                            a500 = i4
    if a10 > 0:
        print 10, a10
    if a50 > 0:
        print 50, a50
    if a100 > 0:
        print 100, a100
    if a500 > 0:
        print 500, a500
    
    n = int(raw_input())
    cnt += 1

### FIXED CODE ###

#! /usr/bin/python
# -*- coding: utf-8 -*-

n = int(raw_input())
cnt = 0
while n!=0:
    if cnt > 0:
        print
    (c10, c50, c100, c500) = map(int, raw_input().split())
    Sum = 10*c10+50*c50+100*c100+500*c500
    while Sum-500 >= n:
        Sum -= 500
        c500 -= 1
    while Sum-100 >= n:
        Sum -= 100
        c100 -= 1
    while Sum-50 >= n:
        Sum -= 50
        c50 -= 1
    while Sum-10 >= n:
        Sum -= 10
        c10 -= 1

    if c10 > 0:
        print 10, c10
    if c50 > 0:
        print 50, c50
    if c100 > 0:
        print 100, c100
    if c500 > 0:
        print 500, c500

    n = int(raw_input())
    cnt += 1
from scipy.special import comb  # AtCoderに出すときはspecialをmiscに変える
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
mod = (10**9)+7
minlist = [0] * N
maxlist = [0] * N
ans = 0

kari = comb((N - 1), K-1, exact=True)
# print(kari)
karimod = kari % mod
ans += (karimod * A[N-1]) % mod
ans -= (karimod * A[0]) % mod
ans = ans % mod

for i in range(1, N):
    if N - i >= K:
        if N - i == 1:
            kari = 1
        else:
            kari //= N - i
            kari *= N - i - K+1
        karimod = kari % mod
        # print(kari)
        ans += (karimod * A[N-i-1]) % mod
        ans -= (karimod * A[i]) % mod
        ans = ans % mod
print(ans)


### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
B = deque()
C = deque()
mod = (10**9)+7
for h in range(N):
    B.append(A[h])
    C.append(A[h])


def cmb(n, r):  # 【Python】組み合わせ(nCr) 計算の高速化より引用
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


N_cmb = 10**5
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for ZZZ in range(2, N_cmb + 1):
    g1.append((g1[-1] * ZZZ) % mod)
    inverse.append((-inverse[mod % ZZZ] * (mod//ZZZ)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


ans = 0
for i in range(N):
    if N - i >= K:
        kari = cmb(N - i - 1, K-1) % mod
        # print(kari)
        ans += (kari * B.pop()) % mod
        ans -= (kari * C.popleft()) % mod
        ans = ans % mod
print(ans)
import sys
cnt = 1
num = sys.stdin.readline().strip()
while num != "0":
    print("Case "+ cnt +  ": " num)
    cnt+=1
    num = sys.stdin.readline().strip()

### FIXED CODE ###

import sys
cnt = 1

while 1:
  num=sys.stdin.readline().strip()
  if num == "0":
    break
  print('Case {0}: {1}'.format(cnt, num))
  cnt+=1
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
#INF = float('inf')
mod = int(1e9)+7

n=int(data())
x=data()
c=x.count('1')
t1,t2=1,1
k1=0
k2=0
for i in range(n-1,-1,-1):
    if x[i]=='1':
        k1=(k1+t1)%(c+1)
        k2=(k2+t2)%(c-1)
    t1=(t1*2)%(c+1)
    t2=(t2*2)%(c-1)
ans=[]
t1,t2=1,1
for i in range(n-1,-1,-1):
    if x[i]=='1':
        k=(k2-t2+c-1)%(c-1)
    else:
        k=(k1+t1)%(c+1)
    cnt=1
    while k:
        k=k%(bin(k)[2:].count('1'))
        cnt+=1
    ans.append(cnt)
    t1 = (t1 * 2) % (c + 1)
    t2 = (t2 * 2) % (c - 1)
outl(ans[::-1])


### FIXED CODE ###

import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
#INF = float('inf')
mod = int(1e9)+7

n=int(data())
x=data()
c=x.count('1')
t1,t2=1,1
k1=0
k2=0
for i in range(n-1,-1,-1):
    if x[i]=='1':
        k1=(k1+t1)%(c+1)
        if c==1:
            continue
        k2=(k2+t2)%(c-1)
    t1=(t1*2)%(c+1)
    if c != 1:
        t2=(t2*2)%(c-1)
ans=[]
t1,t2=1,1
for i in range(n-1,-1,-1):
    if x[i]=='1':
        if c==1:
            ans.append(0)
            continue
        k=(k2-t2+c-1)%(c-1)
    else:
        k=(k1+t1)%(c+1)
    cnt=1
    while k:
        k=k%(bin(k)[2:].count('1'))
        cnt+=1
    ans.append(cnt)
    t1 = (t1 * 2) % (c + 1)
    if c!=1:
        t2 = (t2 * 2) % (c - 1)
outl(ans[::-1])
a, b, x = map(int, input().split())
import math
if x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))

### FIXED CODE ###

a, b, x = map(int, input().split())
import math
if x == b * a** 2:
  print(0)
elif x  <= 0.5 * b * a **2:
  print(round(90 - math.degrees(math.atan(2*x / (a * b ** 2))),10))
else:
  print(round(90 - math.degrees(math.atan(a/  (2*(b-x/(a**2)))  )),10))
def num_to_char(s_num):
    ch = []
    for num in s_num:
        ch.append(alphabet[(num%26)-1])
    return ch

s = raw_input()
K = input()

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans = []

s_num = []
for char in s:
    s_num.append(alphabet.index(char) + 1)thon WS) -----------------------------
for i in xrange(len(s_num)):ive/01_Atcoder/codefesA/A.py
    if 27 - s_num[i] < K and (s_num[i] != 1) and (i != len(s_num) - 1):
        K = K - (27 - s_num[i])1_GoogleDrive/01_Atcoder/
        s_num[i] = 271_Atcoder tong$ ls
#kouji.py#	20151121	B.py		Sort		kouji.py~
    elif 27 - s_num[i] < K and (s_num[i] != 1) and (i == len(s_num) - 1):wo.od        s_num[i] = s_num[i] + K
002		20160502	ColorTracking	contest
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i != len(s_num) - 1):
        passook-Pro:01_Atcoder tong$ mkdir codefesA
tonkous-MacBook-Pro:01_Atcoder tong$ cd codefesA/
    elif 27 - s_num[i] < K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K


    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i != len(s_num)-1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i == len(s_num)-1):
        s_num[i] = s_num[i] + K

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass

    elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K

    #elif i == len(s_num) - 1:
       # s_num[i] = s_num[i] + K

print "".join(num_to_char(s_num))

### FIXED CODE ###

def num_to_char(s_num):
    ch = []
    for num in s_num:
        ch.append(alphabet[(num%26)-1])
    return ch

s = raw_input()
K = input()

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','\
q','r','s','t','u','v','w','x','y','z']
ans = []

s_num = []
for char in s:
    s_num.append(alphabet.index(char) + 1)

for i in xrange(len(s_num)):
    if 27 - s_num[i] <= K and (s_num[i] != 1) and (i != len(s_num) - 1):
        K = K - (27 - s_num[i])
        s_num[i] = 27
    elif 27 - s_num[i] <= K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass
    elif 27 - s_num[i] > K and (s_num[i] != 1) and (i != len(s_num)-1):
        pass
    elif 27 - s_num[i] > K and (s_num[i] == 1) and (i != len(s_num) - 1):
        pass

    elif (i == len(s_num) - 1):
        s_num[i] = s_num[i] + K

print "".join(num_to_char(s_num))
A = map(int, input().split())
print(max(A) - min(A))

### FIXED CODE ###

A = map(int, input().split())
A = sorted(A)
print(A[2] - A[0])
(a, b) = [int(i) for i in input().split()]
d = int(a / b)
r = a % b
f = a / b
print('%s %s %. 5f' % (d, r, f))

### FIXED CODE ###

(a, b) = [int(i) for i in input().split()]
d = int(a / b)
r = a % b
f = a / b
print('%s %s %.5f' % (d, r, f))
s = input()
n = len(s)
rslt = [0] * n
dic = {0:0, 1:1}
for i in range(1, n):
    if s[i] == 'L':
        rslt[i] += dic[(i+1)%2]
        rslt[i-1] += dic[i%2]
        dic[1] = 0
        dic[0] = 0
    else:
        dic[(i+1)%2] += 1
for i in range(n-1, 0, -1):
    if s[i] == 'R':
        rslt[i] += dic[(i+1)%2]
        rslt[i+1] += dic[i%2]
        dic[1] = 0
        dic[0] = 0
    else:
        dic[(i+1)%2] += 1
print(' '.join(rslt))


### FIXED CODE ###

from math import ceil
s = input()
n = len(s)
rslt = [0] * n
dic = {0:0, 1:0}
cnt = 0
for i in range(0, n):
    if s[i] == 'R':
        cnt += 1
    else:
        rslt[i] += cnt//2
        rslt[i-1] += ceil(cnt/2)
        cnt = 0
for i in range(n-1, -1, -1):
    if s[i] == 'L':
        cnt += 1
    else:
        rslt[i] += cnt//2
        rslt[i+1] += ceil(cnt/2)
        cnt = 0
print(' '.join(list(map(str, rslt))))
n = int(input())
wn = list(map(int, input().split()))


import math
mini = math.inf
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

### FIXED CODE ###

import math
 
n = int(input())
wn = list(map(int, input().split()))
 
mini = 10000000000
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)
# AGC011 A Airport Bus
import bisect
from collections import deque

n, c, k = map(int, input().split())
t_list = [int(input()) for _ in range(n)]

t_list.sort()
t_list = deque(t_list)
ans = 0

while len(t_list) > 0:
    _tmp = t_list.popleft() + k
    _idx = bisect.bisect_right(t_list, _tmp)
    if c <= _idx + 1:
        for _ in range(c):
            t_list.popleft()
    else:
        for _ in range(_idx):
            t_list.popleft()
    ans += 1

print(ans)

### FIXED CODE ###

# AGC011 A Airport Bus
import bisect
from collections import deque

n, c, k = map(int, input().split())
t_list = [int(input()) for _ in range(n)]

t_list.sort()
t_list = deque(t_list)
ans = 0

while len(t_list) > 0:
    _tmp = t_list.popleft() + k
    _idx = bisect.bisect_right(t_list, _tmp)
    if c-1 <= _idx:
        for _ in range(c-1):
            t_list.popleft()
    else:
        for _ in range(_idx):
            t_list.popleft()
    ans += 1

print(ans)
min=10
sum=0
for i in range(5):
  y=int(input())
  x=y%10
  min != 0
  min=min(min, x)
  if x==min:
    sum+=y
  else:
    sum+=y+10-x
print(sum)

### FIXED CODE ###

X=[int(input()) for i in range(5)]
Y=[]
for x in X:
  Y.append(-(-x//10)*10-x)
print(sum(X)+sum(Y)-(max(Y)))
s = map(int,input().split("/"))
if s[1] < 5:
    print('Heisei')
else:
    print('TBD')

### FIXED CODE ###

s = list(map(int,input().split("/")))
if s[1] < 5:
    print('Heisei')
else:
    print('TBD')
a, b, c = map(int, input().split())
print("Yes" a <= c and c <= b else "No")

### FIXED CODE ###

a, b, c = map(int, input().split())
print("Yes" if a <= c and c <= b else "No")
o = input()
e = input()
x = []
if len(o) == len(e):
  for i in range(len(o)):
    x.append(o[i]+e[1])
else len(o) != len(e):
  for i in range(len(e)):
    x.append(o[i]+e[i])
  x.append(a[-1])
print(*x,sep="")
    

### FIXED CODE ###

o = str(input())
e = str(input())
x = []
if len(o) == len(e):
  for i in range(len(o)):
    x.append(o[i]+e[i])
else:
  for i in range(len(e)):
    x.append(o[i]+e[i])
  x.append(o[-1])
print(*x,sep="")