Harryxun/stf_run huggingface dataset:
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    cnt = 1
    D = 0

    while True:
        if D > X:
            cnt -= 1
            break
        if cnt > N + 1:
            cnt -= 1
            break
        D += L[cnt - 1]
        cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0

    for cnt in range(2, N + 2):
        D += L[cnt - 2]
        if D > X:
            cnt -= 1
            break

    print(cnt)


if __name__ == "__main__":
    main()
def main():
    menu = [ input() for a in range(5)]
    time = 0
    for i in range(len(menu)):
        if int(menu[i]) % 10 == 0:
            time += int(menu[i])
            menu[i] = "0"
    if len(menu) > 0:
        for i in range(menu.count("0")):
            menu.remove("0")

        menu.sort(key = (lambda x: 10 - int(x[-1])))

        for i in range(len(menu) - 1):
            time += int(menu[i]) + 10 - int(menu[i][-1])
        time += int(menu[-1])
    print(time)
main()

### FIXED CODE ###

def main():
    menu = [ input() for a in range(5)]
    time = 0
    for i in range(len(menu)):
        if int(menu[i]) % 10 == 0:
            time += int(menu[i])
            menu[i] = "0"
    if len(menu) > 0:
        for i in range(menu.count("0")):
            menu.remove("0")
    if len(menu) > 0:
        menu.sort(key = (lambda x: 10 - int(x[-1])))

        for i in range(len(menu) - 1):
            time += int(menu[i]) + 10 - int(menu[i][-1])
        time += int(menu[-1])
    print(time)
main()
sa=input()
sb=input()
sc=input()

sa=list(sa)
sb=list(sb)
sc=list(sc)

for i in range(len(sa)+len(sb)+len(sc)):
    if(sa[0])


### FIXED CODE ###

def solve(sa, sb, sc, t):
	d = {'a': sa, 'b': sb, 'c': sc}
	if d[t] == '':
		return t.upper()
	u = d[t][0]
	d[t] = d[t][1:]
	return solve(d['a'], d['b'], d['c'], u)

SA = input()
SB = input()
SC = input()
print(solve(SA, SB, SC, 'a'))
A, B, C, D, E, F = map(int, input().split())

water_set = set()
sugar_set = set()

