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:
s = input()
a = int(s[0:2])
b = int(s[2:4])

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

Submission status: Accepted

Solution code:
S = input()

def isYYMM(s):
    return isMM(s[2:4])

def isMMYY(s):
    return isMM(s[0:2])

def isMM(s):
    m1, m2 = list(s)
    if m1 == '0':
        if m2 == '0':
            return False
        else:
            return True
    elif m1 == '1':
        return m2 in ('0', '1', '2')
    else:
        return False
            

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=int(input())
A=S//100
B=S-100*A
if A<=12 and A!=0:
    if B<=12  and B!=0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif B<=12 and B!=0:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
temp = int(input())
head = temp//100
tail = temp%100

def judge(x):
  ans = ""
  if (x>12)or(x==0):
    ans="YY"
  else:
    ans="MM"
  return ans

h = judge(head)
t = judge(tail)

if h!=t:
  print(h+t)
elif h=="MM":
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:
S=int(input())
a=S//100
b=S%100
if a==0 or a>=13:
  if b==0 or b>=13:
    print("NA")
  else:
    print("YYMM")
else:
  if b==0 or b>=13:
    print("MMYY")
  else:
    print("AMBIGUOUS")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
h = int(s[:2])
l = int(s[2:])
def mmok(i):
  return 1 <= i <= 12
if mmok(h):
  if mmok(l):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if mmok(l):
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
s=input();print(["NA","YYMM","MMYY","AMBIGUOUS"][(0<int(s[2:])<13)+(0<int(s[:2])<13)*2])

Submission status: Accepted

Solution code:
S = list(map(str,input()))
first = int(S[0]+S[1])
second = int(S[2]+S[3])
fj = False
sj = False
if first >= 1 and first <= 12:
  fj = True
if second >= 1 and second <= 12:
  sj = True
if fj and sj:
  print('AMBIGUOUS')
if fj and not sj:
  print('MMYY')
if not fj and sj:
  print('YYMM')
if not fj and not sj:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def judge_1_12(n):
    if n > 0 and n < 13:
        return True
    else:
        return False

if judge_1_12(first) or judge_1_12(second):
    if judge_1_12(first) and judge_1_12(second):
        print("AMBIGUOUS")
    elif not judge_1_12(first):
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
print("NA" if (S[:2] < "01" or "12" < S[:2]) and (S[2:] < "01" or "12" < S[2:])
      else "YYMM" if (S[:2] < "01" or "12" < S[:2]) and ("01" <= S[2:] <= "12")
      else "MMYY" if ("01" <= S[:2] <= "12") and (S[2:] < "01" or "12" < S[2:])
      else "AMBIGUOUS")

Submission status: Accepted

Solution code:


s = input()

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

is_yymm = False
is_mmyy = False

if 1 <= b <= 12:
    is_yymm = True
if 1 <= a <= 12:
    is_mmyy = True

if is_yymm and is_mmyy:
    print("AMBIGUOUS")
elif is_yymm:
    print("YYMM")
elif is_mmyy:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
# ABC 126 B - YYMM or MMYY
S = input()
a = 0
b = 0

v = str(S[:2])
u = str(S[2:])
month = ['01', '02', '03', '04', '05', '06', '07','08','09','10','11','12']
if u in month:
    a = 1
if v in month:
    b = 1
if a == 1 and b == 1:
    print('AMBIGUOUS')
if a == 1 and b == 0:
    print('YYMM')
if a == 0 and b == 1:
    print('MMYY')
if a ==0 and b == 0:
    print('NA')

Submission status: Accepted

Solution code:
s = list(input())
s = [int(i) for i in s]
mae = 0
ato = 0
if (s[0] == 0 and s[1] != 0) or (s[0] == 1 and (s[1] == 0 or s[1] == 1 or s[1] == 2)):
    mae = 1
if (s[2] == 0 and s[3] != 0) or (s[2] == 1 and (s[3] == 0 or s[3] == 1 or s[3] == 2)):
    ato = 1
if mae == 0 and ato == 1:
    print('YYMM')
if mae == 1 and ato == 0:
    print('MMYY')
if mae == 1 and ato == 1:
    print('AMBIGUOUS')
if mae == 0 and ato == 0:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
def isMM(s):
  i = int(s)
  return True if 1 <= i <=12 else False
isYYMM = isMM(S[2:4])
isMMYY = isMM(S[0:2])
if isYYMM:
  if isMMYY:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if isMMYY:
    print("MMYY")
  else:
    print("NA")

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 0 <= B <= 99:
    print('MMYY')
