Harryxun/stf_run huggingface dataset:
N=int(input())
G=[[0]*(N+1) for  _ in [0]*(N+1)]
res=[0]*(N+1)

for i in range(N-1):
    u,v,w=map(int,input().split())
    G[u][v]=w
    G[v][u]=w
    
    
stack=[]
stack.append(1)
res[1]=1
while stack:
    r=stack.pop()
    for k in range(N+1):
        if G[r][k]>0 and res[k]==0:
            stack.append(k)
            if G[r][k]%2:
                res[k]=-res[r]
            else:
                res[k]=res[r]
for i in res[1:]:
    print((i+1)//2)
        
        
            
    
    
    
    
    

### FIXED CODE ###

N=int(input())
G=[[] for _ in [0]*(N+1)]
for _ in [0]*(N-1):
    u,v,w=map(int,input().split())
    G[u].append((v,w))
    G[v].append((u,w))

c=[0]*(N+1)
stack=[1]
c[1]=1
while stack:
    r=stack.pop()
    for nr,nw in G[r]:
        if c[nr]==0:
            stack.append(nr)
            if nw%2:
                c[nr]=-c[r]
            else:
                c[nr]=c[r]
for i in c[1:]:
    print((i+1)//2)
s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) < k:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

s = []
for i in range(6):
  s.append(int(input()))
if(s[4]-s[0]) <= s[5]:
  print("Yay!")
else:
  print(":(")
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

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


uf = UnionFind(N)
fr = {}
for _ in range(M):
    a, b = map(int, input().split(" "))
    a -= 1
    b -= 1
    uf.union(a, b)
    if fr.get(a) is not None:
        fr[a] += 1
    else:
        fr[a] = 1

    if fr.get(b) is not None:
        fr[b] += 1
    else:
        fr[b] = 1

bl = {}
for _ in range(K):
    c, d = map(int, input().split(" "))
    c -= 1
    d -= 1
    if not uf.is_same(c, d):
        continue

    if bl.get(c) is not None:
        bl[c] += 1
    else:
        bl[c] = 1

    if bl.get(d) is not None:
        bl[d] += 1
    else:
        bl[d] = 1


for i in range(N):
    s = uf.get_size(i) - 1
    s -= bl.get(i, 0)
    s -= fr.get(i, 0)
    print(s)

### FIXED CODE ###


class UnionFind(object):
    "https://www.kumilog.net/entry/union-find"
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]

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


uf = UnionFind(N)
fr = {}
for _ in range(M):
    a, b = map(int, input().split(" "))
    a -= 1
    b -= 1
    uf.union(a, b)
    if fr.get(a) is not None:
        fr[a] += 1
    else:
        fr[a] = 1

    if fr.get(b) is not None:
        fr[b] += 1
    else:
        fr[b] = 1

bl = {}
for _ in range(K):
    c, d = map(int, input().split(" "))
    c -= 1
    d -= 1
    if not uf.is_same(c, d):
        continue

    if bl.get(c) is not None:
        bl[c] += 1
    else:
        bl[c] = 1

    if bl.get(d) is not None:
        bl[d] += 1
    else:
        bl[d] = 1


for i in range(N):
    s = uf.get_size(i) - 1
    s -= bl.get(i, 0)
    s -= fr.get(i, 0)
    print(s)
a=int(input())
N=[0 for i in range(a)]
b=input()
for i in range(a):
  N[i]=int(b.aplit())

2ans=0
2ans2=0
for i in range(a-1):
  if N[i]==N[i+1]:
    2ans2+=1
  else :
    if 2ans2%2==1 :
      2ans2+=1
    ans+=2ans2/2
    2ans2=0
return 2ans

### FIXED CODE ###

a=int(input())
N=[0 for i in range(a)]
b=input()
#print(b)
N=b.split()
for i in range(a):
  N[i]=int(N[i])

#print(N)
  
a2ans=0
a2ans2=0
for i in range(a-1):
  if N[i]==N[i+1]:
    a2ans2+=1
    #print(a2ans2)
  else :
    if a2ans2%2==1 :
      a2ans2+=1
    
    a2ans+=a2ans2/2
    a2ans2=0


if a2ans2%2==1 :
  a2ans2+=1
