Harryxun/stf_run huggingface dataset:
N,M= [int(x) for x in input().split()]

root = list(range(N))

for i in range(M):
    A,B = [int(x)-1 for x in input().split()]
    a = root[A]
    b = root[B]
    if a<b:
        root = [a if i == b else i for i in root]
    if b<a:
        root = [b if i == a else i for i in root]

print(len(set(root))-1)


### FIXED CODE ###

N = int(input())

print("ACL"*N)
import math
 
def check(x):
    k = 0
    global h, a, b
    for i in h:
        if x * b < i:
            k += math.ceil((i - x * b) / (a - b))
    return k <= x
 
 
n, a, b = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
l = -1
r = max(h) // b + 1
while r - l > 1:
    m = (l + r) // 2
    if check(m):
        r = m
    else:
        l = m
print(r)

### FIXED CODE ###

#!/usr/bin/env python3

x = input().split()

A = int(x[0])
B = int(x[1])

if (A+B) < 10:
    print(A+B)
else:
    print("error")
def input(): return sys.stdin.readline().strip()


def resolve():
    from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
    from scipy.sparse import csr_matrix

    N, M = map(int, input().split())  # 頂点数、辺数
    A, B, C = [0] *  M, [0] * M, [1] * (M-1)
    for i in range(M):
        A[i], B[i] = map(int, input().split())
        A[i]-=1
        B[i]-=1

    cnt = 0
    for i in range(M):
        #print(B[:i] + B[i + 1:i + M] + B[i + M + 1:])
        #print(A[:i] + A[i + 1:i + M] + A[i + M + 1:])
        csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
        #print(csr)
        #print('haha')
        n, labels = connected_components(csr)
        if n == 2:
           cnt += 1
    print(cnt)


resolve()

### FIXED CODE ###

from scipy.sparse.csgraph import connected_components  # https://note.nkmk.me/python-scipy-connected-components/
from scipy.sparse import csr_matrix

N, M = map(int, input().split())  # 頂点数、辺数
A, B, C = [0] *  M, [0] * M, [1] * (M-1)
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i]-=1
    B[i]-=1

cnt = 0
for i in range(M):
    csr = csr_matrix((C, (A[:i] + A[i + 1:], B[:i] + B[i + 1:])), shape=(N, N))
    n, labels = connected_components(csr)
    if n == 2:
       cnt += 1
print(cnt)
from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
for i in range(1,N):
  before=0
  if listA[i-1][0]!=listA[i][0] or i==N-1:
    listN=listA[before:i+1]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i
for i in range(N):
  print(listANS[i][2])

### FIXED CODE ###

from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
before=0
if N!=1:
  for i in range(1,N):
    if listA[i-1][0]!=listA[i][0]:
      listN=listA[before:i]
      listN.sort(key=itemgetter(1),reverse=True)
      listANS+=listN
      before=i
 
    if i==N-1:
      listN=listA[before:N]
      listN.sort(key=itemgetter(1),reverse=True)
      listANS+=listN
else:
  listANS=listA
for i in range(N):
  print(listANS[i][2])
S = input()
K = int(input())
Sdash = [x for x in S if not x == '1']  
n = S.index(Sdash[0])
if n >= K:
    print(1)
else:
    print(Sdash[0])

### FIXED CODE ###

S = input()
K = int(input())
Sdash = [x for x in S if not x == '1'] 

if len(Sdash) == 0:
    n = len(S) 
else:
    n = S.index(Sdash[0])

if n >= K:
    print(1)
else:
    print(Sdash[0])
a,b,c,d=int(open(0));print(max(0,min(b,d)-max(a,c)))

### FIXED CODE ###

a,b,c,d = map(int,input().split());print(max(0, min(b,d) - max(a,c)))
a,b = map(int(input().split()))
if b%a :
    print(b-a)
else:
    print(a+b)

### FIXED CODE ###

a,b = map(int,input().split())
if b%a :
    print(b-a)
