peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = []
arr = [-1] * N
for i in range(N, 0, -1):
  s = 0
  j = i * 2
  while j <= N:
    s += arr[j - 1]
    j += i
  if s % 2 != a[i - 1]:
    arr[i - 1] = 1
    b.append(i)
  else:
    arr[i - 1] = 0
print(len(b))
print(*b)
# Judge status: Accepted
N = int(input())
if N%2==1:
  print((N+1)/2/N)
else:
  print(0.5)
# Judge status: Wrong Answer
o,cost = map(int,input().split())
if o > 12:
  cost = cost
elif o >= 6:
  cost = cost / 2
else:
  cost = 0
# Judge status: Accepted
import math

k = int(input())

ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        x = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(x, c)
print(ans)
# Judge status: Wrong Answer
from math import *
n=int(input())
s=sqrt(n)
s=int(s)
print(s**2)
# Judge status: Wrong Answer
import decimal

L=int(input())

x = L/3
decimal.getcontext().prec = 6
x = decimal.Decimal(L / 3)

V=decimal.Decimal(x*x*x)

print("{:.12f}".format(V))
# Judge status: Accepted
A,B=map(int,input().split())
print("Yay!" if A<9 and B<9 else ":(")
# Judge status: Wrong Answer
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+y*max(0,b-c))
ans.append(c*y+x*max(0,a-c))
print(min(ans))
# Judge status: Accepted
a, b = map(int, input().split())
ans = (a+b+1)//2
print(ans)
# Judge status: Wrong Answer
A,B,C,X,Y = map(int,input().split())
mini=float("inf")

for a in range(0,X+1):
  c_num = 2*(X-a)
  b_num = Y- (X-a)
  if b_num>=0:
    P= A*a + B*b_num + C*c_num
    #print(a,b_num,c_num,P)
    mini=min(mini,P)

print(mini)
# Judge status: Accepted

ex = []
for i in range(1001):
    e = 0
    j = i 
    while j != 0:
        e += j / i
        j-=1
    ex.append(e)

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

total = 0
mx = 0

for i in range(n):
    if i < k:
        total += ex[p[i]]
    else:
        total = total + ex[p[i]] - ex[p[i-k]]
    if mx < total:
        mx = total

print(mx)
# Judge status: Accepted
import sys
import math

input = sys.stdin.readline
MOD = 1000000007

X = int(input())

sa = 100000
res = 0

if X == 1:
    print(1)
else:
    for i in range(2,X):
        a = int(math.log(X,i)+0.00000004)
        if (sa > (X - (i**a))) & ( a != 1):
            sa = X - (i**a)
            res = i**a

    print(res)
# Judge status: Accepted
S = str(input())
S = S[:-2]

