Harryxun/stf_run huggingface dataset:
from collections import defaultdict, deque

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

parent_child = defaultdict(set)

for i in range(N - 1):
    a, b = map(int, input().split())
    parent_child[a].add(b)

query_weight = defaultdict(int)
for _ in range(Q):
    q, x = map(int, input().split())
    query_weight[q] += x


dq = deque([])
dq.append((1, query_weight[1]))

ans = [0] * N
while dq:
    node, w = dq.popleft()
    children = parent_child[node]

    ans[node - 1] = str(w)

    for c in children:
        dq.append((c, w + query_weight[c]))


print(' '.join(ans))


### FIXED CODE ###

from collections import deque

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

connect_lst = [[] for _ in range(N + 1)]

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

query_weight = [0] * (N + 1)
for _ in range(Q):
    q, x = map(int, input().split())
    query_weight[q] += x

used = set()
dq = deque([1])
used.add(1)
ans = [0] * (N + 1)

while dq:
    node = dq.popleft()
    can = connect_lst[node]

    used.add(node)
    ans[node] += query_weight[node]

    for c in can:
        if c not in used:
            ans[c] += ans[node]
            dq.append(c)


ans = [str(w) for w in ans[1:]]
print(' '.join(ans))
#!/usr/local/bin/python3
#coding:utf-8
#import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))

   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
         dis = 0
         for j in range(D):
            dis = dis + (X[i,j]-X[(k,j])**2

         dist = np.sqrt(dis)

         i_dist = int(dist)

         if((dist - i_dist)==0):
            cnt = cnt + 1


   print ("%s" % (cnt))




if __name__ == "__main__":
   main()

### FIXED CODE ###

#!/usr/local/bin/python3
#coding:utf-8
import numpy as np


def main():

   in0 = input()

   IN = in0.split(' ')

   N = int(IN[0])
   D = int(IN[1])

   X = np.zeros((N,D))

   for i in range(N):
      in0 = input()
      IN = in0.split(' ')
      for j in range(D):
         X[i,j] = int(IN[j])


   cnt = 0
   for i in range(N-1):
      for k in range(i+1,N):
         dis = 0
         for j in range(D):
            dis = dis + (X[i,j]-X[k,j])**2

         dist = np.sqrt(dis)

         i_dist = int(dist)

         if((dist - i_dist)==0):
            cnt = cnt + 1


   print ("%s" % (cnt))




if __name__ == "__main__":
   main()
import collections
N=int(input())
xy=[tuple([int(i) for i in input().split()])  for j in range(N)]
dist = []
for n,(x,y) in enumerate(xy):
    for j in range(n+1,N):
        gx,gy = xy[j]
        dx,dy = gx-x,gy-y
        dist.append((dx,dy))
zerocost = max(collections.Counter(dist).values())
print(N-zerocost)

### FIXED CODE ###

import collections
N=int(input())
xy=[tuple([int(i) for i in input().split()])  for j in range(N)]
dist = []
if N!=1:
    for n,(x,y) in enumerate(xy):
        for m,(gx,gy) in enumerate(xy):
            if n==m:continue
            dx,dy = gx-x,gy-y
            dist.append((dx,dy))
    zerocost = max(collections.Counter(dist).values())
    print(N-zerocost)
else:
    print(1)
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
mxlba=0
for i in xrange(n):
    mxlba=max(mxlba,len(bin(a[i])[2:]))
cnt=[0]*mxlba
for i in xrange(n):
    bit=bin(a[i])[2:]
    lb=len(bit)
    for j in xrange(lb-1,-1,-1):
        if bit[j]=="1":
            cnt[lb-1-j]+=1
            break

axor=0
for i in xrange(n):
    axor^=a[i]

axor=bin(axor)[2:]
la=len(axor)
ans=0
i=-1
while i<la:
    i+=1
    if axor[i]=="1":
        if cnt[i]==0:
            print(-1)
            exit()
        else:
            ans+=1
            cnt[i]-=1
            if la-i-1==0:
                break
            tmp=int("1"*(la-i-1),2)
            axor=int(axor,2)^tmp
            axor=bin(axor)[2:]

print(ans)


### FIXED CODE ###

n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
mxlba=0
for i in xrange(n):
    mxlba=max(mxlba,len(bin(a[i])[2:]))

exist=[False]*(mxlba+1000)
for i in xrange(n):
    bit=bin(a[i])[2:]
    lb=len(bit)
    for j in xrange(lb-1,-1,-1):
        if bit[j]=="1":
            exist[lb-1-j]=True
            break

axor=0
for i in xrange(n):
    axor^=a[i]
if axor==0:
    print(0)
    exit()
axor=bin(axor)[2:]
la=len(axor)
ans=0
i=0
while i<la:
    if axor[i]=="1":
        if not exist[la-i-1]:
            print(-1)
            exit()
        else:
            ans+=1
            if la-i-1==0:
                break
            tmp=int("1"*(la-i-1),2)
            axor=int(axor,2)^tmp
            axor=bin(axor)[2:]
    i+=1

print(ans)
import re

di = {1:".,!? ",2:"abc",3:"def",4:"ghi"
         ,5:"jkl",6:"mno",7:"pqrs",8:"tuv",9:"wxyz"}
while True:
    str = ""
    line = raw_input()
    if line.endswith("0") is False:
        break
    list = re.split("0+",line)
    for line in list:
        if line is not '':
            str += di[int(line[:1])][(len(line)-1)%len(di[int(line[:1])])]
    print str

### FIXED CODE ###

import sys
di = {1:".,!? ",2 :"abc",3:"def",4:"ghi",5:"jkl",6:"mno",7:"pqrs",8:"tuv",9:"wxyz"}
b = input()

for j in range(b):
    a = raw_input()
    count = 0
    le = 999
    for letter in a:
        if(letter == "0"):
            if(le == 999):
                pass
            else:
                sys.stdout.write(di[le][(count-1)%len(di[le])])
                count = 0
                le = 999
        else:
            le = int(letter)
            count += 1
    print ""
n = int(input())
lst = [iuput() for _ in range(n-1)]
lstset = set(lst)
if len(lst) != len(lstset):
    print("No")
else:
    cnt = 0
    for i in range(n-1):
        if lst[i][-1] == lst[i][0]:
            cnt += 1
        else:
            break
    if cnt == len(lst):
        print('Yes')
    else:
        print('No')
    

### FIXED CODE ###

n = int(input())
lst = [input() for _ in range(n)]
lstset = set(lst)

if len(lst) != len(lstset):
    print("No")
else:
    cnt = 0
    for i in range(n-1):
        if lst[i][-1] == lst[i + 1][0]:
            cnt += 1
        else:
            break
    if cnt + 1 == len(lst):
        print('Yes')
    else:
        print('No')
def sieve(N, limit):
    is_prime = [True] * (N + 1)
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, limit + 1):
        if not is_prime[i]:
            continue
        for j in range(i + i, N + 1, i):
            is_prime[j] = False
    return [i for i in range(2, N + 1) if is_prime[i]]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

