Harryxun/stf_run huggingface dataset:
import numpy as np

N =int(input(''))
K=int(input(''))
A=[]
l=[]
for i in range(K):
    d = int(input(''))
    for j in range(d):
        l_ = int(input(''))
        l.append(l_)
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))



### FIXED CODE ###

import numpy as np

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

A=[]
l=[]
for _ in range(K):
    d = map(int, input())
    l=list(map(int,input().split()))
    A.append(l)
#print(A)
a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)
print(np.count_nonzero(np.all(a==0, axis=1)))
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2])+1)

### FIXED CODE ###

input_AP = list(map(int, input().split()))
A = input_AP[0]
P = input_AP[1]

result = (A*3 + P)//2
print(result)
l = list(map(int,input().split))
A = l[0]
B = l[1]
print(max(A+B,A-B,A*B))

### FIXED CODE ###

l = list(map(int,input().split()))
A = l[0]
B = l[1]
print(max(A+B,A-B,A*B))
x = int(input())

a = 100
i = 0

while a < x:
  i += 1
  a = int(a * 1.01)
  
  
print(math.floor(i))
  



### FIXED CODE ###

x = int(input())

a = 100
i = 0

while a < x:
  i += 1
  a += a // 100
  
  
print(i)
import math
n = int(input())
t,a = map(int,input().split())
hight = list(map(int, input().split()))
ans = 100000
ansnumber = 0
for num,i in enumerate(hight):
    tmp = math.fabs(i - a)
    if ans > tmp:
         ans = tmp
         ansnumber = num+1
print(ansnumber)

### FIXED CODE ###

x,y = map(int ,input().split())
print(int(x+y/2))
def swap():
  N,K = map(int,input().split())
  S = list(input())
  l = 0
  r = N - 1
  ans = 0
  while K > 0:
    for i in range(0,N - 1):
      if S[i] != S[i + 1]:
        left = i + 1
        break
    for j in range(N - 1,-1,-1):
      if S[j] != S[j - 1]:
        right = j
        break
    if left == right:
      right = N
    for i in range(left,right):
      s = S[i]
      if s == "L":
        S[i] = "R"
      else:
        S[i] = "L"
    K -= 1
  
  for i in range(0,N):
    j = (-i - 1)
    if S[i] == "L" and S[i] == S[i - 1] and i > 0:
      ans += 1
    if S[j] == "R" and S[j + 1] == S[j] and i > 0:
      ans += 1

  print(ans)
  
swap()

### FIXED CODE ###

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

score = 0

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

print(ans)
N, W = map(int, input().split())
items = sorted([list(map(int, input().split())) for i in range(N)])

# dp1[i][j] := 商品0 ~ i が対象
dp = [[0] * (W + 1) for i in range(N + 1)]

# dpテーブルを埋める
for i in range(N):
    wi, vi = items[i]
    for j in range(W + 1):
        if j + wi <= W:
            dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])


ans = 0
for i, (wi, vi) in enumerate(items):
    for j in range(W):
        ans = max(ans, dp[i] + vi)

print(ans)


### FIXED CODE ###

N, T = map(int, input().split())
T -= 1
Meals = sorted([list(map(int, input().split())) for i in range(N)])
dp = [[0] * (T + 1) for i in range(N + 1)]
prev = [[-1] * (T + 1) for i in range(N + 1)]


for i, (cost, value) in enumerate(Meals):
    for j in range(T + 1):
        if j >= cost:
            if dp[i + 1][j] <= dp[i][j - cost] + value:
                dp[i + 1][j] = dp[i][j - cost] + value
                prev[i + 1][j] = j - cost

        if dp[i + 1][j] <= dp[i][j]:
            dp[i + 1][j] = dp[i][j]
            prev[i + 1][j] = j

# 復元
selected = set()
cur_w = T
for i in range(N - 1, -1, -1):
    if prev[i + 1][cur_w] == cur_w - Meals[i][0]:
        selected.add(i)
    cur_w = prev[i + 1][cur_w]

non_selected = set(list(range(N))) - selected
ans = dp[N][T]
add = 0
for ni in non_selected:
    add = max(add, Meals[ni][1])

