Harryxun/stf_run huggingface dataset:
import fractions
from functools import reduce
import math
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N,M = map(int,input().split())
List=list(map(int,input().split()))
aa = lcm_list(List) / 2
cnt = 0
a=List[0]
while a%2 == 0:
  cnt+=1
  a /= 2
out = 0
if cnt == 0:
  out = 1
  cnt = 1
for i in range(len(List)):
  if List[i] % (2**cnt) == 1:
    out = 1
  elif List[i] % (2**(cnt+1)) == 1:
    out = 1

if out == 1:
  print(0)
else:
  print(math.ceil((M / aa)) // 2)

### FIXED CODE ###

N, M = map(int, input().split())
A = list(set(map(lambda x : int(x)//2, input().split())))
def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)
def lcm(x, y):
  return (x * y) // gcd(x, y)
l = A[0]
for a in A[1:]:
  l = lcm(l, a)
ans = (M // l + 1) // 2
for a in A[1:]:
  if (l // a) % 2 == 0:
    ans = 0
    break
print(ans)
N,M=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

bit=[[] for i in range(2**3)]
for k in range(N):
    for i in range(2**3):
        t=c[k].copy()
        for j in range(3):
            if(i>>j&1):
                t[j]*=-1
        bit[i].append(t)
for i in range(2**3):
    bit[i].sort(key=lambda x:(x[0],x[1],x[2]),reverse=True)
res=0
for i in range(2**3):
    p=[1,1,1]
    for j in range(3):
        if(i>>j&1):
            p[j]*=-1
    z,o,t=0,0,0
    for k in range(M):
        z+=bit[i][k][0]*p[0]
        o+=bit[i][k][1]*p[1]
        t+=bit[i][k][2]*p[2]
    res=max(res,abs(z)+abs(o)+abs(t))
print(res)

### FIXED CODE ###

N,M=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

bit=[[] for i in range(2**3)]
for k in range(N):
    for i in range(2**3):
        t=c[k].copy()
        for j in range(3):
            if(i>>j&1):
                t[j]*=-1
        bit[i].append(t)
for i in range(2**3):
    bit[i].sort(key=lambda x:(x[0]+x[1]+x[2]),reverse=True)
res=0
for i in range(2**3):
    p=[1,1,1]
    for j in range(3):
        if(i>>j&1):
            p[j]*=-1
    z,o,t=0,0,0
    for k in range(M):
        z+=bit[i][k][0]*p[0]
        o+=bit[i][k][1]*p[1]
        t+=bit[i][k][2]*p[2]
    res=max(res,abs(z)+abs(o)+abs(t))
print(res)
N, K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
numc = 0
numf = 0

for i in range(0, N):
    for j in range(0,i):
        if A[j] > A[i]:
            numc += 1
        if A[i] > A[j]:
            numf += 1
numbers = numc*K*(K+1) % (10**9+7)+ numf*K*(K-1) % (10**9+7)
 
ans = int(numbers/2 % (10**9 + 7))
print(ans)

### FIXED CODE ###

M, D = (int(i) for i in input().split())

days = 0

for m in range(1, M+1):
    for d in range(1, D+1):
        d1 = d % 10
        d2 = d // 10
        if d1 >= 2 and d2 >= 2 and d1*d2 == m:
            days += 1

print(days)
import sys
sys.setrecursionlimit(100000)

class Node():
    def __init__(self, p=None, l=None, r=None):
        self.parent = p
        self.left = l
        self.right = r
        self.depth = None

n = int(input())
nodes = [Node() for i in range(n)]
for i in range(n):
    id, k, *c = list(map(int, input().split(' ')))
    if k == 0: continue
    nodes[id].left = c[0]
    nodes[c[0]].parent = id
    for j in range(1, k):
        nodes[c[j-1]].right = c[j]
        nodes[c[j]].parent = id

root = None
for i in range(n):
    if nodes[i].parent == None:
        root = i

def get_childs(i):
    if nodes[i].left == None: return []
    j = 0
    childs = [nodes[i].left]
    while nodes[childs[j]].right != None:
        childs.append(nodes[childs[j]].right)
        j += 1
    return childs

def set_depth(s, d):
    nodes[s].depth = d
    if nodes[s].right != None:
        set_depth(nodes[s].right, d)
    if nodes[s].left != None:
        set_depth(nodes[s].left, d+1)

set_depth(root, 0)

for i in range(n):
    nodetype = 'internal node'
    childs = get_childs(i)
    if childs == []:
        nodetype = 'leaf'
    parent = nodes[i].parent
    if parent == None:
        parent = -1
        nodetype = 'root'
    print('node ' + str(i) + ': parent = ' + str(parent) + ', depth = ' + str(nodes[i].depth) + ', ' + nodetype + ', ' + str(childs))



### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(100000)

class Node():
    def __init__(self, p=None, l=None, r=None):
        self.parent = p
        self.left = l
        self.right = r
        self.depth = None

n = int(input())
nodes = [Node() for i in range(n)]
for i in range(n):
    id, k, *c = list(map(int, input().split(' ')))
    if k == 0: continue
    nodes[id].left = c[0]
    nodes[c[0]].parent = id
    for j in range(1, k):
        nodes[c[j-1]].right = c[j]
        nodes[c[j]].parent = id

root = None
for i in range(n):
    if nodes[i].parent == None:
        root = i

def get_childs(i):
    if nodes[i].left == None: return []
    j = 0
    childs = [nodes[i].left]
    while nodes[childs[j]].right != None:
        childs.append(nodes[childs[j]].right)
        j += 1
    return childs

# 再帰だと segmentation faultが発生する
# while で実装

def set_depth(s):
    nodes[s].depth = 0
    queue = deque([s])
    while len(queue) > 0:
        u = queue.popleft()
        par_depth = nodes[u].depth
        next_child = nodes[u].left
        while next_child != None:
            nodes[next_child].depth = par_depth + 1
            queue.append(next_child)
            next_child = nodes[next_child].right

set_depth(root)

for i in range(n):
    nodetype = 'internal node'
    childs = get_childs(i)
    if childs == []:
        nodetype = 'leaf'
    parent = nodes[i].parent
    if parent == None:
        parent = -1
        nodetype = 'root'
    print('node ' + str(i) + ': parent = ' + str(parent) + ', depth = ' + str(nodes[i].depth) + ', ' + nodetype + ', ' + str(childs))
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
  if i+1 == P[i]:
    continue
  elif i+1 != P[i] and P[P[i]] == i+1:
    cnt = 1
  elif cnt == 0:
    print('NO')
    cnt = 2
    break
if cnt!=2:
  print('YES')

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
  if i+1 != P[i]:
    cnt += 1
print('NO' if cnt>2 else 'YES')
import collections
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

n, m = map(int, input().split())
edge = np.array([input().split() for _ in range(m)], dtype = np.int64).T
tmp = np.ones(m, dtype = np.int64).T
graph = csr_matrix((tmp, (edge[:] -1)), (n, n))

cnt = collections.Counter(connected_components(graph)[1])

print(max(cnt.values()))

### FIXED CODE ###

import collections
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

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

if m != 0:
    edge = np.array([input().split() for _ in range(m)], dtype = np.int64).T
    tmp = np.ones(m, dtype = np.int64).T
    graph = csr_matrix((tmp, (edge[:] -1)), (n, n))

    cnt = collections.Counter(connected_components(graph)[1])

    print(max(cnt.values()))
else:
    print('1')
#coding: UTF-8
N, A, B=map(int, input().split())
lis=list(map(int,input().split()))
#print(lis)
out=0
for i in range(0,N-1):
    d=lis[i+1]-lis[i]
    if d*A < (B-A):
        out=out+d*A
    else:
        out=out+B
print(out)

### FIXED CODE ###

#coding: UTF-8
A, B, C, D = map(int, input().split())
a1 = A*B
a2 = C*D
if a1 >= a2:
    print(a1)
else:
    print(a2)
N,D =map(int, input().split())
all_list = [list(map(int, input().split())) for i in range(N)]
count = 0
for n in range (N):
    for nn in range(n):
      distance == sum([all_list[n][d]-all_list[nn][d] for d in range(D)])
    for s in range(250):
      if distance == s**2:
        count += 1
print(count)

### FIXED CODE ###

n,a,b = map(int,input().split())
if n*a <= b:
    print(n*a)
else:
    print(b)
n=int(input())
if n=25:
  print('Christmas')
elif n=24:
  print('Christmas Eve')
elif n=23:
  print('Christmas Eve Eve')
elif n=22:
  print('Christmas Eve Eve Eve')

### FIXED CODE ###

n=int(input())
if n==25:
  print('Christmas')
elif n==24:
  print('Christmas Eve')
elif n==23:
  print('Christmas Eve Eve')
elif n==22:
  print('Christmas Eve Eve Eve')
a, b, c = list(map(float, input().split()))
if (b == '+'):
    print(a + c)
else:
    print(a - c)


### FIXED CODE ###

a, b, c = input().split()
if (b == '+'):
    print(int(a) + int(c))
else:
    print(int(a) - int(c))
n = int(input())
cnt = 0
A = []
for _ in range(n):
    A.append(sorted(input())) 
for i in range(n-1):
    for j in range(i+1, n):
        if s == t:
            cnt += 1
print(cnt)
         

### FIXED CODE ###

n = int(input())
cnt = 0
A = []
for _ in range(n):
    t = sorted(input())
    t = "".join(t)
    A.append(t)

import collections
C = collections.Counter(A)
lC = list(C.values())
for i in lC:
    cnt += i * (i-1) // 2
print(cnt)
S = input()


ans = 0
num = 0
cnum = 0
if S[0] == "A":
  ans += 1

for i in range(2,len(S)-1):
  if S[i] == "C":
    cnum += 1
    
if cnum == 1:
  ans +=1

for j in range(len(S)):
  if j.islower() == True:
    num += 1

    
if num == len(S)-2:
  ans +=1
  
  
  

if ans ==3:
  print("AC")
else:
  print("WA")

### FIXED CODE ###

S = input()


ans = 0
num = 0
cnum = 0

if S[0] == "A":
  ans += 1

for i in range(2,len(S)-1):
  if S[i] == "C":
    cnum += 1
    
if cnum == 1:
  ans +=1

for j in range(len(S)):
  if S[j].islower() == True:
    num += 1

    
if num == len(S)-2:
  ans +=1
  
  
  

if ans ==3:
  print("AC")
else:
  print("WA")
import numpy as np
from collections import deque
def main():
    N, M, K = map(int, input().split())
    A = deque(list(map(int, input().split())))
    B = deque(list(map(int, input().split())))
    
    cost = K
    count = 0
    while True:
        if len(A) ==0 and len(B) == 0:
            break
        elif len(A) == 0:
            cost -= B.popleft()
        elif len(B) == 0:
            cost -= A.popleft()

        else:
            a = A[0] + A[1]
            b = B[0]
            if a < b:
                cost -= A.popleft()
            else:
                cost -= B.popleft()

        if cost < 0:
            break
        count += 1
    
    print(count)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect_right
import numpy as np
def main():
    N, M, K = map(int, input().split())
    A = np.array([0] + list(map(int, input().split())), dtype=np.int64)
    B = np.array([0] + list(map(int, input().split())), dtype=np.int64)

    As = np.cumsum(A)
    Bs = np.cumsum(B)

    count = 0

    for i, a in enumerate(As):
        if a > K:
            break
        j = bisect_right(Bs, K-a)
        #print(f"i={i} j={j} Bs={Bs} cost={K-a}")
        count = max(count, (i+j-1))

    print(count)

if __name__ == '__main__':
    main()
import math
import sympy
import sys

n = int(input())

if n == 1:
    print(0)
    sys.exit()

yakusu = set(sympy.divisors(n))
yakusu.discard(1)

sosu = set([min(yakusu)])
tansaku = set(yakusu)
kari = set(tansaku)



while 1:
    for var in tansaku:
        if var % max(sosu) == 0:
            kari.discard(var)
    tansaku = set(kari)
    if len(tansaku) == 0:
        break
    sosu.add(min(tansaku))
sosu = sosu | tansaku

i = 1
j = 0
kari = set(sosu)

while n != 1:
    for var in sosu:
        if n % (var ** i) == 0:
            n = n / (var ** i)
            j += 1
        else:
            kari.discard(var)
    sosu = set(kari)

    i += 1
    if i > 1000:
        break

print(j)


### FIXED CODE ###

import math
import sys

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())

if n <= 1:
    print(0)
    sys.exit()

yakusu = set(make_divisors(n))
yakusu.discard(1)

sosu = set([min(yakusu)])
tansaku = set(yakusu)
kari = set(tansaku)



while 1:
    for var in tansaku:
        if var % max(sosu) == 0:
            kari.discard(var)
    tansaku = set(kari)
    if len(tansaku) == 0:
        break
    sosu.add(min(tansaku))
sosu = sosu | tansaku

i = 1
j = 0
kari = set(sosu)

while n != 1:
    for var in sosu:
        if n % (var ** i) == 0:
            n = n / (var ** i)
            j += 1
        else:
            kari.discard(var)
    sosu = set(kari)

    i += 1
    if i > 1000:
        break

print(j)
n,d = map(int,input().split())
x = [list(map(int,input().split())) for a in range(n)]
c = 0
 
for i in range(n-1):
  for j in range(i+1,n):
    b = 0
    for m in range(d):
      b += (x[i][m])-x[j][m])**2
    if (b**0.5)　== float(int(b**0.5)):
      c += 1
      
print(c)

### FIXED CODE ###

n,d = map(int,input().split())
w = [list(map(int,input().split())) for a in range(n)]
c = 0
 
for i in range(n-1):
  for j in range(i+1,n):
    b = 0
    for m in range(d):
      b += (w[i][m]-w[j][m])**2
    if (b**0.5)==float(int(b**0.5)):
      c += 1
      
print(c)
D=input()
D=int(d)

if D==25:
    print("Christmas")

if D==24:
    print("Christmas Eve")

if D==23:
    print("Christmas Eve Eve")

if D==22:
    print("Christmas Eve Eve Eve")

### FIXED CODE ###

D=input()
D=int(D)

if D==25:
    print("Christmas")

if D==24:
    print("Christmas Eve")

if D==23:
    print("Christmas Eve Eve")

if D==22:
    print("Christmas Eve Eve Eve")
N,K=map(int,input().split())
A=list(map(int,input().split()))
town=1
townhairetu=[1]
n=0
for i in range(K):
	town=A[town-1]
	if(town in townhairetu):
		n=i+1-townhairetu.index(town)
		break
	else:
		townhairetu.append(town)
print(townhairetu[(K-townhairetu.index(town))%n+townhairetu.index(town)])

### FIXED CODE ###

S=input()
T=input()
T=T[:-1]
if(S==T):
	print('Yes')
else:
	print('No')
from collections import deque
h,w,k = map(int,input().split())
a,b,c,d = map(int,input().split())
a -= 1
b -= 1
c -= 1
d -= 1
maze = [input() for _ in range(h)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
depth = [[float("inf") for _ in range(w)] for _ in range(h)]
dq = deque([(b,a)])
depth[a][b] = 0
while dq:
  x,y ==dq.popleft()
  if x == d and y == c:
    break
  for i in range(4):
    nx,ny,K = x,y,k
    while K:
      K -= 1
      nx += dx[i]
      ny += dy[i]
      if 0<=nx<=w-1 and 0<=ny<=h-1 and maze[nx][ny] != "@" and depth[nx][ny] > depth[y][x]:
        if depth[ny][nx] == depth[y][x]+1:
          continue
        depth[ny][nx] = depth[y][x] +1
        dq.append((nx,ny))
      else:
        break
print(depth[c][d] if depth[c][d] != float("inf") else -1)




### FIXED CODE ###

from collections import deque
h,w,k = map(int,input().split())
a,b,c,d = map(int,input().split())
a -= 1
b -= 1
c -= 1
d -= 1
maze = [input() for _ in range(h)]
dx = [1,-1,0,0]
dy = [0,0,1,-1]
depth = [[float("inf") for _ in range(w)] for _ in range(h)]
dq = deque([(b,a)])
depth[a][b] = 0
while dq:
    x,y = dq.popleft()
    if x == d and y == c:
        break
    for i in range(4):
        nx,ny,K = x,y,k
        while K:
            K -= 1
            nx += dx[i]
            ny += dy[i]
            if 0<=nx<=w-1 and 0<=ny<=h-1 and maze[ny][nx] != "@" and depth[ny][nx] > depth[y][x]:
                if depth[ny][nx] == depth[y][x]+1:
                    continue
                depth[ny][nx] = depth[y][x] +1
                dq.append((nx,ny))
            else:
                break
print(depth[c][d] if depth[c][d] != float("inf") else -1)
import math

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

hourdegrees = ( H * 60 + M ) * (0.5)
mindegrees = M*(6)
  
if mindegrees < hourdegrees:
  degree = hourdegrees - mindegrees
elif mindegrees > hourdegrees:
  degree = mindegrees - hourdegrees
  
distance = math.sqrt(A ** 2 + B ** 2 -2 * A * B * math.cos(math.radians(degree) ) )
print(distance)

### FIXED CODE ###

import math
     
A,B,H,M = map(int, input().split())
     
hourdegrees = ( H * 60 + M ) * (0.5)
mindegrees = M*(6)
      
if mindegrees < hourdegrees:
  degree = hourdegrees - mindegrees
elif mindegrees > hourdegrees:
  degree = mindegrees - hourdegrees
elif mindegrees == hourdegrees:
  degree = 0
      
distance = math.sqrt(A ** 2 + B ** 2 -2 * A * B * math.cos(math.radians(degree) ) )
print(distance)
sequence_size = int(input())
sequence = list(map(int, input().split()))
error = False
error_msg = -1
sequence.sort()
if max(sequence) > sequence_size:
    print(error_msg)
else:
    for index in range(0,sequence_size - 1):
        if sequence[index] <= index + 1:
            error is False
        else:
            error is True
            break
if error is False:
    for num in sequence:
        print(sequence[num])
else:
    print(error_msg)


### FIXED CODE ###

size = int(input())
sequence = list(map(int, input().split()))

answer = []
while len(sequence):
  if not any(sequence[i] == i + 1 for i in range(len(sequence))):
    print(-1)
    exit()
  for i in reversed(range(len(sequence))):
    if sequence[i] == i + 1:
      answer.append(sequence[i])
      sequence.pop(i)
      break

for ans in reversed(answer):
  print(ans)
if int(input())==ABC:
  print("ARC")
else :
  print("ABC")

### FIXED CODE ###

if input()=="ABC":
  print("ARC")
else :
  print("ABC")
N = input()
Dig = len(N)
if Dig == 1:
    print(N)
else:
    for i in range(Dig):
        if N[i] != 9:
            num = i
            break
        else:
            continue
    list_num = list(N)
    target = int(list_num[num]) -1
    ans = 9*(num -1) + target + 9*(DIg)
    print(ans)

### FIXED CODE ###

N = input()
Dig = len(N)
num = None
if Dig == 1:
    print(N)
else:
    for i in range(Dig-1):
        if N[i+1] != str(9):
            num = i
            break
        else:
            continue
    list_num = list(N)
    if not num == None:
        target = int(list_num[num]) -1
        array = list(map(int,N))
        ans = sum(array[:num]) + target + 9*(Dig-num-1)
        print(ans)
    else:
        array = list(map(int,N))
        print(sum(array))
x,n = map(int, input().split())
p = list(map(int, input().split()))
l = [i for i in range(1,101)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])

### FIXED CODE ###

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

l = [i for i in range(102)]

for j in p:
    l.remove(j)

m = []

for k in l:
    m.append(abs(k-x))

print(l[m.index(min(m))])
import bisect


def primes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * (int((n - i * i - 1) / (2 * i)) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


q = int(input())
array = [[int(x) for x in input().split()] for z in range(q)]

primes_array = primes(10000+1)
res_primes = [0 for x in range(10000+1)]
cum_sum = 0
for x in range(10000+1):
    if x in primes_array and (x+1) // 2 in primes_array:
        cum_sum += 1
    res_primes[x] = cum_sum

for l, r in array:
    res = res_primes[r] - res_primes[l-1]
    print(res)

### FIXED CODE ###

import math
import bisect


def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if __name__ == '__main__':
    q = int(input())
    array = [[int(x) for x in input().split()] for x in range(q)]
    nearby_2017 = [x for x in range(1, 100000, 2) if is_prime(x) and is_prime((x+1)/2)]
    for i, j in array:
        print(bisect.bisect_right(nearby_2017, j) - bisect.bisect_left(nearby_2017, i))
n = int(input())
a = [int(input()) for _ in range(n)]
tmp = a[0]
if a.index(2) == -1:
    print(-1)
else:
    ans = -1
    count = 0
    for i in range(n):
        count += 1
        if tmp == 2:
            ans = count
            break
        tmp = a[tmp - 1]
print(ans)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
tmp = a[0]
ans = -1
count = 0
for i in range(n):
    count += 1
    if tmp == 2:
        ans = count
        break
    tmp = a[tmp - 1]
print(ans)
import heapq
def SME(start,end):
    count = 0
    ANS = [heapq.heappush(A,[x,i]) for i,x in enumerate(Whole)]
    for j in range(start,end):
        if None not in ANS[a[1]:a[1]+L] : continue
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] : continue
                else :
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * parameter : break
    for i in range(L):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS
[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
A = []
parameter = 0.97
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
target = input()
first, second = int(target[0:2]), int(target[2:4])
if first = 0:
  first = 100
if second = 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

if __name__ == '__main__':
  print(check())

### FIXED CODE ###

target = input()
first, second = int(target[0:2]), int(target[2:4])
if first == 0:
  first = 100
if second == 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

if __name__ == '__main__':
  print(check())
import numpy as np
H, W = map(int, input().split())
S = []
ij = np.zeros([H,W])    # .の連続数を格納用

for i in range(H):
    S.append(input())
    cnt = 0
    start = 0
    end = 0
    for j in range(W):
        if S[i][j] == '#':
            ij[i, start:end+1] += cnt
            cnt = 0
        elif j > 0 and S[i][j-1] == '#':    # .のstart
            start = j
            end = j
            cnt = 1
        else:
            end = j
            cnt += 1
        if j == W-1:    # 最後に書き込み
            ij[i, start:end+1] += cnt
            cnt = 0

for j in range(W):
    cnt = 0
    start = 0
    end = 0
    for i in range(H):
        if S[i][j] == '#':
            ij[start:end+1, j] += cnt
            cnt = 0
        elif i > 0 and S[i-1][j] == '#':    # .のstart
            start = i
            end = i
            cnt = 1
        else:
            end = i
            cnt += 1
        if i == H-1:    # 最後に書き込み
            ij[start:end+1, j] += cnt
            cnt = 0

ij = ij - 1  # 自分が2回足されるので、1引く
ans = int(ij.max())
print(ans)

### FIXED CODE ###

import numpy as np
H, W = map(int, input().split())
S = np.array([list(input()) for _ in range(H)]) == '.'
us = np.zeros((H,W), dtype=int)    # .の連続数を格納用
ds = np.zeros((H,W), dtype=int)    # .の連続数を格納用
ls = np.zeros((H,W), dtype=int)    # .の連続数を格納用
rs = np.zeros((H,W), dtype=int)    # .の連続数を格納用

for h in range(1,H):
    us[h, :] = (us[h-1, :] + 1) * S[h-1, :]
for h in range(H-2, -1, -1):
    ds[h, :] = (ds[h+1, :] + 1) * S[h+1, :]
for w in range(1,W):
    ls[:, w] = (ls[:, w-1] + 1) * S[:, w-1]
for w in range(W-2, -1, -1):
    rs[:, w] = (rs[:, w+1] + 1) * S[:, w+1]

ans = ((us + ds + ls + rs)*S).max() + 1
print(ans)