### FIXED CODE ###

def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))
N, K = map(int, input().split())
S = input()

score = 0
for i in range(N-1):
    if (S[i] == S[i+1]):
        score += 1
    ans = min(score+2*K, N-1)

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()

score = 0
for i in range(N-1):
    if (S[i] == S[i+1]):
        score += 1
ans = min(score+2*K, N-1)

print(ans)
n,m = map(int,input().split())
print(int((n-1)*(m-1))

### FIXED CODE ###

n,m = map(int,input().split())
print(int((n-1)*(m-1)))
N, K = map(int, input().split())
S = list(input())

if S[K] == "A":
    S[K] = "a"
elif S[K] == "B":
    S[K] = "b"
else:
    S[K] = "c"

for i in range(N):
    print(S[i], end="")

### FIXED CODE ###

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

if S[K-1] == "A":
    S[K-1] = "a"
elif S[K-1] == "B":
    S[K-1] = "b"
else:
    S[K-1] = "c"

for i in range(N):
    print(S[i], end="")
import numpy as np
N,M = map(int,input().split())

bridges = [list(map(int,input().split())) for i in range(M)]

roots = np.array((range(0,N)))
a =int(N*(N-1)/2)
ans = [a]

for i in range(0,M)[::-1]:
    island0, island1 = bridges[i][0],bridges[i][1]

    if roots[island0-1] == roots[island1-1]:
        ans.append(int(a))
        continue

    num_island0 = roots.count(roots[island0-1])
    num_island1 = roots.count(roots[island1-1])
    num_island01 = num_island0 + num_island1
    if roots[island1-1] != island1: # merge
        min_i = min(roots[island0-1],roots[island1-1])
        max_i = max(roots[island0-1],roots[island1-1])
        roots = [min_i if root==max_i else root for root in roots]        
    else: # つなげる
        roots[island1-1] = roots[island0-1]
    
    a -= (num_island01*(num_island01-1) - num_island0*(num_island0-1) - num_island1 *(num_island1-1))/2
    ans.append(int(a))

[print(ans[i]) for i in range(M)[::-1]]


### FIXED CODE ###


class UnionFindTree():
    # Union find tree
    # 2つの効率化　経路圧縮、ランク
    # つなげることはできるか分離することはできないので、木をつなげる方向に利用する
    # 
    def __init__(self, node_size):
        # node_num: 全体のノード数
        # parent: ノードがrootなら-1、親がいれば親の番号を入れる
        # size:
        # rank:  
        self.parent =[-1] * node_size 
        self.size = [1] * node_size
        self.rank = [1] * node_size
    
    def find_root(self,node):
        # node属する木のrootを探す
        # たどった経路に含まれるnodeの親をrootにつなぎ替える
        if self.parent[node] == -1:             # 自身がrootの場合
            root = node
        else:                                   # 自身がrootでない場合
            root = self.find_root(self.parent[node]) # 再帰的にrootを探す
            self.parent[node] = root            # たどった経路に含まれるnodeの親をrootにつなぎ替える(経路圧縮)
        return root

    def unite(self,node0, node1):
        # node0とnode1が含まれる木を結合する
        
        #node0 node1のrootを求める
        root0 = self.find_root(node0) 
        root1 = self.find_root(node1)

        if root0 != root1:
            # rankを比較しrankが小さい方の木を大きい方の木のrootにつなげる
            # rank is sameのときのみrankが増える
            rank0 = self.rank[root0]
            rank1 = self.rank[root1]

            if rank0 == rank1: # rank is same
                self.parent[root1] = root0
                self.size[root0] += self.size[root1]
                self.rank[root0] += 1
            elif rank0 > rank1:
                self.parent[root1] = root0
                self.size[root0] += self.size[root1]
            else:
                self.parent[root0] = root1
                self.size[root1] += self.size[root0]

            


N,M = map(int,input().split())
bridges = [list(map(int,input().split())) for i in range(M)]

UFT = UnionFindTree(N)

a = int(N*(N-1)/2) # 不便さ
ans = [a]

for i in range(1,M)[::-1]:
    island0_num, island1_num = bridges[i][0]-1, bridges[i][1]-1 
    root0 = UFT.find_root(island0_num)
    root1 = UFT.find_root(island1_num)
    if root0 != root1:
        size0 =  UFT.size[root0]
        size1 =  UFT.size[root1]
        UFT.unite(island0_num,island1_num)
        a -= size0 * size1
    ans.append(int(a))

[print(ans[i]) for i in range(M)[::-1]]
n, K = map(int, input().split())
h = [int(x) for x in input().split()]
inf = float('inf')
dp = [inf] * n  # initialize dp
dp[0] = 0
for i in range(1, n):
    for k in range(1, K+1):
        if i - k >= 0:
            dp[i] = min(dp[i-k] + abs(h[i] - h[i-k]), dp[i])
        else:
            break
print(dp[-1])

### FIXED CODE ###

n = int(input())
h = [int(x) for x in input().split()]
inf = float('inf')
dp = [inf] * n  # initialize dp
dp[0] = 0
for i in range(1, n):
    if i == 1:
        dp[i] = abs(h[i] - h[i-1])
    elif (dp[i-1] + abs(h[i] - h[i-1])) < (dp[i-2] + abs(h[i] - h[i-2])):
        dp[i] = dp[i-1] + abs(h[i] - h[i-1])
    else:
        dp[i] = dp[i-2] + abs(h[i] - h[i-2])
print(dp[-1])
a,b,c,d = map(int, input())

print(max([a*b,c*d]))

### FIXED CODE ###

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

print(max([a*b,c*d]))
def main():
  M = []
  D = []
  for i in range(2):
    m, d = [int(i) for i in input().split()]
    M.append(m)
    D.append(d)

  if (M[0] != M[1]):
    print(1)
  else:
	print(0)

if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  M = []
  D = []
  for i in range(2):
    m, d = [int(i) for i in input().split()]
    M.append(m)
    D.append(d)

  if (M[0] != M[1]):
    print(1)
  else:
    print(0)

main()
import sys

def main(lines):
  line=lines[0].split()
  n = int(line[0])
  x = int(line[1])
  t = int(line[2])
  ans = math.ceil(n/x)*t
  print(ans)

if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)


