Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
X = [0] * M
Y = [0] * M
Z = [0] * M 
for i in range(M):
  X[i], Y[i], Z[i] = map(int, input().split())

reach = [[] for _ in range(N)]

for i in range(M) :
    reach[Y[i]-1].append(X[i])
    reach[X[i]-1].append(Y[i])

approach = [False for _ in range(N)]

def change(reach, s):       
    approach[s-1] = True
    for i in reach[s-1]:
        if not approach[i-1] :
            change(reach, i)

ans = 0
for i in range(N) :
    if not approach[i]:
        change(reach, i+1)
        ans += 1
print(ans)



### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N,M = list(map(int,input().split()))
XYZ = [list(map(int,input().split())) for _ in range(M)]

G = [[] for _ in range(N)]
 
for i in XYZ:
    G[i[0]-1].append(i[1])
    G[i[1]-1].append(i[0])
 
check = [False for _ in range(N)]
 
def DFS(G,s):
    check[s-1] = True
    for i in G[s-1]:
        if not check[i-1]:         
            DFS(G,i)
ans = 0
for i in range(N):
    if not check[i]:
        DFS(G,i+1)
        ans += 1

print(ans)
import math
b = list(map(int,input().split()))
ans=0
check=0
i=0
A=0
B=0
C=b[1]
max = b[2]//b[1]
if max==0 or max==1:
    for i in range(b[2]+1):
        if b[2]-i <=0:
            break
        check = math.floor((b[0]*(b[2]-i))/b[1]) - b[0]*math.floor((b[2]-i)/b[1])
        if check > ans:
            ans=check

else:
    for i in range(1,max+1):
        A=b[1]-1
        B=b[1]+1
        check = math.floor((b[0]*A)/C) - b[0]*math.floor(A/C)
        if check > ans:
            ans=check
        check = math.floor((b[0]*B)/C) - b[0]*math.floor(B/C)
        if check > ans:
            ans=check
        B[1]+=b[1]
print(ans)

### FIXED CODE ###

import math
b = list(map(int,input().split()))
ans=0
check=0
if b[2]>b[1]-1:
    check = math.floor((b[0]*(b[1]-1))/b[1]) - b[0]*math.floor((b[1]-1)/b[1])
else:
    check = math.floor((b[0]*b[2])/b[1]) - b[0]*math.floor(b[2]/b[1])
if check>ans:
    ans=check
print(ans)
n=int(input())
l=list(map(int,input().split()))

for i,x in enumerate(l.sort()):
  if n%2 and x!=int((i+1)/2):
    print(0)
  else:
    if i%2 and i+1!=x:
      print(0)
    elif i!=x:
      print(0)
      
else:
  print(int((n/2)**2)%(10**9+7))

### FIXED CODE ###

N=int(input())
l=list(map(int,input().split()))
a=1
if N%2==0:
    if len(l)!=len(set(l))*2:
        a=0
else:
    if l.count(0) == 1:
        l.remove(0)
        if len(l) != 2*len(set(l)):
            a = 0
    else:
        a=0
if a:
      print((2**(N//2))%(10**9+7))
else:
      print(0)
import itertools
 
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
U = list(itertools.permutations(range(1, N+1)))
a = U.index(P)
b = U.index(Q)
print(abs(a-b))

### FIXED CODE ###

import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
U = list(itertools.permutations(range(1, N+1)))
a = U.index(P)
b = U.index(Q)
print(abs(a-b))
n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()
fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
def comb(x,y):return fact[x]*inv[y]%mod*inv[x-y]%mod
ans=0
po=pow(m-1,n-1,mod)*m%mod
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)%mod
for i in range(k+1):
    ans+=comb(n-1,i)po%mod
    po*=iii
    po%=mod
print(ans%mod)

### FIXED CODE ###

n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()
fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
po=pow(m-1,n-1,mod)*m%mod
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)%mod
for i in range(k+1):
    ans+=ue*inv[n-1-i]%mod*inv[i]%mod*po%mod
    po*=iii
    po%=mod
print(ans%mod)
s1, s2, s3 = map(int, input().split())
print(s1[0].upper() + s2[0].upper() + s3[0].upper())

### FIXED CODE ###

s1, s2, s3 = input().split()
print(s1[0].upper() + s2[0].upper() + s3[0].upper())
n = int(input())
p = list(map(int,input()))
count = 0
for i in range(n-2):
    if (p[i] > p[i+1]) & (p[i+2] > p[i+1]):
        count += 1
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-2):
    if (p[i] > p[i+1] > p[i+2]) | (p[i+2] > p[i+1] > p[i]):
        count += 1