for _ in range(len(S)//2):
  
  if S[:len(S)//2] == S[len(S)//2:]:
    print(len(S))
    break

  else:
    S = S[:-2]
# Judge status: Accepted
N=int(input())
print((int(N**0.5))**2)
# Judge status: Accepted
import math

K = int(input())
ans = 0
for A in range(1, K+1):
  for B in range(1, K+1):
    AB = math.gcd(A, B)
    for C in range(1, K+1):
      ans += math.gcd(AB, C)
print(ans)
# Judge status: Accepted
import sys
N = int(input())
A = list(map(int, input().split()))

find = 1

for i in range(N):
    if A[i] == find:
        find += 1

print(-1 if find == 1 else len(A) - find + 1)
# Judge status: Wrong Answer
def main():
    a=input()
    ca=a[0]
    for c in a[1:]:
        if ca == c:
            print('Bad')
            return
    ca = c
    print('Good')

main()
# Judge status: Wrong Answer
from math import floor, ceil

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

minx1 = A/0.08
maxx1 = (A+1)/0.08
minx2 = B/0.1
maxx2 = (B+1)/0.1

rangeMin = max(minx1, minx2)
rangeMax = min(maxx1, maxx2)
if rangeMax < rangeMin:
    print(-1)
else:
    print(floor(rangeMin+1))
# Judge status: Accepted
D=int(input())
C=list(map(int,input().split()))
S=list(map(list,zip(*[map(int,input().split()) for i in range(D)])))
s=[sum(l) for l in S]
print(*[s.index(max(s))+1]*D,sep='\n')
# Judge status: Accepted
# Problem C - Multiple Gift

# input
X, Y = map(int, input().split())

# initialization
ans = 0

# count
while X<=Y:
    X *= 2
    ans += 1

# output
print(ans)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())

A.sort()
print(sum(A[N::2]))
# Judge status: Accepted
# 右に(N-1)回移動、下に1回移動
# 合計値は上の段は下に降りるまでの累積和、下の段は降りてからの累積和

N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
 
cum1, cum2 = [0]*(N+1), [0]*(N+1)
for i in range(N):
  cum1[i+1] = cum1[i] + A1[i]
  cum2[i+1] = cum2[i] + A2[i]
print(max([cum1[i+1] + cum2[-1] - cum2[i] for i in range(N)]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[j - 1] for j in range(i + i, n, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i + 1 for i in range(n) if b[i] == 1])
# Judge status: Accepted
import numpy as np

N = int(input())
A = [0] + list(map(int, input().split()))

cumsum = np.cumsum(A)

ans = float("inf")
for i in range(1, N):
    left = cumsum[i]
    right = cumsum[-1] - cumsum[i]
    tmp = abs(right - left)
    if tmp < ans:
        ans = tmp

print(ans)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
a = []
x = 0
for i in range(n):
    x += w[i]
    a.append(x)

b = []
for j in range(n):
    b.append(abs(2 * a[j] - a[n - 1]))
print(min(b))
# Judge status: Wrong Answer
x = int(input())

for i in range(10^5):
  n = 2
  while x % n != 0 and n <= x**0.5 + 2:
    n += 1
  if n < x**0.5 + 2:
    x += 1
    
  else:
    print(x)
    break
# Judge status: Accepted
import itertools
N, K = map(int,input().split())
A = list(map(int,input().split()))
K = min(41,K)
#A = [0] * N

for k in range(K):
    imos = [0] * (N+1)
    for n in range(N):
        a = n - A[n]
        b = n + A[n]
        a = max(0,a)
        b = min(N-1,b)
        imos[a] += 1
        imos[b+1] -= 1
    csum = list(itertools.accumulate(imos))
    A = csum[:-1]
A = [str(a) for a in A]
print (' '.join(A))
# Judge status: Accepted
n=int(input())
ls=list(map(int,input().split()))
m=len(ls)
print("YES" if len(set(ls))==m else "NO")
# Judge status: Accepted
f=lambda:map(int,input().split())
N,X=f()
*A,=f()
A=[0]+A

c=0
for i in range(N):
 c+=max(0,A[i]+A[i+1]-X)
 A[i+1]=min(A[i+1],X-A[i])
print(c)
# Judge status: Accepted
import math
from itertools import accumulate

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

fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]

gcd = []

gcd.append(fromright[1])
for i in range(1, n-1):
    gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])

print(max(gcd))
# Judge status: Wrong Answer
n = int(input())

total = 0