### FIXED CODE ###

import sys
import math

def main(lines):
    line=lines.split()
    n = int(line[0])
    x = int(line[1])
    t = int(line[2])
    ans = math.ceil(n/x)*t
    print(ans)

if __name__ == '__main__':
    lines=input()
    main(lines)
N,M = input().split()
N = int(N)
M = int(M)

temp = sum(input().split())

if N - temp > -1:
  print(N - temp)
else:
  print("-1")

### FIXED CODE ###

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

temp = sum(list(map(int,input().split())))

if N - temp > -1:
  print(N - temp)
else:
  print("-1")
N, R = [int(x) for x in input().split(' ')]

if N > 9:
  print(R)
else:
  print(R - 100 * (10 - K))


### FIXED CODE ###

N, R = [int(x) for x in input().split(' ')]

if N > 9:
  print(R)
else:
  print(R + 100 * (10 - N))
import copy

N, K = map(int, input().split())
V = [int(i) for i in input().split()]

value = 0
# k+1個取って，ret-1個戻す
for k in reversed(range(K)):
    for ret in range(K-k): #戻す個数はret個
        if (ret < k+1) and ((k+1+ret)<=K):
            for i in range(k+1+1): # 左右の分け方
                tmp = []
                V_tmp = copy.copy(V)
                for sp in range(i): # 左端iつ取る
                    tmp.append(V_tmp.pop(0))
                for sp in range(k+1-i): # 右端k+1-iつ取る
                    tmp.append(V_tmp.pop(-1))
                tmp = list(filter(lambda x: x not in sorted(tmp)[:ret],tmp))
                value = max(value,sum(tmp))

