Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n, k=map(int, input().split())
s=list(map(int, list(input())))
renzoku_list=[0]
sum=1
before=s[0]
for i in range(1, n):
    if s[i]==before:
        sum=sum+1
        before=s[i]
    else:
        renzoku_list.append(sum)
        sum=1
        before=s[i]
renzoku_list.append(sum)
renzoku_list.append(0)
result_list=[]
length=len(renzoku_list)

max=0
if s[0]==0 and -(-(length-2)//2)<=k:
    print(n)
elif s[0]==1 and (length-2)//2<=k:
    print(n)
elif s[0]==0:
    for i in range(length-(2*k+1)+1):
        if i%2==0:
            result=0
            for j in range(i, i+2*k+1):
                result=result+renzoku_list[j]
            if max<=result:
                max=result
    print(max)
elif s[0]==1:
    for i in range(length-(2*k+1)+1):
        if i%2==1:
            result=0
            for j in range(i, i+2*k+1):
                result=result+renzoku_list[j]
            if max<=result:
                max=result
    print(max)


### FIXED CODE ###

n, k=map(int, input().split())
s=list(map(int, list(input())))
if s[0]==0:
    renzoku_list=[0]
else:
    renzoku_list=[]
sum=1
before=s[0]
for i in range(1, n):
    if s[i]==before:
        sum=sum+1
        before=s[i]
    else:
        renzoku_list.append(sum)
        sum=1
        before=s[i]
renzoku_list.append(sum)
if s[n-1]==0:
    renzoku_list.append(0)
ruisekiwa=[0]
for i in range(len(renzoku_list)):
    ruisekiwa.append(renzoku_list[i]+ruisekiwa[i])

length=len(renzoku_list)

max=0

if (length-1)//2<=k:
    print(n)
else:
    for i in range(len(ruisekiwa)-(2*k+1)):
        if i%2==0:#i=0,2,4,...
            sum=ruisekiwa[i+2*k+1]-ruisekiwa[i]
            if sum>=max:
                max=sum
    print(max)
### BUGGY CODE ###

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

from fractions import gcd
lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // gcd(lcm, a[i])

ans=0
#for i in range(n):
#    ans+=lcm//a[i]
a2 = list(map(lambda x: lcm //x , a))
print(sum(a2)%(10**9+7))


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
 
from fractions import gcd
lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // gcd(lcm, a[i])
 
ans=0
for i in range(n):
    ans+=lcm//a[i]
 
print(ans%(10**9+7))
### BUGGY CODE ###

from fractions import*
def main():
    _,a=open(0)
    *a,=map(int,a.split())
    s=1
    for i in a:s*=i//gcd(s,i)
    c=0
    for i in a:
        c+=s//i
        c%=10**9+7
    print(c)
main()

### FIXED CODE ###

from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)
### BUGGY CODE ###

K,S = input().strip().split()
K,S = int(K),int(S)

count = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x+y+z == S:
        count += 1
print(count)

### FIXED CODE ###

K,S = input().strip().split()
K,S = int(K),int(S)

count = 0

for x in range(S+1):
  for y in range(S+1-x):
    z = S - x- y
    #print( x,y,z)
    if x <= K and y <= K and z <= K:
      count += 1
print(count)
### BUGGY CODE ###

num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for _ in range(num):
    weight, value = map(int, input().split())
    for w in range(capacity,weight - 1,-1):
        dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

### FIXED CODE ###

def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))
### BUGGY CODE ###

def main():
	a,b = map(int,input().split())

	def sosuu(a):
	    sosuu_list = set()
	    while 1:
	        flag = True
	        for i in range(2,a+1):
	            if a % i == 0 and a != i:
	                a = a//i
	                sosuu_list.add(i)
	                flag = False
	                break
	        if flag:
	            sosuu_list.add(a)
	            return sosuu_list

	a = sosuu(a)
	# print(a)
	ans = 1
	for aa in a:
	    if b % aa == 0 and aa != 1:
	        ans += 1
	print(ans)

if __name__ == "__main__":
	main()

### FIXED CODE ###

