Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(int(2e6))

def dfs(u, p = 0):
  for v in g[u]:
    if v != p:
      dfs(v, u)
  g[u] = None

n, m = map(int, input().split())
g = [list() for i in range(n + 1)]
for i in range(m):
  u, v = map(int, input().split())
  g[u].append(v)
  g[v].append(u)
c = 0
for i in range(1, n + 1):
  if g[i] is not None:
    c += 1
    dfs(i)
print(c - 1 if c else 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(int(2e6))

def dfs(u, p = 0):
  vis[u] = True
  for v in g[u]:
    if not vis[v]:
      dfs(v, u)

n, m = map(int, input().split())
assert 2 <= n <= int(1e5)
assert 1 <= m <= int(1e5)
g = [list() for i in range(n + 1)]
for i in range(m):
  u, v = map(int, input().split())
  assert 1 <= u <= int(1e5)
  assert 1 <= v <= int(1e5)
  assert u < v
  g[u].append(v)
  g[v].append(u)
c = 0
vis = [False] * (n + 1)
for i in range(1, n + 1):
  if not vis[i]:
    c += 1
    dfs(i)
print(c - 1)
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10000)  # RecursionError対策

def func(n):
    if n==0:
        return 0 # 終端条件
    if memo[n] != -1:
        return memo[n] # 探索済み

    res = n

    for i in range(1,n+1):
        pow6 = 6 ** i
        if pow6 > n:
            break
        res = min(res, func(n-pow6)+1)

    for i in range(1,n+1):
        pow9 = 9 ** i
        if pow9 > n:
            break
        res = min(res, func(n-pow9)+1)

    memo[n] = res
    return res


N = int(input())

max_n = 110000
memo = [-1] * max_n
ans = func(N)
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-

def count(val1, val2):
    num = 1
    while True:
        if val1 < (val2 ** num):
            break
        num += 1

    cnt = 0
    digit = num
    while True:
        if val1 >= val2 ** digit:
            val1 -= val2 ** digit
            cnt += 1
        else:
            digit -= 1
        
        if digit== 0:
            break

    return cnt,val1


N = int(input())
ans = N

for i in range(0,N+1):
    n = i
    m = N - i
    res = 0

    cnt, nn = count(n, 9)
    n = nn
    res += cnt

    cnt, mm = count(m, 6)
    m = mm
    res += cnt

    res += n + m
    ans = min(ans, res)

print(ans)
import numpy as np
N = input()
s = np.array(map(int, input().split()))
count = 0
while True:
  if np.all( (s%2) == 0):
    count += 1
    s = s/2
  else:
    break
print(count)


### FIXED CODE ###

import numpy as np
N = input()
s = np.array(list(map(int, input().split())))
count = 0
while True:
  _exp = 2**(count+1)
  if np.all( s%_exp == 0):
    count += 1
  else:
    break
print(count)
N=int(input())
L=list(map(int,input().split()))
L.sort()
#print(L)

answer=0
for i in range(N-2):
  index_c=i+2
  for j in range(i+1,N-1):
    for k in range(index_c,N):
      if L[i]+L[j]<=L[k]:
        #print(i,j,k-1,k-j-1)
        answer+=k-j-1
        index_c=k-1
        break
    else:
      #print(i,j,N-1,N-j-1)
      answer+=N-j-1
      index_c=N-1
        
print(answer)

### FIXED CODE ###

A,B=map(int,input().split())
print(max(0,A-2*B))
import math
import copy
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
ans = reduce(math.gcd,a)
if n==2 or (min(a)==max(a)):
    print(max(a))
else:
    for i in range(n):
        _a = copy.copy(a)
        _a.pop(i)
        tmp = reduce(math.gcd,_a)
        if tmp > ans:
            print(tmp)
            break
        else:
            pass


### FIXED CODE ###

#EOFERROR
# import math
# import copy
# from functools import reduce
# n = int(input())
# a = list(map(int,input().split()))
# ans = reduce(math.gcd,a)
# if n<=2 or (min(a)==max(a)):
#     print(max(a))
# else:
#     for i in range(n):
#         _a = copy.copy(a)
#         _a.pop(i)
#         tmp = reduce(math.gcd,_a)
#         if tmp > ans:
#             print(tmp)
#             break
#         else:
#             pass

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

