Problem:


Score : 200 points

Problem Statement

You have a digit sequence S of length 4. You are wondering which of the following formats S is in:

YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order

MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order

If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

Sample Input 1

1905

Sample Output 1

YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.

Sample Input 3

1700

Sample Output 3

NA

Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
YEARS = ["{:02d}".format(x) for x in range(100)]
MONTHS = ["{:02d}".format(x) for x in range(1, 13)]

S = input()

left, right = S[:2], S[2:]

types = 0x0

# YYMM
if left in YEARS and right in MONTHS:
    types += 0x01
# MMYY
if left in MONTHS and right in YEARS:
    types += 0x10

if types == 0x00:
    print("NA")
elif types == 0x01:
    print("YYMM")
elif types == 0x10:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
def main():
  s = int(input())
  
  a = s // 100
  b = s % 100
  
  if 1 <= a and a <= 12:
    if 1 <= b and b <= 12:
      print("AMBIGUOUS")
    else:
      print("MMYY")
  
  else:
    if 1 <= b and b <= 12:
      print("YYMM")
    else:
      print("NA")
  
main()

Submission status: Accepted

Solution code:
def resolve():
    s = int(input())
    top = s//100
    bottom = s%100
    if (top>12 or top==0) and bottom<=12 and bottom>0:
        print('YYMM')
    elif top<=12 and top>0 and (bottom>12 or bottom==0):
        print('MMYY')
    elif top<=12 and top>0 and bottom<=12 and bottom>0:
        print('AMBIGUOUS')
    else:
        print('NA')

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
s = input()

ml = []

for i in list(range(1, 13)):
    i = str(i)
    if len(i) == 1:
        ml.append("0"+i)
    else:
        ml.append(i)
        
if s[:2] not in ml and s[-2:] not in ml:
    print('NA')
    
elif s[:2] in ml and s[-2:] in ml:
    print("AMBIGUOUS")
    
elif s[:2] in ml:
    print("MMYY")

else:
    print("YYMM")

Submission status: Accepted

Solution code:
import re
s = input()
f = s[:2]
l = s[2:]
year_flg = 0
month_flg = 0
if re.match('^(0\d|1(0|1|2))$', l):
    if int(l) != 0:
        year_flg = 1
if re.match('^(0\d|1(0|1|2))$', f):
    if int(f) != 0:
        month_flg = 1
if year_flg == 1:
    if month_flg == 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif month_flg == 1:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
num=input()
a=eval(num[0])*10+eval(num[1])
b=eval(num[2])*10+eval(num[3])
if 1<=a<=12:
    if 1<=b<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=b<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = list(map(int, input()))
l = int(str(s[0]) + str(s[1]))
u = int(str(s[2]) + str(s[3]))

if l == 0:
    if u > 12:
        print("NA")
    elif u == 0:
        print("NA")
    else:
        print("YYMM")
elif l <= 12:
    if u > 12:
        print("MMYY")
    elif u == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if u > 12:
        print("NA")
    elif u == 0:
        print("NA")
    else:
        print("YYMM")

Submission status: Accepted

Solution code:
S = input()
L = int(S[:2])
R = int(S[2:])

if 0 < L <= 12:
    if 0 < R <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

elif 0 < R <= 12:
    print("YYMM")

else:
    print("NA")

Submission status: Accepted

Solution code:
num=int(input())
n1=num//100
n2=num%100
if 1<=n1 and n1<=12 and 1<=n2 and n2<=12:
    ans='AMBIGUOUS'
elif 1<=n1 and n1<=12:
    ans='MMYY'
elif 1<=n2 and n2<=12:
    ans='YYMM'
else:
    ans='NA'
print(ans)

Submission status: Accepted

Solution code:
s = input()
x=int(s[:2])
y=int(s[2:])
if 1<=x and x<=12:
    if 1<=y and y<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1<=y and y<=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

if 1 <= int(S[:2]) <= 12:
    if 1 <= int(S[2:4]) <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= int(S[2:4]) <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
ab, cd = int(s[0:2]), int(s[2:4])
if 0 < ab <= 12:
    if 0 < cd <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < cd <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S=list(str(input()))