from collections import Counter
from fractions import gcd

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

g = gcd(a,b)

def sosuu(a):
    sosuu_list = set()
    sosuu_list.add(1)
    i = 2
    while 1:
        flag = True
        while a >= i*i:
            if a % i == 0:
                # print(a,i)
                a = a//i
                sosuu_list.add(i)
                flag = False
            else:
                i += 1
        if flag:
            sosuu_list.add(a)
            return sosuu_list
        i += 1

a = sosuu(g)
print(len(a))
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(i) for i in input().split()]
cost=[2,2,5,5,4,5,6,3,7,6]

dp=["" for i in range(n+1)]

for i in range(1,n+1):
    p=0
    for j in a:
        if i-cost[j]>=0 and dp[i-cost[j]]!="0":
            p=max(p,int(dp[i-cost[j]]+str(j)))
    dp[i]=str(p)

print(dp[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(i) for i in input().split()]
cost=[2,2,5,5,4,5,6,3,7,6]

dp=[0 for i in range(n+1)]

for i in range(1,n+1):
    p=0
    for j in a:
        if i-cost[j]>=0 and (dp[i-cost[j]]!=0 or i-cost[j]==0):
            p=max(p,int(dp[i-cost[j]]*10+j))
    dp[i]=p

print(dp[n])
### BUGGY CODE ###

import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    a = sorted(a)[::-1]
    # print(a)
    a[0] = a[0] / 2
sum = 0
# print(a)
for i in range(n):
    sum += math.floor(a[i])
print(sum)

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))
### BUGGY CODE ###

N=int(input())
#A,B,C>0 C=N-A*B
count=0
for A in range(1,N):
    for B in range(1,N):
        # print(A,B,N-A*B)
        if N-(A*B)<0:
            break
        elif N-(A*B)>0:
            count+=1
print(count)

### FIXED CODE ###

N=int(input())
count=0
for A in range(1,N):
    count+=int((N-1)/A)
print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(50000)

tree = {}
edges = []
colors = set()
N = 0

def readlines(n):
    for _ in range(n):
        a, b = map(int, input().split())
        yield a, b

def to_tree(edges_, n):
    tree_ = {i:[] for i in range(1,n+1)}
    for a, b in edges_:
        tree_[a].append(b)
        tree_[b].append(a)
    return tree_

def suc(u, parent):
    for v in tree[u]:
        if (u, v) != (u, parent):
            yield u, v

def assign(assignment, u, parent):
    suc_edges = suc(u, parent)
    if not suc_edges:
        return

    lest_colors = colors - {assignment.get((parent, u))}
    for edge, color in zip(suc_edges, lest_colors):
        assignment[edge] = color
        v = edge[0] if edge[1] == u else edge[1]
        assign(assignment, v, u)

def main():
    global tree, edges, colors, N
    N = int(input())
    colors = set(range(1,N))
    edges = list(readlines(N-1))
    tree = to_tree(edges, N)
    ans = {}
    assign(ans, 1, None)
    print(max(ans.values()))
    for edge in edges:
        print(ans[edge])

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

tree = {}
N = 0

def assign(assignment, u, prev_color):
    color = 1
    for v in tree[u]:
        if color == prev_color:
            color += 1
        assignment[u,v] = color
        assign(assignment, v, color)
        color += 1

def main():
    global tree, N
    N = int(input())
    tree = {i: [] for i in range(1,N+1)}
    edges = []
    for _ in range(N-1):
        a, b = map(int, input().split())
        tree[a].append(b)
        edges.append((a, b))
    ans = {}
    assign(ans, 1, None)
    print(max(ans.values()))
    for edge in edges:
        print(ans[edge])

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import numpy as np

n = int(input())
l = np.array(list(map(int, input().split())))

l = np.sort(l)[::-1]

cnt = 0
for a in range(n):
    for b in range(a, n):
        for c in range(b, n):
            if l[c] <= l[a] - l[b]:
                break
            if a != b and b != c and c != a:
                if l[a] < (l[b] + l[c]) and l[b] < (l[a] + l[c]) and l[c] < (l[a] + l[b]):
                    cnt += 1