elif 0 <= A <= 99 and 1 <= B <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def judge_month(s):
    if '00' < s and s <= '12':
        return True
    else:
        return False

S = input()

s1 = S[0] + S[1]
s2 = S[2] + S[3] 

month_1 = judge_month(s1)
month_2 = judge_month(s2)

if month_1 and month_2:
    print('AMBIGUOUS')
elif month_1:
    print('MMYY')
elif month_2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=int(input())
x=s//100
y=s-x*100




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

Submission status: Accepted

Solution code:
S = input()
S_front = S[:2]
S_rear = S[2:4]
S_front_int = int(S_front)
S_rear_int = int(S_rear)

YYMM_YY = False
YYMM_MM = False
MMYY_MM = False
MMYY_YY = False
YYMM = False
MMYY = False
if 0 <= S_front_int <= 99:
    YYMM_YY = True
if 1 <= S_rear_int <= 12:
    YYMM_MM = True
if 1 <= S_front_int <= 12:
    MMYY_MM = True
if 0 <= S_rear_int <= 99:
    MMYY_YY = True
if YYMM_YY == True and YYMM_MM == True:
    YYMM = True
if MMYY_MM == True and MMYY_YY == True:
    MMYY = True
if YYMM == True and MMYY == True:
    print('AMBIGUOUS')
elif YYMM == False and MMYY == False:
    print('NA')
elif YYMM == True and MMYY == False:
    print('YYMM')
elif YYMM == False and MMYY == True:
    print('MMYY')

Submission status: Accepted

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

if 0 < S1 and S1 < 13:
	if 0 < S2 and S2 < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 0 < S2 and S2 < 13:
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

Solution code:
s = input()
f = int(s[:2])
b = int(s[2:])

if 1 <= f <= 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 = int(input())
s1 = s//100
s2 = s%100

if (0 <= s1 <= 99 and 1 <= s2 <= 12) and (0 <= s2 <= 99 and 1 <= s1 <= 12):
    print("AMBIGUOUS")
elif 0 <= s2 <= 99 and 1 <= s1 <= 12:
    print("MMYY")
elif 0 <= s1 <= 99 and 1 <= s2 <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()


def yymm(S):
    yy = int(S[:2])
    mm = int(S[2:])
    return yy >= 0 and (mm >= 1 and mm <= 12)


def mmyy(S):
    mm = int(S[:2])
    yy = int(S[2:])
    return yy >= 0 and (mm >= 1 and mm <= 12)


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

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2]) < 13 and S[:2] != '00'
b = int(S[2:]) < 13  and S[2:] != '00'


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

Submission status: Accepted

Solution code:
s = input()
fro = int(s[:2])
bac = int(s[2:])

if 1 <= fro <= 12:
    if 1<= bac <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1 <= bac <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
s = int(S[0:2])
t = int(S[2:4])

if s >= 1 and s <= 12 and t >= 1 and t <= 12:
  print('AMBIGUOUS')
elif s >= 1 and s <= 12:
  print('MMYY')
elif t >= 1 and t <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
d1 = int(S[:2])
d2 = int(S[2:])

m = lambda d:d>0 and d<13

if m(d1):
    if m(d2):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if m(d2):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])
if 13<=a<=99 and 1<=b<=12 :
    print('YYMM')
elif a == 0 and 1<=b<=12:
    print('YYMM')
elif 1<=a<=12 and 13<=b<=99:
    print('MMYY')
elif 1<=a<=12 and b ==0:
    print('MMYY')
elif 1<=a<=12 and 1<=b<=12:
    print('AMBIGUOUS')

else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
upper_S = int(S[0:2])
lower_S = int(S[2:4])

if upper_S >=1 and upper_S <=12:
    if lower_S >= 1 and lower_S <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if lower_S >= 1 and lower_S <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
yymm_flag = False
mmyy_flag = False
if 1 <= int(S[0:2]) <= 12:
    mmyy_flag = True
if 1 <= int(S[2:4]) <= 12:
    yymm_flag = True
if (mmyy_flag == True) and (yymm_flag == True):
    print('AMBIGUOUS')
elif (mmyy_flag == True) and (yymm_flag == False):
    print('MMYY')
elif (mmyy_flag == False) and (yymm_flag == True):
    print('YYMM')
elif (mmyy_flag == False) and (yymm_flag == False):
    print('NA')

Submission status: Accepted

