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()

f=int(S[0]+S[1])
r=int(S[2]+S[3])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = n // 100
r = n % 100
yymm = 1 <= r <= 12
mmyy = 1 <= l <= 12
if yymm:
    print('AMBIGUOUS' if mmyy else 'YYMM')
else:
    print('MMYY' if mmyy else 'NA')

Submission status: Accepted

Solution code:
S = input()
a, b = int(S[:2]), int(S[2:])
c = set(list(range(1, 12 + 1)))

if a in c and b in c:
    print('AMBIGUOUS')
    exit()
if a in c:
    print('MMYY')
    exit()
if b in c:
    print('YYMM')
    exit()
print('NA')
exit()

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    S = input()
    isMM = lambda s: int(s) > 0 and int(s) <= 12
    isOnlyYY = lambda s: int(s)>12 or int(s) == 0
    if   isMM(S[:2]) and isOnlyYY(S[2:]): print('MMYY')
    elif isOnlyYY(S[:2]) and isMM(S[2:]): print('YYMM')
    elif isMM(S[:2]) and isMM(S[2:]): print('AMBIGUOUS')
    else: print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#B
s = list(input())
left = int(s[0])*10+int(s[1])
right = int(s[2])*10+int(s[3])
if 0 < left <= 12:
    if 0 < right <= 12:
        print("AMBIGUOUS")
    else:
        print('MMYY')
elif 0 < right <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
ans = 'NA'
mmyy = False
yymm = False
if S[0]=='0' and S[1]!='0':
  mmyy = True
if S[0]=='1' and (S[1]=='0' or S[1]=='1' or S[1]=='2'):
  mmyy = True
if S[2]=='0' and S[3]!='0':
  yymm = True
if S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2'):
  yymm = True
lis = [['NA','YYMM'],['MMYY','AMBIGUOUS']]
ans = lis[mmyy][yymm]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
l=list(range(1,13))
ans="NA"
if a not in l and b in l:
    ans="YYMM"
elif a in l and b not in l:
    ans="MMYY"
elif a in l and b in l:
    ans="AMBIGUOUS"
print(ans)

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  S = input()
  A = int(S[0:2])
  B = int(S[2:4])
  if(1<=A<=12):
      if(1<=B<=12):
          print("AMBIGUOUS")
      else:
          print("MMYY")
  elif(1<=B<=12):
      print("YYMM")
  else:
      print("NA")
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
s = input()
F = 0 < int(s[:2]) < 13
S = 0 < int(s[2:]) < 13
print("AMBIGUOUS" if F*S else "YYMM" if S else "MMYY" if F else "NA")

Submission status: Accepted

Solution code:
s = input()

upper = int(s[:2])
lower = int(s[2:4])

if upper > 12:
    if lower > 12 or lower <= 0: print('NA')
    else: print('YYMM')
elif upper <= 0:
    if lower <= 12 and lower > 0: print('YYMM')
    else: print('NA')
else:
    if lower > 12: print('MMYY')
    elif lower <= 0: print('MMYY')
    else: print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
prefix_MM = False
surfix_MM = False
MM = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
if S[0:2] in MM:
    prefix_MM = True
if S[2:4] in MM:
    surfix_MM = True

if prefix_MM and surfix_MM:
    print("AMBIGUOUS")
elif prefix_MM:
    print("MMYY")
elif surfix_MM:
    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 and s1>=1:
  print('AMBIGUOUS' if (s2<=12 and s2>=1) else 'MMYY')
else:
  print('YYMM' if (s2<=12 and s2>=1) else 'NA')

Submission status: Accepted

Solution code:
S = input()
upper = S[:2]
lower = S[2:]
months = ["0"+str(i) if i < 10 else str(i) for i in range(1, 13)]
is_yymm = lower in months
is_mmyy = upper in months

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:
s = input()
a = int(s[0:2])
b = int(s[2:4])
if 1 <= a <= 12 and 1 <= b <= 12:
  print('AMBIGUOUS')
elif 1 <= a <= 12 and not 1 <= b <= 12:
  print('MMYY')
elif not 1 <= a <= 12 and 1 <= b <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

S = int(input())