print(dp[N][T] + add)
n = int(input())
a =list(map(int, input().split()))
q = int(input())
b = [0]*q
c = [0]*q
for i in range(q):
    b[i],c[i]=map(int, input().split())

at = [0]*10**5+100
sum = 0

for i in a:
    at[i]= at[i]+1
    sum = sum+i


for  i in range(q):
    m= at[b[i]]
    at[b[i]]=0
    at[c[i]]=at[c[i]]+m

    sum = sum + (c[i]-b[i])*m
    print(sum)

### FIXED CODE ###

n = int(input())
a =list(map(int, input().split()))
q = int(input())
b = [0]*q
c = [0]*q
for i in range(q):
    b[i],c[i]=map(int, input().split())

at = [0]*(10**5+100)
sum = 0

for i in a:
    at[i]= at[i]+1
    sum = sum+i


for  i in range(q):
    m= at[b[i]]
    at[b[i]]=0
    at[c[i]]=at[c[i]]+m

    sum = sum + (c[i]-b[i])*m
    print(sum)
N, Ma, Mb = map(int, input().split())
items = []
for i in range(N):
    a, b, c = map(int, input().split())
    items.append((a, b, c))

a_sum = sum([item[0] for item in items])
b_sum = sum([item[1] for item in items])
inf = float("inf")
dp = [[[inf for _ in range(a_sum + 40)] for _ in range(b_sum + 40)] for i in range(N + 1)]
dp[0][0][0] = 0

for i in range(N):
    for a in range(a_sum):
        for b in range(b_sum):
            if dp[i + 1][a][b] > dp[i][a][b]:
                dp[i + 1][a][b] = dp[i][a][b]
            if dp[i + 1][a + items[i][0]][b + items[i][1]] > dp[i][a][b] + items[i][2]:
                dp[i + 1][a + items[i][0]][b + items[i][1]] = dp[i][a][b] + items[i][2]

ans = inf
for a in range(1, a_sum + 1):
    for b in range(1, b_sum + 1):
        if a * Mb == b * Ma:
            ans = min(ans, dp[N][a][b])
if ans != inf:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

N, Ma, Mb = map(int, input().split())
items = []
for i in range(N):
    a, b, c = map(int, input().split())
    items.append((a, b, c))