print(count)
import sys
from functools import reduce
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
dic=dict()
sqrm=int(m**0.5)
for i in range(2,sqrm+1):
    if m%i==0:dic[i]=0
    while m%i==0:
        dic[i]+=1
        m//=i
if m>sqrm:dic[m]=1
ans=1
def comb(a,b):
    p=1
    for i in range(a,a-b,-1):
        p*=i
    for i in range(2,b+1):
        p//=i
    return p
l=[comb(i+n-1,i) for i in dic.values()]
print(reduce(lambda x,y: x*y%1000000007, l))



### FIXED CODE ###

from functools import reduce
n,m=map(int,input().split())
dic=dict()
p=2
while m>=p*p:
    if m%p==0:
        dic[p]=0
        while m%p==0:
            dic[p]+=1
            m//=p
    p+=1
if m!=1:
    if m not in dic.keys():
        dic[m]=0
    dic[m]+=1
def comb(a,b):
    p=1
    for i in range(a,a-b,-1):
        p*=i
    for i in range(2,b+1):
        p//=i
    return p
l=[comb(i+n-1,i) if 1 not in dic.keys() else 1 for i in dic.values() ]
ans=1
for i in l:
    ans=ans*i%1000000007
print(ans)
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    n=n%((a+b)*s)#余り
    if n<a:
        print(s*a+n)
    else:
        print(s*a+a)


### FIXED CODE ###

#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    if s==0:
        m=n
    else:
        absum=(a+b)*s
        m=n%(absum)#余り
    if m<a:
        print(s*a+m)
    else:
        print((s+1)*a)
import sys
for line in sys.stdin:
    a,b = line.split()
    a,b = long(a),long(b)
    print '%d %d %5.8f' %(a/b, a%b, 1.0*a/b)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print '%d %d %.12f' %(a/b, a%b, 1.0*a/b)