total += (n//500)

n %= 500#合計枚数を減らす

total += (n//5)*5#5円玉に交換する

print(total)
# Judge status: Accepted
#!/usr/bin/env python3
n, m = map(int, input().split())
L = [1]*n
R = [1] + [0]*~-n
for _ in range(m):
  x, y = map(int, input().split())
  x -= 1;y -= 1
  if R[x]:R[y] = 1
  L[x] -= 1;L[y] += 1
  R[x] *= (L[x] > 0)
print(sum(R))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

num = len(a)
four = 0
two = 0
one = 0
for i in range(num):
  if a[i]%4 == 0:
    four += 1
  elif a[i]%2 == 0 and a[i]%4 != 0:
    two += 1
  elif a[i]%2 != 0:
    one += 1

if four + 1 >= two//2 + one:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s = int(input())

A = [s]
m = 2
while True:
  n = A[-1]
  if n % 2 == 0:
    f = n // 2
  else:
    f = n * 3 + 1
  if f in A:
    break
  else:
    A.append(f)
  m += 1

#print(A)
print(m)
# Judge status: Wrong Answer
s = input()

s1 = int(s[0:2])
s2 = int(s[2:4])

s1m = False
s1y = False
s2m = False
s2y = False
if s1 <= 12 and s1 >= 1:
  s1y = True
  s1m = True
elif s1 > 12 :
  s1y = True
  
if s2 <= 12 and s2 >= 1:
  s2y = True
  s2m = True
elif s2 > 12 :
  s2y = True

if s1y and s2y and s1m and s2m:
  print("AMBIGUOUS")
elif s1y and s2m :
  print("YYMM")
elif s2y and s1m :
  print("MMYY")
else :
  print("NA")
# Judge status: Wrong Answer
S=input()
if(S=="hi"):
  print("Yes")
elif(S=="hihi"):
  print("Yes")
elif(S=="hihihi"):
  print("Yes")
elif(S=="hihihihi"):
  print("Yes")
elif(S=="hihihihihi"):
  print("Yes")
elif(S=="hihihihihihi"):
  print("Yes")
elif(S=="hihihihihihihi"):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
*a, = map(int, input().split())

ans = float("inf")

for i in range(-100, 101):
    t = 0
    for _a in a:
        t += (i-_a)**2
    ans = min(ans, t)

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

count = 0
for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        count += 1

print(count)
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]
b = [0]*n

k = 0
for i in range(n-1, -1, -2):
  b[k] = a[i]
  k += 1
for i in range(n%2, n, 2):
  b[k] = a[i]
  k += 1

print(*b)
# Judge status: Accepted
n=int(input())
llist=list(map(int,input().split()))
llist.sort()

counter=0
for i in range(2,n):
	now=i+1
	tmpcounter=0
	for j in range(1,i):
		while now <= n:
			if llist[j-1] + llist[i-1] > llist[now-1]:
				tmpcounter += 1
				now += 1
			else:
				break
		counter += tmpcounter

print(counter)
# Judge status: Accepted
c,a,b=map(int,input().split())
print(int(c*a/2))
# Judge status: Accepted
#abc173
n = int(input())
ln ={'AC': 0,'WA': 0,'TLE': 0,'RE': 0}  #ln[0] = AC, 1= WA, 2 =TLE, 3 =RE
for i in range(n):
    s = input()
    ln[s] += 1
for i,j in ln.items():
    print(i +' x ' + str(j))
# Judge status: Accepted
n = int(input())
a = ord('a')

def dfs(s, m):
    # print("dfs", s, chr(m))
    if len(s) == n:
        print(s)
    else:
        for i in range(m + 1 - a):
            dfs(s + chr(a + i), m + 1 if i == m - a else m)

dfs("", a)
# Judge status: Accepted
def main():
  N, K, S = (int(_) for _ in input().split())
  output = []
  for _ in range(K):
    output.append(S)
  if S == 10 ** 9: a = S - 1
  else:
    a = S + 1
  for _ in range(N - K):
    output.append(a)
  print(*output)
  return

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

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

s = A + B + C
M = max(A,B,C)
if M % 2 == 0 and s % 2 != 0:
    M += 1
elif M % 2 != 0 and s % 2 == 0:
    M += 1

ans = (3 * M - s) / 2
print(ans)
# Judge status: Accepted
n = int(input())
lst = list(map(int, input().split()))
mcnt = 0
for i in range(n):
  if lst[i] < 0:
    mcnt += 1
if 0 in lst or mcnt % 2 == 0:
  print(sum(list(map(abs, lst))))
  exit()
m = min(lst, key=abs)
print(sum(list(map(abs, lst))) - 2 * abs(m))
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))

cnt=0
for i in range(1,n):
    if a[i]+a[i-1]>x:
        t=a[i]+a[i-1]-x
        if a[i]>=t:
            a[i]-=t
        else:
            a[i]=0
        cnt+=t
print(cnt)
# Judge status: Accepted
n = int(input())
for x in range(n + 1):
    if x * 108 // 100 == n:
        print(x)
        break
else:
    print(':(')
# Judge status: Accepted
N = int(input())
A = int(input())
 
N = N % 500
if N <= A:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s=input()
if (s[::2]=='L') or (s[1::2]=='R'):
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
a, b = map(int, input().split())
s = input()
flg = True
for i in range(a):
    if s[i] == '-':
        flg = False
if s[a] != '-':
    flg = False
for i in range(a + 2, b):
    if s[i] == '-':
        flg = False
if flg:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from typing import List, Dict