s1 = S//100
s2 = S%100

yymm = 1<=s2<=12
mmyy = 1<=s1<=12

ans = ""
if yymm:
    if mmyy:
        ans = "AMBIGUOUS"
    else:
        ans = "YYMM"
else:
    if mmyy:
        ans = "MMYY"
    else:
        ans = "NA"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
YYMM=MMYY=False
if s[:2]<="12" and s[:2]>="01":
    MMYY=True
if s[2:]<="12" and s[2:]>="01":
    YYMM=True
if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = int(input())

f = S // 100
b = S % 100

if 1 <= f and f <= 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()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

yymm_flag = False
mmyy_flag = False

if 0 < s1 and s1 < 13:
    mmyy_flag = True
if 0 < s2 and s2 < 13:
    yymm_flag = True

if yymm_flag and mmyy_flag:
    print("AMBIGUOUS")
elif yymm_flag:
    print("YYMM")
elif mmyy_flag:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
A = int(S[0:2])
B = int(S[2:4])
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:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    s1=int(s[0:2])
    s2=int(s[2:4])
    flg0,flg1=0,0
    if s1==0 or s1>12:
        flg0=1
    if s2==0 or s2>12:
        flg1=1
    if flg0==1 and flg1==1:
        print('NA')
    elif flg0==0 and flg1==0:
        print('AMBIGUOUS')
    elif flg0==0 and flg1==1:
        print('MMYY')
    elif flg0==1 and flg1==0:
        print('YYMM')
    
if __name__ == '__main__':
    do()

Submission status: Accepted

Solution code:
s = input()

xx = int(s[0:2])
yy = int(s[2:4])

if 1 <= xx <= 12:
    if 1 <= yy <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 1 <= yy <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

xx = s[0] + s[1]
yy = s[2] + s[3]
xx = int(xx)
yy = int(yy)

if 1 <= xx <= 12:
    if yy >= 13 or yy == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

if xx == 0 or 13 <= xx <= 99:
    if 1 <= yy <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = int(input())
a = s //100
b = s - a * 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:
S = int(input())
A = 0
B = 0
ans = "NA"
if 0 < S//100 < 13 :
  A = 1

if 0 < S%100 < 13 :
  B = 1

if A == 1 and B == 1 :
  ans = "AMBIGUOUS"

elif A == 1 :
  ans = "MMYY"

elif B == 1:
  ans = "YYMM"

print(ans)

Submission status: Accepted

Solution code:
S=list(input())
F=int(''.join(S[0:2]))
B=int(''.join(S[2:4]))
if 0<F<13:
  if 0<B<13:
    ans='AMBIGUOUS'
  else:
    ans='MMYY'
else:
  if 0<B<13:
    ans='YYMM'
  else:
    ans='NA'
print(ans)

Submission status: Accepted

Solution code:
S=list(input())
F=int(''.join(S[0:2]))
B=int(''.join(S[2:4]))
if 0<F<13 and 0<B<13:
  ans='AMBIGUOUS'
elif F>12 and B>12:
  ans='NA'
elif F>12 and 0<B<13:
  ans='YYMM'
elif B>12 and 0<F<13:
  ans='MMYY'
elif F==0:
  if not 0<B<13:
    ans='NA'
  else:
    ans='YYMM'
elif B==0:
  if not 0<F<13:
    ans='NA'
  else:
    ans='MMYY'
print(ans)

Submission status: Accepted

Solution code:
S = input()
F = int(S[0] + S[1])
B = int(S[2] + S[3])
if min(F, B) > 12 or max(F, B) == 0 or min(F,B) == 0 and max(F, B) > 12:
  print('NA')
elif min(F, B) != 0 and max(F, B) <= 12:
  print('AMBIGUOUS')
elif F <= 12 and F != 0:
  print('MMYY')
else:
  print('YYMM')

Submission status: Accepted

Solution code:
s = input()
YYMM = False
MMYY = False

if 1 <= int(s[:2]) <= 12:
    MMYY = True
if 1 <= int(s[2:]) <= 12:
    YYMM = True

ans = ''
if YYMM and MMYY:
    ans = 'AMBIGUOUS'