print(cnt)


### FIXED CODE ###

import numpy as np
import bisect

n = int(input())
l = np.array(list(map(int, input().split())))

# l.sort()

# ans = 0
# for a in range(n - 2):
#     for b in range(a + 1, n - 1):
#         ans += bisect.bisect_left(l, l[a] + l[b]) - (a + 1)
# print(ans)

res = 0
l = sorted(l)
for i in range(1, n - 1):
    b = l[i]
    for j in range(0, i):
        a = l[j]
        res += bisect.bisect_left(l, a + b) - (i + 1)
print(res)
### BUGGY CODE ###

from itertools import product
N = int(input())
S = input()
ans = 0
for q in product(range(10),repeat=3):
    i = 0
    for s in S:
        if s==str(q[i]):
            if i==2:
                ans += 1
                break
            else:
                i+=1
print (ans)
            


### FIXED CODE ###

from itertools import product
N = int(input())
S = input()
S = [int(s) for s in S]
ans = 0
for q in product(range(10),repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                ans += 1
                break
            else:
                i+=1
print (ans)
### BUGGY CODE ###

n =int(input())

def main(i):
  if i == 0:
    return 2
  elif i == 1:
    return 1
  else:
    return main(i-1)+main(i-2)

print(main(n))

### FIXED CODE ###

n =int(input())
a = [0]*(n+1)
a[0] = 2
a[1] = 1

for i in range(2,n+1):
  a[i] = a[i-1]+a[i-2]

print(a[n])
### BUGGY CODE ###

import collections
N,K=map(int,input().split())
#N=int(input())
A=list(map(int,input().split()))
M=10**9+7
dp=[[0]*(K+2)for i in range(N+1)]
for i in range(N+1):
    dp[i][0]=1

for i in range(1,A[0]+1):
    dp[0][i]=1
for i in range(N-1):
    for j in range(K+1):
        if j-A[i+1]<0:
            dp[i+1][j+1] = (dp[i+1][j]+dp[i][j+1])%M
        else:
            dp[i+1][j+1] = (dp[i+1][j]+dp[i][j+1]-dp[i][j-A[i+1]])%M
print(dp[N-1][K])

### FIXED CODE ###

import collections
N,K=map(int,input().split())
#N=int(input())
A=list(map(int,input().split()))
M=10**9+7
dp=[[0]*(K+2)for i in range(N+1)]
for i in range(N+1):
    dp[i][0]=1

for i in range(1,A[0]+1):
    dp[0][i]=1
for i in range(N-1):
    for j in range(K+1):
        if j-A[i+1]<0:
            dp[i+1][j+1] = (dp[i+1][j]+dp[i][j+1])%M
        else:
            dp[i+1][j+1] = (dp[i+1][j]+dp[i][j+1]-dp[i][j-A[i+1]])%M
print(dp[N-1][K])
### BUGGY CODE ###

[n, k]= map(int, input().rstrip().split(" "))
ps = list(map(int, input().rstrip().split(" ")))

history = {}

top3 = []

result = 0

def calc_expect_sum(targets):
    return sum( (p+1) * 0.5 for p in targets)


for i in range(n-k+1):
    targets = ps[i:i+k]
    new = calc_expect_sum(targets)
    if new > result:
        result = new

print(result)




### FIXED CODE ###

[n, k]= map(int, input().rstrip().split(" "))
ps = list(map(int, input().rstrip().split(" ")))

history = {}

top3 = []

result = 0

def calc_expect_sum(targets):
    return sum( (p+1) * 0.5 for p in targets)

prev_sum = calc_expect_sum(ps[0:0+k])
result = 0

if n == k:
    print(calc_expect_sum(ps))
else:
    for i in range(1,n-k+1):
        prev = ps[i-1]
        current = ps[i+k-1]
        diff = (current - prev) * 0.5
        new = prev_sum + diff
        if new > result:
            result = new
        prev_sum += diff
    
    print(result)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

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

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
    
val = L[0]
for i in range(1,n):
    val=gcd(L[i],val)
if val!=1:
    print('not coprime')
    sys.exit()

d={}
for i in range(n):
    factors = prime_factor(L[i])
    for j in factors:
        if j not in d:
            d[j]=1
        else:
            print('setwise coprime')
            sys.exit()
print('pairwise coprime')



### FIXED CODE ###

import sys
import math
input = sys.stdin.readline
def prime_factor(n):
    factors = []
    while n%2==0:
        factors.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            factors.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        factors.append(n)
    return set(factors)


n=int(input())
L=list(map(int,input().split()))
val = L[0]
for i in range(1,n):
    val=math.gcd(val,L[i])
if val!=1:
    print('not coprime')
    sys.exit()
d={}
for i in range(n):
    factors = prime_factor(L[i])
    for j in factors:
        if j not in d.keys():
            d[j]=1
        else:
            print('setwise coprime')
            sys.exit()
print('pairwise coprime')
### BUGGY CODE ###

def prime_numbers(m):
    # 素数を保持するset
    primes = set()

    # 2以上m以下の素数を数え上げる
    n = 2
    while n <= m:
        # 自身より小さい全ての素数で割り切れなければ、素数とみなせる
        if all(n % i != 0 for i in primes):
            primes.add(n)
        n += 1

    return primes

n=int(input())
a=sorted(list(map(int,input().split())))
prit=prime_numbers(a[-1])
ans=2
for i in prit:
  cnt=0
  for j in a:
    if i>j:
      continue
    if j%i==0:
      cnt+=1
  if cnt==n:
    ans=0
    break
  if cnt>=2:
    ans=1
if ans==2:
  print('pairwise coprime')
elif ans==1:
  print('setwise coprime')
else:
  print('not coprime')

### FIXED CODE ###

def resolve():
    import sys
    input = sys.stdin.readline
    n=int(input())
    a=sorted(list(map(int,input().split())))
    ma=a[-1]
    pn=[i for i in range(ma+1)]
    for i in range(2,ma//2+1):
      j=2
      while j*i<=ma:
        pn[j*i]=min(pn[j*i],i)
        j+=1
    chk=[0]*(ma+1)
    for i in a:
      if i==1:
        continue
      x=pn[i]
      chk[x]+=1
      while x!=i:
        while i%x==0:
          i//=x
        x=pn[i]
        chk[x]+=1
    ans=2
    for i in chk[2:]:
      if i==n:
        ans=0
        break
      if i>=2:
        ans=1
    if ans==2:
      print('pairwise coprime')
    elif ans==1:
      print('setwise coprime')
    else:
      print('not coprime')

if __name__ == '__main__':
    resolve()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)

reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

mod = 10**9+7

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

cnt = [0]*n
def dfs(cur, prev):
    tmp = 1
    for to in G[cur]:
        if to != prev:
            tmp += dfs(to, cur)
    cnt[cur] = tmp
    return tmp

dfs(0, -1)

power = [0]*(n)
powe2_n = pow(2, n, mod)
powe2_n = pow(powe2_n, mod-2, mod)
power[n-1] = powe2_n
for i in reversed(range(n-1)):
    powe2_n *= 2
    powe2_n %= mod
    power[i] = powe2_n
ans = 0
from collections import deque
que = deque()
que.append((0, -1))

while que:
    cur, prev = que.pop()
    if len(G[cur]) == 1:
        if prev == -1:
            que.append((G[cur][0], cur))
        continue

    prob = 1
    prob -= power[n-2]

    for to in G[cur]:
        if to == prev:
            bubun_cnt = n-cnt[cur]
        else:
            que.append((to, cur))
            bubun_cnt = cnt[to]
        tmp = 1-power[bubun_cnt-1]
        tmp *= power[n-1-bubun_cnt-1]
        prob -= tmp
    prob %= mod
    ans += power[0]*prob
    ans %= mod

print(ans)



### FIXED CODE ###

import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

from collections import deque

mod = 10**9+7

n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append(b)
    G[b].append(a)

que = deque()
dep = [0]*n
que.append((0,-1, 0))
order = []
while que:
    cur, prev, d = que.popleft()
    dep[cur] = d
    order.append(cur)
    for to in G[cur]:
        if to != prev:
            que.append((to, cur, d+1))

cnt = [1]*n
for i in reversed(order):
    for to in G[i]:
        if dep[to] < dep[i]:
            cnt[to] += cnt[i]

power = [0]*(n)
powe2_n = pow(2, n, mod)
powe2_n = pow(powe2_n, mod-2, mod)
power[n-1] = powe2_n
for i in reversed(range(n-1)):
    powe2_n *= 2
    powe2_n %= mod
    power[i] = powe2_n
ans = 0
que = deque()
que.append((0, -1))

while que:
    cur, prev = que.pop()
    if len(G[cur]) == 1:
        if prev == -1:
            que.append((G[cur][0], cur))
        continue

    prob = 1
    prob -= power[n-2]

    for to in G[cur]:
        if to == prev:
            bubun_cnt = n-cnt[cur]
        else:
            que.append((to, cur))
            bubun_cnt = cnt[to]
        tmp = 1-power[bubun_cnt-1]
        tmp *= power[n-1-bubun_cnt-1]
        prob -= tmp
    prob %= mod
    ans += power[0]*prob
    ans %= mod

print(ans)
### BUGGY CODE ###

def main():
    N, M = map(int, input().split())
    box = []
    for i in range(M):
        L, R = map(int, input().split())
        box.append(L)
        box.append(R)

    # print(box)
    num = 0
    for j in range(1, N+1):
        plus = 1
        # print(j)
        for i in range(0, len(box), 2):
            # print(box[i], box[i+1])
            if j < box[i] or box[i+1] < j:
                plus = 0
                break

        num += plus

    print(num)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, M = map(int, input().split())

    L = []
    R = []
    for i in range(M):
        l, r = map(int, input().split())
        L.append(l)
        R.append(r)

    Lout = max(L)
    Rout = min(R)
    ans = Rout - Lout+1
    if ans < 0:
        print(0)
    else:
        print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,m = (int(i) for i in input().split())
for i in range(m//n,0,-1):
	if m%i==0: break
print(i)

### FIXED CODE ###

from math import sqrt
from bisect import bisect
n,m = (int(i) for i in input().split())
x = []
for i in range(1,int(sqrt(m))+1):
	if m%i==0:
		x.append(i)
		x.append(m//i)
x.sort()
print(x[bisect(x,m//n)-1])
### BUGGY CODE ###

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

cnt = 0
for i in range(n):
  cnt_j = 0
  for j in range(i+1):
    if p[i] <= p[j]:
      cnt_j += 1
    else:
      break
  if cnt_j == i+1:
    cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 0
p_min = p[0]
for i in range(n):
  pi = p[i]
  if pi <= p_min:
    cnt += 1
    p_min = pi
print(cnt)
### BUGGY CODE ###

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

count_max = Y / 1000  # all 1000

def sample(n, y):
    ans = '-1 -1 -1'
    for i in reversed(range(y // 10000 + 1)):
        count_tmp1 = count_max - 9 * i
        price_tmp1 = y - 10000 * i
        if count_tmp1 < n or price_tmp1 < 0:
            continue

        if count_tmp1 == n:
            ans = '{} {} {}'.format(i, 0, N - i)
            return ans

        if price_tmp1 > 5000 * count_tmp1:
            return ans

        for j in reversed(range(price_tmp1 // 5000 + 1)):
            count_tmp2 = count_tmp1 - 4 * j
            price_tmp2 = price_tmp1 - 5000 * j
            if count_tmp2 < n or price_tmp2 < 0:
                continue
            if count_tmp2 == n:
                ans = '{} {} {}'.format(i, j, N - i -j)
                return ans
            if price_tmp2 > 5000 * count_tmp2:
                return ans
    return ans
a = sample(N, Y)
print(a)

### FIXED CODE ###

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

count_max = Y / 1000  # all 1000

ans = '-1 -1 -1'
for i in range(N+1):  # 10000
    for j in range(N+1 - i):  # 5000
        k = N - i - j
        if k < 0:
            continue
        total = 10000 * i + 5000 * j + 1000 * k
        if total == Y:
            ans = '{} {} {}'.format(i, j, k)
            break
print(ans)
### BUGGY CODE ###

from functools import reduce
from operator import add, mul

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

ans = reduce(mul,a)
  
if ans > 10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

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

if A.count(0) > 0:
  print(0)
else:
  ans = A[0]
  flag = 0
  for i in range(1,N):
    ans *= A[i]
    if ans > 10 ** 18:
      print(-1)
      flag += 1
      break
  if flag == 0:
    print(ans)
### BUGGY CODE ###

N = int(input())
lstA = []
dctA = {}
for n in input().split():
  i = int(n)
  lstA.append(i)
  dctA[i] = 0
lstA.sort()
for i in range(N):
  Ai = lstA[i]
  if dctA[Ai] > 0:
    continue
  for j in range(i + 1,N):
    Aj = lstA[j]
    if dctA[Aj] > 0:
      continue
    m = Aj % Ai
    if m == 0:
      dctA[Aj] += 1
c = 0
for a in dctA:
  if dctA[a] == 0:
    c += 1
print(c)
  
  

### FIXED CODE ###

N = int(input())
c=[0]*8**7
for a in input().split():
    c[int(a)] += 1
i=r=0
for t in c:
    if t:
        c[::i]=[0]*-(-8**7//i)
    i+=1
    r+=t==1
print(r)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)

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

SCORE=dict()

def score(i,j,k,l):#A[i:j)が残っているときのscore,1:Xの手番,-1:Yの手番

    if i==j:
        return k
    if SCORE.get((i,j))!=None:
        return SCORE.get((i,j))+k
        

    if l==1:
        SCORE[(i,j)]=max(score(i+1,j,k+A[i],-l),score(i,j-1,k+A[j-1],-l))-k
        return SCORE[(i,j)]+k
    if l==-1:
        SCORE[(i,j)]=min(score(i+1,j,k-A[i],-l),score(i,j-1,k-A[j-1],-l))-k
        return SCORE[(i,j)]+k


print(score(0,N,0,1))

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

SCORE=[[None for i in range(N+1)] for j in range(N+1)]

def score(i,j,k,l):#A[i:j)が残っているときのscore,1:Xの手番,-1:Yの手番
    #print(i,j,k,l)
    
    if SCORE[i][j]!=None:
        return SCORE[i][j]+k
    if i==j:
        SCORE[i][j]=0
        return k

        

    if l==1:
        SCORE[i][j]=max(score(i+1,j,k+A[i],-l),score(i,j-1,k+A[j-1],-l))-k
        return SCORE[i][j]+k
    if l==-1:
        SCORE[i][j]=min(score(i+1,j,k-A[i],-l),score(i,j-1,k-A[j-1],-l))-k
        return SCORE[i][j]+k



hand=N%2
for i in range(N+1):
    for j in range(N-i+1):
        score(j,j+i,0,(-1)**(j+j+i+hand))

print(SCORE[0][N])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split())) 
a = tuple(a)
if a.count(1) == 0:
    print(-1)
else:
    y = n
    for i in range(1, n+1):
        if a.count(i) == 0:
            y = i-1
            break
        else:
            s = a.index(i)
            a = a[s+1:]
    print(n-y)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split())) 
a = tuple(a)
if a.count(1) == 0:
    print(-1)
else:
    s = 0
    t = 1
    for i in range(n):
        if a[i] == t:
            t += 1
        else: s += 1
    print(s)
### BUGGY CODE ###

S = input()
initial_length = len(S)

if initial_length == 1:
    print("0")
else:
    len_S = 0
    while len_S != len(S):
        len_S = len(S)
        S = S.replace("10", "")
        S = S.replace("01", "")
    print(initial_length - len(S))

### FIXED CODE ###

S = input()
nof_0 = S.count("0")
nof_1 = S.count("1")
print(min(nof_0, nof_1) * 2)