Harryxun/stf_run huggingface dataset:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import defaultdict
from collections import deque
import bisect
from decimal import *
from functools import reduce
def main():
    def comb(n, r):
        numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
        denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])
        return numerator * pow(denominator, mod - 2, mod) % mod
    S = I()
    mod = 10 ** 9 + 7
    N = S // 3
    ans = 0
    for i in range(1, N + 1):
        x = S - 3 * i
        ans += comb(x + i - 1, x)
        ans %= mod
    print(ans)
if __name__ == "__main__":
    main()



### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import defaultdict
from collections import deque
import bisect
from decimal import *
from functools import reduce
def main():
    def comb(n, r):
        if r == 0:
            return 1
        else:
            numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
            denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])
            return numerator * pow(denominator, mod - 2, mod) % mod
    S = I()
    mod = 10 ** 9 + 7
    N = S // 3
    ans = 0
    for i in range(1, N + 1):
        x = S - 3 * i
        ans += comb(x + i - 1, i - 1)
        ans %= mod
    print(ans)
if __name__ == "__main__":
    main()
# OLE?
a = input()
b = input()

### FIXED CODE ###

a, b = map(int, input().split())
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")
n = int(input())
a = 1
for i range in (n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    


### FIXED CODE ###

n = int(input())
for i in range(1, n+1):
    if i%3 == 0 :
        print(' {}'.format(i),end='')

    elif '3' in str(i):
        print(' {}'.format(i),end='')
print()
N=int(input())
t=[[int(x) for x in input().split()] for i in range(0,N)]

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N+1):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 or ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))

### FIXED CODE ###

N=int(input())
t=[[int(x) for x in input().split()] for i in range(0,N)]

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 or ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))
from collections import deque
h,w=list(map(int, input().split()))
s = [input() for _ in range(h)]

water=[[0]*w for _ in range(w)]
water[0][0]=0
a_index=[]
a_column=[]
a_index.append(0)
a_column.append(0)
b=[]
count=0
flag=True
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            water[i][j]=3000
            count+=1
while water[h-1][w-1]==0:
    for i,j in zip(a_index,a_column):
        if water[i][j]==1:
            if i>0:
                if water[i-1][j]==0:
                    water[i-1][j]+=1
                    b.insert(0,[i-1,j])
            if i<h-1:
                if water[i+1][j]==0:
                    water[i+1][j]+=1
                    b.insert(0,[i+1,j])
            if j>0:
                if water[i][j-1]==0:
                    water[i][j-1]+=1
                    b.insert(0,[i,j-1])
            if j<w-1:
                if water[i][j+1]==0:
                    water[i][j+1]+=1
                    b.insert(0,[i,j+1])
        water[i][j]+=1
    a_index+=[x[0] for x in b]
    a_column+=[x[1] for x in b]
    if not b:
        flag=False
        break
    b=[]
if flag:
    print(h*w-water[0][0]-count)
else:
    print(-1)

### FIXED CODE ###

from collections import deque
h,w=list(map(int, input().split()))
s = [input() for _ in range(h)]

water=[[0]*w for _ in range(h)]
water[0][0]=1
a_index=[]
a_column=[]
a_index.append(0)
a_column.append(0)
b=[]
count=0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            water[i][j]=3000
            count+=1
while water[h-1][w-1]==0:
    for i,j in zip(a_index,a_column):
        if water[i][j]==1:
            if i>0:
                if water[i-1][j]==0:
                    water[i-1][j]+=1
                    b.insert(0,[i-1,j])
            if i<h-1:
                if water[i+1][j]==0:
                    water[i+1][j]+=1
                    b.insert(0,[i+1,j])
            if j>0:
                if water[i][j-1]==0:
                    water[i][j-1]+=1
                    b.insert(0,[i,j-1])
            if j<w-1:
                if water[i][j+1]==0:
                    water[i][j+1]+=1
                    b.insert(0,[i,j+1])
        water[i][j]+=1

    a_index+=[x[0] for x in b]
    a_column+=[x[1] for x in b]

    if not b:
        print(-1)
        exit()
    b=[]