import collections

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def primes(n):
    sieve = [True] * (n//2)
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i//2]:
            sieve[i*i//2::i] = [False] * ((n-i*i-1)//(2*i)+1)
    return [2] + [2*i+1 for i in range(1,n//2) if sieve[i]]

a, b = map(int, input().split())
l = [i for i, j in collections.Counter(make_divisors(a) + make_divisors(b)).items() if j > 1]
p = {}
for i in primes(l[-1]+1): p[i] = 1
print(1+len([x for x in l if p.get(x)]))

### FIXED CODE ###

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = map(int, input().split())
print(len(set(prime_factorize(a)) & set(prime_factorize(b)))+1)
S = int(input())
v = 1e9
x=(v-s%v)%v
y=(s+x)/v
print("0 0 1000000000 1 ",x,y)

### FIXED CODE ###

s = int(input())
v = 1000000000
x=(v-s%v)%v
y=(s+x)//v
print("0 0 1000000000 1",int(x),int(y))
x1,y1,x2,y2 = map(int,input().split())
x12 = x2 - x1
y12 = y2 - y1

for x in range(-100, 101):
    for y in range(-100, 101):
        if x*x12 + y*y12 == 0 and x12**2 + y12**2 == x**2 + y**2:
            x += x1
            y += y1
            if x12 >= 0 and y12 <= 0:
                if 0 <= x and 0 <= y:
                    x4 = x
                    y4 = y
            elif x12 >= 0 and y12 >= 0:
                if 0 >= x and 0 <= y:
                    x4 = x
                    y4 = y
            elif x12 <= 0 and y12 >= 0:
                if 0 >= x and 0 >= y:
                    x4 = x
                    y4 = y
            elif x12 <= 0 and y <= 0:
                if x >= 0 and y <= 0:
                    x4 = x
                    y4 = y

for x in range(-300,301):
    for y in range(-300,301):
        if (x2-x)**2 + (y2-y)**2 == (x4-x)**2 + (y4-y)**2 == x12**2 + y12**2 and x != x1 and y != y1:
            x3 = x
            y3 = y
print(x3,y3,x4,y4)


### FIXED CODE ###

import math

x1,y1,x2,y2 = map(int,input().split())
x12 = x2 - x1
y12 = y2 - y1

r = (x12**2+y12**2)**(1/2)
θ = math.asin(abs(y12)/r)
if 0 >= x12 and 0 <= y12:
    θ = math.pi - θ
elif 0 >= x12 and 0 > y12:
    θ += math.pi
elif 0 < x12 and y12 < 0:
    θ = 2*math.pi - θ
x3 = round((2**(1/2)*r)*math.cos(θ + (math.pi/4)) + x1)
y3 = round((2**(1/2)*r)*math.sin(θ + (math.pi/4)) + y1)
x4 = round(r*math.cos(θ + (math.pi/2)) + x1)
y4 = round(r*math.sin(θ + (math.pi/2)) + y1)
print(x3,y3,x4,y4)
def main():
    num = input()
    num_list = list(map(int, input().split(" ")))
    result = sum([sum([num_list[i]^num_list[j] for j in range(i)]) for i in range(int(num))])
    print(result%(10**9+7))    

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def main():
    input_list = input().split(" ")
    a1, a2, a3 = int(input_list[0]), int(input_list[1]), int(input_list[2])
    if a1 + a2 + a3 >= 22:
        print('bust')
    else:
        print('win')

if __name__ == "__main__":
    main()
n=int(input())
if(n>81):
    print("No")
else:
    c2=0
    c3=0
    c5=0
    c7=0
    while(n%2==0):
        c2+=1
        n=n/2
    while(n%3==0):
        c3+=1
        n=n/3
    while(n%5==0):
        c5+=1
        n=n/5
    while(n%7==0):
        c7+=1
        n=n/7
    if(n!=1):
        print("No")
    else:
        if(c5==2 and c2==0 and c3==0 and c7==0):
            print("Yes")
        elif(c5==1 and c7==1 and c2==1):
            print("No")
        elif(c5<2):
            print("Yes")
        else:
            print("No")

### FIXED CODE ###

a,b=map(int,input().split())
if(a<10 and b<10):
  print(a*b)
else:
  print(-1)
import sys
input = sys.stdin.readline

import sys
input = sys.stdin.readline

class Unionfind:

    __slots__ = ['nodes','size']

    def __init__(self, n):
        self.nodes = list(range(n))
        self.size = [1]*n

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root_x = self.root(self.nodes[x])
            self.nodes[x] = root_x
            return root_x

    def unite(self, x, y):
        x = self.root(x); y = self.root(y)
        if x == y:
            return
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.size[x] += self.size[y]
        self.nodes[y] = x

    def same(self, x, y):
        return self.root(x) == self.root(y)

N = int(input())
edge = [list(map(int,input().split())) for _ in range(N-1)]

uf = Unionfind(N)

for u,v,w in edge:
    u -= 1; v -= 1
    if w % 2 == 1:
        continue
    uf.unite(u,v)

if len(set(uf.nodes)) == 1:
    for _ in range(N):
        print(0)
    exit()

for i in range(N):
    uf.root(i)

w,b = list(set(uf.nodes))

for i in range(N):
    if uf.nodes[i] == w:
        uf.nodes[i] = 0
    elif uf.nodes[i] == b:
        uf.nodes[i] = 1

for v in uf.nodes:
    print(v)

### FIXED CODE ###

import sys
input = sys.stdin.readline

from heapq import heappush, heappop
inf = float('inf')
# (始点,隣接リスト)
def dijkstra(start,ad):
    dist = [inf]*len(ad)
    dist[start] = 0
    pq = [(start,0)]
    while pq:
        v = heappop(pq)[0]
        for nv,nw in ad[v]:
            if dist[nv] > dist[v] + nw:
                dist[nv] = dist[v] + nw
                heappush(pq,(nv,dist[nv]))
    return dist

N = int(input())

ad = [[] for _ in range(N)]

for _ in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1; v -= 1
    ad[u].append((v,w))
    ad[v].append((u,w))

dist = dijkstra(0,ad)

for d in dist:
    if d % 2 == 0:
        print(0)
    else:
        print(1)
a = int(input())
s = input()


print(s) if a >= 

### FIXED CODE ###

a = int(input())
s = input()


print(s) if a >= 3200 else print("red")
T = input()
count, temp = [], 0
AGCT = ['A', 'G', 'C', 'T']
for i in T:
  if (i in AGCT) == True:
    temp += 1
  else:
    count.append(temp)
    temp = 0
print(max(count))

### FIXED CODE ###

T = input()
count, temp = [], 0
AGCT = ['A', 'G', 'C', 'T']
for i in T:
  if (i in AGCT) == True:
    temp += 1
  else:
    count.append(temp)
    temp = 0
count.append(temp)
print(max(count))
str = input()
arr = input.split(' ')
A = int(arr[0])
B = int(arr[1])

print(A * B)

### FIXED CODE ###

A, B = input().split()
A = int(A)
B = int(B)
print(A * B)
import numpy as np
n = int(input())
v = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))

for i in range(n):
  profit = v[i] - c[i]

max_profit = np.sum(profit[profit>0])
print(max_profit)

### FIXED CODE ###

import numpy as np
n = int(input())
v = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))