a_sum = sum([item[0] for item in items])
b_sum = sum([item[1] for item in items])
inf = float("inf")
dp = [[[inf for _ in range(a_sum + 100)] for _ in range(b_sum + 100)] for i in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
    for a in range(a_sum + 1):
        for b in range(b_sum + 1):
            dp[i + 1][a][b] = min(dp[i + 1][a][b], dp[i][a][b])
            dp[i + 1][a + items[i][0]][b + items[i][1]] = min(dp[i + 1][a + items[i][0]][b + items[i][1]],
                                                              dp[i][a][b] + items[i][2])
ans = inf
for a in range(1, a_sum + 1):
    for b in range(1, b_sum + 1):
        if a * Mb == b * Ma:
            ans = min(ans, dp[N][a][b])
if ans != inf:
    print(ans)
else:
    print(-1)
import sys
input=sys.stdin.readline

def calc():
  mod=998244353
  n,s=map(int,input().split())
  arr=list(map(int,input().split()))
  dp=[[[0]*(s+1) for _ in range(n+1)] for _ in range(n+1)]
  dp[0][0][0]=1
  for i in range(1,n+1):
    val=arr[i-1]
    for j in range(i,-1,-1):
      for k in range(s,val-1,-1):
        dp[i][j][k]=dp[i-1][j][k]
        dp[i][j][k]+=dp[i-1][j-1][k-val]
      for k in range(val-1,-1,-1):
        dp[i][j][k]=dp[i-1][j][k]
  ans=0
  for i in range(1,n+1):
    ans+=dp[n][i][s]*pow(2,n-i,mod)
    ans%=mod
  print(ans)
calc()

### FIXED CODE ###

import sys
input=sys.stdin.readline

def calc():
  mod=998244353
  n,s=map(int,input().split())
  arr=list(map(int,input().split()))
  dp=[0]*(s+1)
  dp[0]=1
  ans=0
  for i in range(1,n+1):
    val=arr[i-1]
    for k in range(s,-1,-1):
      dp[k]*=2
      dp[k]%=mod
      if k>=val and dp[k-val]!=0:
        dp[k]+=dp[k-val]
        dp[k]%=mod
  print(dp[s]%mod)
calc()
N = int(input())
S = input()
T = input()
ans = ""

for i in range(N):
    ans += S[i]+T[i]
print(str(ans))

### FIXED CODE ###

N = int(input())
S,T = input().split()
ans = ""
 
for i in range(N):
    ans += S[i]+T[i]
print(ans)
#!/usr/bin/env python3

x = int(input())
a = x//500
x -= a*500
b = x//5
print(a*1000+b*5)
~                  

### FIXED CODE ###

#!/usr/bin/env python3

x = int(input())
a = x//500
x -= a*500
b = x//5
print(a*1000+b*5)
N=input()
res=0
for in range(1:10):
  if N.count("i")>=3:
    res+=1
    print("Yes")
if res==0:
  print("No")
  

### FIXED CODE ###

N = input()

if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
    print("Yes")
else:
    print("No")
n, k = map(int, input().split())
a = list(map(int, input().split()))
seta = set(a)
dic = {}
for i in seta:
  dic[i] = a.count(i)

dic = sorted(dic.items(), key=lambda x:x[1], reverse=True)
print(dic)
cnt = 0
for i in range(k):
  cnt = cnt + dic[i][1]

print(n - cnt)

### FIXED CODE ###

n, k = map(int, input().split())
d = {}
for i in input().split():
  if i in d:
    d[i] = d[i] + 1 
  else:
    d[i] = 1

l = sorted(d.values())
print(sum(l[:len(l) - k]))
a, b, c = map(int, input().split())

for i in range(b):
    if ((i+1) * a) % b == c:
        print('YES')
        exit(1)
print('NO')

### FIXED CODE ###

a, b, c = map(int, input().split())
flag = True
for i in range(b):
    if ((i+1) * a) % b == c:
        print('YES')
        flag = False
        break
if flag:
    print('NO')
import sys
sys.setrecursionlimit(10**9)
n=int(input())
h=list(map(int,input().split()))
def cst(n):
    if n==1:
        return 0
    if n==2:
        return abs(h[1]-h[0])
    else:
        return min(cst(n-1)+abs(h[n-1]-h[n-2]),cst(n-2)+abs(h[n-1]-h[n-3]))
n=int(input())
h=list(map(int,input().split()))
A=cst(n)
print(A)

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
D=[10**0 for i in range(n)]

for i in range(n):
    if i==0:
        D[i]=0
    elif i==1:
        D[i]=abs(h[1]-h[0])  
    else:
        D[i]=min(D[i-1]+abs(h[i]-h[i-1]),D[i-2]+abs(h[i]-h[i-2]))
print(D[n-1])
import sys

def read_int():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return int(l[0])

def read_int_list():
    l = sys.stdin.readline().rstrip('\n').split(' ')                                                  
    return [int(i) for i in l]

N, M, K = tuple(read_int_list())                                                                      
A = read_int_list()                                                                                   
B = read_int_list()                                                                                   

def can_read(A, B, i, j, memo, k):                                                                    
    key = (i, j, k)                                                                                   
    if key in memo:                                                                                   
        return memo[key]                                                                              
    ans = 0
    if i < len(A) and A[i] <= k:                                                                      
        ans = max(ans, can_read(A, B, i+1, j, memo, k - A[i]) + 1)                                    
    if j < len(B) and B[j] <= k:                                                                      
        ans = max(ans, can_read(A, B, i, j+1, memo, k - B[j]) + 1)                                    
    memo[key] = ans                                                                                   
    return ans                                                                                        

memo = {}                                                                                             
print(can_read(A, B, 0, 0, memo, K))       

### FIXED CODE ###

import sys

def read_int():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return int(l[0])

def read_int_list():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return [int(i) for i in l]

N, M, K = tuple(read_int_list())
A = read_int_list()
B = read_int_list()

ans = 0
sum_k =  0

ai = 0
bi = 0

for i in range(len(A)):
    if sum_k + A[i] > K:
        break
    sum_k += A[i]
    ai = i + 1

for i in range(len(B)):
    if sum_k + B[i] > K:
        break
    sum_k += B[i]
    bi = i + 1

ans = ai + bi

for i in range(ai - 1, -1, -1):
    sum_k -= A[i]
    ai = i
    while bi < len(B) and sum_k + B[bi] <= K:
        sum_k += B[bi]
        bi += 1
    ans = max(ans, ai+bi)
print(ans)
p = 1000000007
def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p

X, Y = map(int, input().split())

a = (2 * Y - X) / 3
b = (2 * X - Y) / 3

if a.is_integer()==False or b.is_integer()==False:
    print(0)
else:
    n = a + b
    fac = [0] * (n + 1)
    fac[0] = 1
    for i in range(n):
        fac[i + 1] = fac[i] * (i + 1) % p
        print(mcomb(n, a))
#他者の解答を参考にした

### FIXED CODE ###

p = 1000000007

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print(0)
    exit()

a = (2 * Y - X) // 3
b = (2 * X - Y) // 3

if a < 0 or b < 0:
    print(0)
    exit()

n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
    fac[i + 1] = fac[i] * (i + 1) % p


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], p - 2, p) * pow(fac[k], p - 2, p) % p