def cul(n,x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1,l-1):
        tmp = gcd(tmp,b[i])
    return tmp

import sys
p = 50
N = int(input())
if p>N : p=N
a = list(map(int,input().split()))

ans = 0

for i in range(p):
    s = cul(i,a[:p])
    if s>ans : ans=s

print(ans)
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    ll c = A + B;
    if (c % 2 == 1)
        cout << "IMPOSSIBLE" << endl;
    else
        cout << c / 2 << endl;
    return 0;
}

### FIXED CODE ###

A, B = map(int, input().split())
C = A + B
if C % 2 == 0:
    print(C // 2)
else:
    print("IMPOSSIBLE")
n = int(inpit())
a = list(map(int,input().split()))
m = round(sum(a)/n)
x = 0
for i in a:
  x=+(i-m)**2
print(x)

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
M = round(sum(X)/N)
ans = 0
for i in X:
    ans+=(i-M)**2
print(ans)
K = int(input())
S = input()

if len(S) <= K:
    print(s)
else:
    print(s[:k] + "...")

### FIXED CODE ###

k = int(input())
s = input()
n = len(s)
     
if n <= k:
	print(s)
else:
	print(s[:k] + '...')
# -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
left_in_c = c - (a -b )
left_in_c = 0 if left_in_c < 0
print("{}".format(left_in_c));

### FIXED CODE ###

a, b, c = map(int, input().split())
left_in_c = c - (a -b )
if left_in_c <=0:
  left_in_c =0
print("{}".format(left_in_c));
S = input()
T = input()

count = 0
#iを３回数えてもらう
for i in range(3):
#数えてｓとｔが同じならカウント１とする
    if S[i] == T[i] 
    print(I)
count(I)

### FIXED CODE ###

S = input()
T = input()

count = 0
#iを３回数えてもらう
for i in range(3):
#数えてｓとｔが同じならカウント１とする
    if S[i]==T[i]:
        count += 1
print(count)
a,b=input();print('>' if a>b else '<' if a<b else '=')

### FIXED CODE ###

a,b=input().split();print('>' if a>b else '<' if a<b else '=')
while True:
    N,K = map(int, input().strip().split(" "))
    X = list(map(int,input().strip().split(" ")))
    L = [X[i+1] - X[i] for i in range(0,N-1)]
    L.sort()
    s = 0
    for i in range(0,N-K):
        s = s + L[i]
    print(s)


### FIXED CODE ###


# coding: utf-8

# In[23]:


#ｎは戸数
#ｋは発電機の個数
#ｘは家の座標

t = int(input()) 
for t in range(t):
    N,K = map(int, input().strip().split(" "))
    X = list(map(int,input().strip().split(" ")))
    L = [X[i+1] - X[i] for i in range(0,N-1)]
    L.sort()
    s = 0
    for i in range(0,N-K):
        s = s + L[i]
    print(s)
    
#Country Road
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2104&lang=jp
#右中央
def main():
    n, m = map(int, input().split())
    indic = {}
    for i in range(m):
        s, c = map(int, input().split())
        if s in indic:
            if indic[s] == c:
                pass
            else:
                print(-1)
                exit()
        else:
            indic[s] = c
    ans = ""
    if indic[1] == 0:
        print(-1)
        exit()
    for i in range(n):
        if i+1 in indic:
            ans += str(indic[i+1])
        else:
            if i == 0 and n > 1:
                ans += "1"
            else:
                ans += "0"
    print(ans)


    
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    indic = {}
    for i in range(m):
        s, c = map(int, input().split())
        if s in indic:
            if indic[s] == c:
                pass
            else:
                print(-1)
                exit()
        else:
            indic[s] = c
    ans = ""
    if 1 in indic and indic[1] == 0 and n > 1:
        print(-1)
        exit()
    for i in range(n):
        if i+1 in indic:
            ans += str(indic[i+1])
        else:
            if i == 0 and n > 1:
                ans += "1"
            else:
                ans += "0"
    print(ans)


    
    
if __name__ == "__main__":
    main()
a,b,c = map(int,input().split())
if (a==b==5 and c==7) or (a==c==5 b==7) or (b==c==5 a==7):
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c = map(int,input().split())
if (a==b==5 and c==7) or (a==c==5 and b==7) or (b==c==5 and a==7):
  print('YES')
else:
  print('NO')
n=int(input())
s=list(input())
li=[0]
ans=n
for i in s:
    li+=[li[-1]+1] if i=='#' else [li[-1]]
b=li[-1]
for i in range(n+1):
    temp=li[i]+n-i-b+li[i]
    ans=min(ans,temp)
print(ans)n

### FIXED CODE ###

n=int(input())
s=list(input())
li=[0]
ans=n
for i in s:
    li+=[li[-1]+1] if i=='#' else [li[-1]]
b=li[-1]
for i in range(n+1):
    temp=li[i]+n-i-b+li[i]
    ans=min(ans,temp)
print(ans)
n=int(input())
s=input()
if s[0]==".":
  k[0]="."
  k[1]="#"
else:
  k[0]="#"
  k[1]="."
  
for i in range(n):
  if s[i]!=k[i%2]:
    s[i]=k[i%2]
print(s)

### FIXED CODE ###

from collections import deque
n=int(input())
s=input()
black=0
write=s.count(".")
koho=deque([write,s.count("#")])
for i in s:
    if i==".":
        write-=1
    else:
        black+=1
    koho.append(write+black)
print(min(koho))
# -*- coding: utf-8 -*-
def check(t, now, idx):
    if t < idx:
        return 99999999999
    # use
    use = -1
    if t == now + idx:
        use = idx
    else:
        use = check(t, now + idx, idx + 1)
    # not use
    nuse = check(t, now, idx + 1)

    return min(use, nuse)

X = int(raw_input())
print(str(check(X, 0, 1)))

### FIXED CODE ###

N = int(input())
 
for i in range(1, N + 1):
    if N <= (i * (i + 1) / 2):
        print (str(i))
        break
n,m = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
ans = 0
g = A[0]*A[1]//(4*gcd(A[0]//2, A[1]//2))
for i in range(2, n):
    u = g
    v = A[i]//2
    p = u*v//gcd(u,v)
    g = p
if g <= m:
    print(int((m/g-1)/2)+1)
else:
    print(0)


### FIXED CODE ###

n,m = map(int,input().split())
A = list(map(int,input().split()))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
cur = 0
if n != 1:
    t = A[0]
    while t%2 == 0:
        cur += 1
        t = t//2
        flag = True
    for i in range(1,n):
        temp = 0
        s = A[i]
        while s%2 == 0:
            temp += 1
            s = s//2
        if temp != cur:
            flag = False
            break
    if flag:
        g = A[0]*A[1]//(4*gcd(A[0]//2, A[1]//2))
        for i in range(2, n):
            u = g
            v = A[i]//2
            p = u*v//gcd(u,v)
            g = p
        if g <= m:
            print(int((m/g-1)/2)+1)
        else:
            print(0)
    else:
        print(0)
else:
    if A[0] <= 2*m:
        print(int(((2*m/A[0])-1)/2)+1)
    else:
        print(0)
# coding: utf-8

import math
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

def gcd(num):
    if len(num) == 1:
        return num[0]
    else:
        return math.gcd(gcd(num[0:1]), gcd(num[1:]))

print(gcd(A))



### FIXED CODE ###

# coding: utf-8

import sys
input = sys.stdin.readline

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

N = int(input())
A = list(map(int, input().split()))

first_gcd = A[0]
for i in range(len(A)):
    first_gcd = gcd(first_gcd, A[i])

print(first_gcd)
import numpy as np

n, m = map(int, input().split())
vote_lists = list(map(int, input().split()))

vote_arr = np.array(vote_lists)
total_vote = vote_arr.sum()
is_popular = total_vote / (4 * m)

answer_lists = []

for i in vote_lists:
  if i >= is_popular:
    answer_lists.append(i)

if len(answer_lists) >= m:
  print('Yes')
else:
  Print('No')

### FIXED CODE ###

import numpy as np

n, m = map(int, input().split())
vote_lists = list(map(int, input().split()))

vote_arr = np.array(vote_lists)
total_vote = vote_arr.sum()
is_popular = total_vote / (4 * m)

answer_lists = []

for i in vote_lists:
  if i >= is_popular:
    answer_lists.append(i)

if len(answer_lists) >= m:
  print('Yes')
else:
  print('No')
n,a,b,c,d=map(int,input().split())
a-=1;b-=1;c-=1;d-=1 
from collections import deque 

queueA=deque([a])
queueB=deque([b])
S=input()
JinA=JinB=[0]*n 
if c<b or c<d:
    for i in range(a,d):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    else:
        print("Yes")
        exit()
    
else:
    for j in range(min(a,c),max(a,c)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for j in range(min(b,d),max(b,d)):
        if S[i]=="#" and S[i+1]=="#":
            print("No")
            exit() 
    for i in range(n-2):
        if S[i]==S[i+1]==S[i+2]==".":
            print("Yes")
            exit()
    else:
        print('No')

### FIXED CODE ###

int1 = lambda x: int(x) - 1
N, A, B, C, D = map(int1, input().split())
S = input()

if "##" not in S[A:B+1] and "##" not in S[C:D+1]:
    if C > D and "..." not in S[B-1:D+2]:
        print("No")
    else:
        print("Yes")
else:
    print("No")
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)

### FIXED CODE ###

import numpy as np
N = int(input().strip('\n'))
lis = []
for i in range(N):
    lis.append(int(input().strip('\n')))
lis = np.sort(np.array(lis))
mx_n = lis[-1]
ms_n = lis[0]
lis = lis[1:-1]
point = mx_n-ms_n
while lis.shape[0]>=2:
    mx = lis[-1]
    ms = lis[0]
    point += (mx_n-ms+mx-ms_n)
    mx_n = mx
    ms_n = ms
    lis = lis[1:-1]
if lis.shape[0]==1:
    point += max(abs(mx_n-lis[0]),abs(ms_n-lis[0]))
print(point)
N, M = map(int, input().split())

klist = []
sdict = {}
for m in range(M):
    tmp = list(map(int, input().split()))
    klist.append(tmp[0])
    sdict[m] = tmp[1:]
plist = list(map(int, input().split()))

def solve(N, plist, switch_num):
    global M
    num = 0

    if N == 1:
        idx = []
        idx2 = []
        for m in range(M):
            if switch_num in sdict[m]:
                idx.append(plist[m])
            else:
                idx2.append(plist[m])
        if sum(idx) == len(idx):
            if sum(idx2) == 0:
                return 1
            else:
                return 0
        elif sum(idx) == 0:
            if sum(idx2) == 0:
                return 2
        else:
            return 0

    # switch1 == OFF
    new_plist = plist
    num += solve(N-1, new_plist, switch_num+1)
    
    # switch1 == ON
    new_plist = []
    for i in range(M):
        if switch_num in sdict[i]:
            new_plist.append(1 - plist[i])
        else:
            new_plist.append(plist[i])
    num += solve(N-1, new_plist, switch_num+1)

    return num

print(solve(N, plist, 1))


### FIXED CODE ###

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

klist = []
sdict = {}
for m in range(M):
    tmp = list(map(int, input().split()))
    klist.append(tmp[0])
    sdict[m] = tmp[1:]
plist = list(map(int, input().split()))

def solve(N, plist, switch_num):
    global M
    num = 0

    if N == 1:
        idx = []
        idx2 = []
        count = 0
        for m in range(M):
            if switch_num in sdict[m]:
                count += 1
                idx.append(plist[m])
            else:
                idx2.append(plist[m])
        if sum(idx) == len(idx) or sum(idx) == 0:
            if sum(idx2) == 0:
                if count == 0:
                    return 2
                else:
                    return 1
            else:
                return 0
        else:
            return 0

    # switch1 == OFF
    new_plist = plist
    num += solve(N-1, new_plist, switch_num+1)
    
    # switch1 == ON
    new_plist = []
    for i in range(M):
        if switch_num in sdict[i]:
            new_plist.append(1 - plist[i])
        else:
            new_plist.append(plist[i])
    num += solve(N-1, new_plist, switch_num+1)

    return num

print(solve(N, plist, 1))
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
for i in range(1, 101):
    if i not in p:
        if ans > abs(x - i):
            ans = abs(x-i)
            m = i
print(m)


### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
li = []
ans = []
Min_sa = 9999999999
for i in range(-200,201):
    if i not in p:
        li.append(i)
for i in li:
     Min_sa = min(Min_sa,abs(x-i))
for i in li:
    if abs(x-i) == Min_sa:
        ans.append(i)
print(min(ans))
def dist(x0, y0, x1, y1):
    return math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)

