Harryxun/stf_run huggingface dataset:
H, W = list(map(int, input().split()))
s = [[c for c in input()] for _ in range(H)]
accept = True

def dfs(x, y, count):
    if  x < 0 or W <= x or y < 0 or H <= y:
        return count - 1
    elif s[y][x] != "#":
        return count - 1
    else:
        s[y][x] = "."
        return max(dfs(x-1, y, count+1), dfs(x+1, y, count+1), dfs(x, y-1, count+1), dfs(x, y+1, count+1))

for y in range(H):
    for x in range(W):
        if s[y][x] != "#":
            continue
        elif dfs(x, y, 0) == 0:
            accept = False

if accept:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

H, W = list(map(int, input().split()))
s = [[c for c in input()] for _ in range(H)]
accept = True

def dfs(x, y, count):
    if  x < 0 or W <= x or y < 0 or H <= y:
        return count - 1
    elif s[y][x] != "#":
        return count - 1
    else:
        s[y][x] = "."
        return max(dfs(x-1, y, count+1), dfs(x+1, y, count+1), dfs(x, y-1, count+1), dfs(x, y+1, count+1))

for y in range(H):
    for x in range(W):
        if s[y][x] != "#":
            continue
        elif dfs(x, y, 0) == 0:
            accept = False

if accept:
    print("Yes")
else:
    print("No")
def get_cost(arr, n, dp):
  if dp[n] != 0:
    return dp[n]
  if n == 1:
    dp[1] = abs(arr[1] - arr[0])
    return dp[1]
  if n == 0:
    dp[0] = 0
    return dp[0]
  dp[n] = min(
    abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp),
    abs(arr[n] - arr[n-2]) + get_cost(arr, n-2, dp)
  )
  return dp[n]


N = int(input())
arr = [int(num) for num in input().split()]
dp_arr = [0]*N
print(get_cost(arr, N-1, dp_arr))


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

def get_cost(arr, n, dp):
  if dp[n] != float('inf'):
    return dp[n]
  if n == 1:
    dp[1] = abs(arr[1] - arr[0])
    return dp[1]
  elif n == 0:
    dp[0] = 0
    return dp[0]
  else:
    dp[n] = min(
      abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp),
      abs(arr[n] - arr[n-2]) + get_cost(arr, n-2, dp)
    )
    return dp[n]


N = int(input())
arr = [int(num) for num in input().split()]
dp_arr = [float('inf')]*N
print(get_cost(arr, N-1, dp_arr))
M=10**9+7
k,n=int(input()),len(input())
a=t=pow(26,k,M)
for i in range(k):
  t=t*25*(i+n)*pow(26*-~i,-1,M)%M
  a+=t
print(a%M)

### FIXED CODE ###

M=10**9+7
k,n=int(input()),len(input())
a=t=pow(26,k,M)
for i in range(1,k+1):
  t=t*25*(i+n-1)*pow(26*i,-1,M)%M
  a+=t
print(a%M)
import itertools

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

sw = [[] for _ in range(M)]
for i in range(m):
    sw[i] = list(map(int,input().split()[1:])) #k不要
     
p = list(map(int,input().split()))

res = 0
for tpl in itertools.product([0,1],repeat=n):
    bl = True
    for i in range(m):
        s = sum([tpl[s-1] for s in sw[i]]) # 電球iを計算
        if (s-p[i])%2 != 0:
            bl = False
            break
    if bl:
        res += 1
print(res)

### FIXED CODE ###

import itertools

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

sw = [[] for _ in range(m)]
for i in range(m):
    sw[i] = list(map(int,input().split()[1:])) #k不要
     
p = list(map(int,input().split()))

res = 0
for tpl in itertools.product([0,1],repeat=n):
    bl = True
    for i in range(m):
        s = sum([tpl[s-1] for s in sw[i]]) # 電球iを計算
        if (s-p[i])%2 != 0:
            bl = False
            break
    if bl:
        res += 1
print(res)
n = int(input())
letters = [input() for _ in range(n)]

common = []

for item in letters[0]:
    if item in letters[1] and item in letters[2]:
        common.append(item)

if common == []:
    print()
else:
    b = sorted(common)
    ans = ""
    for i in range(n):
        ans = ans + b[i]
    print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())
letters = [input() for _ in range(n)]

cnt = Counter(letters[0])

for i in range(1,n):
    cnt = cnt & Counter(letters[i])