#print(a2ans2)
a2ans+=a2ans2/2
a2ans2=0



print(int(a2ans))
N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] =< peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))

### FIXED CODE ###

N, M = map(int, input().split())
peaks = list(map(int, input().split()))
ng_peaks = set([])
for j in range(M):
    A_j, B_j = map(int, input().split())
    if peaks[A_j-1] >= peaks[B_j-1]:
        ng_peaks.add(B_j)
    if peaks[A_j-1] <= peaks[B_j-1]:
        ng_peaks.add(A_j)
print(N-len(ng_peaks))
import itertools
n,m,q = map(int,input().split())
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
for i in range(q):
    a[i],b[i],c[i],d[i] = map(int,input().split())
ans = 0
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    cnt = 0
    for i in range(q):
        if A[b[i]-1] - A[a[i]-1] == c[i]:
            cnt += d[i]
    ans = max(ans,tmp)
print(ans)


### FIXED CODE ###

import itertools
n,m,q = map(int,input().split())
a = [0]*q
b = [0]*q
c = [0]*q
d = [0]*q
for i in range(q):
    a[i],b[i],c[i],d[i] = map(int,input().split())
ans = 0
for A in itertools.combinations_with_replacement(range(1,m+1),n):
    tmp = 0
    for i in range(q):
        if A[b[i]-1] - A[a[i]-1] == c[i]:
            tmp += d[i]
    ans = max(ans,tmp)
print(ans)
#ABC050B

n=int(raw_input())
t=map(int,raw_input().split())
m=int(raw_input())
v=[]
for i in xrange(m):
 u=t[:]
 p,x=map(int,raw_input().split())
 u[p-1]=x
 v.append(sum(u))
for i in xrange(m):
 print v[i]


### FIXED CODE ###

#ABC050A

res=raw_input()
res=res.replace(' ','')
print eval(res)
r,g,b=input()
a=(100*int(r)+10*int(g)+int(b))%4
if a==0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

r,g,b=map(int,input().split())
if (10*g+b)%4==0:
    print("YES")
else:
    print("NO")
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