if 1<=int(S[0]+S[1])<=12 and 1<=int(S[2]+S[3])<=12:
    print('AMBIGUOUS')
elif 1<=int(S[0]+S[1])<=12 and (1>int(S[2]+S[3]) or 12<int(S[2]+S[3])):
    print('MMYY')
elif 1<=int(S[2]+S[3])<=12 and (1>int(S[0]+S[1]) or 12<int(S[0]+S[1])):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
first = 0
second = 0
if 0 < int(S[:2]) < 13:
  first = 1
if 0 < int(S[2:]) < 13:
  second = 1

if first == 1 and second == 1:
  print('AMBIGUOUS')
elif first == 1 and second == 0:
  print('MMYY')
elif first == 0 and second == 1:
  print('YYMM')
elif first == 0 and second == 0:
  print('NA')

Submission status: Accepted

Solution code:
s = input()
l = [int(s[:2]), int(s[2:])]
ans = [0] * 2
for i in range(2):
    if l[i] > 12 or l[i] == 0:
        ans[i] = 1
    elif l[i] == 0:
        ans[i] = 3
sm = sum(ans)
if sm == 2:
    a = "NA"
elif sm == 1 and ans[0] == 0:
    a = "MMYY"
elif sm == 1 and ans[0] == 1:
    a = "YYMM"
elif sm == 3 and ans[0] == 0:
    a = "MMYY"
elif sm == 3 and ans[0] == 1:
    a = "YYMM"
elif sm > 3:
    a = "NA"
else:
    a = "AMBIGUOUS"
print(a)

Submission status: Accepted

Solution code:
def isMM(s):
    if s in ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']:
        return True
    return False

S = input()

front = S[0:2:]
back = S[2::]

if isMM(front) and isMM(back):
    print('AMBIGUOUS')
elif not isMM(front) and isMM(back):
    print('YYMM')
elif isMM(front) and not isMM(back):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
S=str(S)
list=['01','02','03','04','05','06','07','08','09','10','11','12']
if (S[0:2] in list) and (S[2:4] in list):
  print('AMBIGUOUS')
elif ((S[0:2] in list)==False) and ((S[2:4] in list)==True):
  print('YYMM')
elif ((S[0:2] in list)==True) and ((S[2:4] in list)==False):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
d=input()
a,b=map(int, [d[:2],d[2:]])
temp=[]
for i in [a,b]:
    if 1 <= i <=12:
        temp.append(2)
    elif 0 <= i <= 99:
        temp.append(1)
    else:
        temp.append(0)

if sum(temp) == 4:
    print('AMBIGUOUS')
elif sum(temp) == 3:
    if temp[0]==2:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = str(input()) 

a = int(s[:2])
b = int(s[2:])

if 1 <= a and a <= 12:
  if 1 <= b and b <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= b and b <= 12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
if (int(s[0]+s[1]) > 0 and int(s[0]+s[1])<=12) and (int(s[2]+s[3]) > 0 and int(s[2]+s[3])<=12):
    print("AMBIGUOUS")
elif int(s[0]+s[1]) > 0 and int(s[0]+s[1])<=12:
    print("MMYY")
elif int(s[2]+s[3]) > 0 and int(s[2]+s[3])<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())

firsthalf = int(S/100)
latterhalf = int(S%100)

if (firsthalf>12 or firsthalf==0) and (latterhalf>12 or latterhalf==0):
    print("NA")
elif firsthalf<=12 and (latterhalf>12 or latterhalf==0):
    print("MMYY")
elif (firsthalf>12 or firsthalf==0) and latterhalf<=12:
    print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = input()
a = int(s[0:2])
b = int(s[2:4])

if a >= 1 and a <= 12:
    if b >= 1 and b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if b == 0 or b > 12:
        print('NA')
    else:
        print('YYMM')

Submission status: Accepted

Solution code:
S = input()

yymm = 0
mmyy = 0

kami2 = int(S[0]) * 10 + int(S[1])
simo2 = int(S[2]) * 10 + int(S[3])


if simo2 > 0 and simo2 <= 12:
    yymm=1
if kami2 <= 12 and kami2 >0:
    mmyy=1


if yymm:

 if mmyy:
    print("AMBIGUOUS")
 else:
     print("YYMM")
           