Solution code:
s = input()
x = int(s[0:2])
y = int(s[2:4])

if (x > 12 and y > 12 ) or (x==0 and y==0) or (x>12 and y==0) or (y>12 and x==0):
  print("NA")
elif x<13 and (y>12 or y==0):
  print("MMYY")
elif (x>12 or x==0) and y<13:
  print("YYMM")
elif x<13 and y<13:
  print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
x = input()

if int(x[0:2]) <= 12 and int(x[0:2])>0:
  a = True
else:
  a = False
      
if int(x[2:4]) <= 12 and int(x[2:4])>0:
  b = True
else:
  b = False
  
if(a and b):
  print("AMBIGUOUS")
  
elif( not a and b):
  print("YYMM")
  
elif( a and not b):
  print("MMYY")
  
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
head = int(s[0]+s[1])
tail = int(s[2]+s[3])
#print(head,tail)
if 1<=head<=12:
    if 1<=tail<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=tail<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
sp = s[:2]
ss = s[2:]
m = ["{0:02d}".format(i) for i in range(1,13)]
def check(s):
    if s in m:
        return True

sp_c = check(sp)
ss_c = check(ss)

if sp_c and ss_c:
    print("AMBIGUOUS")
elif sp_c and not ss_c:
    print("MMYY")
elif ss_c and not sp_c:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:

s = input()
s_up = int(s[0] + s[1])
s_down = int(s[2] + s[3])

if 0 < s_up <= 12 and 0 < s_down <= 12:
    print("AMBIGUOUS")
elif 0 < s_down <= 12:
    print("YYMM")
elif 0 < s_up<= 12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
import math
 
S = int(input())
 
first_half = math.floor(S / 100)
second_half = S - first_half * 100
 
if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 1 <= first_half <= 12 :
    	print("MMYY")
else: 
        print("NA")

Submission status: Accepted

Solution code:
import math

S = int(input())

first_half = math.floor(S / 100)
second_half = S - first_half * 100

if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 0 == first_half or 12 < first_half :
    	print("NA")
else: 
        print("MMYY")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
flg1 = 1 <= int(S[:2]) <= 12
flg2 = 1 <= int(S[2:]) <= 12

if flg1 and flg2:
    print('AMBIGUOUS')
elif flg1 and not flg2:
    print('MMYY')
elif not flg1 and flg2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = list(input())
S1 = int(S[0] + S[1])
S2 = int(S[2] + S[3])
if 0 < S1 < 13:
    if 0 < S2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < S2 < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
a = s[0:2]
b = s[2:4]
ans = ''
for i in [int(a), int(b)]:
        if 1 <= i <= 12:
                ans = ans + 'MM'
        else:
                ans = ans + 'YY'
if ans == 'YYYY':
        ans = 'NA'
elif ans == 'MMMM':
        ans = 'AMBIGUOUS'

print(ans)

Submission status: Accepted

Solution code:
S = input()


# 上2ケタ
if 0 < int(S[:2]) <= 12:
    temp = "both"
else:
    temp = "YY"
    
if 0 < int(S[2:4]) <= 12:
    temp2 = "both"
else:
    temp2 = "YY"
    
if temp == "both" and temp2 == "both":
    print("AMBIGUOUS")
elif temp == "both" and temp2 == "YY":
    print("MMYY")
elif temp == "YY" and temp2 == "both":
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

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:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
x = input()
erl = int(x[:2])
lat = int(x[2:4])

def ymjudge(date):
    return date <= 12 and date != 0 

if ymjudge(erl):
    if not ymjudge(lat):
        print("MMYY")
    else:
        print("AMBIGUOUS")
elif ymjudge(lat):
    if not ymjudge(erl):
        print("YYMM")
    else:
        print("AMBIGUOS")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
A = int(S[:2])
B = int(S[2:])
flag1 = 1 <= A and A <= 12
flag2 = 1 <= B and B <= 12
if flag1:
	if flag2:
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if flag2:
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    head = int(inputs[0][:2])
    tail = int(inputs[0][2:])

    if head >= 1 and head <= 12:
        if tail >= 1 and tail <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"

    if tail >= 1 and tail <= 12:
        return "YYMM"

    return "NA"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Accepted

Solution code:
S = input()

a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])

if 1<=a<=12 and 1<=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()
x = int(s[:2])
y = int(s[2:])

def in_month(n):
    return 1 <= n <= 12

if in_month(x) and in_month(y):
    print('AMBIGUOUS')
elif in_month(x):
    print('MMYY')