profit = v - c

max_profit = np.sum(profit[profit>0])
print(max_profit)
from sys import stdin
from copy import deepcopy

def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())
def LS(): return list(stdin.readline().rstrip().split())
def LI(): return list(map(int,stdin.readline().rstrip().split()))
def R(x):
    r = round(x)
    if r+0.5 <= x:
        r += 1
    return r

a,b = I(),I()

print(a*b)

### FIXED CODE ###

from sys import stdin
from copy import deepcopy

def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())
def LS(): return list(stdin.readline().rstrip().split())
def LI(): return list(map(int,stdin.readline().rstrip().split()))
def R(x):
    r = round(x)
    if r+0.5 <= x:
        r += 1
    return r

tmp = LI()

print(tmp[0]*tmp[1])
import heapq
from collections import deque

n,k = map(int,input().split())
V = list(map(int,input().split()))

dq = deque()
dq.extend(V)

ans = - 10**9
for i in range(k+1):
  for j in range(k+1-i):           
    que = dq.copy()        
    a = []    
    for l in range(i):      
      heapq.heappush(a,que.popleft())
    for r in range(j):
      heapq.heappush(a,que.pop())    
    
    for ki in range((k+1-i-j)//2+1):            
      ans = max(ans,sum(a))        
      if len(a) > 0:
        heapq.heappop(a)
        
print(ans)        

### FIXED CODE ###

import heapq
from collections import deque
from copy import deepcopy

n,k = map(int,input().split())
V = list(map(int,input().split()))

dq = deque()
dq.extend(V)
INF = 10**10

ans = -INF
for i in range(k+1):
  for j in range(k+1-i):           
    que = deepcopy(dq)
    a = []    
    
    if i+j <= n:
      for l in range(i):      
        heapq.heappush(a,que.popleft())
      for r in range(j):
        heapq.heappush(a,que.pop())    
      
      ans = max(ans,sum(a))        
      for ki in range(k-i-j):   
        if len(a) > 0:
          heapq.heappop(a)
        ans = max(ans,sum(a))        
        
if ans != -INF:          
  print(ans)
else:
  print(0)
n,k = map(int,input().split())
alist = list(map(int,input().split()))

town_loop = [1]

for i in range(k):
    next_town = alist[town_loop[i]-1]

    try:
        loop_start = town_loop.index(next_town)
        break
    except ValueError:
        town_loop.append(next_town)

if len(town_loop) == k-1:
    print(town_loop[k-1])
else:
    o = len(town_loop) - loop_start
    print(town_loop[((k-loop_start) % o) + loop_start])


### FIXED CODE ###


n,k = map(int,input().split())
alist = list(map(int,input().split()))

town_loop = [1]
used = [-1] * n

for i in range(k):
    next_town = alist[town_loop[i]-1]

    if used[next_town-1] == -1:
        town_loop.append(next_town)
        used[next_town-1] = 1
    else:
        break

loop_start = town_loop.index(next_town)
if len(town_loop) == k+1:
    print(town_loop[k])
else:
    o = len(town_loop) - loop_start
    print(town_loop[((k-loop_start) % o) + loop_start])
K,S = map(int, input().split())

if K == S:
	print( (K+5)*(K+4)//2 )
	sys.exit( ) 

ans = 0
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += S1 - 2*K + 1
		else:
			continue

print(ans)
		

### FIXED CODE ###

K,S = map(int, input().split())
 
ans = 0
 
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += 2*K - S1 + 1
 
print(ans)
from heapq import heappush, heappushpop

Q = int(input())

b = 0
la = []
sl = 0
ra = []
sr = 0

cnt = 0
for _ in range(Q):
    q = map(int, input().split())
    # print(la, ra)
    if q[0] == 2:
        # 求値
        x = -la[0]
        cl = (cnt + 1) // 2
        cr = cnt - cl
        print(x, (cl * x - sl) + (sr - cr * x) + b)
    else:
        # 更新
        b += q[2]
        cnt += 1
        if cnt % 2 == 1:
            sr += q[1]
            x = heappushpop(ra, q[1])
            sr -= x
            sl += x
            heappush(la, -x)
        else:
            sl += q[1]
            x = heappushpop(la, -q[1])
            x *= -1
            sl -= x
            sr += x
            heappush(ra, x)


### FIXED CODE ###

from heapq import heappush, heappop

Q = int(input())

update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
    # print(f'al:{al}, sl:{sl}')
    # print(f'ar:{ar},sr:{sr}')
    # print(f'b:{b}')
    # print()
    s = tuple(map(int, input().split()))
    if s[0] == 1:
        # 更新クエリ
        b += s[2]
        if update_count % 2 == 0:
            # 左に追加
            heappush(ar, s[1])  # 右に追加
            sr += s[1]
            x = heappop(ar)  # 右の最小値
            sr -= x
            heappush(al, -x)  # 左に追加
            sl += x
        else:
            # 右に追加
            heappush(al, -s[1])  # 左に追加
            sl += s[1]
            x = heappop(al)  # 左の最小値
            sl -= (-x)
            heappush(ar, -x)  # 右に追加
            sr += (-x)
        update_count += 1
        # 左キューalの最大値が中央値になっている
        # 左キューにheappushする際,負値に変換したので,heappopで最大値*(-1)が求まる
    else:
        # 求値クエリ
        x = heappop(al)  # 中央値
        heappush(al, x)
        x *= (-1)
        cnt_l = (update_count + 1) // 2
        cnt_r = update_count - cnt_l
        print(x, (cnt_l * x - sl) + (sr - cnt_r * x) + b)
A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res)

### FIXED CODE ###

A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100,0,-1):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res)
n,m = map(int,input().split())
N = [list(map(int, input().split())) for _ in range(n)]
M = [list(map(int, input().split())) for _ in range(m)]