def main(N: int, A: List[int]):
    bosses: Dict[int, List[int]] = {}

    for i, boss in enumerate(A, start=2):
        if boss not in bosses:
            bosses[boss] = [i]
        else:
            bosses[boss].append(i)

    for worker in range(1, N + 1):
        if worker not in bosses:
            print(0)
        else:
            print(len(bosses[worker]))


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split())))

    main(N, A)
# Judge status: Wrong Answer
N,M=map(int,input().split())
*X,=map(int,input().split())
X.sort()

count=[0]*(M-1)
i=1
while i<M:
    count[i-1]=X[i]-X[i-1]
    i+=1
count.sort()

print(sum(count[:M-N]))
# Judge status: Wrong Answer
# ABC122 B - ATCoder

S=str(input())
AC = 'ATGC'
N = []
count=0
for i in range(len(S)):
    if S[i] not in AC:
        N.append(i)
    else:
        count+=1
if count == len(S):
    print(count)
    exit()

M = N[0]
for j in range(len(N)-1):
    M = max( N[j+1] - N[j],M)
print(M)
# Judge status: Wrong Answer
import sys
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
    print(0)
    sys.exit()
s=max(a,b,c)
t=a*b*c/s
ans=int(t)
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if i < N-1 and A[i+1] == A[i] + 1:
        ans += C[A[i]-1]

print(ans)
# Judge status: Accepted
d,t,s = map(int, input().split())
print('Yes' if t*s >= d else 'No')
# Judge status: Accepted
a = input()

if a == a.upper():
    print('A')
else:
    print('a')
# Judge status: Accepted
N, M = map(int, input().split())