def resolve():
    N = int(input())
    x, y = [], []
    for _ in range(N):
        x_tmp, y_tmp = list(map(int, input().split()))
        x.append(x_tmp)
        y.append(y_tmp)

    ls = list(permutations(list(range(N)), N))
    ans = 0
    for l in ls:
        idx = 0
        while idx + 1 < len(l):
            ans += dist(x[l[idx]], y[l[idx]], x[l[idx+1]], y[l[idx+1]])
            idx += 1

    print(ans / len(ls))
    return

resolve()

### FIXED CODE ###

import math
from itertools import permutations

def dist(x0, y0, x1, y1):
    return math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)

def resolve():
    N = int(input())
    x, y = [], []
    for _ in range(N):
        x_tmp, y_tmp = list(map(int, input().split()))
        x.append(x_tmp)
        y.append(y_tmp)

    ls = list(permutations(list(range(N)), N))
    ans = 0
    for l in ls:
        idx = 0
        while idx + 1 < len(l):
            ans += dist(x[l[idx]], y[l[idx]], x[l[idx+1]], y[l[idx+1]])
            idx += 1

    print(ans / len(ls))
    return

resolve()
n,m=map(int,input().split())
l=[]
o=[]
for i in range(1,m+1):
  if m%i==0:
    l.append(i)