int_list = sorted(cnt.items(), key=lambda x:x[0])

ans = ""
for key, val in int_list:
    ans += key*val
print(ans)
line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]

print((N//X+1)*T)line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]

if N%X == 0:
	print((N//X)*T)
else:
    print((N//X+1)*T)
    

### FIXED CODE ###

line = [int(i) for i in input().rstrip().split()]
N = line[0]
X = line[1]
T = line[2]
 
if N%X == 0:
	print((N//X)*T)
else:
    print((N//X+1)*T)
import math
#minH=6deg/min
#HrH=30deg/hr=0.5degree/min
##angle by minH=6*M
##angle by HrH=30*H
##angle=abs(minH-HrH)
A,B,H,M=map(int,input().strip().split())
minH=6*M
HrH=0.5*(H*60+M)
Ang=abs(HrH-minH)
Ans=math.sqrt(A**2+B**2-2*A*B*math.cos((2*math.pi/180)*Ang))
Ans=str(Ans)
if "." in Ans:
  intg=Ans.split(".")[0]
  decimal=Ans.split(".")[1]
  if len(decimal)<9:
    	print(intg+"."+decimal+"0"*(9-len(decimal))
  else:
        print(intg+"."+decimal[:9])
else:
  print(Ans+"."+"0"*9)



### FIXED CODE ###

import math
#minH=6deg/min
#HrH=30deg/hr=0.5degree/min
    ##angle by minH=6*M
    ##angle by HrH=30*H
    ##angle=abs(minH-HrH)
A,B,H,M=map(int,input().strip().split())
minH=6*M
HrH=0.5*(H*60+M)
Ang=abs(HrH-minH)
#print(math.cos((math.pi/180)*Ang))
Ans=math.sqrt(A**2+B**2-2*A*B*math.cos((math.pi/180)*Ang))
Ans=str(Ans)
if "." in Ans:
    intg=Ans.split(".")[0]
    decimal=Ans.split(".")[1]
    if len(decimal)<9:
      print(intg+"."+decimal+"0"*(9-len(decimal)))
    else:
      print(intg+"."+decimal[:9])
else:
   print(Ans+"."+"0"*9)
n = list(input())
ans = 'No'
for i in range(len(n)):
  if n[i] = '7':
    ans = 'Yes'
    break
print(ans)


### FIXED CODE ###

n = list(input())
ans = 'No'
for i in range(len(n)):
  if n[i] == '7':
    ans = 'Yes'
    break
print(ans)
n=int(input())
s=input()
cnt=0
a=["R","G","B"]
for i in range(n):
    x=a.remove(s[i])
    for j in range(i+1,n):
        if s[i]!=s[j]:
            qw=s
            x.remove(s[j])
            k=j-1
            if j+k<n:
               qw[j+k]="P"
            q=x.pop(0)
            cnt+=qw.count(q)
print(cnt)

### FIXED CODE ###

n=int(input())
s=input()
B=s.count("B")
R=s.count("R")
G=s.count("G")
ans=R*G*B
for i in range(n-2):
    for j in range(i+1,n-1):
        k=j-i+j
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[i]!=s[k]:
                ans-=1
print(ans)
k=int(input())
mal=1
a=[]      
for i in range(1,k+1):
      n=int(input())
      a.append(n)      
for i in range(0,len(a)):
            mal=mal*a[i]
if(mal<=10**18):
    print(mal)
else:
    print(-1)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
r = int(input())
z = r*r*pi
l = 2*r*3.141529
print('{} {}'.format(z,l))

### FIXED CODE ###

from math import pi
r = float(input())
z = r*r*pi
l = 2*r*pi
print('{} {}'.format(z,l))
a = 0
for i in range(1,int(input())+1):
  a += 1/int(input())
a = 1/a
  

### FIXED CODE ###

a = 0
b = int(input())
c = list(map(int,input().split()))
for i in range(b):
  a += 1/c[i]
b = 1/a
print(b)
N,x,y=map(int,input().split())

tri=y-x+1
linear=x+N-y+1

nl=[0]*(N-1)
# triangle is gusu
if tri%2==0:
    # triangle
    for i in range(tri//2-1):
        nl[i]+=tri

    nl[i+1]+=tri//2

    # before,x,y,after
    for i in range(linear-1):
        if i==0:
            nl[i]+=min(0,linear-(i+1)-1)
        else:
            nl[i]+=linear-(i+1)
    
    # before,tri
    half_tri=(tri-2)//2
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

elif tri%2==1:
    # triangle
    for i in range(tri//2):
        nl[i]+=tri

    # before,x,y,after
    for i in range(linear-1):
        if i==0:
            nl[i]+=min(0,linear-(i+1)-1)
        else:
            nl[i]+=linear-(i+1)
    
    # before,tri
    half_tri=(tri-2)//2
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    
    half_tri=min(0,half_tri-1)
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind

    half_tri-=1
    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

for s in nl:
    print(s)




### FIXED CODE ###

N,x,y=map(int,input().split())

ln=[0]*(N-1)

for i in range(1,N+1):
    for j in range(i+1,N+1):
        d2=N
        d=j-i
        if j <= x:
            pass
        elif i<=x and j <=y:
            d2=y-j+1+x-i
        elif j<=y:
            d2=y-j+1+i-x
        elif i<=x and j>=y:
            d2=x-i+j-y+1
        elif j>=y:
            d2=j-y+1+i-x

        if d2 < d:
            d=d2
        
        ln[d-1]+=1

for i in ln:
    print(i)
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x]))

### FIXED CODE ###

import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))
judge=0
for i in range(1,4):
	if (A+B+i)*2==1:
      judge=1
if judge==1:
  print ("Yes")
else:
  print ("No")

### FIXED CODE ###

A, B = map(int, input().split())

judge=0
for C in range(1,4):
  if (A*B*C)%2==1:
    judge=1

if judge==1:
  print ("Yes")
else:
  print ("No")
import numpy as np
#from fractions import gcd
#from functools import reduce
import functools

MOD = 10**9+7


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

    x = 1
    ans = 0
    # for a in A:
    #     tmp = gcd(x, a)
    #     # ans += (i) * A[i] // tmp + A[i] * x //tmp  
    #     x = (x * a) // tmp
    x = functools.reduce(functools.gcd, A, 1)
        
    b = 0
    A = np.array(A)
    # for a in A:
    #     b += x // a
    b = np.sum(x//A, axis=0)
    print(b%MOD)
main()


### FIXED CODE ###

import fractions 
#from functools import reduce
import functools

MOD = 10**9+7


def main():
    # N = int(input())
    # A = list(map(int, input().split()))
    N, *A = map(int, open(0).read().split())
            
    x = 1
    for a in A:
        x *= a //  fractions.gcd(x, a)
        
    b = sum(x//a for a in A)
    print(b%MOD)
    
if __name__== "__main__":
    main()
# -*- coding: utf-8 -*-
import math
N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
maxavg = sum(V[:A])/A
print(maxavg)
min = V[A-1]
ltAnum = 0
minnum = 0
for i in range(N):
    if V[i] > min:
        ltAnum = ltAnum + 1
    elif V[i] == min:
        minnum = minnum + 1
    else:
        break
#print(ltAnum)
#print(minnum)

import math
def nCr(n,r):
    f = math.factorial
    return f(n)//f(r)//f(n-r)

c_min = 0
import itertools
if ltAnum > 0:
    c_min = nCr(minnum, A-ltAnum)
if ltAnum == 0:
    for j in range(A, B+1):
        if minnum < j:
            break
        else:
            c_min = c_min + nCr(minnum, j)
print(c_min)


### FIXED CODE ###

# -*- coding: utf-8 -*-
A, B = map(int, input().split())
print("%d" % ((A+B)%24))
s = input()
len_s = len(s)
if s[:int((len_ s -1 ) /2)] != s[int((len_ s -1 ) / 2 +1):]:
    print('No')
else:
    tmp = s[:int((len_ s -1 ) /2)]
    if len(tmp) == 1:
        print('Yes')
    else:
        if len(tmp ) %2 == 1:
            if tmp[:int((len(tmp) - 1) / 2)] == tmp[int((len(tmp) - 1) / 2 + 1):][::-1]:
                print('Yes')
            else:
                print('No')
        else:
            if tmp[:int(len(tmp) / 2)] == tmp[int(len(tmp) / 2):][::-1]:
                print('Yes')
            else:
                print('No')


### FIXED CODE ###


s = input()
len_s = len(s)
if s[:int((len_s-1) /2)] != s[int((len_s-1) / 2 +1):]:
    print('No')
else:
    tmp = s[:int((len_s -1 ) /2)]
    if len(tmp) == 1:
        print('Yes')
    else:
        if len(tmp ) %2 == 1:
            if tmp[:int((len(tmp) - 1) / 2)] == tmp[int((len(tmp) - 1) / 2 + 1):][::-1]:
                print('Yes')
            else:
                print('No')
        else:
            if tmp[:int(len(tmp) / 2)] == tmp[int(len(tmp) / 2):][::-1]:
                print('Yes')
            else:
                print('No')
import sys

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

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    icnt=0
    if mm==0:
      mm=1
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(600):
    if rf(m)>(n+k):
        lm=m
        m=(um+m)//2
    elif rf(m)<(n+k):
        um=m
        m=(lm+m)//2
    else:
#        print(m)
        break

for mi in range(m,0,-1):
    if rf(mi)!=(n+k):
        break
print(mi+1)



### FIXED CODE ###

import sys

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

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    if mm==0:
        mm=1
    icnt=0
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(60):
    if m==1:
        break
    if rf(m)<=(n+k) and rf(m-1)>(n+k):
        break
    if um-lm<5:
        break
    if rf(m)>(n+k):
        lm=m
        m=(um+lm)//2-1
    elif rf(m)<(n+k):
        um=m
        m=(um+lm)//2-1
    else:
        um=m-1
        m=(um+lm)//2-1
#    if rf(m)==(n+k) and um-lm<5:

if um<1:
    print(1)
    sys.exit()
    
for mi in range(um,max(0,lm-1),-1):
    if rf(mi)<=(n+k) and rf(mi-1)>(n+k):
        break

print(mi)
s, t = list(input().split()), list(input().split())
print(len([s[i] == t[i] for i in range(len(s))

### FIXED CODE ###

s, t = list(input()), list(input())
print(len([1 for i in range(len(s)) if s[i] == t[i]]))
s=input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)
minn_go  = int((maney%10000)/5000)
minn_sen = int((maney%5000)/1000)
flg = True
min_maisuu = minn_man+minn_go+minn_sen
if min_maisuu <= maisuu <= maney/1000:
	minn_go  = maney / 5000 +1
	minn_sen = maney / 1000 +1
	minn_man += 1

	for man in range(0,minn_man):
		for go in range(0,minn_go):
			for sen in range(0,minn_sen):
				if man+go+sen == maisuu:
					if man*10000+ go*5000 + sen*1000 == maney:
						print(str(man)+","+str(go)+","+str(sen))
						flg=False
if flg:
	print('-1,-1,-1')


### FIXED CODE ###

s=input()

data = s.split('/')
out = '2018/01/'+data[2]

print(out)
X, Y = map(int, input().split(" "))
print("<" if X < Y else "=" if X == Y else Y)


### FIXED CODE ###

X, Y = input().split(" ")
print("<" if X < Y else "=" if X == Y else ">")
n = input()
e = len(n)
totalList = []
for i in range(len(n)):
  totalList.append(n[i])
  
total = sum(totalList)
if(total == 0):
  print("Yes")
if(n % total == 0):
  print("Yes")
else:
  print("No")
  

  

### FIXED CODE ###

n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")
N = input()
nums = list(map(int, input().split()))
odd = []
even = []
for idx, num in enumerate(nums):
  if idx%2 == 0:
    even.append(num)
  else:
    odd.append(num)
if N%2 == 0:
  print(' '.join(even+odd))
else:
  print(' '.join(odd+even))

### FIXED CODE ###

N = int(input())
nums = list(input().split())
odd = []
even = []
for idx, num in enumerate(nums):
  if idx%2 == 0:
    even.append(num)
  else:
    odd.append(num)
if N%2 == 0:
  print(' '.join(odd[::-1]+even))
else:
  print(' '.join(even[::-1]+odd))
N=int(input())
n=len(str(N))
ans=0
for i in range(n):
  b=10**(n-i)
  a=N//b
  ans+=a
if 12%ans==0:
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

N = str(input())
SUM = 0
for i in N:
    SUM += int(i)
print('Yes') if int(N) % SUM == 0 else print('No')
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

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

k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print(cnt.sum() % MOD)


### FIXED CODE ###

N, K = map(int, input().split())
S1 = 0
S2 = 0
for k in range(1, N+1):
    S1 += k*N - k*(k-1) +1
    S1 %= 10**9 + 7
for k in range(1, K):
    S2 += k*N - k*(k-1) +1
    S2 %= 10**9 + 7
    
S = S1 - S2 + 1
S %= 10**9 +7

print(S)
from heapq import heappop,heappush
from collections import defaultdict
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab_sort = sorted(ab,key=lambda x:x[0])
h_queue = []
j = 0
ans = 0
for i in range(1,m+1):
    while (j < n) and (ab_sort[j] <= i):
        heappush(h_queue,ab_sort[j])
        j += 1
    if len(h_queue):
        ans -= heappop(h_queue)
print(ans)



### FIXED CODE ###

from heapq import heappop,heappush
from collections import defaultdict

n,m = map(int,input().split())
data = defaultdict(list)
for _ in range(n):
    a,b = map(int,input().split())
    data[a].append(b)

ans = 0
h_queue =[]
for i in range(1,m+1):
    for j in data[i]:
        heappush(h_queue,-j)
    if len(h_queue) > 0:
        ans -= heappop(h_queue)

print(ans)
N = int(input())
a = list(map(int,input().split()))
b = a
c= a[1]^a[2]
S = 0
for i in range(N):
	S = S^a[i]

for i in range(N):
	b[i] = S^a[i]

print(*b)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
b = a
S = 0
for i in range(N):
	S = S^a[i]

for i in range(N):
	b[i] = S^a[i]

print(*b)
import sys
input = sys.stdin.readline
H, W, h, w = map(int, input().split())
unit = 10 ** 9 - 1
c = H * W
for i in range(h - 1, H, h):
  for j in range(w - 1, W, w): c -= 1
res = [[unit // c] * W for _ in range(H)]
for i in range(h - 1, H, h):
  for j in range(w - 1, W, w): res[i][j] = -(unit // c * (h * w - 1) + 1)
if sum([sum(r) for r in res]) > 0:
  print("Yes")
  for r in res: print(*r)
else: print("No")

### FIXED CODE ###

import sys
input = sys.stdin.readline
H, W, h, w = map(int, input().split())
unit = 10 ** 9 - 1
c = H * W
for i in range(h - 1, H, h):
  for j in range(w - 1, W, w): c -= 1
if c == 0:
  print("No")
  exit(0)
res = [[unit // c] * W for _ in range(H)]
for i in range(h - 1, H, h):
  for j in range(w - 1, W, w): res[i][j] = -(unit // c * (h * w - 1) + 1)
if sum([sum(r) for r in res]) > 0:
  print("Yes")
  for r in res: print(*r)
else: print("No")
N = int(input())

C = input()
firstW = -1
for i in range(N):
    if C[i] == "W":
        firstW = i
        break
for i in range(N-1,-1,-1):
    if C[i] == "R":
        firstR = i
        break

def checkR(ri,wi):
    for i in range(ri,wi,-1):
        if C[i] == "R":
            return i
    else:
        return -1
def checkW(ri,wi):
    for i in range(wi,ri):
        if C[i] == "W":
            return i
    else:
        return -1


if firstW == -1 or firstW == N-1:
    print(0)
else:
    ri = firstR
    wi = firstW
    cnt = 0
    while 1:
        wi = checkW(ri,wi+1)
        ri = checkR(ri-1,wi)
        if wi == -1 or ri == -1:
            break
        cnt += 1
    print(cnt+1)


        


### FIXED CODE ###

N = int(input())

C = input()
firstW = -1
for i in range(N):
    if C[i] == "W":
        firstW = i
        break
for i in range(N-1,-1,-1):
    if C[i] == "R":
        firstR = i
        break

def checkR(ri,wi):
    for i in range(ri,wi,-1):
        if C[i] == "R":
            return i
    else:
        return -1

def checkW(ri,wi):
    for i in range(wi,ri):
        if C[i] == "W":
            return i
    else:
        return -1


if len(set(C)) == 1:
    print(0)
elif firstW > firstR:
    print(0)
else:
    ri = firstR
    wi = firstW
    cnt = 0
    while 1:
        wi = checkW(ri,wi+1)
        ri = checkR(ri-1,wi)
        if wi == -1 or ri == -1:
            break
        cnt += 1
    print(cnt+1)
# -*- coding: utf-8 -*-

for line in sys.stdin.readlines():
    a, b = map(int, line.strip().split())
    n = a + b
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
    print ans

### FIXED CODE ###

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

import sys

for line in sys.stdin.readlines():
    a, b = map(int, line.strip().split())
    n = a + b
    ans = 1
    while(n >= 10):
        n /= 10
        ans += 1
    print ans
import sys
def input():
    return sys.stdin.readline()[:-1]

import collections

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

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n
#n/2回ループ
for i in range(n//2):
    if len(ls) == 1 and dic[ls[0]] == 2:
        ans -= 2
        dic[ls[0]] -= 1
        break
    else:
        if len(ls) == 1:
            dic[ls[0]] -= 2
        else:
            dic[ls[0]] -= 1
            dic[ls[-1]] -= 1
        ans -= 2

    if len(ls) > 1:
        if dic[ls[-1]] <= 1:
            ls.pop()
    if dic[ls[0]] <= 1:
        ls.popleft()

    if len(ls) == 0:
        break
print(ans)


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

import collections

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

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n
if len(ls) > 0:
#n/2回ループ
    for i in range(n//2):
        if len(ls) == 1 and dic[ls[0]] == 2:
            ans -= 2
            dic[ls[0]] -= 1
            break
        else:
            if len(ls) == 1:
                dic[ls[0]] -= 2
            else:
                dic[ls[0]] -= 1
                dic[ls[-1]] -= 1
            ans -= 2

        if len(ls) > 1:
            if dic[ls[-1]] <= 1:
                ls.pop()
        if dic[ls[0]] <= 1:
            ls.popleft()

        if len(ls) == 0:
            break
print(ans)
N = int(input())
a = 1
for i in range(N):
  a *= int(input())
if a > 10 ** 18:
  print(-1)
else:
  print(a)

### FIXED CODE ###

N = int(input())
li = input().split()
a = 1
sikataganai = False
try:
  h = li.index('0')
  print(0)
  sikataganai = True
except:
  for i in range(N):
    a *= int(li[i])
    if a > 10 ** 18:
      print(-1)
      exit()
  if not sikataganai :
    print(a)
k, n = [int(x) for x input().split()]

if k*500 >= n:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

k, n = [int(x) for x in input().split()]

if k*500 >= n:
  print("Yes")
else:
  print("No")
#AとBの最大公約数を素因数分解してから考える。
from fractions import gcd
a,b = map(int,input().split())
g = gcd(a,b)
#gを素因数分解し、素因数のセットを作る。
s = set([1,g])
for i in range(2,int(-(-g**0.5//1)+1)):
  flag = True
  while flag:
    if g%i==0:
      if len(l1) == 0 or l1[-1] != i:
        s.add(i)
      g=g//i
    else:
      flag = False
print(len(s))

### FIXED CODE ###

#AとBの最大公約数を素因数分解してから考える。
from fractions import gcd
a,b = map(int,input().split())
g = gcd(a,b)
#gを素因数分解し、素因数のセットを作る。
s = set([1])
for i in range(2,int(-(-g**0.5//1)+1)):
  flag = True
  while flag:
    if g%i==0:
      s.add(i)
      g=g//i
    else:
      flag = False
s.add(g)
print(len(s))
n=int(input())
a=list(map(int,input().split()))
#print(n)
#print(a)
count=0
flag=True
while(flag):
    flag=False
    for i in range(n):
        if(a[i]%2==0):
            #print(i)
            #a=list(map(lambda x:x*3,a))
            a[i]=int(a[i]/2)
            #print(a)
            count+=1
            flag=True
            break
print(count)

### FIXED CODE ###

a,b = map(int,input().split())
#if((a<0 or a>16) or (b<0 or b>16) or (a+b>16)):
    #print("error\n")
count=16
flag=False
pic=0 # 0=a,1=b
while(count>0):
    if(pic==0):
        a-=1
        count-=1
        pic=1    
    elif(pic==1):
        pic=0
        b-=1
        count-=1
    if(a<=0 and b<=0):
        flag=True
        break
if(flag==True):
    print("Yay!")
else:
    print(":(")
import numpy as np
import sys
L,R = map(int,input().split())
a = np.zeros(R-L+1,dtype="int64")
b = 2018
if R - L >= 2018:
  print("0")
  sys.exit()
else:
  for i in range (L,R+1):
    for j in range (L+1,R+1):
      x = (i * j) % 2019
      b = min(b,x)
  print(b)

### FIXED CODE ###

L, R = map(int,input().split())
b = 2018
if R - L >= 2019:
  print(0)
else:
  L = L % 2019
  R = R % 2019
  for i in range(L, R):
    for j in range(i + 1, R + 1):
      if b > (i * j) % 2019:
        b = (i * j) % 2019
  print(b)