elif in_month(y):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def judge(s):
    if int(s[0]) == 0:
        if int(s[1]) > 0:
            return 1
        else:
            return 0
    elif int(s[0]) == 1:
        if int(s[1]) <=2:
            return 1
        else:
            return 0
    else:
        return 0

S = input()
tmp = list(S)
first = ''.join([tmp[0],tmp[1]])
second = ''.join([tmp[2],tmp[3]])

flag1 = -1
flag2 = -1

#YYMMがあるか判定　下2桁が01~12であればよい
flag1 = judge(second)

#MMYYがあるか判定
flag2 = judge(first)

#結果発表
if flag1 ==1 and flag2 == 1:
    print("AMBIGUOUS")
elif flag1 == 1 and flag2 == 0:
    print("YYMM")
elif flag1 == 0 and flag2 == 1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

Y = False
M = False
if 1 <= int(S[:2]) <= 12:
    Y = True
if 1 <= int(S[2:]) <= 12:
    M = True

if Y and M:
    print("AMBIGUOUS")
elif Y and not M:
    print("MMYY")
elif not Y and M:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = int(input())

Y = s//100
M = s%100
flag=0
#YYMM
if(M!=0 and M<13):
    flag+=1
#MMYY
if(Y!=0 and Y<13):
    flag+=2

if(flag==0):
    print('NA')
elif(flag==1):
    print('YYMM')
elif(flag==2):
    print('MMYY')
elif(flag==3):
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s = int(input())

prev = s // 100
late = s % 100

flag1 = False
flag2 = False

if prev >= 1 and prev <= 12:
    flag1 = True
if late >= 1 and late <= 12:
    flag2 = True

if flag1 and flag2:
    print('AMBIGUOUS')
elif flag1:
    print('MMYY')
elif flag2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=str(input())
A=int(S[0]+S[1])
B=int(S[2]+S[3])

if 0<A<=12 and 0<B<=12:
  print('AMBIGUOUS');exit()
elif (A>12 or A==0) and 0<B<=12:
  print('YYMM');exit()
elif 0<A<=12 and (B>12 or B==0):
  print('MMYY');exit()
else:
  print('NA');exit()

Submission status: Accepted

Solution code:
S = input()

mm = ['0' + str(x) for x in range(1,10)] + ['10','11','12']

mmyy = (S[:2] in mm)
yymm = (S[2:] in mm)

answer = 'NA'
if yymm and mmyy:
  answer = 'AMBIGUOUS'
elif yymm:
  answer = 'YYMM'
elif mmyy:
  answer = 'MMYY'
  
print(answer)

Submission status: Accepted

Solution code:
s = str(input())
ss = s[:2]
sss = s[2:]

if "01" <= sss <= "12":
    if "01" <= ss <= "12":
        print("AMBIGUOUS")
        exit()
    else:
        print("YYMM")
        exit()
