Harryxun/stf_run huggingface dataset:
A,B = map(int,input().split())
N = 100

def printAns(ans):
	h = len(ans)
	w = len(ans[0])
	print(h, w)
	for l in ans:
		print(''.join(l))

if A <= B:
	minority = '.'
	majority = '#'
else:
	A,B = B,A
	minority = '#'
	majority = '.'

diff = abs(A-B)
if B <= N:
	ans = [[majority if (i+j) % 2 == 0 else minority for i in range(B)] for j in range(2)]
	a,b = B,B
	endsWithMajor = B % 2 == 0
	cnt = 1
	while a > A:
		if endsWithMajor:
			ans[1][-(2*cnt - 1)] = minority
			if cnt == 1:
				a -= 1
				b -= 1
			else:
				a -= 2
				b -= 1
		else:
			ans[1][-(2*cnt)] = minority
			a -= 2
			b -= 1
		cnt += 1
	ans.append([majority] * B)
	ans.append([minority] * B)
	while a < A:
		ans.append([majority] * B)
		ans.append([minority] * B)
		a += 1
		b += 1
	index = len(ans) - 1
	for i in range(diff // ((B+1) // 2) + 1):
		app = [minority for i in range(B)]
		for j in range((B+1) // 2):
			if b < B:
				app[2*j] = majority
				b += 1
		ans.append(app)
		ans.append([minority] * B)
		if b == B:
			break

else:
	ans = []
	a,b =0, 0
	for i in range(A // N + 1):
		ans.append([majority if (j + 0) % 2 == 0 else minority for j in range(N)])
		ans.append([majority if (j + 1) % 2 == 0 else minority for j in range(N)])
		a += N
		b += N

	endsWithMajor = N % 2 == 0
	cnt = 1
	index = len(ans) - 1
	while a > A:
		if endsWithMajor:
			ans[index][-(2*cnt - 1)] = minority
			if cnt == 1:
				a -= 1
				b -= 1
			else:
				a -= 2
				b -= 1
		else:
			ans[index][-(2*cnt)] = minority
			a -= 2
			b -= 1
		cnt += 1
	while a < A:
		ans.append([majority] * N)
		ans.append([minority] * N)
		a += 1
		b += 1
	index = len(ans) - 1
	for i in range(diff // (N // 2) + 1):
		app = [minority for i in range(N)]
		for j in range((N+1) // 2):
			if b < B:
				app[2*j] = majority
				b += 1
		ans.append(app)
		ans.append([minority] * N)
		if b == B:
			break
printAns(ans)




### FIXED CODE ###

# coding: utf-8
# Your code here!
A,B = map(int,input().split())
h,w = 100, 100
grid = [['.' if j < 50 else '#' for i in range(w)] for j in range(h)]
A -= 1
B -= 1
reg = ['.' if i % 2 == 0 else '#' for i in range(w)]
for i in range(25):
    if B >= 50:
        grid[i*2] = reg
        B -= 50
    else:
        for j in range(B):
            grid[i*2][j*2] = '#'
        break
for i in range(25):
    if A >= 50:
        grid[99 - i*2] = reg
        A -= 50
    else:
        for j in range(A):
            grid[99 - i*2][j*2] = '.'
        break
print(h,w)
for row in grid:
    print(''.join(row))
while 1:
     x, y = map(int, raw_input().split())
     if x == 0 and y == 0:
         break
     else:
         if x > y:
          print '%s %s' % (y,x)
         else:
          print '%s %s' % (x,y)
    

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
a, b = int(input().split())
print(a*b)

### FIXED CODE ###

a, b = list(map(int, input().split()))
print(a*b)
A=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
   'P','Q','R','S','T','U','V','W','X','Y','Z']
N=int(input())
X=input()
for i in range(0,len(X)-1):
  n=(A.index(X[i])+N)%26
  X[i]=A[n]
print(X)

### FIXED CODE ###

A=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
   'P','Q','R','S','T','U','V','W','X','Y','Z']
N=int(input())
x=input()
X=[j for j in x]
for i in range(0,len(X)):
  n=(A.index(X[i])+N)%26
  X[i]=A[n]
Y=''
for i in X:
  Y+=i
print(Y)
def is_valid():
    x_removed_S = S.replace("x", "")
    M = len(x_removed_S)
    for i in range(M // 2):
        if x_removed_S[i] != x_removed_S[M - i - 1]:
            return False
    return True


S = input()
N = len(S)
if is_valid():
    ans = 0
    left, right = 0, N - 1
    while left != right:
        if S[left] == S[right]:
            left += 1
            right -= 1
            continue
        elif S[left] == "x":
            ans += 1
            left += 1
        else:
            ans += 1
            right -= 1
    print(ans)
else:
    print(-1)


### FIXED CODE ###

def is_valid():
    x_removed_S = S.replace("x", "")
    M = len(x_removed_S)
    for i in range(M // 2):
        if x_removed_S[i] != x_removed_S[M - i - 1]:
            return False
    return True


S = input()
N = len(S)
if is_valid():
    ans = 0
    left, right = 0, N - 1
    while left < right:
        if S[left] == S[right]:
            left += 1
            right -= 1
            continue
        elif S[left] == "x":
            ans += 1
            left += 1
        else:
            ans += 1
            right -= 1
    print(ans)
else:
    print(-1)
C = [input().split() for i in range(2)]
if (C[0][0] == C[1][2]) and (C[0][1] == C[1][1]) and (C[0][2] == C[1][0]):
  print('YES')
else:print('NO')

### FIXED CODE ###

import sys
C = [[str(c) for c in l.strip()] for l in sys.stdin]
if (C[0][0] == C[1][2]) and (C[0][1] == C[1][1]) and (C[0][2] == C[1][0]):
  print('YES')
else:print('NO')
S = input()

if S == ("SUN"):
    pritn(7)
elif S == ("MON"):
    print(6)
elif S == ("TUE"):
    print(5)
elif S == ("WED"):
    print(4)
elif S == ("THU"):
    print(3)
elif S == ("FRI"):
    print(2)
elif S == ("SAT"):
    print(1)

### FIXED CODE ###

S = input()

if S == ("SUN"):
    print(7)
elif S == ("MON"):
    print(6)
elif S == ("TUE"):
    print(5)
elif S == ("WED"):
    print(4)
elif S == ("THU"):
    print(3)
elif S == ("FRI"):
    print(2)
elif S == ("SAT"):
    print(1)
s=input()
n=len(s)
print(min((abs(753-int(s[i:i+3])) for i in range(n-2)))

### FIXED CODE ###

s=input()
n=len(s)
print(min((abs(753-int(s[i:i+3])) for i in range(n-2))))
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


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

    print(algorithm(N, A))


def algorithm(N, A):
    gcdList = [0] * N
    for i in range(N):
        copy_A = A.copy()
        copy_A.pop(i)
        gcdList[i] = gcd_list(copy_A)

    return max(gcdList)
problem()

### FIXED CODE ###

from functools import reduce
import fractions


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

    print(algorithm(N, A))


def algorithm(N, A):
    if N == 0:
        return 0
    if N == 1:
        return A[0]
    if N == 2:
        return max(A[0],A[1])

    L_i = 0
    R_i = [0] * N
    R_i[N - 1] = A[N - 1]
    R_i[N-2] = fractions.gcd(A[N-1], A[N-2])
    
    for i in range(3,N):
        R_i[N - i] = fractions.gcd(R_i[N - i + 1], A[N - i])

    maxGCD = R_i[1]
    for i in range(1, N-1):
        L_i = fractions.gcd(L_i, A[i - 1])
        tmp = fractions.gcd(L_i, R_i[i+1])
        if tmp > maxGCD:
            maxGCD = tmp

    L_i = gcd_list(A[:N-1])
    if L_i > maxGCD:
        maxGCD = L_i
    return maxGCD

problem()
import numpy as np

[H, W, M] = map(int, input().split())
mp = np.zeros((H+1, W+1), dtype=np.int64)
#for i in range(M):
#    [h, w] = map(int, input().split())
#    mp[h][w] = 1

#colsum = np.sum(mp, axis=0)
#rowsum = np.sum(mp, axis=1)

#maxcol = max(colsum)
#maxrow = max(rowsum)

#colchk = np.where(colsum==maxcol)
#rowchk = np.where(rowsum==maxrow)

#for i in range(len(rowchk[0])):
#    for j in range(len(colchk[0])):
#        if mp[rowchk[0][i]][colchk[0][j]] == 0:
#            print(int(max(colsum)+max(rowsum)))
#            quit()

#print(int(max(colsum)+max(rowsum))-1)


### FIXED CODE ###

import numpy as np

[H, W, M] = map(int, input().split())
colsum = np.zeros(W+1)
rowsum = np.zeros(H+1)
bombs = []
rowbombs = [set() for i in range(H+1)]
for i in range(M):
    [h, w] = map(int, input().split())
    rowsum[h] += 1
    colsum[w] += 1
    bombs.append([h, w])
    rowbombs[h].add(w)

maxcol = max(colsum)
maxrow = max(rowsum)

colchk = np.where(colsum==maxcol)
rowchk = np.where(rowsum==maxrow)

for i in range(len(rowchk[0])):
    for j in range(len(colchk[0])):
        if colchk[0][j] not in rowbombs[rowchk[0][i]]:
            print(int(max(colsum)+max(rowsum)))
            quit()

print(int(max(colsum)+max(rowsum))-1)
N, M = map(int, input().split())
A = [int(_) for _ in input().split()]

while M != 0:
  ind = A.index(max(A))
  A[ind] = A[ind] // 2
  M -= 1
  
print(sum(A))

### FIXED CODE ###

S = input()
ans_list = ["Sunny", "Cloudy", "Rainy", "Sunny"]
for i in range(3):
  if S == ans_list[i]:
    ans = ans_list[i+1]

print(ans)
n=int(input())
l=[]
r=[]
for i in range(n):
    a,b=map(int,input().split())
    r.append(a)
    l.append(b)
m=max(l)
s=sum(r)
if s<m:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=str(input())
c=0
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        c+=1
if c:
    print("Bad")
else:
    print("Good")
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    M,K=MI()
    N=pow(2,M)
    if K>=N:
        print(-1)
        exit()
    elif M==1 and K==0:
        print(0,0,1,1)
    else:
        ans=[]
        temp=0
        for i in range(N):
            if i!=K:
                ans.append(i)
                temp=temp^i
        ans.append(K)
        for i in range(N2-1,-1,-1):
            if i!=K:
                ans.append(i)
        ans.append(K)
        if temp!=K:
            print(-1)
        else:
            print(' '.join(map(str, ans)))        

                

main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    M,K=MI()
    N=pow(2,M)
    
    if K>=N or (M==1 and K==1):
        print(-1)
    elif M==1 and K==0:
        print(0,0,1,1)
    else:
        from collections import deque
        dq=deque()
        dq.append(K)
        for i in range(N):
            if i!=K:
                dq.append(i)
                dq.appendleft(i)
        dq.append(K)
        
        ans=[]
        while len(dq)!=0:
            ans.append(dq.pop())
        print(' '.join(map(str, ans)))
    

                

main()
a, b = map(int,input())
if a + b >= 10:
  print('error')
else:
  print(a+b)


### FIXED CODE ###

a, b = map(int,input().split())
if a + b >= 10:
  print('error')
else:
  print(a+b)
n = input()
a = input()
if (n % 500) <= a:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
A = int(input())
if N % 500 <= A :
  print('Yes')
else :
  print('No')
l = list(map(int(input(), 16).split))

if l[0] < l[1]:
  print("<")
elif l[0] = l[1]:
  print ("=")
elif l[0] > l[1]:
  print(">")


### FIXED CODE ###

l = input().split()
l2 = [int(s, 16) for s in l]

if l2[0] < l2[1]:
  print("<")
elif l2[0] == l2[1]:
  print ("=")
elif l2[0] > l2[1]:
  print(">")
width = float(input('Please Enter the Width of a Rectangle: '))
height = float(input('Please Enter the Height of a Rectangle: '))
# calculate the area of rectangle
Area = width * height

# calculate the Perimeter
Perimeter = 2 * (width + height)

print("\n Area of a Rectangle is: %.2f" %Area)
print(" Perimeter of Rectangle is: %.2f" %Perimeter)


### FIXED CODE ###

def areaRectangle(a, b): 
    return (a * b) 
  
def perimeterRectangle(a, b): 
    return (2 * (a + b)) 
  
a,b = map(int, input().split())
print ( areaRectangle(a, b),perimeterRectangle(a, b))
n = int(input())
table = list(map(int,input().split()))
table.sort()
count = 0
for i in range(n):
    if i%2 = 0:
        count += table[i]
    else:
        pass
print(count)

### FIXED CODE ###

n = int(input())
table = list(map(int,input().split()))
table.sort()
count = 0
for i in range(2*n):
    if i%2 == 0:
        count += table[i]
    else:
        pass
print(count)
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    X = input()
    XINT = int(X,2)
    ANS = [0]*N
    TEMP = [0]*N
    CHAIND = [0]*N


    cnt = count_ones_by_bitmask(XINT)
    
    if cnt == 0:
        for i in range(N):
            print(1)
            return
    
    bit = 1
    p = XINT % (cnt+1)
    m = 0
    if cnt != 1 :
        m = XINT % (cnt-1)
    pmod = 1
    mmod = 1
    for i in range(N):
        if not (cnt ==1 and X[N-i-1]=='1'):
            ANS[i] = 1
            if (X[N-i-1] == '0'):
                TEMP[i] = (p + pmod) % (cnt+1)
            else:
                TEMP[i] = (m - mmod) % (cnt-1)
        pmod = (pmod*2) % (cnt+1)
        mmod = (mmod*2) % (cnt-1)


    CHA = list(set(TEMP))

    for i in range(len(CHA)):
        an = 0
        cha = CHA[i]
        cnt = count_ones_by_bitmask(CHA[i])
        while cnt>0:
            an += 1
            cha = cha%cnt
            cnt = count_ones_by_bitmask(cha)
        CHAIND[CHA[i]] = an

    for i in reversed(range(N)):
        print(ANS[i]+CHAIND[TEMP[i]])




def count_ones_by_bitmask(num):
    count = 0
    while num:
        count += num & 1
        num >>= 1
    return count

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    X = input()
    XINT = int(X,2)
    ANS = [0]*N
    TEMP = [0]*N
    CHAIND = [0]*N

    cnt = count_ones_by_bitmask(XINT)
    
    if cnt == 0:
        for i in range(N):
            print(1)
            return
    if cnt ==1:
        for i in  range(N):
            if X[i] == '1':
                print(0) #全てが0になる
            else:
                if i==N-1:
                    print((int(X[N-1])+1)%2+1) # 2の剰余の反転
                else:
                    print((int(X[N-1]))%2+1) # 2の剰余
        return

    p = XINT % (cnt+1)
    m = XINT % (cnt-1)
    pmod = 1
    mmod = 1
    for i in range(N):
        ANS[i] = 1
        if (X[N-i-1] == '0'):
            TEMP[i] = (p + pmod) % (cnt+1)
        else:
            TEMP[i] = (m - mmod) % (cnt-1)
        pmod = (pmod*2) % (cnt+1)
        mmod = (mmod*2) % (cnt-1)


    CHA = list(set(TEMP))

    for i in range(len(CHA)):
        an = 0
        cha = CHA[i]
        cnt = count_ones_by_bitmask(CHA[i])
        while cnt>0:
            an += 1
            cha = cha%cnt
            cnt = count_ones_by_bitmask(cha)
        CHAIND[CHA[i]] = an

    for i in reversed(range(N)):
        print(ANS[i]+CHAIND[TEMP[i]])


def count_ones_by_bitmask(num):
    count = 0
    while num:
        count += num & 1
        num >>= 1
    return count

if __name__ == '__main__':
    main()
x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
Pl = 0
Ql = 0

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

while P[-1 - Pl] < R[0] or Q[-1 - Ql] < R[0]:
    if Q[-1 - Ql] >= P[-1 - Pl]:
        P[-1 - Pl] = R.pop(0)
        #P.sort(reverse = True)
        Pl = Pl + 1
    else:
        Q[-1 - Ql] = R.pop(0)
        #Q.sort(reverse=True)
        Ql = Ql + 1

    if R == []:
        break

print(sum(P) + sum(Q))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
Pl = 0
Ql = 0
Rb = 0

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]):
#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]) and (Pl != len(P) or Ql != len(Q)):
while Pl != len(P) or Ql != len(Q):
    if Pl == len(P):
        if Q[-1 - Ql] < R[0 + Rb]:
            Q[-1 - Ql] = R[0 + Rb]
            Ql = Ql + 1
        else:
            break
    elif Ql == len(Q):
        if P[-1 - Pl] < R[0 + Rb]:
            P[-1 - Pl] = R[0 + Rb]
            Pl = Pl + 1
        else:
            break

    elif Q[-1 - Ql] >= P[-1 - Pl] and P[-1 - Pl] < R[0 + Rb]:
        P[-1 - Pl] = R[0 + Rb]
        Pl = Pl + 1
    elif P[-1 - Pl] > Q[-1 - Ql] and Q[-1 - Ql] < R[0 + Rb]:
        Q[-1 - Ql] = R[0 + Rb]
        Ql = Ql + 1

    else:
        break

    Rb = Rb + 1
    if Rb == len(R):
        break

print(sum(P) + sum(Q))
import sys

s=string(input())

for i in range(len(s)-1):
  if s[i]=="h" and s[i+1]=="i":
    print("Yes")
    sys.exit()
print("No")


### FIXED CODE ###

s=str(input())

if s=="hi" or s=="hihi" or s=="hihihi" or s=="hihihihi" or s=="hihihihihi":
  print("Yes")
else:
  print("No")
a, b, x, y = map(int, input().split())
ans = double(a)*double(b) / 2.0
if(x + x == a and y + y == b):
    num = 1
else:
    num = 0

print(ans, num)


### FIXED CODE ###

a, b, x, y = map(int, input().split())
ans = float(a)*float(b) / 2.0
if(x + x == a and y + y == b):
    num = 1
else:
    num = 0

print(ans, num)
x, n = map(int, input().split())
if n!=0:
    p = input().split()
    p = [int(i) for i in p]

if not(x in p):
    print(x)
else:
    for i in range(101):
        if not(x-i in p):
            print(x-i)
            break
        elif not(x+i in p):
            print(x+i)
            break

### FIXED CODE ###

x, n = map(int, input().split())
if n==0:
    print(x)
else:
    p = input().split()
    p = [int(i) for i in p]
    if not(x in p):
        print(x)
    else:
        for i in range(101):
            if not(x-i in p):
                print(x-i)
                break
            elif not(x+i in p):
                print(x+i)
                break
            else:
                continue
n=int(input())
h=list(map(int,input().split()))
li=[]
for i in range(n-1):
  if h[i]<h[i+1] or i==n-2:
    s=i-sum(li)
    li = li + [s]
print(max(li))

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
li=[0]
while len(h)>1:
  for i in range(len(h)):
    if i==len(h)-1:
      li += [len(h)-1]
      del h[1:]
    elif h[i]<h[i+1]:
      li += [len(h[0:i+1])-1]
      del h[0:i+1]
      break
print(max(li))
n=input()
a,b=map(int,input().split())
if n=="1":
  print("Hello World")
else:
  print(a+b)

### FIXED CODE ###

n=int(input())
if n==1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
a,b=int(input().split())
cnt = 1
b -= a
while True:
  if b > 0:
  	b -= (a - 1)
    cnt += 1
  else:
    break
print(cnt)

### FIXED CODE ###

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

if b == 1:
  print('0')
else:
  cnt = 1
  b -= a
  while True:
    if b > 0:
      b -= (a - 1)
      cnt += 1
    else:
      print(cnt)
      break
S = raw_input()
lst = []
for i in range(0, 26):
	lst.append(True)

for i in range(0, len(S)):
	lst[ord(S[i])-141] = False

flag = True
for i in range(0, 26):
	if lst[i]:
		print chr(i+141)
		flag = False
		break

if flag:
	print 'None'

### FIXED CODE ###

S = raw_input()
lst = []
for i in range(0, 26):
	lst.append(True)

for i in range(0, len(S)):
	lst[ord(S[i])-97] = False

flag = True
for i in range(0, 26):
	if lst[i]:
		print chr(i+97)
		flag = False
		break

if flag:
	print 'None'
N,M = map(int,input().split())
S = input()
N0 = 2**(N-1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(2*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(2*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
S = input()
N0 = 2**(N-1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(3*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(3*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(max(0,n-M+1),n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

A = [ [0 for _ in range(N)] for _ in range(N) ]
visited = [False] * N

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

#print(A)

def dfs(node, count):
    if all(visited):
        return count+1

    for i in range(M):
        if A[node][i] == 0:
            continue
        if visited[i]:
            continue

        visited[i] = True
        count = dfs(i, count)
        visited[i] = False

    return count


visited[0] = True
count = dfs(0, 0)
print(count)

### FIXED CODE ###


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

# N = 頂点の数(= 数字の数)
# M = 辺の数(= aの行数)

N, M = map(int, input().split())
graph = [ [0 for _ in range(N)] for _ in range(N) ]
visited = [False] * N

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

#print(graph)

# u は 0-index
def dfs(u):
    visited[u] = True
    if False in visited:
        pass
    else:
        return 1

    count = 0
    for i in range(N):
        if graph[u][i] == False: continue
        if visited[i]: continue

        visited[i] = True
        count += dfs(i)
        visited[i] = False

    return count

count = dfs(0)
print(count)
N, Q = input().split()
S = input()
for i in range(int(Q)):
    l, r = (int(x) for x in input().split())
    sub_S = S[l-1:r]
    count = 0
	print('test')

### FIXED CODE ###

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

AC_appearance = [0] * len(S)
counter = 0
for i in range(1, len(S)):
    if S[i-1] == 'A' and S[i] == 'C':
        counter += 1
    AC_appearance[i] = counter 

for i in range(Q):
    l, r = map(int, input().split())
    l = l - 1
    r = r - 1
    print(AC_appearance[r] - AC_appearance[l])
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
s = [0] * n
for i in sc:
    s[i[0]-1] = str(i[1])
ans = ""
first = True
for i in s:
    if i == 0 and first and len(s) != 1:
        ans += str(1)
        first = False
        continue
    ans += str(i)
if len(ans) != len(str(int(s))):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
if n == 3:
    l = range(100, 1000)
if n == 2:
    l = range(10, 100)
if n == 1:
    l = range(0, 10)
flag = False
for i in l:
    num = str(i)
    if all([num[s-1] == str(c) for s, c in sc]):
        #print(num)
        #exit()
        flag = True
        ans = num
        break
if flag:
    print(num)
else:
    print(-1)
#print(-1)
import math
A,H=input().split()
print(math.ceil(H/A))


### FIXED CODE ###

import math
H,A=(float(x) for x in input().split())
print(math.ceil(H/A))
a=int(input())
for x in range(int(a**0.5),0,-1)
	if a%x==0:
    s=a+x-2
    break
print(s)

### FIXED CODE ###

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