def kyori(X,Y):
    return abs(X[0]-Y[0])+abs(X[1]-Y[1])

def near_p(hito):
    temp = []
    for _ in range(n):
        temp.append(kyori(hito,M[_]))
    return temp.index(min(temp))+1

for i in range(n):
    print(near_p(N[i]))


### FIXED CODE ###

n,m = map(int,input().split())
N = [list(map(int, input().split())) for _ in range(n)]
M = [list(map(int, input().split())) for _ in range(m)]

def kyori(X,Y):
    return abs(X[0]-Y[0])+abs(X[1]-Y[1])

def near_p(hito):
    temp = []
    for _ in range(m):
        temp.append(kyori(hito,M[_]))
    return temp.index(min(temp))+1

for i in range(n):
    print(near_p(N[i]))
def solve():
    s = list(input())
    if s.count("o") >= 8:
        print("YES")
    else:
        print("NO")
    return 0

if __name__ == "__main__":
    solve()
,

### FIXED CODE ###

def solve():
    s = input()
    k = len(s)
    if s.count("o")+(15-k) >= 8:
        print("YES")
    else:
        print("NO")
    return 0

if __name__ == "__main__":
    solve()
n, q = map(int, input().split())
s = list(input())

l = [0]
ll = []
count = 0

for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        count += 1
    l.append(count)


for i in range(q):
    array = list(map(int, input().split()))
    ll.append(array)

for i in range(q):
    print(l[ll[i][1]-1] - l[ll[i][0]-1])

print(l)


### FIXED CODE ###

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