print(mcomb(n, a))
#他者の解答を参考にした
import sys
input = sys.stdin.readline
n = int(input())
x = int(input().rstrip(),2)
#print(x)
anslist = []
pop = [0]*(int('1'*n,2)+1)

def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f
def toggle_nth_bit(num: int, n: int):
    return num ^ (1 << n)

for i in range(1,len(pop)):
    pop[i] = popcount(i)

for i in range(n):
    '''
    b = list(x)
    if b[n-i] == '1':
        b[n-i] = '0'
    else:
        b[n-i] = '1'
    p = int(''.join(b),2)
    '''
    p = toggle_nth_bit(x,i)
    #print(p)
    ans = 0
    while True:
        if p == 0:
            break
        p = p%pop[p]
        ans += 1
    anslist.append(ans)

for i in range(len(anslist)-1,-1,-1):
    print(anslist[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline

def p_count(n):
    return bin(n)[2:].count('1')


n = int(input())
x = input().rstrip()
x_dec = int(x,base = 2)

pop_cnt = x.count('1')
pop_cnt_0 = (pop_cnt + 1)
pop_cnt_1 = (pop_cnt - 1)
x_0 = pow(x_dec,1,pop_cnt_0)
x_1 = pow(x_dec,1,pop_cnt_1) if pop_cnt_1 > 0 else 0

x_bit = [0]*n

for i in range(n-1,-1,-1):
    if x[i] == '0':
        x_bit[i] = (x_0 + pow(2,n-1-i,pop_cnt_0))%pop_cnt_0
        #x_bit[i] = (x_dec + pow(2,n-1-i))%pop_cnt_0
        
    else:
        if pop_cnt_1 > 0:
            x_bit[i] = (x_1 - pow(2,n-1-i,pop_cnt_1))
            x_bit[i] = x_bit[i] if x_bit[i] >= 0 else x_bit[i] + pop_cnt_1
        else:
            x_bit[i] = -1

anslist = []
for i in range(n):
    if x_bit[i] == -1:
        anslist.append(0)
        continue
    ans = 1 
    now = x_bit[i]
    while True:
        if now == 0:
            break
        now = now%p_count(now)
        
        ans += 1
    anslist.append(ans)


for ans in anslist:
    print(ans)
A,B=map(int,input().split())
A*=100
B*=100
for i in range(2000):
  t*=100
  if A==t*8 and B==t*10:
    print(i)
    break
else:
    print(-1)


### FIXED CODE ###

A, B = map(int, input().split())
for i in range(20000):
    if int(i*0.08) == A and int(i * 0.1) == B:
        print(i)
        exit()
print(-1)
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())

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

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

c = [False for _ in range(N)]
 
def DFS(G,s):
    c[s-1] = True
    for i in G[s-1]:
        if not c[i-1]:         
            DFS(G,i)
ans = 0
for i in range(N):
    if not c[i]:
        DFS(G,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)
a,b,c,d=map(int,input().split())
if a+b>c+d:
  print("Left")
if a+b=c+d:
  print("Balanced")
else:
  print("Right")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a+b > c+d:
  print("Left")
elif a+b==c+d:
  print("Balanced")
else:
  print("Right")
x,a = map(int,input().split())
print(0) if x<a else: print(10)

### FIXED CODE ###

x,a = map(int,input().split())
print(0) if x<a else print(10)
x = input()

y = x ** 3

print int(y)

### FIXED CODE ###

x = input()

y = x**3

print int(y)
s = input()
k = int(input())

for i,a in enumerate(s):
    if (a != '1' and k>i) or k==i:
        ans = int(a)
        break

print (ans)


### FIXED CODE ###

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

for i,a in enumerate(s):
    if (a != '1' ) or k==i+1:
        ans = int(a)
        break

print (ans)
n = int(input())
a = map(int, input().split())
counter = 0
while(True):
  for i in range(n):
    if a[i] % 2 != 0:
      break
    else:
      a[i] = a[i] // 2
  counter += 1
print(counter)

### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
g = a[0]
for i in range(n):
  g = gcd(g, a[i])
counter = 0
while(True):
  if g % 2 != 0:
    break
  else:
    counter += 1
    g = g // 2
print(counter)
import numpy as np
import collections

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

for k in range(1, n+1):
    counts = collections.Counter(a).values()
    counts = sorted(list(counts), reverse=True)
    
    eat = 0
    while True:
        if np.count_nonzero(counts) < k:
            break
        else:
            for i in range(k):
                counts[i] -= 1
            eat += 1
            counts = sorted(list(counts), reverse=True)
            
    print(eat)
            

### FIXED CODE ###

import collections
import numpy as np

# リストarrからx個の同じ長さの列を取り出す時の最大の長さ
# 発想: x個取り出す時、ある文字をx個より多く取り出して列に含むことはない
#       一方ある文字をその文字がある数よりも取り出して使うこともできない
#       つまり、min(arr.count(a), x)で、x個の同じ長さの列に使えるaの数がわかる
#       さらに、sum(min(arr.count(a),x))で、x個の同じ長さの列に使える文字の数がわかる
#       よって、sum(min(arr.count(a),x))//xで、x個の同じ長さの列の長さがわかる
#       発展的に、longest(arr,x)までの計算状況からlongest(arr,x+1)が計算できる
# def longest(arr, x):    # legacy
#     return sum(min(arr.count(a), x) for a in arr) // x


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

counter = collections.Counter(a)        #O(n)
nums = list(counter.values())           #O(n)
num_counter = collections.Counter(nums) #O(n)
lastest_add = np.count_nonzero(nums)    #O(n)
building, longests = [0], [0]
for i in range(1, n+1):                 #O(n)
    appended = building[-1] + lastest_add   #O(1)
    building.append(appended)               #O(1)
    longests.append(appended // i)          #O(1)
    lastest_add -= num_counter[i]           #O(1)


lastest_longest = 0
k_most = []
for i, x in enumerate(reversed(longests)):
    while x > lastest_longest:
        lastest_longest += 1
        k_most.append(n-i)

k_most.extend([0]*(n-len(k_most)))      # zero padding

for longests_num in k_most:
    print(longests_num)

# print('----------------')
# for k in range(1, n+1):
#     maxindexes = list(i for i, x in enumerate(longests) if x >= k)
#     if maxindexes:
#         print(maxindexes[-1])
#     else:
#         print(0)
import math

N = int(input())
n = int(math.sqrt(N))
count=0
for i in range(1,n+1)
    d = N - i
    if d%i==0:
        k = int(d/i)
        count+=k
print(count)

### FIXED CODE ###

import math

N = int(input())
n = int(math.sqrt(N))
count=0
for i in range(1,n+1):
    d = N - i
    if d%i==0 and i < (N // i) -1:
        k = d//i
        count+=k
print(count)
s = input()
a=0
z=0

for i in range(len(s)):
    if s[i]=="A":
        a = i
        break

for j in range(len(s)):
    if s[-j-1]=="Z":
        z = len(s)-j-1
		break
print(z-a+1)

### FIXED CODE ###

s = input()
a=0
z=0

for i in range(len(s)):
    if s[i]=="A":
        a = i
        break

for j in range(len(s)):
    if s[-j-1]=="Z":
        z = len(s)-j-1
        break

print(z-a+1)
import sys

nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())

nE = 0

if nN =< nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK

nAns = nX * nN + nY * nE
print(nAns)





### FIXED CODE ###

import sys
 
nN = int(input())
nK = int(input())
nX = int(input())
nY = int(input())
 
nE = 0
nAns = 0
 
if nN <= nK:
  nAns = nX * nN
  print(nAns)
  sys.exit()
  
nE = nN - nK
 
nAns = (nX * nK) + (nY * nE)
print(nAns)
def sieve(n):
	p=[True]*(n+1)
	p[0]=p[1]=False
	for i in range(2,int((n+1)*0.5)+1):
		if p[i]==True:
			for j in range(i*i,n+1,i):
				p[j]=False
	prime=[]
	for i in range(n+1):
		if p[i]==True:
			prime.append(i)
	return prime

def solve(n):
	i=0
	while True:
		if n>prime[i]:
			a=prime[i]
		elif n==prime[i]:
			a=prime[i-1]
		else:
			b=prime[i]
			break
		i+=1
	print(a,b)

prime=sieve(5003)
while True:
	try:
		n=int(input())
		solve(n)
	except EOFError:
		break

### FIXED CODE ###

def sieve(n):
	p=[True]*(n+1)
	p[0]=p[1]=False
	for i in range(2,int((n+1)*0.5)+1):
		if p[i]==True:
			for j in range(i*i,n+1,i):
				p[j]=False
	prime=[]
	for i in range(n+1):
		if p[i]==True:
			prime.append(i)
	return prime

def solve(n):
	i=0
	while True:
		if n>prime[i]:
			a=prime[i]
		elif n==prime[i]:
			a=prime[i-1]
		else:
			b=prime[i]
			break
		i+=1
	print(a,b)

prime=sieve(50021)
while True:
	try:
		n=int(input())
		solve(n)
	except EOFError:
		break
import sys
sys.setrecursionlimit(10**7)
import time

t1 = time.time()

x,y = map(int,input().split())
kyori = x+y
if kyori % 3 !=0:
    print(0)
    exit()
    
mod = 10**9+7

nagasa = kyori // 3
dif = x - y

n_x = (nagasa + dif) // 2
n_y = nagasa - n_x

#print(nagasa,n_x,n_y)

if x != n_x * 2 + n_y * 1 or y != n_x * 1+ n_y*2:
    print(0)
    exit()

#H, W, A, B = map(int, raw_input().split())

def kj(n, x,y, mod):
    #if ( r<0 or r>n ):
     #   return 0
    #r = min(r, n-r)
    return g1[n] * g2[x] * g2[y] % mod

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

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


a = kj(nagasa,n_x,n_y,mod)
print(a)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
import time

t1 = time.time()

x,y = map(int,input().split())
kyori = x+y
if kyori % 3 !=0:
    print(0)
    exit()
    
mod = 10**9+7

nagasa = kyori // 3
dif = x - y

n_x = (nagasa + dif) // 2
n_y = nagasa - n_x

#print(nagasa,n_x,n_y)

if x != n_x * 2 + n_y * 1 or y != n_x * 1+ n_y*2:
    print(0)
    exit()

if n_x < 0 or n_y < 0:
    print(0)
    exit()
#H, W, A, B = map(int, raw_input().split())

def kj(n, x,y, mod):
    #if ( r<0 or r>n ):
     #   return 0
    #r = min(r, n-r)
    return g1[n] * g2[x] * g2[y] % mod

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

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


a = kj(nagasa,n_x,n_y,mod)
print(a)
X,N = map(int,input().split())
if N!=0:
    p=list(map(int,input().split()))
    p.sort()
    for i in range(X,101):
        if i not in p:
            min_=i
            dif_min=i-X
            break;
    for i in range(X,0,-1):
        if i not in p:
            max_=i
            dif_max=X-i
            break;
    if dif_max<=dif_min:
          print(max_)
    else:
          print(min_)
else:
    print(X)

### FIXED CODE ###

X,N = map(int,input().split())
if N!=0:
    p=list(map(int,input().split()))
    p.sort()
    for i in range(X,102):
        if i not in p:
            min_=i
            dif_min=i-X
            break;
    for i in range(X,-1,-1):
        if i not in p:
            max_=i
            dif_max=X-i
            break;
    if dif_max<=dif_min:
          print(max_)
    else:
          print(min_)
else:
    print(X)