for i in l:
  if n>=m/l[i]:
    o.append(l[i])
print(max(o))


### FIXED CODE ###

def make_divisors(n,m):
    divisors = []
    for i in range(1,min(int(m**(1/2))+1,int(m//n)+1)):
      if m % i == 0:
          divisors.append(i)
          if i != m // i and m//i<=m//n:
              divisors.append(m//i)
    return divisors
n,m=map(int,input().split())
print(max(make_divisors(n,m)))
a,b=map(int,input().split())
if b>a:if b%a>0:print(b//a+1)
elif b<=a:print(1)
else:print(b//a)

### FIXED CODE ###

a,b=map(int,input().split())
if (b-1)%(a-1)>0:
  print((b-1)//(a-1)+1)
if (b-1)%(a-1)==0:
  print((b-1)//(a-1))
a=int(input())
b=int(input())
c=(a*b)%2
if c==0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a, b=map(int, input().split())
c=(a*b)%2
if c==0:
  print("Even")
else:
  print("Odd")
def ABC158D():
    txt2 = txt.split("\n")
    s = txt2[0]
    q = int(txt2[1])
    for i in range(2, len(txt2)):
        txt3 = txt2[i].split()
        if txt3[0] == '1':
            s = s[::-1]
        else:
            if txt3[1] == '1':
                s = txt3[2] + s
            else:
                s = s + txt3[2]
    print(s)

f = open("foot/bar.dat")
txt = f.read()
f.close()
ABC158D(txt)


### FIXED CODE ###


s = input()
q = int(input())
ht = 1
head = ''
tail = ''
count = 0
for i in range(q):
    txt3 = input().split()
    if txt3[0] == '1':
        ht = 3 - ht
        count += 1
    else:
        if int(txt3[1]) == ht:
            head = txt3[2] + head
        else:
            tail = tail + txt3[2]
s = head + s + tail
if count % 2 == 1:
    s = s[::-1]
print(s)
c = input()
if v,c in 'aeiou':
  print(vowel)
else:
  print(consonant)

### FIXED CODE ###

c = input()
if c in 'aeiou':
  print('vowel')
else:
  print('consonant')
N = int(input())
edges = list(map(int, input().split()))
sum = 0
m = max(edges)
m.pop(edges.index(m))
for i in range(len(edges)):
  sum += edges[i]
if m < sum:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N = int(input())
edges = list(map(int, input().split()))
sum = 0
m = max(edges)
edges.pop(edges.index(m))
for i in range(len(edges)):
  sum += edges[i]
if m < sum:
  print("Yes")
else:
  print("No")
X, N = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
tmp = [i for i in range(1, 101)]
for i in p:
        tmp.remove(i)

ans_num = float("Inf")
ans_i = 0
for i in range(len(tmp)):
        if abs(X - tmp[i]) < ans_num:
                ans_num = abs(X - tmp[i])
                ans_i = i
if N == 0:
        print(X)
else:
        print(tmp[ans_i])


### FIXED CODE ###

X, N = map(int, input().split())
p = list(map(int, input().split()))

if N == 0:
        print(X)
        exit()

p.sort()
tmp = [i for i in range(-111, 111)]
for i in p:
        tmp.remove(i)

ans_num = float("Inf")
ans_i = 0
for i in range(len(tmp)):
        if abs(X - tmp[i]) < ans_num:
                ans_num = abs(X - tmp[i])
                ans_i = i


print(tmp[ans_i])
import sys
N = int(sys.stdin.readline())
ss = []
for i in range(N):
    ss.append(sys.stdin.readline().rstrip())

incount = 0
has_ba = 0
has_b = 0
has_a = 0
for s in ss:
    incount += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        has_ba += 1
    elif s[0] == 'B':
        has_b += 1
    elif s[-1] == 'A':
        has_a += 1

res = incount
if has_a:
    res += has_ba
elif has_ba:
    has_a += 1
    has_ba -= 1
    res += has_ba
res += min(has_a, has_b)

print(res)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N, K = nm()


def solve():
    return N - K + 1


if __name__ == "__main__":
    print(solve())
def main():
    n = int(input())
    S = list(map(int,input().split()))

    if 'Y' in S:
        print('Four')
    else:
        print('Three')


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    S = input()

    if 'Y' in S:
        print('Four')
    else:
        print('Three')


if __name__ == '__main__':
    main()
n = int(input())
for i in range(1, 10)
    for j in range(1, 10)
		if n == i * j:
			print("Yes")
			break
 
print("No")



### FIXED CODE ###

def solve():
    N, M = map(int, input().split())
    return N*M if max(N, M) < 10 else -1

print(solve())
cnt = 0
s = input().lower()
while 1:
    line = input()
    if W == "END_OF_TEXT":
        break
    for s in line.lower().split():
print(cnt)

### FIXED CODE ###

cnt = 0
s = input().lower()
while 1:
    line = input()
    if line == "END_OF_TEXT":
        break
    for w in line.lower().split():
        if w == s:
            cnt+=1
print(cnt)
import math
a,b=[int(x) for x in input().split()]
i=1
g=math.gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0:
        l.append(i)
        l.append(g//i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))


### FIXED CODE ###

a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
ABC = list(map(int,input().split()))

ABC.sort()

print("Yes" if A[0]+A[1]==A[2] else "No")

### FIXED CODE ###

A = sorted(map(int,input().split()))
print("Yes" if A[0]+A[1]==A[2] else "No")
import math
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/math.gcd(c, d))
a_cd = (a-1)//int((c*d)/math.gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))

### FIXED CODE ###

def gcd(a, b):
    # ユークリッド互除法により最大公約数を求める。
    if a < b:
        a, b = b, a

    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/gcd(c, d))
a_cd = (a-1)//int((c*d)/gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))