l = [0]
ll = []
count = 0

for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'C':
        count += 1
    l.append(count)


for i in range(q):
    array = list(map(int, input().split()))
    ll.append(array)

for i in range(q):
    print(l[ll[i][1]-1] - l[ll[i][0]-1])
s=input()
if s[3]=s[4] and s[5]=s[6]:
 print("Yes")
else:
 print("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
x,n=map(int,input().split())
I=list(map(int,input().split()))
S=[]
T=[]
ans=[]
for i in range(1,101):
    S.append(i)
    if i in I:
        S.remove(i)
for j in range(len(S)):
    if j==0:
        T.append(S[0])
    elif abs(x-S[j-1])>abs(x-S[j]):
        T.clear()
        T.append(S[j])
print(min(T))


### FIXED CODE ###

x,n=map(int,input().split())
I=list(map(int,input().split()))
S=[]
T=[]
ans=[]
for i in range(-200,200):
    S.append(i)
    if i in I:
        S.remove(i)
for j in range(len(S)):
    if j==0:
        T.append(S[0])
    elif abs(x-S[j-1])>abs(x-S[j]):
        T.clear()
        T.append(S[j])
print(min(T))
N=int(input())
M=int(input())

print(int((M-1)*M/2+(N-1)*N/2))

### FIXED CODE ###

inp=str(input())
N= int(inp.split()[0])
M=int(inp.split()[1])
n= abs(N)
m=abs(M)
sum_N = (N-1)*N/2
sum_M=(M-1)*M/2
sum_all = sum_N + sum_M
print(int(sum_all))
S = input()
T = input()
print(T+S)

### FIXED CODE ###

the_string = raw_input()
S, T = the_string.split()
print(T.strip()+S.strip())
n = int(input())
A = list(map(int, input().split()))
q = int(input())
BC = [list(map(int, input().split())) for i in range(q)]

list=[0]*100000
sum=sum(A)
for i in A:
    list[i]+=1

for bc in BC:
    x=list[bc[0]]
    sum+=(bc[1]-bc[0])*x
    print(sum)
    list[bc[0]]-=x
    list[bc[1]]+=x

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
q = int(input())
BC = [list(map(int, input().split())) for i in range(q)]

list=[0]*100001
sum=sum(A)
for i in A:
    list[i]+=1

for bc in BC:
    x=list[bc[0]]
    sum+=(bc[1]-bc[0])*x
    print(sum)
    list[bc[0]]-=x
    list[bc[1]]+=x
s,t=map(str,input().split())
s_array=[]
t_array=[]
for i in range(len(s)):
  s_array.append(s[i])
for i in range(len(t)):
  t_array.append(t[i])

s_array=sorted(s_array)

t_array=sorted(t_array,reverse=True)
for i in range(min([len(s_array),len(t_array)])):
  if s_array[i]<t_array[i]:
    print('Yes')
    exit()
  elif s_array[i]>t_array[i]:
    print('No')
    exit()
print('No')

### FIXED CODE ###

s=input()
t=input()
s_array=[]
t_array=[]
for i in range(len(s)):
  s_array.append(s[i])
for i in range(len(t)):
  t_array.append(t[i]) 
s_array=sorted(s_array)
 
t_array=sorted(t_array,reverse=True)
for i in range(min([len(s_array),len(t_array)])):
  if s_array[i]<t_array[i]:
    print('Yes')
    exit()
  elif s_array[i]>t_array[i]:
    print('No')
    exit()
if len(s_array)<len(t_array):
  print('Yes')
  exit()
print('No')
# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.ones(N*Q).reshape(Q,N)
    for i in range(Q):
        score[i,int(input())-1] = 0
    score = np.sum(score,axis=0).reshape(-1,)
    score -= K
    for i in range(N):
        if score[i] <0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.zeros(N)
    for i in range(Q):
        score[int(input())-1] += 1
    for i in range(N):
        if K - Q +score[i] > 0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()
N,X=map(int,input().split())
L=list(map(int,input().split()))
Di=0
result=0

while Di<=X:
    result+=1
    Di+=L[result-1]
    
print(result)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
Di=0
result=0

while Di<=X:
    result+=1
    if result==N+1:
        break
    Di+=L[result-1]

print(result)