elif mmyy:
     print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
count =0
s = list(map(int, input()))
s1 = s[:2]
if s1 >= [0, 1] and s1 <= [1, 2]:
    count += 1
s1 = s[2:]
if s1 >= [0, 1] and s1 <= [1, 2]:
    count += 2

if count == 0:
    print("NA")
elif count == 1:
    print("MMYY")
elif count == 2:
    print("YYMM")
elif count == 3:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = input()

a = int(s[:2])
b = int(s[2:])
if 1<= a <=12 and 1<=b<=12:
	print("AMBIGUOUS")
elif 1<=a<=12 and (b ==0 or b>=13):
	print("MMYY")
elif (a == 0 or a>=13) and  1<=b<=12:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
s = str(input())
s = list(s)
S1 = int(s[0]+s[1])
S2 = int(s[2]+s[3])

def mon(x):
    if x <= 12 and 1<=x:
        return True
    else:
        return False
    
if mon(S1) and mon(S2):
    print("AMBIGUOUS")
elif mon(S1) and not mon(S2):
    print("MMYY")
elif not mon(S1) and mon(S2):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = list(input())
L, R = int("".join(S[:2])), int("".join(S[2:]))
if 1 <= L <= 12:
    if 1 <= R <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= R <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import bisect
from collections import defaultdict

def main():
    S = input().strip()

    first, last = int(S[:2]), int(S[2:])

    is_first_month = 0 < first and first <= 12
    is_last_month = 0 < last and last <= 12

    if is_first_month and is_last_month:
        print("AMBIGUOUS")
    if not is_first_month and not is_last_month:
        print("NA")
    if is_first_month and not is_last_month:
        print("MMYY")
    if not is_first_month and is_last_month:
        print("YYMM")



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#coding:utf-8

import sys

S = int(input())
S1 = int(S/100)
S2 = int(S-100*S1)

if (1 <= S1 <= 12) and (1 <= S2 <= 12):
    print("AMBIGUOUS")
    sys.exit()

if (1 <= S2 <= 12):
    print("YYMM")
    sys.exit()

if (1 <= S1 <= 12):
    print("MMYY")
    sys.exit()

else:
    print("NA")

Submission status: Accepted

Solution code:
S = list(input())
front = int(S[0])*10 + int(S[1])
back = int(S[2])*10 + int(S[3])

if 1 <= front and front <= 12 and 1 <= back and back <= 12:
    print("AMBIGUOUS")
elif 1 <= front and front <= 12:
    print("MMYY")
elif 1 <= back and back <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
A=input()
B=int(A[:2])
C=int(A[2:4])
  