else:
    print(a+b)
mod=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))

a=sorted(a,reverse=True,key=lambda x:abs(x))

if k==n:
  ans=1
  for i in range(n):
    ans *= a[i]
    ans %= mod
  print(ans)
else:
  if k%2 and a[0]<0:
    ans=1
    for i in range(k):
      ans *=a[n-i+1]
      ans %= mod
    print(ans)
  else:
    ans=1
    count=0
    for i in range(k):
      if a[i]<0:
        count +=1
      ans *= a[i]
      ans %= mod
    if count%2==0:
      print(ans)
    else:
      min_plus=-1 #Kこの中の絶対値最小の非負数
      min_minus=1 #Kこの中の絶対値最大の負数
      for i in range(k):
        if a[i]<0:
          min_minus=a[i]
        else:
          min_plus=a[i]
      max_plus=-1 #N-Kこの中の絶対し最小の非負数
      max_minus=1 #N-Kこの中の絶対値最大の負数
      for i in range(k,n):
        if a[i]<0:
          max_minus=a[i]
          break
      for i in range(k,n):
        if a[i]>=0:
          max_plus=a[i]
          break
      if min_plus=-1: #Kこの中に非負数が存在しない
        a.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans *= a[i]
          ans %= mod
        ans*=max_plus
        print(ans)
      elif min_minus=1: #Kこの中に負数が存在しない
        a.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans *= a[i]
          ans %= mod
        ans*=max_minus
        print(ans) 
      elif min_plus*max_plus>=min_minus*max_minus: #Kこの中に非負数が存在しない
        a.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans *= a[i]
          ans %= mod
        ans*=max_minus
        print(ans) 
      else:
        a.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans *= a[i]
          ans %= mod
        ans*=max_plus
        print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a_list = list(map(int, input().split()))
mod = 10**9+7
a_list.sort()
ans = 1
if k % 2 == 1 and a_list[-1] < 0:
    for i in range(k):
        ans *= a_list[n - 1 - i]
        ans %= mod
else:
    l = 0
    r = -1
    mlt1 = a_list[0] * a_list[1]
    mlt2 = a_list[-2] * a_list[-1]
    count = 0
    while True:
        if count == k:
            break
        elif count == k - 1:
            ans *= a_list[r] % mod
            ans %= mod
            break
        if mlt1 >= mlt2:
            ans *= mlt1 % mod
            l += 2
            count += 2
            if l <= n - 2:
                mlt1 = a_list[l + 1] * a_list[l]
        else:
            ans *= a_list[r] % mod
            r -= 1
            count += 1
            if r >= - n + 1:
                mlt2 = a_list[r - 1] * a_list[r]
        ans %= mod
print(ans)
N, A, B = map(int, input().split())
print(min(A, B), max(0, A + B - N))

### FIXED CODE ###

N, A, B = map(int, input().split())
print(min(A, B), max(0, A + B - N))
lst = [None]*5
for i in range(5):
    s=input()
    lst[i]=s
k = int(input())

c=0
for j in range(4):
    lgth=abs(lst[j]-lst[j+1])
    if lgth>k:
        print(':(')
    elif k==3 and lgth<=k:
        print('Yay!')

### FIXED CODE ###

import itertools

lst = [None]*5
for i in range(5):
    s=input()
    lst[i]=s
k = int(input())

lst_sub=[]
lst_C = list(itertools.combinations(lst,2))
for j in range(len(lst_C)):
    sub = abs(int(lst_C[j][0])-int(lst_C[j][1]))
    lst_sub.append(sub)

if max(lst_sub)>k:
    print(":(")
else:
    print("Yay!")
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

def my_pow(base, n, mod):
    if n == 0:
        return 1
    x = base
    y = 1
    while n > 1:
        if n % 2 == 0:
            x *= x
            n //= 2
        else:
            y *= x
            n -= 1
        x %= mod
        y %= mod
    return x * y % mod