for ai in range(3000 // (100 * A) + 1):
    for bi in range(3000 // (100 * B) + 1):
        if ai * 100 * A + bi * 100 * B <= 3000:
            water_set.add(ai * 100 * A + bi * 100 * B)

for ci in range(3000 // C + 1):
    for di in range(3000 // D + 1):
        if ci * C + di * D <= 3000:
            sugar_set.add(ci * C + di * D)

water_list = sorted(list(water_set))
sugar_list = sorted(list(sugar_set))

cons = 0
water_ans = 0
sugar_ans = 0
for water in water_list:
    for sugar in sugar_list:
        if water + sugar <= F and sugar <= E * water:
            if 100 * water / (water + sugar) > cons:
                cons = 100 * water / (water + sugar)
                water_ans = water
                sugar_ans = sugar

print(sugar_ans, water_ans)

### FIXED CODE ###

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

water_set = set()
sugar_set = set()

for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        if a + b <= F:
            water_set.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        if c + d <= F//2 + 1:
            sugar_set.add(c + d)

water_set.remove(0)
water_list = list(water_set)
sugar_list = list(sugar_set)

cons = -1
water_ans = 0
sugar_ans = 0
for water in water_list:
    for sugar in sugar_list:
        if water + sugar <= F and sugar * 100 <= E * water:
            if 100 * sugar / (water + sugar) > cons:
                cons = 100 * sugar / (water + sugar)
                water_ans = water
                sugar_ans = sugar

print(water_ans + sugar_ans, sugar_ans)
N = int(input())
pl = []
mi = []

for i in range(N):
    _m = 0
    _t = 0
    s = input()
    for c in s:
        if c == ")":
            _t -= 1
            _m = min(_m, _t)
        else:
            _t += 1
    if _t > 0:
        pl.append([_m, -_t]) # sortの調整のために負にしている
        # totalは大きい順
        # mは小さい順
    else:
        mi.append([_m, - _t])
pl = sorted(pl)
mi = sorted(mi)

import IPython;IPython.embed()


if len(pl) == 0:
    if mi[0][0] == 0:
        print("Yes")
    else:
        print("No")
    exit()
if len(mi) == 0:
    print("No")
    exit()

tot = 0
for m, nt in pl:
    if tot + m < 0:
        print("No")
        exit()
    else:
        tot += nt
for m, nt in mi:
    if tot + m <0:
        print("No")
        exit()
    else:
        tot -= nt
if tot != 0:
    print("No")
else:
    print("Yes")
        



# どういう時できるか
# で並べ方
# tot, minの情報が必要
# totが+のものはminとtotを気をつける必要がある
# minがsum以上であればどんどん足していけばいい.
# なのでminが小さい順にsortし,totの大きい順にsort
# その次はtotがminusの中ではminが小さい順に加える
# 合計が0になる時Yes,それ意外No.

### FIXED CODE ###

N = int(input())
pl = []
mi = []

for i in range(N):
    _m = 0
    _t = 0
    s = input()
    for c in s:
        if c == ")":
            _t -= 1
            _m = min(_m, _t)
        else:
            _t += 1
    if _t > 0:
        pl.append([-_m, -_t]) # sortの調整のために負にしている
    else:
        mi.append([- _t + _m,  _m, _t])
pl = sorted(pl)
mi = sorted(mi)

#import IPython;IPython.embed()


if len(pl) == 0:
    if mi[0][0] == 0:
        print("Yes")
    else:
        print("No")
    exit()
if len(mi) == 0:
    print("No")
    exit()

tot = 0
for m, nt in pl:
    if tot - m < 0: # これはひくではないのでは?
        print("No")
        exit()
    else:
        tot -= nt
for d, m, nt in mi:
    if tot + m <0:
        print("No")
        exit()
    else:
        tot += nt
if tot != 0:
    print("No")
else:
    print("Yes")
        



# どういう時できるか
# で並べ方
# tot, minの情報が必要
# totが+のものはminとtotを気をつける必要がある
# minがsum以上であればどんどん足していけばいい.
# なのでminが大きい順にsortし,totの大きい順にsort
# その次はtotがminusの中ではminが小さい順に加える
# 合計が0になる時Yes,それ意外No.
X = int(input())

500_cnt = X//500
new_X = X - 500_cnt * 500
5_cnt = new_X // 5
print(500_cnt*1000 + 5_cnt*5)

### FIXED CODE ###

X = int(input())
 
cnt = X//500
new_X = X - cnt * 500
ncnt = new_X // 5
print(cnt*1000 + ncnt*5)
s,t = map(int,input().split())
a,b = map(int,input().split())
u = str(input())
if u == s:
    a -= 1
else:
    b -= 1
print(a,b)

### FIXED CODE ###

s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
if u == s:
    a -= 1
else:
    b -= 1
print(a,b)
def main():
	# s = int(input())
	# s = str(input())
	a,b = map(int,input().split())
	#1行R列
	# a = list(map(int,input().split()))
	#R行1列
	# l = [str(input()) for i in range(n)]
	#R行C列
	# qu = [list(map(str,input().split())) for x in range(q)]
	# print(' '.join(map(str,)))
	import math
	def combinations_count(n, r):
		return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

	if b <= 1:
		print(combinations_count(a,2))
	elif a <= 1:
		print(0)
	else:
		print(combinations_count(a,2) + combinations_count(b,2))


if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	# s = int(input())
	# s = str(input())
	a,b = map(int,input().split())
	#1行R列
	# a = list(map(int,input().split()))
	#R行1列
	# l = [str(input()) for i in range(n)]
	#R行C列
	# qu = [list(map(str,input().split())) for x in range(q)]
	# print(' '.join(map(str,)))
	import math
	def combinations_count(n, r):
		return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

	if a <= 1 and b > 1:
		print(combinations_count(b,2))
	elif a <= 1 and b <= 1:
		print(0)
	elif a > 1 and b <= 1:
		print(combinations_count(a,2))
	else:
		print(combinations_count(a,2) + combinations_count(b,2))


if __name__ == '__main__':
	main()
N, L = input().split()
apples = [x + int(L) for x in list(range(int(N))]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

### FIXED CODE ###

N, L = input().split()
N = int(N)
L = int(L)

apples = list(range(N)) 
apples = [x + L for x in apples]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))

print(sum(apples) - apples[abs_min_index])
N=int(input())
test_case=[input() for _ in range(N)]
a=test_case.count('AC')
b=test_case.count('WA')
c=test_case.count('TLE')
d=test_case.count('RE')
print('AC x '+a)
print('WA x '+b)
print('TLE x '+c)
print('RE x '+d)


### FIXED CODE ###

N=int(input())
test_case=[input() for _ in range(N)]
a=test_case.count('AC')
b=test_case.count('WA')
c=test_case.count('TLE')
d=test_case.count('RE')
print('AC x '+ str(a))
print('WA x '+ str(b))
print('TLE x '+str(c))
print('RE x '+str(d))
import sys

sys.setrecursionlimit(3000)

H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[-1] * (W+2) for i in range(H+2)]
lst_shita = [[-1] * (W+2) for i in range(H+2)]
lst_migi = [[-1] * (W+2) for i in range(H+2)]
lst_hidari = [[-1] * (W+2) for i in range(H+2)]

# print (lst_ue)
def ue(i, j):
    if lst_ue[i][j] != -1:
        return lst_ue[i][j]
    if lst[i][j] == '#':
        lst_ue[i][j] = 0
        return 0
    else:
        lst_ue[i][j] = ue(i-1, j) + 1
        return lst_ue[i][j]


def shita(i, j):
    if lst_shita[i][j] != -1:
        return lst_shita[i][j]
    if lst[i][j] == '#':
        lst_shita[i][j] = 0
        return 0
    else:
        lst_shita[i][j] = shita(i+1, j) + 1
        return lst_shita[i][j]        


def hidari(i, j):
    if lst_hidari[i][j] != -1:
        return lst_hidari[i][j]
    if lst[i][j] == '#':
        lst_hidari[i][j] = 0
        return 0
    else:
        lst_hidari[i][j] = hidari(i, j-1) + 1
        return lst_hidari[i][j]        

def migi(i, j):
    if lst_migi[i][j] != -1:
        return lst_migi[i][j]
    if lst[i][j] == '#':
        lst_migi[i][j] = 0
        return 0
    else:
        lst_migi[i][j] = migi(i, j+1) + 1
        return lst_migi[i][j]        

ans = 0
if H < 1500 and W < 1500:
    for i in range(1,H+1):
        for j in range(1, W+1):
            if lst[i][j] != '#':
                ans = max(ans, ue(i,j)+shita(i,j)+hidari(i,j)+migi(i,j)-3)
else:
    for i in range(750,1250):
        for j in range(750, 1250):
            if lst[i][j] != '#':
                ans = max(ans, ue(i,j)+shita(i,j)+hidari(i,j)+migi(i,j)-3)
                if ans == H+W-1:
                    print (asn)
                    sys.exit()

print (ans)


### FIXED CODE ###

#上下方向の探索と左右方向の探索をまとめる
#まず表を完成させる-->全マスの探索
H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[0] * (W+2) for i in range(H+2)]
lst_shita = [[0] * (W+2) for i in range(H+2)]
lst_migi = [[0] * (W+2) for i in range(H+2)]
lst_hidari = [[0] * (W+2) for i in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        lst_hidari[i][j] = 0 if lst[i][j] == '#' else 1 + lst_hidari[i][j-1]
    for j in range(W, 0, -1):
        lst_migi[i][j] = 0 if lst[i][j] == '#' else 1 + lst_migi[i][j+1]

for j in range(1, W+1):
    for i in range(1, H+1):
        lst_ue[i][j] = 0 if lst[i][j] == '#' else 1 + lst_ue[i-1][j]
    for i in range(H+1, 0, -1):
        lst_shita[i][j] = 0 if lst[i][j] == '#' else 1 + lst_shita[i+1][j]

ans = 0
for i in range(1,H+1):
    for j in range(1, W+1):
        ans = max(ans, lst_ue[i][j]+lst_shita[i][j]+lst_migi[i][j]+lst_hidari[i][j]-3)

print (ans)
import math
a,b = map(int, input().split())
for i in range(1 , 1e5):
    a2 = math.floor(i*0.08)
    b2 = math.floor(i*0.1)
    if a2 == a and b2 == b:
        exit(print(i))
    print(-1)

### FIXED CODE ###

import math
a,b = map(int, input().split())
for i in range(1 , 100000):
    a2 = math.floor(i*0.08)
    b2 = math.floor(i*0.1)
    if a2 == a and b2 == b:
        exit(print(i))
print(-1)
import sys
sys.setrecursionlimit(sys.getrecursionlimit())
def trace(i,j):
    global ans
    if i == 0 or j == 0:
        return
    if dp[i][j][1] == 0:
        trace(i,j-1)
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        trace(i-1,j-1)
    elif dp[i][j][1] == 2:
        trace(i-1,j)
    else:
        return

s = input()
t = input()
# dp[i][j] = LCS(s[:i+1],t[:j+1])
dp = [ [( 0 , -1 )]*(len(t)+1)  for _ in range(len(s)+1) ]
for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
trace(len(s),len(t))
print(ans[::-1])

### FIXED CODE ###

import sys

s = sys.stdin.readline()
t = sys.stdin.readline()

# dp[i][j] = LCS(s[:i],t[:j])
sLen, tLen = len(s),len(t),
dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
for i in range(1,sLen+1):
    for j in range(1,tLen+1):
        comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
        argmax = comp.index(max(comp))
        dp[i][j] = ( comp[argmax] , argmax )

ans = ""
i,j = sLen, tLen
for _ in range(sLen+tLen):
    if dp[i][j][1] == 0:
        j -= 1
    elif dp[i][j][1] == 1:
        ans += s[i-1]
        i -= 1
        j -= 1
    elif dp[i][j][1] == 2:
        i -= 1
    else:
        break

print(ans[::-1])
N = int(input())
S = input()

R_list = []
G_list = []
B_list = []
pair_list = []

for i in range(N):
    if S[i]=='R':
        R_list.append(i)
    elif S[i]=='G':
        G_list.append(i)
    else:
        B_list.append(i)

for i in R_list:
    for j in G_list:
        for k in B_list:
            pair_list.append([i,j,k])
        
count = 0
for pair in pair_list:
    pair.sort()
    if((pair[1]-pair[0])==(pair[2]-pair[1])):
        continue
    else:
        count += 1

#print(R_list)
#print(G_list)
#print(B_list)
#print(pair_list)
print(count)

### FIXED CODE ###

N = input()

bool_7 = False

for i in N:
    if (int(i)== 7):
        bool_7 = True
        break

if bool_7:
    print('Yes')
else:
    print('No')
N = int(input())
p_list = [int(i) for i in input().split()] 
sum = 0
for i in range(N):
  if p_list[i] == max(p_list):
    sum += int(p_list[i]/2)
  else:
    sum += p_list[i]
print(sum)


### FIXED CODE ###

D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")
# encoding: utf-8
H, W, K = map(int, input().split())

raw_route = [0] * W # 0 in unused
possible_route = 0

for i in range(2 ** (W - 1)):
    # check
    i_tmp = i
    last = 0
    for j in range(W - 1):
        if i_tmp % 2 == last == 1: break
        last = i_tmp % 2
        i_tmp = i_tmp // 2
    else:
        # valid drawing
        i_tmp = i
        for j in range(W - 1):
            if i_tmp % 2 == 1: raw_route[j + 1] += 1
            i_tmp = i_tmp // 2
        possible_route += 1

# print("#", raw_route)            
            
def draw(depth, clm):
    # done
    if depth == H + 1: return 1
    # running
    ## param
    range_min = K - (H - depth)
    range_max = K + (H - depth)
    ## calc ans
    ans = 0
    # print("##", depth, clm, (range_min, range_max))
    ### go straight
    if range_min <= clm <= range_max: ans += (possible_route - raw_route[clm - 1] - raw_route[clm]) * draw(depth + 1, clm)
    ### go left
    if range_min <= clm - 1 and 1 <= clm - 1: ans += raw_route[clm - 1] * draw(depth + 1, clm - 1)
    ### go right
    if clm + 1 <= range_max and clm + 1 <= W: ans += raw_route[clm] * draw(depth + 1, clm + 1)
    ## end
    return ans % (10 ** 9 + 7)

print(draw(1, 1))

### FIXED CODE ###

# encoding: utf-8
H, W, K = map(int, input().split())

raw_route = [0] * W # 0 in unused
possible_route = 0

for i in range(2 ** (W - 1)):
    # check
    i_tmp = i
    last = 0
    for j in range(W - 1):
        if i_tmp % 2 == last == 1: break
        last = i_tmp % 2
        i_tmp = i_tmp // 2
    else:
        # valid drawing
        i_tmp = i
        for j in range(W - 1):
            if i_tmp % 2 == 1: raw_route[j + 1] += 1
            i_tmp = i_tmp // 2
        possible_route += 1

# print("#", raw_route)

DP = [[None] * W for i in range(H)]

def draw(depth, clm):
    # done
    if depth == H + 1: return 1
    # running
    if DP[depth - 1][clm - 1] != None: return DP[depth - 1][clm - 1]
    ## param
    range_min = K - (H - depth)
    range_max = K + (H - depth)
    ## calc ans
    ans = 0
    # print("##", depth, clm, (range_min, range_max))
    ### go straight
    if range_min <= clm <= range_max:
        coeff = possible_route
        if clm > 1: coeff -= raw_route[clm - 1]
        if clm < W: coeff -= raw_route[clm]
        ans += coeff * draw(depth + 1, clm)
    ### go left
    if range_min <= clm - 1 and 1 <= clm - 1: ans += raw_route[clm - 1] * draw(depth + 1, clm - 1)
    ### go right
    if clm + 1 <= range_max and clm + 1 <= W: ans += raw_route[clm] * draw(depth + 1, clm + 1)
    ## end
    if DP[depth - 1][clm - 1] == None: DP[depth - 1][clm - 1] = ans % (10 ** 9 + 7)
    return ans % (10 ** 9 + 7)

print(draw(1, 1))
import sys
sys.setrecursionlimit(10**7)
N = int(input())
ts = [int(input()) for _ in range(N)]

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

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

l = 1
for t in ts:
    l = lcm(l,t)
    
print(l)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
N = int(input())
ts = [int(input()) for _ in range(N)]

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

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

l = 1
for t in ts:
    l = lcm(l,t)
    
print(l)
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = list(map(int, input().split()))
    ans = [0] * (N-1)
    for i in range(K-1):
        d = int(input())
        A = list(map(int, input().split()))
        for j in range(d-1):
            ans[A[j]] += 1

    a = 0
    for i in ans:
        if i==0:
            a += 1
    print(a)
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    n, k = map(int, input().split())
    a = []
    for i in range(k):
        d = int(input())
        ai = list(map(int, input().split()))
        a = a + ai
 
    print(n-len(set(a)))
    return

if __name__ == '__main__':
    main()
b = input()
if b = "A":
    print(T)
elif b = "T":
    print(A)
elif b = "C":
    print(G)
elif b = "G":
    print(C)

### FIXED CODE ###

b = input()
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b == "G":
    print("C")
def main():
  import sys
  input = sys.stdin.readline
  h, w = map(int, input().split())
  A = []
  B = []
  for i in range(h):
    row = list(map(int, input().split()))
    A.append(row)
  for i in range(h):
    row = list(map(int, input().split()))
    B.append(row)
 
  dp = [[{} for j in range(w+1)] for i in range(h+1)]
  dp[0][0][abs(A[0][0] - B[0][0])] = 1
  for i in range(h):
    for j in range(w):
      for key in dp[i][j]:
        if j < w - 1:
          dif = abs(A[i][j+1] - B[i][j+1])
          dp[i][j+1][item+dif] = 1
          dp[i][j+1][abs(item-dif)] = 1
        if i < h - 1:
          dif = abs(A[i+1][j] - B[i+1][j])
          dp[i+1][j][item+dif] = 1
          dp[i+1][j][abs(item-dif)] = 1
  print(min(dp[h-1][w-1].keys()))
if __name__ == '__main__':
  main()


### FIXED CODE ###

import sys
def main():
  input = sys.stdin.readline
  h, w = map(int, input().split())
  A = []
  AB = []
  A_append = A.append
  AB_append = AB.append
  for i in range(h):
    row = list(map(int, input().split()))
    A_append(row)
  for i in range(h):
    row = [abs(A[i][j] - int(b)) for j, b in enumerate(input().split())]
    AB_append(row)
 
  dp_cur = [set([]) for _ in range(w)]
  dp_cur[0].add(AB[0][0])
  for i in range(h):
    dp_next = [set([]) for _ in range(w)]
    for j in range(w):
      if j < w - 1:
        add1 = dp_cur[j+1].add
        dif1 = AB[i][j+1]
      if i < h - 1:
        add2 = dp_next[j].add
        dif2 = AB[i+1][j]
      for item in dp_cur[j]:
        if j < w - 1:
          add1(item+dif1)
          add1(abs(item-dif1))
        if i < h - 1:
          add2(item+dif2)
          add2(abs(item-dif2))
    if i == h - 1:
      break
    dp_cur = dp_next
  print(min(dp_cur[w-1]))
if __name__ == '__main__':
  main()
n=int(input())
li=map(int,input().split())
li=sorted(li)
A=0
B=0
for k in range(n//2):
  A += li[2*k]
  B += li[2*k+1]
if n % 2 ==1:
  A += li[n-1]
print(B-A)


### FIXED CODE ###

n=int(input())
a=int(input())
print('Yes' if n%500<=a else 'No')
def main():
    n=int(input())
    color=list(map(int,input().split()))
    nodes=[[]for i in range(n)]
    cut=[[0]for i in range(n+1)]
    ans=[0]*(n+1)
    for i in range(n-1):
        a,b=map(int,input().split())
        nodes[a-1].append(b-1)
        nodes[b-1].append(a-1)
    def num(p,parent):
        s=0
        for child in nodes[p]:
            if child==parent:
                continue
            cut[color[p]].append(0)
            nc=num(child,p)
            group=nc-cut[color[p]].pop()
            ans[color[p]]+=group*(group+1)//2
            s+=nc
        s+=1
        cut[color[p]][-1]+=s
        return s
    num(0,-1)
    for a,c in zip(ans[1:],cut[1:]):
        group=n-c[0]
        c=group*(group+1)//2
        print(n*(n+1)//2-c-a)
main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def main():
    n=int(input())
    color=list(map(int,input().split()))
    nodes=[[]for i in range(n)]
    cut=[[0]for i in range(n+1)]
    ans=[0]*(n+1)
    for i in range(n-1):
        a,b=map(int,input().split())
        nodes[a-1].append(b-1)
        nodes[b-1].append(a-1)
    def num(p,parent):
        s=0
        for child in nodes[p]:
            if child==parent:
                continue
            cut[color[p]].append(0)
            nc=num(child,p)
            group=nc-cut[color[p]].pop()
            ans[color[p]]+=group*(group+1)//2
            s+=nc
        s+=1
        cut[color[p]][-1]+=s
        return s
    num(0,-1)
    for a,c in zip(ans[1:],cut[1:]):
        group=n-c[0]
        c=group*(group+1)//2
        print(n*(n+1)//2-c-a)
main()
while True:
   m, f, r = map(int, input().split())
   if m+f+r = -3:
      break
   if m == -1 or f == -1:
      print("F")
   S = m + f
   if S >= 80:
      print("A")
   elif S >= 65 and S < 80:
      print("B")
   elif S >= 50 and S < 65:
      print("C")
   elif S >= 30 and S < 50:
      if r >= 50:
         print("C")
      else:
         print("D")
   else:
      print("F")


### FIXED CODE ###

while True:
   m, f, r = map(int, input().split())
   if m == -1 and f == -1 and r == -1:
      break
   S = m + f
   if m == -1 or f == -1:
      print("F")
   elif S >= 80:
      print("A")
   elif S >= 65 and S < 80:
      print("B")
   elif S >= 50 and S < 65:
      print("C")
   elif S >= 30 and S < 50:
      if r >= 50:
         print("C")
      else:
         print("D")
   else:
      print("F")
k = int(input())
s = str(input())

if len(s) <= k:
  print(s)
elif len(s) > k:
  print(s[0:k-1]

### FIXED CODE ###

k = int(input())
s = str(input())

if len(s) <= k:
  print(s)
elif len(s) > k:
  print(s[:k] + '...')
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*B;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))


### FIXED CODE ###

S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")