if(1<=B<=12):
    if(1<=C<=12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif(1<=C<=12):
    print('YYMM')    
else:
    print('NA')

Submission status: Accepted

Solution code:
a = int(input())  # 数値入力
b = int(a/100)
c = a%100
if b>0 and b<=12:
    if c>0 and c<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if c>0 and c<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
S_1 = S[:2]
S_2 = S[2:]
if int(S_1)>=13 or int(S_1)==0:
    if int(S_2)>=13 or int(S_2)==0:print("NA")
    else:print("YYMM")
else:
    if int(S_2)>=13 or int(S_2)==0:print("MMYY")
    else:print("AMBIGUOUS")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


YYMM = "YYMM"
MMYY = "MMYY"
AMBIGUOUS = "AMBIGUOUS"
NA = "NA"

def solve(S):
    a= S//100
    b= S % 100
    if 1 <= a <=12 and 1 <= b <= 12:
        print(AMBIGUOUS)
    elif 1 <= a <= 12:
        print(MMYY)
    elif 1 <= b <= 12:
        print(YYMM)
    else:
        print(NA)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
if(1<=a<=12):
    if(1<=b<=12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif(1<=b<=12):
    print('YYMM')    
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
left,right = map(int, [s[:2], s[-2:]])
if 0 < left < 13:
    if 0 < right < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < right < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S=input()
aa=int(S[:2])
bb=int(S[2:])

a=False
b=False

if aa!=0 and aa<=12:
    a=True

if bb!=0 and bb<=12:
    b=True
    
#print(a,b,bb)
    
if a and b:
    ans="AMBIGUOUS"
elif a and not b:
    ans="MMYY"
elif not a and b:
    ans="YYMM"
else:
    ans="NA"
    
print(ans)

Submission status: Accepted

Solution code:
s = input()
n1, n2 = int(s[:2]), int(s[2:])
YM, MY = False, False
if 0 < n2 < 13: YM = True
if 0 < n1 < 13: MY = True

if YM and MY: print("AMBIGUOUS")
elif YM: print("YYMM")
elif MY: print("MMYY")
else: print("NA")

Submission status: Accepted

Solution code:
data = int(input())
up = data/100
down = data % 100
if(1 <= up and up <= 12):
    if(1 <= down and down <= 12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(1 <= down and down <= 12):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s=input()
a,b=map(int,[s[:2],s[-2:]])
if 0<a<13:
    if 0<b<13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0<b<13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
start = int(s[:2])
end = int(s[-2:])
if 0 < start <= 12 and 0 < end <= 12:
  print('AMBIGUOUS')
elif 0 < end <= 12:
  print('YYMM')
elif 0 < start <= 12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def is_m(a):
    if 1 <= a <= 12:
        return 1
    return 0


def main():
    S = input()

    A = int(S[:2])
    B = int(S[2:])

    a = is_m(A)
    b = is_m(B)

    if a and b:
        print("AMBIGUOUS")
    elif not a and not b:
        print("NA")
    elif a:
        print("MMYY")
    else:
        print("YYMM")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
first = int(s[:2])
last = int(s[2:])

def is_month(m):
    return m > 0 and m <= 12

if is_month(first) and not is_month(last):
    print('MMYY')
elif not is_month(first) and is_month(last):
    print('YYMM')
elif not is_month(first) and not is_month(last):
    print('NA')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
a=int(S[:2])
b=int(S[2:])
if (1<=a and a<=12):   
    if (1<=b and b<=12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if (1<=b and b<=12):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
a = input()
if 0<int(a[:2])<=12:
  if 0<int(a[2:])<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0<int(a[2:])<=12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S=input()
S1=int(S[0]+S[1])
S2=int(S[2]+S[3])

if 1<=S1<=12 and 1<=S2<=12:
    print('AMBIGUOUS')

elif 1<=S1<=12 :
    print('MMYY')

elif 1<=S2<=12:
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

a = int(s[:2])
b = int(s[2:])

ma = 1 <= a <= 12
mb = 1 <= b <= 12

if ma:
    if mb:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if mb:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()

head = int(s[:2])
tail = int(s[2:])

if 0 < head <= 12 and 0 < tail <= 12:
  print("AMBIGUOUS")

elif 0 < head <= 12:
  print("MMYY")

elif 0 < tail <= 12:
  print("YYMM")

else :
  print("NA")

Submission status: Accepted

Solution code:
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])

if  1<=s1<=12:
    if  1<=s2<=12:
        print('AMBIGUOUS')
    else :
        print('MMYY')

else:
    if  1<=s2<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()

a = int(s[:2])
b = int(s[2:])

ans = []

if ((1 <= b) and (b <= 12)) and ((1 <= a) and (a <= 12)):
    print("AMBIGUOUS") 
elif (1 <= b) and (b <= 12):
    print("YYMM")
elif (1 <= a) and (a <= 12):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
x,y = map(int, [S[:2],S[2:]] )
if 1 <= x and x <= 12:
    if 1<= y and y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<= y and y <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
mmlist = ["01", "02", "03",
          "04", "05", "06",
          "07", "08", "09",
          "10", "11", "12"]
if S[:2] in mmlist :
    if S[2:] in mmlist :
        print("AMBIGUOUS")
    else :
        print("MMYY")
else :
    if S[2:] in mmlist :
        print("YYMM")
    else :
        print("NA")

Submission status: Accepted

Solution code:
def abc():
    import re
    re_yy = r'([0-9][0-9])'
    re_mm = r'(0[1-9]|1[0-2])'
    s = input().rstrip()

    f = ''
    if re.match(re_yy + re_mm, s):
        f += 'YYMM'
    if re.match(re_mm + re_yy, s):
        f += 'MMYY'
    if f == 'YYMMMMYY':
        f = 'AMBIGUOUS'
    if f == '':
        f = 'NA'
    print(f)


abc()

Submission status: Accepted

Solution code:
S = input()
AA = int(S[:2])
BB = int(S[2:])

## YY/MMの確認
isYYMM = False
isMMYY = False
if BB > 0 and BB < 13:
    isYYMM = True
if AA > 0 and AA < 13:
    isMMYY = True

if isYYMM and isMMYY:
    print("AMBIGUOUS")
elif isYYMM:
    print("YYMM")
elif isMMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = list(input())
MMYY = False
YYMM = False
for x in range(1,13):
    MMYY = MMYY or (x == int(''.join(s[:2])))
    YYMM = YYMM or (x == int(''.join(s[2:])))
if MMYY and YYMM:
    ans = 'AMBIGUOUS'
elif(YYMM):
    ans = 'YYMM'
elif(MMYY):
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
import re
s = list(input())
match_MMYY = re.match(r'0[1-9]|1[0-2]', "".join(s[:2]))
match_YYMM = re.match(r'0[1-9]|1[0-2]', "".join(s[2:]))
if (match_YYMM and match_MMYY):
    answer = 'AMBIGUOUS'
elif(match_YYMM):
    answer = 'YYMM'
elif(match_MMYY):
    answer = 'MMYY'
else:
    answer = 'NA'

print(answer)

Submission status: Accepted

Solution code:
S = str(input())
L = int(S[:2])
R = int(S[2:])

if L == 0:
    L = 99
if R == 0:
    R = 99

if L > 12 and R > 12:
    print("NA")
elif L <= 12 and R <= 12:
    print("AMBIGUOUS")
elif L > R:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
S = str(input())
L = int(S[:2])
R = int(S[2:])

if L == 0:
    L = 99
if R == 0:
    R = 99

if (L > 12 and R > 12) or (L == 0 and R == 0):
    print("NA")
elif 0 < L <= 12 and 0 < R <= 12:
    print("AMBIGUOUS")
elif L > R:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
s=list(map(int,input().split()))
a=0
b=0
c=0
d=0
e=0
f=0
a=s[0]-s[0]%1000
a=a/100
d=s[0]%10
c=s[0]%100-d
b=s[0]-a*100-c-d
b=int(b/100)
e=a+b
f=c+d
if e==0:
  if 1<=f and f<=12:
    print('YYMM')
  else:
    print('NA')
elif 1<=e and e<=12:
  if 1<=f and f<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1<=f and f<=12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S=int(input())
U=S//100
L=S%100
#M 01 12
#Y 00 99
if U==0 or U>12: # U=Y
    if L ==0 or L>12: # L=Y
        print("NA")
    else:
        print("YYMM")
else: # U=YorM
    if L==0 or L>12: #L=Y
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = str(input())

a, b = 0, 0

#YYMM
if 1 <= int(S[2:]) and int(S[2:]) <= 12:
  a = 1
#MMYY
if 1 <= int(S[:2]) and int(S[:2]) <= 12:
  b = 1
  
if a == 1 and b == 1:
  print("AMBIGUOUS")
elif a == 1 and b == 0:
  print("YYMM")
elif a == 0 and b == 1:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
a = input()
mm = int(a[:2])
yy = int(a[2:])

can1 = True
can2 = True

if mm>12:
  can1 = False
if mm<1:
  can1= False

if yy>12:
  can2 = False
if yy<1:
  can2 = False

if can1 and can2:
  print("AMBIGUOUS")
elif can2:
  print("YYMM")
elif can1:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
S = int(input())

word = "NA","MMYY","YYMM","AMBIGUOUS"
S1 = int(S/100)
S2 = int(S%100)
answer = 0
if S1 > 0 and S1 < 13:
  if S2 >= 0 and S2 <= 99:
    answer = answer + 1
if S2 > 0 and S2 < 13:
  if S1 >= 0 and S1 <= 99:
    answer = answer + 2
print(word[answer])

Submission status: Accepted

Solution code:
n=input()
l,r=int(n[:2]),int(n[2:])
if (r>12 or r==0) and l<=12 and l>0:
  print("MMYY")
elif r<=12 and r>0 and (l>12 or l==0):
  print("YYMM")
elif r<=12 and l<=12 and r>0 and l>0:
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:
s=int(input())
a=s//100
b=s%100
if 0<a<13 and 0<b<13:
  print("AMBIGUOUS")
elif 0<a<13:
  print("MMYY")
elif 0<b<13:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
MMYY, YYMM = 0, 0
if 1 <= int(s[0:2]) <= 12:
    MMYY = 1
if 1 <= int(s[2:4]) <= 12:
    YYMM = 1
if MMYY and YYMM:
    ans = 'AMBIGUOUS'
elif MMYY:
    ans = 'MMYY'
elif YYMM:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
if (1<=a<=12) and (1<=b<=12):
  print('AMBIGUOUS')
elif (1<=a<=12) and (b==0 or 12<b):
      print('MMYY')
elif (1<=b<=12) and (a==0 or 12<a):
      print('YYMM')
else:
      print('NA')

Submission status: Accepted

Solution code:
S = input()
x0 = int(S[:2])
x1 = int(S[2:])

if 0 < x0 <= 12 and 0 < x1 <= 12:
    print('AMBIGUOUS')
elif 0 < x0 <= 12:
    print('MMYY')
elif 0 < x1 <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()
s1 = int(s[0:2])
s2 = int(s[2:4])
if s1 > 12 or s1 == 0 :
    if s2 > 12 or s2 == 0 :
        print('NA')
    else:
        print('YYMM')
elif s2 > 12 or s2 == 0 :
    print('MMYY')
else :
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s = str(input())
 
if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
    ans = "AMBIGUOUS"
elif 0 < int(s[:2]) <= 12:
    ans = "MMYY"
elif 0 < int(s[2:]) <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
s = str(input())

if 0 < int(s[:2]) <= 12:
    if 0 < int(s[2:]) <= 12:
        ans = "AMBIGUOUS"
    else :
        ans = "MMYY"
elif 0 < int(s[2:]) <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
S = input()
s1 = int(S[:2])
s2 = int(S[2:])

if 12>=s1>0 and 12>=s2>0:
    print('AMBIGUOUS')
elif 12>=s1>0:
    print('MMYY')
elif 12>=s2>0:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = list(map(int, input()))
pre =  S[0] * 10 + S[1]
suf =  S[2] * 10 + S[3]
S2 = [pre, suf]
ans = ''

def YorM (x):
    if x == 0:
        return 'YY'
    elif x >= 1 and x <= 12:
        return 'AMB'
    else:
        return 'YY'

S3 = [YorM(i) for i in S2]

if S3[0] == 'YY':
    if S3[1] == 'AMB':
        ans = 'YYMM'
    else:
        ans = 'NA'
if S3[0] == 'AMB':
    if S3[1] == 'YY':
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'

print(ans)

Submission status: Accepted

Solution code:
S = input()

ans1 = 'YYMM'
ans2 = 'MMYY'
ans3 = 'AMBIGUOUS'
ans4 = 'NA'

s1 = int(S[:2])
s2 = int(S[2:])

if 0 < s1 < 13 and 0 < s2 < 13:
  print(ans3) 
elif 0 < s1 < 13:
  print(ans2) 
elif 0 < s2 < 13:
  print(ans1) 
else:
  print(ans4)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
ri = lambda: int(input())
#rl = lambda: [int(x) if x.isdecimal() else x for x in input().split()]
#rl = lambda: list(input().split()))
rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

S=input().rstrip()
a=int(S[:2])
b=int(S[2:])
if 1<=a and a<=12 and 1<=b and b<=12:
    print('AMBIGUOUS')
elif 1<=b and b<=12:
    print('YYMM')
elif 1<=a and a<=12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
sm = list(s)
sm1 = [sm[0], sm[1]]
sm2 = [sm[2], sm[3]]
a = int(''.join(sm1))
b = int(''.join(sm2))

if (a >= 1 and a<= 12)and(b >= 1 and b<=12):
    print("AMBIGUOUS")
elif (a >=1 and a<=12) and (b == 0 or b>=13):
    print("MMYY")
elif (a == 0 or a>=13) and (b>=1 and b<=12):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
Y = int(S[:2])
M = int(S[2:])

if 0 < Y <13 and 0 < M < 13:
  print("AMBIGUOUS")
elif 0 < M < 13:
  print("YYMM")
elif 0 < Y < 13:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = int(input())
l = s//100
r = s%100

if 0 < l < 13:
    if 0 < r <13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0 < r < 13:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
front = s//100
bk = s%100
if 0 < front < 13:
    if 0 < bk < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0 < bk < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
ss = input()
ue = int(ss[:2])
sita = int(ss[2:])

uem = False
sitam = False

if 1 <= ue and ue <= 12:
  uem = True
  
if 1 <= sita and sita <= 12:
  sitam = True
  
if uem and sitam:
  print('AMBIGUOUS')
elif uem:
  print('MMYY')
elif sitam:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
a = int(input())  # 数値入力
b = a%100
a = int(a/100)

if a>0 and a<=12:
    if b>0 and b<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b>0 and b<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
yy = int(s[:2])
mm = int(s[2:])
if  0 < yy <= 12 and 0 < mm <= 12:
    print("AMBIGUOUS")
elif 0 < yy <= 12:
    print("MMYY")
elif 0 < mm <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    s = input()
    if 1 <= int(s[:2]) <= 12 and 1 <= int(s[2:4]) <= 12:
        print('AMBIGUOUS')
    elif 1 <= int(s[:2]) <= 12 and 0 <= int(s[2:4]) <= 99:
        print('MMYY')
    elif 0 <= int(s[:2]) <= 99 and 1 <= int(s[2:4]) <= 12:
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
a=int(s[0]+s[1])
b=int(s[2]+s[3])

if a > 0 and a < 13:
  if b >0 and b < 13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if b>0 and b < 13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
def solve():
	unknownDate = input()
	datePre = int(unknownDate[:2])
	datePos = int(unknownDate[2:])
	
	isPreMightMonth = (0 < datePre <= 12)
	isPostMightMonth = (0 < datePos <= 12)
	
	if isPreMightMonth and isPostMightMonth:
		print('AMBIGUOUS')
	elif isPreMightMonth and (not isPostMightMonth):
		print('MMYY')
	elif (not isPreMightMonth) and isPostMightMonth:
		print('YYMM')
	else:
		print('NA')
solve()

Submission status: Accepted

Solution code:
def isyymm(s0,s1,s2,s3):
    if s2 == 0:
        if s3 in range(1,10):
            return 1
    elif s2 == 1:
        if s3 in range(3):
            return 1
    else:
        return 0

def ismmyy(s0,s1,s2,s3):
    if s0 == 0:
        if s1 in range(1,10):
            return 1
    elif s0 == 1:
        if s1 in range(3):
            return 1
    else:
        return 0

S = input()
s = [int(i) for i in S]

if isyymm(*s) == 1:
    if ismmyy(*s) == 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if ismmyy(*s) == 1:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
mae = int(S[0:2])
ushiro = int(S[2:4])
flg = 3
 
if 1 <= mae <= 12 :
	flg -= 2
if 1 <= ushiro <= 12 :
	flg -= 1
if flg == 3:
	print('NA')
elif flg == 2:
	print('YYMM')
elif flg == 1:
	print('MMYY')
elif flg == 0:
	print('AMBIGUOUS')

Submission status: Accepted

Solution code:

s = input()
pre = s[:2]
suf = s[2:]


def is_yy(s):
    return s <= "00" or "13" <= s


if is_yy(pre) and is_yy(suf):
    print("NA")
elif is_yy(pre) and not is_yy(suf):
    print("YYMM")
elif not is_yy(pre) and is_yy(suf):
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = int(input())

A = int(S/100)
B = S%100

if 1<=A<= 12:
    if 1<=B<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=B<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
	s = input()
	first = int(s[:2])
	second = int(s[2:])

	if (first >= 13 or first == 00) and (second >= 13 or second == 00):
		print("NA")
	elif first >= 13 or first == 00:
		print("YYMM")
	elif second >= 13 or second == 00:
		print("MMYY")
	else:
		print("AMBIGUOUS")


if __name__ == "__main__":
	main()