MOD = 10 ** 9 + 7

N = int(input())
X = list(input())

def popcount(n):
    ret = 0
    while n > 0:
        if n % 2 == 1:
            ret += 1
        n //= 2
    return ret

ones = X.count('1')
A_1 = 0
A_2 = 0
d = 1
for a in X[::-1]:
    A_1 += (int(a) * d) % (ones - 1)
    A_2 += (int(a) * d) % (ones + 1)
    d *= 2

for i in range(N):
    ans = 1
    total = ones
    sumA = 0
    if X[i] == '0':
        total += 1
        sumA = A_2 + my_pow(2, N - i - 1, total)
    else:
        total -= 1
        sumA = A_1 - my_pow(2, N - i - 1, total)
    if total == 0:
        print(0)
        continue
    n = sumA % total
    while n != 0:
        n = n % popcount(n)
        ans += 1
    print(ans)
    


### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
X = input()

def popcount(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n //= 2
    return cnt
def f(n):
    cnt = 0
    while n != 0:
        n = n % popcount(n)
        cnt += 1
    return cnt

ones = X.count('1')
MOD1 = ones + 1
MOD2 = ones - 1
pow1 = [1] * (len(X) + 1)
pow2 = [0] * (len(X) + 1)
if MOD2 != 0:
    pow1[0] = 1
    pow2[0] = 1
    for i in range(1, len(X) + 1):
        pow1[i] = (pow1[i - 1] * 2) % MOD1
        pow2[i] = (pow2[i - 1] * 2) % MOD2
else:
    for i in range(1, len(X) + 1):
        pow1[i] = (pow1[i - 1] * 2) % MOD1

X1 = 0
X2 = 0
for i in range(N):
    if X[i] == '1':
        X1 += pow1[N - i - 1]
        X2 += pow2[N - i - 1]
X1 %= MOD1
if MOD2 != 0:
    X2 %= MOD2

for i in range(N):
    d = N - i - 1
    if X[i] == '0':
        x = (X1 + pow1[d]) % MOD1
        print(f(x) + 1)
    else:
        if MOD2 != 0:
            x = (X2 - pow2[d]) % MOD2
            print(f(x) + 1)
        else:
            print(0)
N = int(input())
A = list(map(int, input().split()))
assert len(A) == N
total = 0
sumA = []
for i,ai in enumerate(A):
  sumA.append(sum(A[i+1]))

for i,ai in enumerate(A):
  total += ai * sumA[i]
print(total % (10 ** 9 + 7))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
assert len(A) == N
total = 0
sum_A = sum(A)
for i,ai in enumerate(A):
  sum_A -= ai
  total += ai * sum_A
print(total % (10 ** 9 + 7))
import sys
input = sys.stdin.readline
import fractions
from functools import reduce
n = int(input())
A = []
A = list(map(int, input().split()))
mod = 10**9 + 7
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
Z = lcm(A)
ans = sum(Z//a%mod for a in A)%mod
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c=c*A_//fractions.gcd(c,A_)
for A_ in A:
    a+=c//A_
print(int(a%w))
h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        dp = [[0 for i in range(w)] for j in range(h)]
        step = [[i, j]]

        while len(step) > 0:
            y, x = step.pop(0)
            if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
                step.append([y+1, x])
                dp[y+1][x] = dp[y][x] + 1
            if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
                step.append([y, x+1])
                dp[y][x+1] = dp[y][x] + 1
            if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
                step.append([y-1, x])
                dp[y-1][x] = dp[y][x] + 1
            if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
                step.append([y, x-1])
                dp[y][x-1] = dp[y][x] + 1
        mx = max([mx, max(list(itertools.chain.from_iterable(dp)))])

print(mx)

### FIXED CODE ###

import itertools

import copy
    
h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        if ab[i][j] == '.':
            dp = [[0 for a in range(w)] for b in range(h)]
            step = [[i, j]]

            while len(step) > 0:
                y, x = step.pop(0)
                if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
                    step.append([y+1, x])
                    dp[y+1][x] = dp[y][x] + 1
                if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
                    step.append([y, x+1])
                    dp[y][x+1] = dp[y][x] + 1
                if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
                    step.append([y-1, x])
                    dp[y-1][x] = dp[y][x] + 1
                if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
                    step.append([y, x-1])
                    dp[y][x-1] = dp[y][x] + 1
            dp[i][j] = 0
            mx = max([mx, max(list(itertools.chain.from_iterable(dp)))])

print(mx)
X = int(input())
b=1
MAX=1
if X!=1:
    while b<X:
        p=2
        b+=1
        while b**p <= X:
            if b**p > MAX:
                MAX = b**p
            p+=1
print(MAX)

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if abs(a-c)<=d or (abs(a-b)<=d and abs(b-c)<=d):
    print("Yes")
else:
    print("No")
n, a, b = map(int, input().split())
def cmb(n, r, p):
    ans = 1
    for i in range(1, r + 1):
        ans *= 
        ans /= i
        ans %= mod
    return int(ans)
 p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
import math
mod = 10 ** 9 + 7
res = pow(2, n, mod) - 1 - mod_comb(n, a, mod) - mod_comb(n, b, mod)
print(res % mod)

### FIXED CODE ###

n, a, b = map(int, input().split())
def mod_comb(n, r, mod):
    ans = 1
    for i in range(1, r + 1):
        ans *= n - (i - 1)
        ans %= mod
        ans *= inv[i]
        ans %= mod
    return int(ans)
p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
import math
mod = 10 ** 9 + 7
res = pow(2, n, mod) - 1 - mod_comb(n, a, mod) - mod_comb(n, b, mod)
print(res % mod)
k = int(input())
a, b = map(int,input().split())

for x in range(a, b+1):
    if x%k == 0:
        print("OK")
        exit(1)

print("NG")        

### FIXED CODE ###

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

for x in range(a, b+1):
    if x%k == 0:
        print("OK")
        exit()

print("NG")
N,K,S=map(int,input().split())
if S==10**9:
    print("1000000000 "*K+"1"*(N-K))
else:
    print(f"{S} "*K +"1000000000 "*(N-K))

### FIXED CODE ###

N,K,S=map(int,input().split())
if S==10**9:
    l=[10**9]*K + [1]*(N-K)
    print(*l)
else:
    l=[S]*K+[10**9]*(N-K)
    print(*l)
N, M = map(int, input().split())
X = list(set(map(int, input().split())))
M = len(X)

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    tmp=X[old:]
    ans+=max(tmp)-min(tmp)
  print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
X = list(set(map(int, input().split())))
M = len(X)

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  Y=Y[:N-1]
  Y.sort()
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    if old<len(X):
      tmp=X[old:]
      ans+=max(tmp)-min(tmp)
  print(ans)
s =0

print(n,a)

for f in range(n):
  
  for g in range(n):

    if g != f:
    	if a[f] == a[g]:
      		#print(a[f], a[g])
      		s = s+1
      
if s>0: print("NO")
else: print('YES')

### FIXED CODE ###

n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")
S = list(input())

new_S = sorted(s)

if new_S =="abc":
    print("Yes")
else:
    print("No")

   


### FIXED CODE ###

S = str(input())

new_S = sorted(S)
new_S = ''.join(new_S)

if new_S == "abc":
    print("Yes")
else:
    print("No")
n=int(input())
l=[0]*n

l[0]=2
l[1]=1

for i in range(n-2):
    l[i+2]=l[i+1]+l[i]
print(l[-1])

### FIXED CODE ###

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

l[0]=2
l[1]=1

for i in range(n-1):
    l[i+2]=l[i+1]+l[i]
print(l[-1])
from collections import Counter
import heapq
N = int(input())
A = sorted(list(map(int, input().split())))
max3 = heapq.nlargest(3, A)
d = Counter(A)
if d[max3[1]] == 1:
  ans = sum(A) + max3[1] - max3[2] - A[0]
else:
  ans = sum(A) - A[0]
print(ans)

### FIXED CODE ###

from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
d = deque([A[0]])
for x in A[1:]:
  ans += d.popleft()
  d.append(x)
  d.append(x)
print(ans)
n = int(input())
a = list(map(int,input().split()))

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two =n = int(input())
a = list(map(int,input().split()))

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two = 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')= 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

zero = 0
two = 0
odd = 0

for i in range(len(a)):
    if a[i] % 4 == 1 or a[i] % 4 == 3:
        odd = odd + 1
    elif a[i] % 4 == 0:
        zero = zero + 1
    else:
        two = two + 1
        
if zero >= odd -1 and two == 0:
    print('Yes')
elif zero >= odd:
    print('Yes')
else:
    print('No')
#ACB-136-B1

N = int(input())

str_N= str(N)

for i in range(1,N+1):
	if len(str(i)) % 2 ==1:
		ans +-1
print(ans)

### FIXED CODE ###

#ACB-136-B1

N = int(input())

str_N= str(N)
ans = 0
for i in range(1,N+1):
	if len(str(i)) % 2 ==1:
		ans +=1
print(ans)
N,Q = map(int, input().split())
ANS = (N-2)**2
R,C=N,N
RLEN=[]
CLEN=[]
for i in range(Q):
    RC,num = map(int, input().split())
    if RC==1:
        if R>num:
            for j in range(R-num-2):
                RLEN.append(C)
            ANS-=C-2
            R=num
        else:
            if len(RLEN)>0:
                ANS-=RLEN[N-num-1]-2
            else:
                ANS-=R-2
    else:
        if C>num:
            for j in range(C-num-2):
                CLEN.append(R)
            ANS-=R-2
            C=num
        else:
            if len(CLEN)>0:
                ANS-=CLEN[N-num-1]-2
            else:
                ANS-=C-2

print(ANS)



### FIXED CODE ###

N,Q = map(int, input().split())
ANS = (N-2)**2
R,C=N,N
RLEN=[]
CLEN=[]
for i in range(Q):
    RC,num = map(int, input().split())
    if RC==1:
        if R>num:
            for j in range(R-num):
                RLEN.append(C)
            ANS-=C-2
            R=num
        else:
            if len(RLEN)>0:
                ANS-=RLEN[N-num-1]-2
            else:
                ANS-=R-2
    else:
        if C>num:
            for j in range(C-num):
                CLEN.append(R)
            ANS-=R-2
            C=num
        else:
            if len(CLEN)>0:
                ANS-=CLEN[N-num-1]-2
            else:
                ANS-=C-2

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

parity = []
runlength = []

prev = S[0]
run = 0
for c in S:
    if c != prev:
        parity.append(bool(int(prev)))
        runlength.append(run)
        run = 0
    prev = c
    run += 1
parity.append(bool(int(prev)))
runlength.append(run)

if parity.count(False) <= K:
    print(N)
    quit()

argmax = 0
maximum = 0

L = len(parity)
for i in range(L):
    total = sum(runlength[max(0, i - 1): min(L, i + 2)])
    if not parity[i] and total > maximum:
        argmax = i
        maximum = total

while True:
    parity[argmax] = True
    runlength[argmax] = maximum
    del parity[argmax + 1]
    del parity[argmax - 1]
    del runlength[argmax + 1]
    del runlength[argmax - 1]

    K -= 1
    if not K:
        print(maximum)
        break

    L = len(parity)
    maximum = 0
    for i in [argmax - 2, argmax]:
        total = sum(runlength[max(0, i - 1): min(L, i + 2)])
        if total > maximum:
            argmax = i
            maximum = total

### FIXED CODE ###

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

offset = int(S[0]) == (K & 1)
runs = []

prev = S[0]
run = 0
for c in S:
    if c != prev:
        runs.append(run)
        run = 0
    prev = c
    run += 1
runs.append(run)

L = len(runs)
candidates = []

prev = sum(runs[max(0, offset - K): min(L, offset + K + 1)])
candidates.append(prev)

for i in range(offset + 2, L, 2):
    now = prev
    old_left = i - 2 - K
    new_right = i + K
    if old_left >= 0:
        now -= runs[old_left]
    if old_left + 1 >= 0:
        now -= runs[old_left + 1]
    if new_right - 1 < L:
        now += runs[new_right - 1]
    if new_right < L:
        now += runs[new_right]
    prev = now
    candidates.append(prev)

print(max(candidates))
N = int(input())

def main():
    ans = 1
    t = 0
    while t < N:
        t += 1
        ans *= t
        ans %= 1_000_000_007
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

N = int(input())

def main():
    ans = 1
    t = 0
    while t < N:
        t += 1
        ans *= t
        ans %= 1000000007
    print(ans)

if __name__ == '__main__':
    main()
import numpy as np
s = input()
y = 2019
dp = np.zeros(y, dtype="int64")
tmp = np.zeros(y, dtype="int64")
k = 1
r = 0
for c in s[::-1]:
    i = int(c)*k%y
    tmp[i:] = dp[:y-i]
    tmp[:i] = dp[-i:]
    tmp[i] += 1
    dp, tmp = tmp, dp
    r += dp[0]
    k *= 10
    k %= y
print(r) 1

### FIXED CODE ###

import numpy as np
s = input()
y = 2019
dp = np.zeros(y, dtype="int64")
tmp = np.zeros(y, dtype="int64")
k = 1
r = 0
for c in s[::-1]:
    i = int(c)*k%y
    tmp[i:] = dp[:y-i]
    tmp[:i] = dp[y-i:]
    tmp[i] += 1
    dp, tmp = tmp, dp
    r += dp[0]
    k *= 10
    k %= y
print(r)
line = input().split()
x = int(line[1])
ans = 0
 
a = sorted(input().split())
 
for i in len(a):
  map(int, a[i])
  if a[i] > x:
    print(ans)
    break
  else:
    x-=a[i]
    if i!=len(a)-1:
      ans+=1
    else:
      if x==0:
        ans+=1
      print(ans)

### FIXED CODE ###

line = input().split()
N = int(line[0])
x = int(line[1])
ans = 0

a = input().split()
a = [int(i) for i in a]
a.sort()

for i in range(N):
    if a[i] > x:
        print(ans)
        break
    else:
        x -= a[i]
        if i != (N - 1):
            ans += 1
        else:
            if x == 0:
                ans += 1
            print(ans)
import sys
N=input()

pow(N,3)

### FIXED CODE ###

import sys
N=int(input())

print(pow(N,3))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0


for i in range(n):
  if(b[i]<=a[i]):
    cnt+=b[i]
    a[i]-=b[i]
  elif(b[i]>a[i] and a[i]+a[i+1]>b[i]):
    cnt+=a[i]
    cnt+=b[i]-a[i]
    a[i+1]-=b[i]-a[i]
    a[i]=0
  else:
    cnt+=a[i]+a[i+1]
    a[i]=0
    a[i+1]=0
    
  print(a)
    
print(cnt)

### FIXED CODE ###

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


for i in range(n):
  if(b[i]<=a[i]):
    cnt+=b[i]
    a[i]-=b[i]
  elif(b[i]>a[i] and a[i]+a[i+1]>b[i]):
    cnt+=a[i]
    cnt+=b[i]-a[i]
    a[i+1]-=b[i]-a[i]
    a[i]=0
  else:
    cnt+=a[i]+a[i+1]
    a[i]=0
    a[i+1]=0
    
  #print(a)
    
print(cnt)
a,b=map(int,input().split())
print(6-a-b)

### FIXED CODE ###

a=int(input())
b=int(input())
print(6-a-b)