print(value)

### FIXED CODE ###

import copy

N, K = map(int, input().split())
V = [int(i) for i in input().split()]

result = 0
# i個取る
for i in range(min(N,K)+1):
    #print('i:',i)
    for sp in range(i+1): # 左右の分け方
        #print('right',sp)
        #print('left',i-sp)
        tmp = []
        V_tmp = copy.copy(V)
        #print('元々：',V_tmp)
        tmp.extend(V_tmp[:sp]) # 左端追加
        #print('left',V_tmp[:sp])
        tmp.extend(V_tmp[N-(i-sp):]) #右端追加
        #print('right',V_tmp[N-(i-sp):])
        #print(tmp)
        tmp = sorted(tmp)
        value = sum(tmp)
        # ret個戻す
        for ret in range(0, min(K-i,i)): #残り操作回数か取った石の個数iの小さい方
            if ret < i:
                # マイナスの価値は戻す
                if tmp[ret] < 0:
                    value -= tmp[ret]
                    #print('捨てた宝石：',tmp[ret])
            else:
                break
        result = max(result,value)
            #print()

print(result)
N = int(input())
if N % == 0:
  print(2/N)
else:
  print((N - N//2)/N)

### FIXED CODE ###

N = int(input())
print(((N + 1) // 2) / N)
Atcoder 173 b

N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0


for i in range(N):
    C = input()
    If C == ‘AC’:
        C0 += 1
    elif C == ‘WA’:
        C1 += 1
    elif C == ‘LTE’:
        C2 += 1
    elif C == ‘RE’:
        C3 += 1

print(‘AC x ‘ + str(C0))
print(‘WA x ‘ + str(C1))
print(‘LTE x ‘ + str(C2))
print(‘RE x ‘ + str(C3))

### FIXED CODE ###

N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0


for i in range(N):
    C = input()
#    print(C)
    if C == 'AC':
        C0 += 1
    elif C == 'WA':
        C1 += 1
    elif C == 'TLE':
        C2 += 1
    elif C == 'RE':
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))
i = input().split()
a = int(i[0])
b = int(i[1])
c = int(i[2])

answer = "NO"
while a <= a*b:
    if a%b==c:
        answer = "YES"
        break
    a += a 
    
print(answer)



### FIXED CODE ###

a = input()
b = a.split()

if b[0][-1] == b[1][0] and b[1][-1] == b[2][0]:
    print("YES")
else:
    print("NO")
a = int(input())
b = int(input())

if a < b:
  print('Bob')
elif a > b:
  print('Alice')
else:
  print('Draw')

### FIXED CODE ###

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

if a == b:
  print('Draw')
elif a == 1:
  print('Alice')
elif b == 1:
  print('Bob')
elif a < b:
  print('Bob')
elif a > b:
  print('Alice')
N=input()
if N<11 or N==12 or 11<N<17 or N==18 or 19<N<22 or 23<N<26 or N==27 or N==30
or N==32 or 34<N<37 or N==40 or N==42 or N==45 or N==48 or N==49 or N==54 or N==63 or N==72 or N==81 or N==64 or N==56:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

N=int(input())
a=[]
for i in range(10):
	for j in range(10):
		a.append(i*j)
if N in a:
	print('Yes')
else:
	print('No')
N = int(input())

for i in range(int(N**0.5), 1, -1):
    if (N / i).is_integer():
        a = N // i
        b = N // a
        break

print(a+b-2)

### FIXED CODE ###

N = int(input())

for i in range(int(N**0.5), 0, -1):
    if (N / i).is_integer():
        a = N // i
        b = N // a
        break

print(a+b-2)
def dfs(v, g, colors, color = 0):
	colors[v] = color
	if not len(g[v]):
		return
	for nv in g[v]:
		if colors[nv.v()] != -1:
			continue
		nc = color if nv.w() % 2 == 0 else 1 - color
		dfs(nv.v(), g, colors, nc)

def resolve():
	n = int(input())
	colors = [-1]*n
	g = [list() for _ in range(n)]
	for _ in range(n-1):
		u, v, w = map(int, input().split())
		g[v-1].append(Edge(u-1, w))
		g[u-1].append(Edge(v-1, w))
	dfs(0, g, colors)
	for c in colors:
		print(c)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100**4)

class Edge():
	def __init__(self, v, w):
		self._v = v
		self._w = w
	def v(self):
		return self._v
	def w(self):
		return self._w

def dfs(v, g, colors, color = 0):
	colors[v] = color
	if not len(g[v]):
		return
	for nv in g[v]:
		if colors[nv.v()] != -1:
			continue
		nc = color if nv.w() % 2 == 0 else 1 - color
		dfs(nv.v(), g, colors, nc)

def resolve():
	n = int(input())
	colors = [-1]*n
	g = [list() for _ in range(n)]
	for _ in range(n-1):
		u, v, w = map(int, input().split())
		g[v-1].append(Edge(u-1, w))
		g[u-1].append(Edge(v-1, w))
	for i in range(n):
		if colors[i] != -1:
			continue
		dfs(i, g, colors)
	for c in colors:
		print(c)
resolve()
a, b, c = int(input().split())
if a >= 1 and a <= 100:
    if b >= 1 and b <= 100:
        if c >= 1 and c <= 100:
            a, b = b, a
            a, c = c, a
print(a, b, c)

### FIXED CODE ###

a, b, c = map(int, input().split())
print(c, a, b)
n = int(input())
a_list = list(map(int,input().split()))

if n % 2 == 0: # 1パス使える
    dp = [[-float('inf') for _ in range(n)] for __ in range(2)]
    dp[1][-1] = a_list[-1]

    for j in reversed(range(2)):
        for i in reversed(range(n)):
            if j == 2 and i >= n-2:
                pass
            elif j == 2:
                dp[j][i] = dp[j][i+2] + a_list[i]
            elif i == n-2:
                dp[j][i] = dp[j+1][i+1]
            elif i > n-2:
                pass
            else:
                dp[j][i] = max(dp[j+1][i+1],dp[j][i+2] + a_list[i])
    print(dp[0][0])
else: # 2パス使える
    dp = [[-float('inf') for _ in range(n)] for __ in range(3)]
    dp[2][-1] = a_list[-1]

    for j in reversed(range(3)):
        for i in reversed(range(n)):
            if j == 2 and i >= n-2:
                pass
            elif j == 2:
                dp[j][i] = dp[j][i+2] + a_list[i]
            elif i == n-2:
                dp[j][i] = dp[j+1][i+1]
            elif i > n-2:
                pass
            else:
                dp[j][i] = max(dp[j+1][i+1],dp[j][i+2] + a_list[i])
    print(dp[0][0])

### FIXED CODE ###


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

if n == 2 or n == 3:
    print(max(a_list))
elif n % 2 == 0: # 1パス使える
    dp = [[-float('inf') for _ in range(n)] for __ in range(2)]
    dp[1][-1] = a_list[-1]

    for j in reversed(range(2)):
        for i in reversed(range(n)):
            if j == 1 and i >= n-2:
                pass
            elif j == 1:
                dp[j][i] = dp[j][i+2] + a_list[i]
            elif i == n-2:
                dp[j][i] = dp[j+1][i+1]
            elif i > n-2:
                pass
            else:
                dp[j][i] = max(dp[j+1][i+1],dp[j][i+2] + a_list[i])
    print(dp[0][0])
else: # 2パス使える
    dp = [[-float('inf') for _ in range(n)] for __ in range(3)]
    dp[2][-1] = a_list[-1]

    for j in reversed(range(3)):
        for i in reversed(range(n)):
            if j == 2 and i >= n-2:
                pass
            elif j == 2:
                dp[j][i] = dp[j][i+2] + a_list[i]
            elif i == n-2:
                dp[j][i] = dp[j+1][i+1]
            elif i > n-2:
                pass
            else:
                dp[j][i] = max(dp[j+1][i+1],dp[j][i+2] + a_list[i])
    print(dp[0][0])
S = input()
DAY = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for num in range(7):
  if DAY[num] = S:
    print(7-num)

### FIXED CODE ###

S = input()
DAY = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for num in range(7):
  if DAY[num] == S:
    print(7-num)
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(index(max(a))+1)

### FIXED CODE ###

n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(a.index(min(a))+1)
eople,point,quiz = map(int,input().split())
an = [int(input()) for _ in range(quiz)]
each_p = [point-quiz] * people

for x in an:
    each_p[x-1] += 1

for y in each_p:
    if y <= 0:
        print("No")
    else:
        print("Yes")


### FIXED CODE ###

people,point,quiz = map(int,input().split())
an = [int(input()) for _ in range(quiz)]
each_p = [point-quiz] * people

for x in an:
    each_p[x-1] += 1

for y in each_p:
    if y <= 0:
        print("No")
    else:
        print("Yes")
import math
from fractions import gcd
a, b = map(int, input().split())

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

print(lcm(a, b))


### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())

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

print(lcm(a, b))
inp1 = input()
inp1 = list(inp1)
inp2 = input()

ans = 1
for i in inp1:
    if i != '1'
        ans = int(i)
        break

print(ans)

### FIXED CODE ###

inp1 = input()
inp1 = list(inp1)
inp2 = input()
inp2 = int(inp2)

ans = 1
count = 0
for i in inp1:
    if i != '1':
        ans = int(i)
        break
    else:
        count += 1

if count >= inp2:
    ans = 1

print(ans)
S = input()
print(700 + 100*S.count(o))

### FIXED CODE ###

S = input()
print(700 + 100*S.count('o'))
"\n".join(reversed(sorted([input() for i in range(10)]))[:3])

### FIXED CODE ###

print "\n".join([str(x) for x in (sorted([input() for i in range(10)])[:-4:-1])])