elif YYMM:
    ans = 'YYMM'
elif MMYY:
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

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')
else:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:

s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm_e == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s= str(input())
s1, s2, s3, s4 = [int(i) for i in s]
if (s1 == 0 and 1 <= s2 and s2 <= 9) or (s2 == 1 and 0 <= s2 and s2 <= 2):
    if (s3 == 0 and 1 <= s4 and s4 <= 9) or (s3 == 1 and 0 <= s4 and s4 <= 2):
        print("AMBIGUOUS")
    
    else:
        print("MMYY")
else:
    if (s3 == 0 and 1 <= s4 and s4 <= 9) or (s3 == 1 and 0 <= s4 and s4 <= 2):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = list(input())

d = []
d.append(int(S[0]+S[1]))
d.append(int(S[2]+S[3]))

res = []
if(1<= d[0] <= 12):
    res.append('MMYY')
    # MMYY
if(1<= d[1] <= 12):
    res.append('YYMM')
    # YYMM
if(res == []):
    print('NA')
elif(len(res) == 1 and res[0] == 'MMYY'):
    print('MMYY')
elif(len(res) == 1 and res[0] == 'YYMM'):
    print('YYMM')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()
l = S[:2]
r = S[2:]
 
lcnt = 0
rcnt = 0
if 0 < int(l) <= 12:
    lcnt = 1
if  0 < int(r) <= 12:
    rcnt = 1
if lcnt and rcnt:
    print('AMBIGUOUS')
    exit()
elif lcnt:
    print('MMYY')
    exit()
elif rcnt:
    print('YYMM')
    exit()
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    up = int(s[0:2])
    lo = int(s[-2:])
    if can_month(up):
        if can_month(lo):
            print('AMBIGUOUS')
        else:
            print('MMYY')

    else:
        if can_month(lo):
            print('YYMM')
        else:
            print('NA')


def can_month(v):
    if v > 0 and v <= 12:
        return True
    else:
        return False

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = int(input())
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")

Submission status: Accepted

Solution code:
s=input()
be=s[:2]
af=s[2:]

if s=="0000":
  print("NA")

elif int(be)<=12 and int(af)<=12 and be!="00" and af!="00":
  print("AMBIGUOUS")

elif int(af)<=12 and af!="00":
    print("YYMM")
    
elif int(be)<=12 and be!="00":
    print("MMYY")
  
else:
  print("NA")

Submission status: Accepted

Solution code:
S = list(map(int, input()))

if 0<S[0]*10+S[1]<=12 and 0<S[2]*10+S[3]<=12:
    print('AMBIGUOUS')
elif 0<S[0]*10+S[1]<=12:
    print('MMYY')
elif 0<S[2]*10+S[3]<=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def solve():
    S = input()
    l = int(S[:2])
    r = int(S[2:])
    
    if 1 <= l <= 12:
        if 1 <= r <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= r <= 12:
            return 'YYMM'
        else:
            return 'NA'

print(solve())

Submission status: Accepted

Solution code:

S = input()
l = S[:2]
r = S[2:]

lcnt = 0
rcnt = 0
if 0 < int(l) <= 12:
    lcnt = 1
if  0 < int(r) <= 12:
    rcnt = 1
if lcnt and rcnt:
    print('AMBIGUOUS')
    exit()
elif lcnt:
    print('MMYY')
    exit()
elif rcnt:
    print('YYMM')
    exit()
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
head = int(s[:2])
tail = int(s[2:])


def is_only_year(a):
    return a == 0 or a > 12


def is_month(a):
    return 0 < a <= 12


if is_only_year(head) and is_month(tail):
    print("YYMM")
elif is_month(head) and is_only_year(tail):
    print("MMYY")