def solve():
    N, K = mapint()
    As = list(mapint())
    mod = 10**9+7
    pos = []
    neg = []
    for a in As:
        if a>=0:
            pos.append(a)
        else:
            neg.append(a)
    
    pos.sort(reverse=True)
    neg.sort()
    lenp = len(pos)
    lenn = len(neg)
    if not pos and K%2==1:
        ans = 1
        for i, n in enumerate(neg[::-1]):
            ans *= n
            ans %= mod
            if i==K-1:
                break
        return ans
    if lenp+lenn==K and (K-lenp)%2==1:
        ans = 1
        pos.extend(neg)
        pos.sort(reverse=True)
        for i, p in enumerate(pos):
            ans *= p
            ans %= mod
            if i==K-1:
                break
        return ans
    ans = 1
    pcnt = 0
    ncnt = 0
    for i in range(K//2):
        if pcnt+2>=lenp:
            ans *= neg[ncnt*2]*neg[ncnt*2+1]
            ans %= mod
            ncnt += 1
        elif ncnt+2>=lenn:
            ans *= pos[pcnt*2]*pos[pcnt*2+1]
            ans %= mod
            pcnt += 1
        elif pos[pcnt*2]*pos[pcnt*2+1]>neg[ncnt*2]*neg[ncnt*2+1]:
            ans *= pos[pcnt*2]*pos[pcnt*2+1]
            ans %= mod
            pcnt += 1
        else:
            ans *= neg[ncnt*2]*neg[ncnt*2+1]
            ans %= mod
            ncnt += 1
    if K%2==1:
        ans *= pos[pcnt]
        ans %= mod
    return ans

print(solve())

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

def solve():
    N, K = mapint()
    As = list(mapint())
    mod = 10**9+7
    pos = []
    neg = []
    for a in As:
        if a>=0:
            pos.append(a)
        else:
            neg.append(a)

    pos.sort(reverse=True)
    neg.sort()
    lenp = len(pos)
    lenn = len(neg)
    if not pos and K%2==1:
        ans = 1
        for i, n in enumerate(neg[::-1]):
            ans *= n
            ans %= mod
            if i==K-1:
                break
        return ans
    if lenp+lenn==K and (K-lenp)%2==1:
        ans = 1
        pos.extend(neg)
        pos.sort(reverse=True)
        for i, p in enumerate(pos):
            ans *= p
            ans %= mod
            if i==K-1:
                break
        return ans
    ans = 1
    pcnt = 0
    ncnt = 0
    for i in range(K//2):
        if pcnt*2+1>=lenp:
            ans *= neg[ncnt*2]*neg[ncnt*2+1]
            ans %= mod
            ncnt += 1
        elif ncnt*2+1>=lenn:
            ans *= pos[pcnt*2]*pos[pcnt*2+1]
            ans %= mod
            pcnt += 1
        elif pos[pcnt*2]*pos[pcnt*2+1]>neg[ncnt*2]*neg[ncnt*2+1]:
            ans *= pos[pcnt*2]*pos[pcnt*2+1]
            ans %= mod
            pcnt += 1
        else:
            ans *= neg[ncnt*2]*neg[ncnt*2+1]
            ans %= mod
            ncnt += 1
    if K%2==1:
        ans *= pos[pcnt*2]
        ans %= mod
    return ans

print(solve())
N=int(input())
S=input()
for i in range(N-1):
    if S[i]==S[i+1]:
       S= S.replace(S[i],'')
print(len(S))

### FIXED CODE ###

N=int(input())
S=input()
ans=1
for i in range(N-1):
    if S[i]!=S[i+1]:
       ans+=1
print(ans)
def main():
    a,b,c = list(map(int,input().split(' ')))
    #a,b,c = list(map(lambda x:abs(int(x)),input().split(' ')))
    # if (a**0.5 + b**0.5) < (c**0.5):
    #     print('Yes')
    # else:
    #     print('No')

    if (4*a*b) < ((c-a-b)**2) and c>=0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    K = int(input())
    List = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(List[K-1])

if __name__ == '__main__':
    main()
S = input()
l = len(S)
print(S[0] + l +S[l-1])

### FIXED CODE ###

S = input()
l = len(S)
print(S[0] + str(l-2) + S[l-1])
a,b = input().split()
c = a*b
print(c//1)

### FIXED CODE ###

from decimal import Decimal
a,b = input().split()
c = int(a)*Decimal(b)
print(int(c))
import math

A,B,H,M =int(input()),int(input()),int(input()),int(input())
if 1<=A<=1000 and 1<=B<=1000 and 0<=H<=11 and 0<=M<=59:
    hw=(2*math.pi)/(12*60*60) #時針の角速度[rad/s]
    mw=(2*math.pi)/(60*60) #分針の角速度[rad/s]
    time_h=H*60*60 #Hour時間[s] 
    time_m=M*60 #Min時間[s]
    aw=hw*(time_h+time_m) #Arad[rad] #最後の鬼門だった！！なるほどね！40min経ってる間に時針も進んでるから。。
    bw=mw*time_m #Brad[rad]
    rad=abs(bw-aw)
    # 正弦定理で出力結果を得る(a^2=b^2+c^2-2bccosθ)
    print(math.sqrt(A**2+B**2-2*A*B*math.cos(rad)))
    #確認用
    #print(time_h,time_m,aw,bw,rad) 
else: 
    print("各値の条件は次の通り:1<=A,B<=1000,0<=H<=11,0<=M<=59")
    print("あなたの入力:A={},B={},H={},M={}".format(A,B,H,M))

### FIXED CODE ###

import math

A,B,H,M =map(int, input().split())
if 1<=A<=1000 and 1<=B<=1000 and 0<=H<=11 and 0<=M<=59:
    hw=(2*math.pi)/(12*60*60) #時針の角速度[rad/s]
    mw=(2*math.pi)/(60*60) #分針の角速度[rad/s]
    time_h=H*60*60 #Hour時間[s] 
    time_m=M*60 #Min時間[s]
    aw=hw*(time_h+time_m) #Arad[rad] #最後の鬼門だった！！なるほどね！40min経ってる間に時針も進んでるから。。
    bw=mw*time_m #Brad[rad]
    rad=abs(bw-aw)
    # 正弦定理で出力結果を得る(a^2=b^2+c^2-2bccosθ)
    print(math.sqrt(A**2+B**2-2*A*B*math.cos(rad)))
    #確認用
    #print(time_h,time_m,aw,bw,rad) 
else: 
    print("各値の条件は次の通り:1<=A,B<=1000,0<=H<=11,0<=M<=59")
    print("あなたの入力:A={},B={},H={},M={}".format(A,B,H,M))
# naive

x, y = map(int, input().split())

s = min(x,y)
l = max(x,y)
for i in list(range(s+1)[::-1]):
    if s % i == 0:
        if l % i == 0:
            print(i)
            break


### FIXED CODE ###

x, y = map(int, input().split())
l = max(x, y)
s = min(x, y)

for i in range(x):
    olds = s
    oldl = l
    s = oldl % olds
    l = olds

    if s == 0:
        print(l)
        break
import sys
input = sys.stdin.readline
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
a.sort()
bc=[None]*m
for i in range(m):
    bc[i] = list(map(int, input().split(" ")))
bc.sort(reverse=True, key=lambda x:x[c])
l=[]
for [b,c] in bc:
    l = l+[c]*b
    if n < len(l):
        break
print(sorted(l))

### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
a.sort()
bc=[None]*m
for i in range(m):
    bc[i] = list(map(int, input().split(" ")))
bc.sort(reverse=True, key=lambda x:x[1])
l=[]
for [b,c] in bc:
    l.extend([c]*b)
    if n < len(l):
        break
for i in range(n):
    if len(l) <= i or l[i] <= a[i]:
        break
    a[i] = l[i]
print(sum(a))
a, b = mao(int,input().split())
if a < b:
  print(a-1)
else:
  print(a)

### FIXED CODE ###

a, b = map(int,input().split())
if a <= b:
  print(a)
else:
  print(a-1)
N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range:
    S[i] = list(map(int, input().split()))

b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))

### FIXED CODE ###

N, M, C = map(int, input().split())                                                                                                                         
B = list(map(int, input().split()))
 
S = [[0]*M for i in range(N)]
for i in range(N):
    S[i] = list(map(int, input().split()))

b = 0
 
for i in range(N):
    a = 0
    for ii in range(M):
        a += S[i][ii] * B[ii]
    a += C
    if a > 0:
        b += 1
print(str(b))
n = int(input())
buttons = [0]
target_index = 0
for i in range(n):
    num = int(input())
    buttons.append(num)

count = 0
next_index = 2
while count < n:
    if len(buttons) - 1 <= next_index:
        count = -1
        break

    prev_index = buttons.index(next_index)
    count += 1
    if prev_index == 1:
        break
    else:
        next_index = prev_index

print(count if count < n else -1)


### FIXED CODE ###

n = int(input())
buttons = [0]
target_index = 0
for _ in range(n):
    buttons.append(int(input()))

count = 0
prev_index = 1
while count < n:
    if prev_index < 1 or len(buttons) <= prev_index:
        count = -1
        break

    next_index = buttons[prev_index]
    count += 1
    if next_index == 2:
        break
    else:
        prev_index = next_index

print(count if count < n else -1)
def funcion():
    n = int(input())
    m = []
    indice_anterior = -1
    total = 0

    for i in range(n):
        cadena = input()
        lista = cadena.split()
        m.append(lista)
    
    for i in range(n):
        mayor = 0
        for j in m[i]:
            jnum = int(j)
            indice_actual = m[i].index(j)
            if (jnum > mayor) and indice_actual != indice_anterior:
                mayor = jnum
        indice_anterior = m[i].index(str(mayor))     
        total = total + mayor
    
    print(total)
def main():
    return(funcion())

if __name__ == "__main__":
    main()


### FIXED CODE ###

N = int(input())
vacation = []
for i in range(N):
    vacation.append(list(map(int, input().split())))

activities = 3
schedules = [[None for _ in range(activities)] for _ in range(N)]
schedules[0] = vacation[0]

for i in range(1, N):
    for j in range(activities):
        schedules[i][j] = max(schedules[i - 1][(j + 1) % 3], schedules[i - 1][(j + 2) % 3]) + vacation[i][j]

print(max(schedules[N - 1]))
import sys

for l in sys.stdin:
  a, p = l.rstrip('\n').split(' ')
pies = (3*a+p)//2
print(pies)

### FIXED CODE ###

import sys

for l in sys.stdin:
  a, p = l.rstrip('\n').split(' ')
pies = (int(a) * 3 + int(p)) //2
print(pies)
n = list(input())
for num in n:
    if num ==1:
        num=9
    elif num==1:
        num=9:
print(n)

### FIXED CODE ###

n = list(input())
for num in n:
    if num == '1':
        num ='9'
    elif num == '9':
        num = '1'
    print(num,end='')
N= int(input())
s = [''.join(sorted(list(input()))) for i in range(N)]
tmp = list(combinations(s,2))
result = [i for i in tmp if i[0] == i[1]]
print(len(result))

### FIXED CODE ###

def nCr(n, r):
    r = min(r, n-r)
    numerator = 1
    for i in range(n, n-r, -1):
        numerator *= i
    denominator = 1
    for i in range(r, 1, -1):
        denominator *= i
    return numerator // denominator

N= int(input())
s = [''.join(sorted(list(input()))) for i in range(N)]

dic={}
for i in s:
	if i in dic:
		dic[i] +=1
	else:
		dic[i] = 1

result = 0
for j in dic.values():
	if j > 1:
		result += nCr(j,2)

print(result)
def main()
    a = int(input())
    b = int(input())
    c = int(input())
    tt = int(input())
    total = 0

    for yen500 in range(a+1):
        for yen100 in range(b+1):
            for yen50 in range(c+1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == tt:
                    total += 1

    print(total)

main()

### FIXED CODE ###

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    tt = int(input())
    total = 0

    for yen500 in range(a+1):
        for yen100 in range(b+1):
            for yen50 in range(c+1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == tt:
                    total += 1

    print(total)

main()
a, b, c, d = map(int, input().split())
if abs(a) <= abs(b) and abs(c) <= abs(d):
    print(b*d)
elif abs(a) > abs(b) and abs(c) <= abs(d):
    print(b*c)
elif abs(a) <= abs(b) and abs(c) > abs(d):
    print(a*d)
else:
    print(a*c)

### FIXED CODE ###

x= int(input())
if x==1:
    print('0')
elif x==0:
    print('1')
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
x=0
for i in range(N+1):
  if A[i]+A[i+1]<=B[i]:
    x+=A[i]+A[i+1]
    A[i+1]=0
  if A[i]>=B[i]:
    x+=B[i]
  if A[i]<B[i]:
    x+=B[i]
    A[i+1]=A[i+1]-(B[i]-A[i])
print(x)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
x=0
for i in range(N):
  if A[i]+A[i+1]<=B[i]:
    x+=A[i]+A[i+1]
    A[i+1]=0
  elif A[i]>=B[i]:
    x+=B[i]
  elif A[i]<B[i]:
    x+=B[i]
    A[i+1]=A[i+1]-(B[i]-A[i])
print(x)
l = map(int, raw_input().split())

print(l[0] + l[1] / 2)

### FIXED CODE ###

x, y = map(int, input().split())
print(x + y//2)
l=input()
n = len(l)
mod = 10**9+7

p3 = [1]
for _ in range(len(l)+5):
    p3.append((p3[-1]*3)%mod)

def dfs(k,f):
    if k == n:
        return 1
    if not f:
        return p3[n-k]
    if l[k] == "1":
        return (dfs(k+1,False)+dfs(k+1,True)*2)%mod
    else:
        return dfs(k+1,True)%mod

print(dfs(0,True))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

l=input()
n = len(l)
mod = 10**9+7

p3 = [1]
for _ in range(len(l)+5):
    p3.append((p3[-1]*3)%mod)

def dfs(k,f):
    if k == n:
        return 1
    if not f:
        return p3[n-k]
    if l[k] == "1":
        return (dfs(k+1,False)+dfs(k+1,True)*2)%mod
    else:
        return dfs(k+1,True)%mod

print(dfs(0,True))
n = int(input())

def dts(s):
  if int(s) > n:
    return 0
  if ret = 1 if all(s.count(_) for _ in '753') else 0
  for i in '753':
    ret += dts(s+i)
  return ret
  
dts('0')

### FIXED CODE ###

n = int(input())

def dts(s):
  if int(s) > n:
    return 0
  ret = 1 if all(s.count(_) for _ in '753') else 0
  for i in '753':
    ret += dts(s+i)
  return ret
  
print(dts('0'))
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
base_list = [0] * N
 
for l in range(K):
 
    list_copy = A.copy()
    A = base_list.copy()
 
    for i, j in enumerate(list_copy, 1):
        if i - j >= 1:
            low = i - j
        else:
            low = 1
        if i + j <= N:
            high = i + j
        else:
            high = N
        for k in range(low - 1, high):
                A[k] += 1
            
        if A == list_copy:
          break
 
ans = map(str, A)
ans = " ".join(ans)
 
print(ans)

### FIXED CODE ###

S = input()
print(S[:3])
k,x = list(map(int,input().split()))
if 500 * k >= x
   print('Yes')
else:
   print('No')

### FIXED CODE ###

k,x = list(map(int,input().split()))
if 500 * k >= x:
   print('Yes')
else:
   print('No')
n,k = map(int,input().split())
hn = [int(input()) for i in range(n)]

hn.sort()

print(min(hn[i+k-1] - hn[i] for i in range(i-k+1)))

### FIXED CODE ###

n,k = map(int,input().split())
hn = [int(input()) for i in range(n)]

hn.sort()

print(min(hn[i+k-1] - hn[i] for i in range(n-k+1)))
a = input()
mylist = list(map(int, a.split(" ")))
A = mylist[0]
B = mylist[1]
C = mylist[2]
 
if (A == B and B != C):
  print(Yes)
elif (A == C and B != C):
  print(Yes)
elif (B == C and A != B):
  print(Yes)
else:
  print(No)


### FIXED CODE ###

a = input()
mylist = list(map(int, a.split(" ")))
A = mylist[0]
B = mylist[1]
C = mylist[2]
 
if (A == B and B != C):
  print("Yes")
elif (A == C and B != C):
  print("Yes")
elif (B == C and A != B):
  print("Yes")
else:
  print("No")
from collections import deque

#幅優先探索でラベリング
def bfs(x, graph, people):
    #people[x] is None -> まだ訪問していない．訪問していたらなラベルがつくので，
    if people[x] is not None:
        return
    unvisited = deque([x])
    people[x] = 0
    while unvisited:
        now = unvisited.popleft()
        for Next, d in graph:
            if people[Next] is None:
                people[Next] = people[now] + d
                unvisited.append(Next)

def main():
    N, M = list(map(int, input().split()))
    graph = [ [] for i in range(N)]
    people = [None] * N

    #グラフの作成
    for i in range(M):
        L, R, D = list(map(int, input().split()))
        graph[L].append((R, D))
        graph[R].append((L, -D))
    #全ての頂点でサーチ ->ラベリングを行う
    for i in range(N):
        bfs(i, graph, people)

    for i in range(N):
        for j,d in graph[i]:
            if people[j] - people[i] != d:
                print("No")
                exit()
    print("Yes")
if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque

#幅優先探索でラベリング
def bfs(x, graph, people):
    #people[x] is None -> まだ訪問していない．訪問していたらなラベルがつくので，
    if people[x] is not None:
        return
    unvisited = deque([x])
    people[x] = 0
    while unvisited:
        now = unvisited.popleft()
        for Next, d in graph[now]:
            if people[Next] is None:
                people[Next] = people[now] + d
                unvisited.append(Next)

def main():
    N, M = list(map(int, input().split()))
    graph = [ [] for i in range(N+1)]
    people = [None] * (N+1)

    #グラフの作成
    for i in range(M):
        L, R, D = list(map(int, input().split()))
        graph[L].append((R, D))
        graph[R].append((L, -D))
    #全ての頂点でサーチ ->ラベリングを行う
    for i in range(1,N+1):
        bfs(i, graph, people)

    for i in range(1,N+1):
        for j,d in graph[i]:
            if people[j] - people[i] != d:
                print("No")
                exit()
    print("Yes")
if __name__ == '__main__':
    main()
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=a
ans=0
for i in n:
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
m=100000
ans=0
for i in range(n):
  if abs((t-h[i]*0.006)-a) < m:
    m=abs((t-h[i]*0.006)-a)
    ans=i+1
print(ans)