if N == M:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
Q, H, S, D = map(int,input().split())
N = int(input())
print((N//2)*min(8*Q,4*H,2*S,D)+(N%2)*min(4*Q,2*H,S))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().strip().split()))

import collections
c = collections.Counter(a)
_max = 0
for i in range(max(a)):
  _sum = c[i-1] + c[i] + c[i+1]
  if _max < _sum:
    _max = _sum
print(_max)
# Judge status: Accepted
s = input()
if s[2] == s[3] and s[4] ==s[5]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x = int(input())

m = 100
y = 0
while (m<x):
    m *= 1.01
    y += 1
    
print(y)
# Judge status: Accepted
A,B=map(int,input().split())
S=input()
if S.count('-')==1 and S[A]=='-':
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
n=int(input())
head=[]
end=[]
rev = False
for i in range(n):
    q = list(map(str,input().split()))
    if q[0]=='1':
        head,end = end, head
        rev = not rev
    elif q[0]=='2':
        if q[1]=='1':
            head.append(q[2])
        else:
            end.append(q[2])

head.reverse()
if rev:
    ans = list(s)
    ans.reverse()
else:
    ans = list(s)
print("".join(head+ans+end))
# Judge status: Accepted
# coding: utf-8
N, K, S = map(int, input().split())
L = []
for i in range(N):
    if i < K:
        L.append(S)
    else:
        L.append(99999989)
print(*L)
# Judge status: Accepted
N,M=map(int,input().split())
*A,=map(int,input().split())
BC=[list(map(int,input().split()))[::-1]for _ in range(M)]
BC=sorted(BC)[::-1]

L=[0]
for c,b in BC:
    L+=[c]*b
    if len(L)-1>N:
        break

ans=sorted(A+L)[::-1]
print(sum(ans[:N]))
# Judge status: Wrong Answer
r, g, b = list(map(int,input().split()))

if (r+g+b)%4==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n, l = map(int, input().split())
a = sorted([l + i for i in range(n)], key=abs)
print(sum(a[1:]))
# Judge status: Wrong Answer
k,a,b=map(int, input().split())

#aaaabできる。ｃが…
if a+3<=b and k>=a+1:
  #
  if a%2==0 and k%2==0:
    print(b+1)
  if a%2==0 and not k%2==0:
    print(2 * b+a)
  if not a%2==0 and k%2==0:
    print(a+1)
  if not a%2==0 and not k%2==0:
    print(2 * b+a)
# Judge status: Wrong Answer
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans, reverse=True):
  print(a)
# Judge status: Accepted
import math
N = int(input())

print(math.ceil(N / 2))
# Judge status: Accepted
n, a, b = map(int, input().split())
c = 0
for i in range(1, n+1):
    t = sum(list(map(int, str(i))))
    if a<=t<=b: c += i
print(c)
# Judge status: Wrong Answer
H=int(input())
W=int(input())
N=int(input())
T=max(H,W)
print(N//T+1)
# Judge status: Accepted
x,y = map(int, input().split())
cnt = 0
for i in range(100000):
    if x > y:
        break
    cnt += 1
    x *= 2
print(cnt)
# Judge status: Accepted
a,b = map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
n = int(input())

d_list = [int(x) for x in input().split()]
d_list.sort()

n >>= 1
ans = d_list[n] - d_list[n - 1]
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
x = b - a
tmp = 0
for i in range(1, x):
    tmp += i
print(tmp - a)
# Judge status: Accepted
t = list(input())
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(t))
# Judge status: Wrong Answer
S = list(input())

ans = 1
r = 1
s = 0
while r <= len(S)-1:  #貪欲に
    if S[r] != S[r-1] or s == 1:
        ans += 1
        r += 1
        s = 0
    else:
        ans += 1
        r += 2
        s = 1

print(ans)
# Judge status: Accepted
N, T = map(int,input().split())
list1 = [list(map(int,input().split())) for i in range(N)]
list2 = [x[0]  for x in list1 if x[1]<=T ]
if len(list2)==0:
  print("TLE")
else :
  print(min(list2))
# Judge status: Wrong Answer
S = input()
T = input()
num = 0

for i in range(len(T)):
  if (S[i] != T[i]):
    S[i] == T[i]
  num += 1

print(num)
# Judge status: Accepted
print('bust' if sum(map(int, input().split())) > 21 else 'win')
# Judge status: Wrong Answer
n=int(input())
a=[int(i) for i in input().split()]
print(round(sum(a)/n))
# Judge status: Accepted
l = list(map(int, input().split()))

l = sorted(l)

d = l[0] + l[1]

print(d)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
  n, k = map(int,input().split())
  result = 0
  for i in range(k, n+2):
    min = (i-1) * (1+(i-2)*0.5)
    max = (n * i) - min
        
    result += (max-min+1)
    
  return int(result)

if __name__ == '__main__':
  print(main())
# Judge status: Wrong Answer
import math
n = int(input())
ans_l,ans_r=0,0
root = math.floor(math.sqrt(n))
for i in range(10**5):
    if n%root == 0:
        ans_l,ans_r = root,n//root
        break
    else:
        root -= 1
print(ans_l-1 + ans_r-1)
# Judge status: Accepted
s=input()
S=list(s)
t=set(S)
if len(t)==1:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
def main():
    import collections

    n = int(input())
    s = list(input())

    cnt_s = []

    for i in range(n):
        cnt_l = collections.Counter(s[:i])
        cnt_r = collections.Counter(s[i:])
        cnt = 0
        for key in dict(collections.Counter(cnt_l)):
            if key in dict(collections.Counter(cnt_r)):
                cnt += 1
        cnt_s.append(cnt)

    print(max(cnt_s))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b, t = (int(i) for i in input().split())
print(b * ((t+0.5)//a))
# Judge status: Wrong Answer
n = int(input())
a = [int(s) for s in input().split()]

combn = max(a)

ar = [abs(num-combn/2) for num in a]
combr = int(combn/2 - min(ar))

print(' '.join(map(str,[combn,combr])))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

for num, rep in zip(b, c):
    if num not in a: continue
    else:
        a = [rep if ele == num else ele for ele in a]
    print(sum(a))
# Judge status: Accepted
ab=[int(i) for i in input().split()]
for i in range(2):
    if ab[i]==1:
        ab[i]+=13
print("Alice" if ab[0]>ab[1] else "Draw" if ab[0]==ab[1] else "Bob")
# Judge status: Accepted
def resolve():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    sortedA = sorted(A)
    for a in A:
        if a == sortedA[-1]:
            print(sortedA[-2])
        else:
            print(sortedA[-1])

    
if '__main__' == __name__:
    resolve()
# Judge status: Accepted
N = int(input())

if N < 1000:
  print("ABC")
else:
  print("ABD")
# Judge status: Wrong Answer
S = input()
count = len(S)
a = 0
for i in range(count):
    if S[i] in S[i+1:]:
        print(S[i+1:])
        a = a+1
    else:
        pass
if a>0:
    print("no")
else:
    print("yes")
# Judge status: Accepted
S = list(input())
x = int("".join(S[0:2]))
y = int("".join(S[2:4]))
if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA")
pass
# Judge status: Wrong Answer
L, R = map(int, input().split())
if R - L > 2019:
  print(0)
else:
  l = []
  for i in range(L, R + 1):
    for j in range(i, R + 1):
      l.append(i * j % 2019)
  print(min(l))
# Judge status: Accepted
n=int(input())
s=input()

black=s.count("#")
white=s.count(".")
b=0
w=0
ans=float('inf')

for i in range(n):
  if s[i]=="#":
    b+=1
  elif s[i]==".":
    w+=1
  
  right_change=white-w
  now=b+right_change
  # print(now)
  ans=min(ans,now)
  
print(min(ans,black,white))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

points = [K - Q] * N

for i in A:
    points[i - 1] += 1
for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")
print(points)
# Judge status: Wrong Answer
l,r=map(int,input().split())
if r%2019<=l%2019:print(0)
else:print(l*(l+1)%2019)
# Judge status: Accepted
#ABC124
a,b = map(int,input().split())
print(max(a+b,a+(a-1),b+(b-1)))
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if a<=b:
    if a+v*t>=b+w*t:
        print('YES')
    else:
        print('NO')
else:
    if a-v*t<=b-w*t:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
import bisect

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

Q = []
P = [[] for _ in range(n)]
for i in range(m):
    p,y = map(int,input().split())
    Q.append([p,y])
    P[p-1].append(y)

P_1 = [sorted(l) for l in P]

for p,y in Q:
    a = str(p).zfill(6)
    b = str(bisect.bisect(P_1[p-1], y)).zfill(6)
    print(a+b)
# Judge status: Wrong Answer
# 1<=a,b<=10000
# a,bは整数

#number = input('整数を入力してね > ')
#print (number)
a, b = map(int, input('整数を入力してね > ').split())
#print(a, b)
c = a * b
#print(c)
d=c%2
if d==0:
    print('Even')
if d==1:
    print('Odd')
# Judge status: Wrong Answer
N, M=map(int, input().split())

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

num=["a"]*N
ans=True
for s in S:
  if (num[s[0]-1]!="a") and (num[s[0]-1]!=s[1]):
    ans=False
    break
  else:
    num[s[0]-1]=s[1]
    
if num[0]==0:
  ans=False
    
if ans:
  for i in range(N):
    if num[i]=="a":
      print(1, end="")
    else:
      print(num[i], end="")
else:
  print(-1)
# Judge status: Wrong Answer
alen,blen,k = map(int,input().split())
alist = list(map(int,input().split()))
blist = list(map(int,input().split()))
max = 0

for acount in range(0,alen):
    bcount = 0
    asum = sum(alist[:acount])
    while asum + sum(blist[:bcount+1]) < k and bcount <= blen:
        bcount += 1
    if acount + bcount > max and asum + sum(blist[:bcount])<=k:
        max = acount + bcount

print(max)
# Judge status: Wrong Answer
n,q = map(int,input().split())
s = input()

li = [0]*n

for i in range(1,n):
    if s[i-1] == "A" and s[i] == "C":
        li[i] += 1

from itertools import accumulate

lin = [0]+list(accumulate(li))
print(lin)
for _ in range(q):
    l,r = map(int,input().split())
    print(lin[r]-lin[l])
# Judge status: Accepted
x = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            tmp = i*10001 + j*1010 + k*100
            x.append(tmp)
x.sort()

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

ret = sum((a<= z and z <= b) for z in x)
print(ret)
# Judge status: Accepted
n = int(input())
s = input()
l, r, c = 0, 0, 0
for a in s:
    if a == '(':
        c += 1
    elif c:
        c -= 1
    else:
        l += 1
r = c
print("("*l + s + ")"*r)
# Judge status: Accepted
N=int(input())
ans=(1+(N-1))*(N-1)//2
print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())

s1 = [i for i in range(a, a+k) if i<=b]
s2 = [i for i in range(b-k+1, b+1) if i>=a]

s = list(set(s1+s2))
s.sort()

for i in s:
    print(i)