elif is_month(head) and is_month(tail):
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#n,k = list(map(int,input().split()))
s = input()
a=int(s[: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")

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

front = int(S[0:2])
rear = int(S[2:4])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
F = int(S[0:2])
SE = int(S[2:4])


if F > 12 and 1 <= SE <= 12:
  print("YYMM")
elif 1 <= F <= 12 and SE > 12:
  print("MMYY")
elif 1 <= F <= 12 and 1 <= SE <= 12:
  print("AMBIGUOUS")
elif F == 0 and 1 <= SE <= 12:
  print("YYMM")
elif 1 <= F <= 12 and SE == 0:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
s = input()

up2 = int(s[:2])
end2 = int(s[2:])

if (0<up2<13) and (0<end2<13):
    ans = "AMBIGUOUS"
elif 0<up2<13:
    ans = "MMYY"
elif 0<end2<13:
    ans = "YYMM"
else:
    ans = "NA"
# ans = YYMM, MMYY, AMBIGUOUS, NA
print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

S = input()
x, y = int(S[:2]), int(S[2:])
yymm = 1 <= y <= 12
mmyy = 1 <= x <= 12
if yymm and mmyy:
    print('AMBIGUOUS')
elif yymm:
    print('YYMM')
elif mmyy:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
s=int(S[:2])
t=int(S[2:])
if 1<=s<=12:
    if 1<=t<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=t<=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 0<=s1<=99 and 1<=s2<=12:
  print('YYMM')
elif 0<=s2<=99 and 1<=s1<=12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

s=input()


if 0<int(s[:2])<13:
	upper=True
else:
	upper=False

if 0<int(s[2:])<13:
	low=True
else:
	low=False

if upper and low:
	print("AMBIGUOUS")

elif not upper and low:
	print("YYMM")

elif upper and not low:
	print("MMYY")
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()
f, r = int(S[:2]), int(S[2:])
#print(f)
#print(r)
if (f > 12 or f == 0) and 0 < r <= 12:
  ans = "YYMM"
elif 0 < f <= 12 and (r > 12 or r == 0):
  ans = "MMYY"
elif 0 < r <= 12 and 0 < f <= 12:
  ans = "AMBIGUOUS"

else:
  ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
s = raw_input()

m = [i for i in xrange(1,13)]
y = [i for i in xrange(100)]
f2 = int(s[:2])
l2 = int(s[2:])
if (f2 in m and f2 in y) and (l2 in m and l2 in y):
    print "AMBIGUOUS"
elif f2 in m and l2 in y   :
    print "MMYY"
elif f2 in y and l2 in m:
    print "YYMM"
else:
    print "NA"

Submission status: Accepted

Solution code:
s=list(input())
u=[int(s[0]+s[1]),int(s[2]+s[3])]
if(0<u[0]<=12):
    m1=1
    if(0<u[1]<=12):                                                                                                                                                                                                    m2=1
    else:
        m2=0
else:
    m1=0
    if(0<u[1]<=12):
        m2=1
    else:
        m2=0
if(m1==1 and m2==0):
    print('MMYY')
elif(m1==1 and m2==1):
    print('AMBIGUOUS')
elif(m1==0 and m2==0):
    print('NA')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
s=input()
#数値はスライスできないので一旦文字列で受け取って、int型にシフトする
fro=int(s[:2])
ba=int(s[2:])

#s==前半01~12
if 1<=fro<=12:
    #s==前半01~12かつ後半01~12
    if 1<=ba<=12:
        print("AMBIGUOUS")
    #s==前半00または13以上
    else:
        print("MMYY")
#s==前半00または13以上
else:
    #s==前半00または13以上かつ後半01~12
    if 1<=ba<=12:
        print("YYMM")
    #s==前半00または13以上かつ後半00もしくは13以上
    else:
        print("NA")

Submission status: Accepted

Solution code:
def is_month( n :int ):
  return ( 1 <= n ) and ( n <= 12 )

def judge( first, second ):
  if (first and second):
    return "AMBIGUOUS"
  elif (first and not(second)):
    return "MMYY"
  elif (not( first ) and second):
    return "YYMM"
  else:
    return "NA"

s = input()
first = is_month( int( s[0:2] ))
second = is_month( int( s[2:4] ))
print( judge( first, second ) )

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    str = input()
    YY = []
    MM = []
    YYMM_flg = False
    MMYY_flg = False
    AMB_flg = False
    NA_flg = False

    for i in range(2):
    	YY.append(str[i])

    for i in range(2, 4):
    	MM.append(str[i])

    yy = int(''.join(YY))
    mm = int(''.join(MM))

    if (yy >= 1 and yy <= 12) and (mm >= 1 and mm <= 12):
    	AMB_flg = True
    elif (mm >= 1 and mm <= 12) and (yy != 0 or mm != 0):
    	YYMM_flg = True
    elif (yy >= 1 and yy <= 12) and (yy != 0 or mm != 0):
    	MMYY_flg = True
    else:
    	NA_flg = True

    if AMB_flg:
    	print("AMBIGUOUS")
    elif YYMM_flg:
    	print("YYMM")
    elif MMYY_flg:
    	print("MMYY")
    elif NA_flg:
    	print("NA")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
s = input()
ym = [s[i*2:i*2+2] for i in range(2)]

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

Submission status: Accepted

Solution code:
s = input()

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

mm_flag = False
yy_flag = False

result = 'No'

# yymm / mmyyに当てはまるかの判定を行ってから、結果によって場合分けを行う。
#
if 12 >= s1 > 0:
    mm_flag = True
if 12 >= s2 > 0:
    yy_flag = True

if mm_flag and yy_flag:
    print('AMBIGUOUS')
elif mm_flag and not yy_flag:
    print('MMYY')
elif not mm_flag and yy_flag:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

s = input()

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

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:
S = input()
LL = int(S[0]+S[1])
RR = int(S[2]+S[3])
# YY or MM
L = ""
if LL == 0 or LL > 12:
    L = "YY"
else:
    L = "YY or MM"

if L == "YY":
    if RR == 0 or RR > 12:
        print("NA")
    elif 1 <= RR <= 12:
        print("YYMM")
elif L == "YY or MM":
    if RR == 0 or RR > 12:
        print("MMYY")
    elif 1 <= RR <= 12:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
y = str(input())
ans = ["NA","MMYY","YYMM","AMBIGUOUS"]
k = 0
if 1 <= int(y[:2]) <= 12:
  k += 1
if 1 <= int(y[2:]) <= 12:
  k += 2
print(ans[k])

Submission status: Accepted

Solution code:
A = str(input())
AC = list(A)
AB = int(A[0] + A[1])
AC = int(A[2] + A[3])

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

Submission status: Accepted

Solution code:
S =list(input())

former = int(S[0])*10+int(S[1])
latter = int(S[2])*10+int(S[3])
former_YY=False
former_MM=False
latter_YY=False
latter_MM=False

if former <= 99:
    former_YY = True
    
if former <= 12 and former > 0:
    former_MM = True

if latter <= 99:
    latter_YY = True

if latter <= 12 and latter > 0:
    latter_MM = True

if former_YY and former_MM and latter_YY and latter_MM:
    print("AMBIGUOUS")
elif former_YY and latter_MM:
    print("YYMM")
elif former_MM and latter_YY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import fractions

import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
import numpy as np
from decimal import *


if __name__ == '__main__':
    s = input()
    s1 = int(s[0:2])
    s2 = int(s[2:4])
    f1 = 0
    f2 = 0

    if s1 == 0:
        f1 = 0
    elif s1 >0 and 13 > s1:
        f1 = 1
    else:
        f1 =2

    if s2 == 0:
        f2 = 0
    elif s2 >0 and 13 > s2:
        f2 = 1
    else:
        f2 =2

    if f1 == 0 and f2 ==0:
        print("NA")
    elif (f1 ==0 and f2 == 2) or (f1 == 2 and f2 ==2) or (f1 == 2 and f2 ==0) :
        print("NA")
    elif (f1 ==0 and f2 == 1) or (f1 == 2 and f2 ==1) :
        print("YYMM")
    elif (f1 ==1 and f2 == 0) or (f1 == 1 and f2 ==2) :
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

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

# 00<= YY <= 99
# 01<= MM <= 12

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

Submission status: Accepted

Solution code:
s = list(map(int,list(input())))
a = s[0]*10+s[1]
b = s[2]*10+s[3]
lst = [1,2,3,4,5,6,7,8,9,10,11,12]
if a in lst:
    if b in lst:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if b in lst:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

else:
    print("NA")