print(h*w-water[0][0]-count)
x=int(input())
y=int(input())
print(x+y//2)

### FIXED CODE ###

x,y=map(int,input().split())
print(x+y//2)
import sys
a, b = map(str, input().split())
x = int(a+b)

for i in range(1001):
    if x == i*i:
        print("Yes")
        sys.exit(1)
print("No")


### FIXED CODE ###

import sys
a, b = map(str, input().split())
x = int(a+b)

for i in range(1001):
    if x == i*i:
        print("Yes")
        sys.exit()
print("No")
S = str(input())
l = len(S)
mem = l
i = 0
while (i < l-1):
    j = 0
    if (S[i] != S[i + 1]):
        if (i == 0):
            S = S[i + 2:]
        else:
            S = S[:i] + S[i + 2]
        i = 0
    else:
        i += 1
    l = len(S)

print(mem-len(S))

### FIXED CODE ###

S = []
ans = 0
for c in input():
    if len(S) > 0 and c != S[-1]:
        S.pop()
        ans += 2
    else:
        S.append(c)
print(ans)
def main():
    N = int(input())
    i = 0
    while N >0:
        n = int(str(N)[-1])
        if n % 2 != 0:
            print("yes")
            i+=1
        N -= 1
    print(i)
main()

### FIXED CODE ###

def main():
    A, B, C = map(int, input().split())
    output = C - A + B
    if output < 0:
        print(0)
    else:
        print(output)
main()
n = int(input())
input(s)
s1 = [s[i : i + n / 2] for i in range(0, len(s), n / 2)]
if (s == s1)
  print("Yes")
else
  print ("No")    

### FIXED CODE ###

import sys

n = int(input())
s = input()
if n == 1:
  print("No")
  sys.exit()
n = n // 2
if s[:n]  == s[n:]:
    print("Yes")
else:
    print ("No")
def d_partition(N, M):
    if N == 1:
        return M  # a_1 = M とする他なく、これが最大公約数

    def divisor_list(n):
        # n の正の約数のリスト
        ret = []
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.extend([k, n // k])
        ret.sort()
        return ret

    divisor_m = divisor_list(M)
    ans = -1
    for d in divisor_m:
        if d <= M // N:
            ans = d
        else:
            break
    return ans

sys.stdin = io.StringIO(textwrap.dedent(INPUT).strip())
N, M = [int(i) for i in input().split()]
print(d_partition(N, M))

### FIXED CODE ###

def d_partition(N, M):
    if N == 1:
        return M  # a_1 = M とする他なく、これが最大公約数

    def divisor_list(n):
        # n の正の約数のリスト
        ret = []
        for k in range(1, int(n**0.5) + 1):
            if n % k == 0:
                ret.extend([k, n // k])
        ret.sort()
        return ret

    divisor_m = divisor_list(M)
    ans = -1
    for d in divisor_m:
        if d <= M // N:
            ans = d
        else:
            break
    return ans

N, M = [int(i) for i in input().split()]
print(d_partition(N, M))
def f():
    n=int(input())
    l=[0,0,0]
    ans=1
    mod=10**9+7
    for i in list(map(int,input().split())):
        if i not in l:print(0);exit()
        ans=ans*l.count(i)%mod
        l[l.index(i)]+=1
    print(ans)
if _name__=="__main__":f()


### FIXED CODE ###

def f():
    n=int(input())
    l=[0,0,0]
    ans=1
    mod=10**9+7
    for i in list(map(int,input().split())):
        if i not in l:print(0);exit()
        ans=ans*l.count(i)%mod
        l[l.index(i)]+=1
    print(ans)
if __name__ == "__main__":f()
S, T = input().split()
A, B = map(int,input().split)
U = input()

if S == U:
    print(A-1 " " B)
else:
    print(A " " B-1)


### FIXED CODE ###

S, T = input().split()
A, B = map(int,input().split())
U = input()
 
if S == U:
    print(A-1 , B)
else:
    print(A , B-1)
def func_rfindr(str, start):
    return str.rfind('R', start)

def func_lfindw(str, start):
    return str.find('W', start)

def func_replace(target, pos, str):
    ret = ""
    if pos != 0:
        ret = target[0:pos]
    ret = ret + str
    if len(target) - 1 != pos:
        ret = ret + target[pos + 1:]
    return ret

N = int(input())
C = input()
ans = 0

posrr = func_rfindr(C)
poslw = func_lfindw(C)

while poslw != -1 and posrr != -1 and posrr > poslw:
    C = func_replace(C, posrr, "W")
    C = func_replace(C, poslw, "R")
    ans = ans + 1
    posrr = func_rfindr(C, posrr)
    poslw = func_lfindw(C, poslw)

print(ans)

### FIXED CODE ###

def func_rfindr(str):
    return str.rfind('R')

def func_lfindw(str):
    return str.find('W')

def func_replace(target, pos, str):
    ret = ""
    if pos != 0:
        ret = target[0:pos]
    ret = ret + str
    if len(target) - 1 != pos:
        ret = ret + target[pos + 1:]
    return ret

N = int(input())
C = input()
ans = 0

posrr = func_rfindr(C)
poslw = func_lfindw(C)

while poslw != -1 and posrr != -1 and posrr > poslw:
    #C = func_replace(C, posrr, "W")
    #C = func_replace(C, poslw, "R")
    C = C[poslw + 1:posrr]
    ans = ans + 1
    posrr = func_rfindr(C)
    poslw = func_lfindw(C)

print(ans)
x = int(input())
while True:
	xs = [n for i in range(x) if x % n == 0]
    if len(xs) > 2:
      break
	x += 1
print(x)

### FIXED CODE ###

x = int(input())
while True:
  xs = [i for i in range(1, x + 1) if x % i == 0]
  if len(xs) == 2:
    break
  x += 1
print(x)
# 1つづつ順に
def resolve():
    N, W = map(int, input().split())    
    w_v = [list(map(int, input().split())) for _ in range(N)]  # [N][0:weight, 1:value]

    dp = [[0] * (W+1) for _ in range(N+1)] 

    for i in range(N):
        for j in range(W+1):
            w = w_v[i][0]
            v = w_v[i][1]
            if j < w:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = max(dp[i][j], dp[i][j - w] + v)
 
    print(dp[N][W])
if __name__ == "__main__":
    resolve()

### FIXED CODE ###

# 1つづつ順に
# V << W なので、 dp[N][W]ではなく、 dp[N][V]で作成
def resolve():
    N, W = map(int, input().split())
    w_l = []
    v_l = []
    for _ in range(N):
        w, v = map(int, input().split())
        w_l.append(w)
        v_l.append(v)

    max_v = sum(v_l) + 1
    dp = [[10**10] * (max_v) for _ in range(N+1)] 
    dp[0][0] = 0

    for i in range(N):
        for j in range(max_v):
            #print(i, j)
            w = w_l[i]
            v = v_l[i]
            if j < v:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = min(dp[i][j], dp[i][j - v] + w)
 
    res = 0
    for j in range(max_v):
        if dp[N][j] <= W:
            res = j

    print(res)

if __name__ == "__main__":
    resolve()
H,W=map(int,input().split())
f=H*W
d=[[0]*f for _ in range(f)]


s=[input() for _  in range(H)]
    
for i in range(H):
    for j in range(W-1): 
        cnt=W*i+j
        d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="."
        d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="."
       
for i in range(H-1):
    for j in range(W): 
        cnt=W*i+j
        d[cnt][cnt+W]=s[i][j]==s[i+1][j]=="."
        d[cnt+W][cnt]=s[i][j]==s[i+1][j]=="."
        
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
csr=np.array(d)


ans=-1
for i in range(H):
    for j in range(W): 
        cnt=W*i+j
        k=shortest_path(csr, indices=cnt)
        for q in range(f):
            if k[q]>=f+1:k[q]=-1
        ans=max(ans,max(k))

print(int(ans))

### FIXED CODE ###

H,W=map(int,input().split())
f=H*W
d=[[0]*f for _ in range(f)]


s=[input() for _  in range(H)]
    
for i in range(H):
    for j in range(W-1): 
        cnt=W*i+j
        d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="."
        d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="."
       
for i in range(H-1):
    for j in range(W): 
        cnt=W*i+j
        d[cnt][cnt+W]=s[i][j]==s[i+1][j]=="."
        d[cnt+W][cnt]=s[i][j]==s[i+1][j]=="."
        
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
csr=np.array(d)


ans=-1
k=shortest_path(csr)
for i in range(f):   
    for q in range(f):
            if k[i][q]>=f+1:k[i][q]=-1

    ans=max(ans,max(k[i]))

print(int(ans))
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1

for i in range(n):
	print(ans[i+1])

### FIXED CODE ###

l, r, d = map(int, input().split())
print(r//d - (l-1)//d)
n = int(input())
a = list(map(int,input().split()))
print(*a[::-2],*a[::2])


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if n == 1:
    print(a[0])
else:
    print(*a[::-2],end = ' ')
    print(*a[n%2::2])
H, W = map(int, input().split())
S = [None] * H
for i in range(H):
  S[i] = input()

# direction definition
# 0: up
# 1: down
# 2: left
# 3: right
grid = [[[-1, -1, -1, -1] for w in range(W)] for h in range(H)]

# Initialize top and bottom sides
for w in range(W):
  grid[0][w][0] = 1
  grid[H-1][w][1] = 1

# Initialize left and right sides
for h in range(H):
  grid[h][0][2] = 1
  grid[h][W-1][3] = 1

# height, width, direction
def dfs(h, w, d):
  if not (0<=h<=H-1 and 0<=w<=W-1):
    return 0
  
  if S[h][w] == "#":
    grid[h][w] = [0, 0, 0, 0]
    return 0

  # up
  if d == 0:
    if grid[h][w][d] == -1:
      grid[h][w][d] = 1 + dfs(h-1, w, d)
    return grid[h][w][d]
  # down
  elif d == 1:
    if grid[h][w][d] == -1:
      grid[h][w][d] = 1 + dfs(h+1, w, d)
    return grid[h][w][d]
  # left
  elif d == 2:
    if grid[h][w][d] == -1:
      grid[h][w][d] = 1 + dfs(h, w-1, d)
    return grid[h][w][d]
  # right
  elif d == 3:
    if grid[h][w][d] == -1:
      grid[h][w][d] = 1 + dfs(h, w+1, d)
    return grid[h][w][d]

ans = 0
for h in range(H):
  for w in range(W):
    if S[h][w] == ".":
      count = 1
      count += dfs(h-1, w, 0)
      count += dfs(h+1, w, 1)
      count += dfs(h, w-1, 2)
      count += dfs(h, w+1, 3)
      if count >= ans:
        ans = count
    
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
S = [None] * H
for i in range(H):
    S[i] = input()

up = [[0 for w in range(W)] for h in range(H)]
down = [[0 for w in range(W)] for h in range(H)]
left = [[0 for w in range(W)] for h in range(H)]
right = [[0 for w in range(W)] for h in range(H)]

# up and left
for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            up[h][w] = 0
            left[h][w] = 0
        else:
            # up
            if h == 0:
                up[h][w] = 1
            else:
                up[h][w] = up[h - 1][w] + 1
            # left
            if w == 0:
                left[h][w] = 1
            else:
                left[h][w] = left[h][w - 1] + 1

# down and right
for h in reversed(range(H)):
    for w in reversed(range(W)):
        if S[h][w] == "#":
            down[h][w] = 0
            right[h][w] = 0
        else:
            # down
            if h == H - 1:
                down[h][w] = 1
            else:
                down[h][w] = down[h + 1][w] + 1
            # right
            if w == W - 1:
                right[h][w] = 1
            else:
                right[h][w] = right[h][w + 1] + 1


ans = 0
for h in range(H):
    for w in range(W):
        masu = -3
        masu += up[h][w]
        masu += down[h][w]
        masu += left[h][w]
        masu += right[h][w]
        if masu > ans:
            ans = masu

print(ans)
import sys

def debug(*args):
    print(*args, file=sys.stderr)

# https://www.themathpage.com/Alg/difference-two-squares-2.htm#fifth

# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def get_factors_of(a_number):
    factorized = factorize(a_number)
    return [factor for factor, _ in factorized]


x_diff_of_5th_factor = int(input())

factors_of_x = get_factors_of(x_diff_of_5th_factor)

# debug(factors_of_x)

for a_factor_of_x in factors_of_x:
    for a in range(a_factor_of_x//2+1):
        b = a - a_factor_of_x

        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)
print('0 0')
sys.exit(1)


### FIXED CODE ###

import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)
from collections import defaultdict
n=int(input())

def guidebook(n):
    SPlist=defaultdict(list)
    for i in range(n):
        s,p=input().split()
        SPlist[s].append((int(p), i+1))

    if n==1:
        print(1)
        return

    ans=[]
    SPlist=[(k, v) for k, v in SPlist.items()]
    SPlist.sort()
    ans=[]
    count=1
    for sp in SPlist:
        p=sp[1]
        if len(p)>1:
            p.sort(reverse=True)
            for i in p:
                ans.append((count, i[1]))
                count+=1
        else:
            ans.append((count, p[1]))

    for i in ans:
        print(i[1])
    return

guidebook(n)


### FIXED CODE ###

n=int(input())
sp=[]
for i in range(1, n+1):
    s,p=input().split()
    sp.append((s, -int(p), i))

sp.sort()
for s,p,i in sp:
    print(i)
N = int(input())
Y = int(input())

answer = []
comb = []
for j in range(N+1):
    for i in range(N+1):
        sum = 10000*j + 5000*i + 1000*(N-i-j)
        if(sum==Y and N-i-j>=0):
            print(j,i,N-i-j)
            exit()
            
print('-1 -1 -1')

### FIXED CODE ###

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

for j in range(N+1):
    for i in range(N+1):
        sum = 10000*j + 5000*i + 1000*(N-i-j)
        if(sum==Y and N-i-j>=0):
            print(j,i,N-i-j)
            exit()
            
print('-1 -1 -1')
import sys
input_list = sys.stdin.readlines() 
N, s = map(str.strip, input_list)
red_hat_counter = 0
for s_str in s:
  if s_str == "R":
    red_hat_counter += 1

if red_hat_counter > (int(N)%2):
  print "Yes"
else:
  print "No"

### FIXED CODE ###

print_val = "No"
 
A, B, C = map(int, raw_input().split())

if A == B and B == C:
  print_val = "Yes"

print print_val
N = input()
if N == 1:
  print('Hello World')
else :
  a = input()
  b = input()
  print(int(a) + int(b))

### FIXED CODE ###

N = input()
if N == '1':
  print('Hello World')
else :
  a = input()
  b = input()
  print(int(a) + int(b))
if int(input())%3==0:
  print(0)
else:
  print(1)

### FIXED CODE ###

n,k=map(int,input().split())
if n%k==0:
  print(0)
else:
  print(1)
a, b = input().split()
a = int(a)
b =　int(float(b) * 100)
print(a * b // 100)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)
from scipy.misc import comb

N = input()
K = int(input())

L = len(N)

if N.count("0") > L - K:
    integer = int(N)
    N = str(integer - integer % 10 - 1)

L = len(N)

if L < K:
    print(0)
    quit()

M = ["0"] * L
count = 0
for i in range(L):
    count += bool(int(N[i]))
    M[i] = N[i]
    if count == K:
        M = "".join(M)
        break

index = 0
ans = 0
while index < L:
    if int(M[index]):
        n = L - index - 1
        k = K - index
        digit = (int(M[index]) - 1)
        ans += comb(n, k, exact=True) * 9 ** k + \
               digit * comb(n, k - 1, exact=True) * 9 ** (k - 1)
    index += 1

print(ans + 1)


### FIXED CODE ###

from scipy.misc import comb

N = input()
K = int(input())

L = len(N)

if N.count("0") > L - K:
    integer = int(N)
    N = str(integer - integer % 10 - 1)

L = len(N)

if L < K or N[0] == "-":
    print(0)
    quit()

M = ["0"] * L
count = 0
for i in range(L):
    count += bool(int(N[i]))
    M[i] = N[i]
    if count == K:
        M = "".join(M)
        break

index = 0
ans = 0
count = 0
while index < L:
    if int(M[index]):
        count += 1
        n = L - index - 1
        k = K - count + 1
        digit = int(M[index]) - (count != K)
        ans += comb(n, k, exact=True) * 9 ** k + \
               digit * comb(n, k - 1, exact=True) * 9 ** (k - 1)
    index += 1

print(int(ans))
n,  m = map(int, input().split())
np = [input() for _ in range(n)]
mp = [input() for _ in range(m)]
for i in range(n-m):
  for  j in range(n-m):
    f = True
    for k in range(m):
      if np[i+k][j:j+m] != mp[i+k]:
        f = False
    if f:
      print("Yes")
      exit(0)
else:
  print("No")

### FIXED CODE ###

n,  m = map(int, input().split())
np = [input() for _ in range(n)]
mp = [input() for _ in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    f = True
    for k in range(m):
      if np[i+k][j:j+m] != mp[k]:
        f = False
    if f:
      print("Yes")
      exit(0)
else:
  print("No")
a=int(input())
b=int(input())
if(a>b):
  print(2a-1)
elif(a=b):
  print(2a)
else:
  print(2b-1)


### FIXED CODE ###

a,b=map(int, input().split())
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)
N=int(input())
A=[int(input()) for _ in range(N)]
 
ans=0
for i in range(1,N+1):
  if A[i-1]>=A[i]:
    ans+=A[i]
    ans+=(A[i-1]-A[i])//2
    A[i]=0
  else:
    ans+=A[i-1]
    ans+=(A[i]-A[i-1])//2
    A[i]-=A[i-1]
    
print(ans)

### FIXED CODE ###

N=int(input())
A=[int(input()) for _ in range(N)]

ans=0
idx=[]
for i in range(N):
  if A[i]==0:
    idx.append(i+1)
n=0
idx.append(N)
for iidx in idx:
  ans+=sum(A[n:iidx])//2
  n=iidx
print(ans)
temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.append([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i, x]-points[j, x], 2) for x in range(D)]), 1/2)
    if l.is_integer():
      counter+=1
      
print(counter)

### FIXED CODE ###

temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.append([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i][x]-points[j][x], 2) for x in range(D)]), 1/2)
    if l.is_integer():
      counter+=1
      
print(counter)
from sympy import sieve
x = int(input())
sosuu = list(sieve.primerange(2, 1000000))
for i in sosuu:
    if i >= x:
        print(i)
        break

### FIXED CODE ###

x = int(input())
flag = False
for i in range(x, 1000000):
    for j in range(2, i+1):
        #print(i, j)
        if j == i:
            print(i)
            flag = True
            break
        if i % j == 0:
            #print('*', i, j)
            break
    if flag:
        break