if "01" <= ss <= "12":
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    S = input()
    YY = int(S[:2])
    MM = int(S[2:])

    if 1 <= YY <= 12:
        if 1 <= MM <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 1<= MM <= 12:
            print("YYMM")
        else:
            print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def test(A, B):
    if((A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("AMBIGUOUS")
        return

    if((B > 0 and B <= 12)):
        print("YYMM")
        return

    if ((A > 0 and A <= 12)):
        print("MMYY")
        return

    print("NA")


S = list(input())
A = int(S[0] + S[1])
B = int(S[2] + S[3])
test(A, B)

Submission status: Accepted

Solution code:
def test(A, B):
    if((A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("AMBIGUOUS")
        return

    if(not(A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("YYMM")
        return

    if ((A > 0 and A <= 12) and (not (B > 0 and B <= 12))):
        print("MMYY")
        return

    print("NA")


S = list(input())
A = int(S[0] + S[1])
B = int(S[2] + S[3])
# print(A)
# print(B)

# print(A != 0 and A <= 12)
# print(B != 0 and B <= 12)
test(A, B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())

for i in range(4):
    s[i] = int(s[i])

ans = "NA"

if 1 <= s[0] * 10 + s[1] <= 12 and 1 <= s[2] * 10 + s[3] <= 12:
    ans = "AMBIGUOUS"
elif 1 <= s[0] * 10 + s[1] <= 12:
    ans = "MMYY"
elif 1 <= s[2] * 10 + s[3] <= 12:
    ans = "YYMM"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

A = S[:2]
B = S[2:] 

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

Submission status: Accepted

Solution code:
S = input()

S_mae = int(S[:2])
S_ushiro = int(S[2:])

flg_MMYY = 0
flg_YYMM = 0
if 1 <= S_mae and S_mae <= 12:
    flg_MMYY = 1
    if 1 <= S_ushiro and S_ushiro <= 12:
        flg_YYMM = 1
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= S_ushiro and S_ushiro <= 12:
    flg_YYMM = 1
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

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

S = input()

formerYY = int(S[:2]) > 12 or int(S[:2]) == 0
latterYY = int(S[2:]) > 12 or int(S[2:]) == 0
if formerYY and latterYY:
    print("NA")
elif formerYY and not latterYY:
    print("YYMM")
elif latterYY and not formerYY:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
#r, d, x = map(int,input().split())
#n = int(input())
#ls = list(map(int,input().split()))
s = input()

if 0 < int(s[2:]) < 13 and 0 < int(s[0:2]) < 13:
  print("AMBIGUOUS")
elif 0 < int(s[2:]) < 13:
  print("YYMM")
elif 0 < int(s[0:2]) < 13:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()

front = int(s[:2])
back = int(s[2:])

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

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

aa=N//100
bb=N%100

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

Submission status: Accepted

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

def main():
    s = input()
    fi = int(s[:2])
    la = int(s[2:])
    flags = (can_be_month(fi), can_be_month(la))
    if flags == (True, True):
        res = "AMBIGUOUS"
    elif flags == (True, False):
        res = "MMYY"
    elif flags == (False, True):
        res = "YYMM"
    else:
        res = "NA"
    print(res)

def can_be_month(x):
    return 1 <= x <= 12

main()

Submission status: Accepted

Solution code:
s = int(input())
s1= s//100
s2= s%100
if (1 <= s1 and s1 <= 12) and (1 <= s2 and s2 <= 12):
  print('AMBIGUOUS')
elif 1 <= s1 and s1 <= 12:
  print('MMYY')
elif 1 <= s2 and s2 <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
ls = ['01','02','03','04','05','06','07','08','09','10','11','12']

if S[:2] in ls:
    if S[2:] in ls:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if S[2:] in ls:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s_1 = int(s[:2])
s_2 = int(s[2:])
if 0<s_1<=12 and (s_2>12 or s_2==0):
    print("MMYY")
elif (s_1>12 or s_1==0) and 0<s_2<=12:
    print("YYMM")
elif s_1<=12 and s_2<=12 and (s_1!=s_2 or min(s_1,s_2)>0):
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    head = int(S[:2])
    tail = int(S[2:])

    def can_month(i):
        return 1 <= i and i <= 12

    if can_month(head):
        if can_month(tail):
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if can_month(tail):
            print('YYMM')
        else:
            print('NA')


main()

Submission status: Accepted

Solution code:
S = input()
YY = int(S[:2])
MM = int(S[2:])

if 0 < MM and MM < 13:
    if 0 < YY and YY < 13:
        print('AMBIGUOUS') 
    else:
        print('YYMM')
elif 0 < YY and YY < 13:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
N = s[0]+s[1]
M = s[2]+s[3]
YM = ["01","02","03","04","05","06","07"
,"08","09","10","11","12"]
Y = ["00"]
for i in range(13,100):
	Y.append(str(i))
if N in Y and M in YM:
	print("YYMM")
elif N in YM and M in Y:
	print("MMYY")
elif N in YM and M in YM:
	print("AMBIGUOUS")
else:
	print("NA")

Submission status: Accepted

Solution code:
def MM(num: int):
    return 1 <= num <= 12

ret_dict = {
    (1,1): 'AMBIGUOUS',
    (1,0): 'MMYY',
    (0,1): 'YYMM',
    (0,0): 'NA'
}

def solve2():
    S = input()
    first = int(S[:2])
    second = int(S[2:])
    print(ret_dict[(MM(first), MM(second))])

solve2()

Submission status: Accepted

Solution code:
def MM(num: int):
    return 1 <= num <= 12

def solve():
    S = input()
    first = int(S[:2])
    second = int(S[2:])
    if MM(first) and MM(second):
        print('AMBIGUOUS')
    elif MM(first):
        print('MMYY')
    elif MM(second):
        print('YYMM')
    else:
        print('NA')

solve()

Submission status: Accepted

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

if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print("AMBIGUOUS")

elif 1 <= s2 <= 12:
    print("YYMM")

elif 1 <= s1 <= 12:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
a = input()

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

Submission status: Accepted

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

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