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()
s1,s2=s[:2],s[2:]

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

Submission status: Accepted

Solution code:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    S = input()

    first = int(S[:2])
    second = int(S[2:])

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
F,E = int(S[:2]),int(S[2:])
def j(s):
    if 0 < s <= 12:
        return 1
    else:
        return 0
R = j(F)+j(E)
if R == 0:
    print("NA")
elif R == 1:
    if j(F):
        print("MMYY")
    else:
        print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()
Month = []
for i in range(1,13):
    if i < 10:
        Month.append("0" + str(i))
    else:
        Month.append(str(i))
YYMMpt = 0
MMYYpt = 0
if S[0:2] in Month:
    MMYYpt += 1
if S[2:4] in Month:
    YYMMpt += 1
if YYMMpt == 0 and MMYYpt == 0:
    print("NA")
elif YYMMpt == 0 and MMYYpt == 1:
    print("MMYY")
elif YYMMpt == 1 and MMYYpt == 0:
    print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

MM = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if S[0:2] in MM and S[2:4] in MM:
  print('AMBIGUOUS')
elif S[0:2] in MM:
  print('MMYY')
elif S[2:4] in MM:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = input()
a = s[:2]
b = s[2:]
if int(a) == 0 or int(a) > 12:
	if int(b) == 0 or int(b) > 12:
		print("NA")
	else:
		print ("YYMM")
else:
	if int(b) == 0 or int(b) > 13:
		print ("MMYY")
	else:
		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):
  print("MMYY")
elif (1 <= b <= 12):
    print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
a=int(S[:2])#前半
b=int(S[2:4])
cYYMM=b>0 and b<13
cMMYY=a>0 and a<13
#print(a,b)
#print(["NO","YES"][1-cond])
print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])

Submission status: Accepted

Solution code:
def main():
  S=int(input())
  a=S//100
  b=S%100
  if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS ")
  elif 1<=a<=12 and (b==0 or 13<=b<=99):
    print("MMYY")
  elif 1<=b<=12 and (a==0 or 13<=a<=99):
    print("YYMM")
  else:
    print("NA")
main()

Submission status: Accepted

Solution code:
s = input()
str1 = int(s[0:2])
str2 = int(s[2:])

if (1 <= str1 <= 12) and (1 <= str2 <= 12):
    print('AMBIGUOUS')
elif (0 <= str1 <= 99) and (1 <= str2 <= 12):
    print('YYMM')
elif (1 <= str1 <= 12) and (0 <= str2 <= 99):
    print('MMYY')
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def aaa(s):
  if s[0]=='0':
    if s[1]=='0':
      return 'y'
    return 'm'
  elif s[0]=='1':
    if int(s[1])<3:
      return 'm'
  return 'y'
  
s = input()
l = aaa(s[:2])
r = aaa(s[2:])
if l=='m' and r=='m':
  print('AMBIGUOUS')
elif l=='m' and r=='y':
  print('MMYY')
elif l=='y' and r=='m':
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()

    b = 0
    for i in range(2):
        if 0 < int(S[2*i:2*i+2]) <= 12: b += i + 1

    if b == 0: print("NA")
    elif b == 1: print("MMYY")
    elif b == 2: print("YYMM")
    else: print("AMBIGUOUS")


if __name__ == '__main__':
    main()

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>12 or b==0)):
    print('MMYY')
elif ((a>12 or a==0) and 1<=b<=12):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

sm = int(s[0:2])
sl = int(s[2:4])

ans = [["NA", "MMYY"],
       ["YYMM", "AMBIGUOUS"]]

qm = (1 <= sm <= 12)
ql = (1 <= sl <= 12)

print(ans[ql][qm])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
#126
s = input()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def isMonth(n):
    if 0<n and n<=12:return True
    else:False

s=list(input())
f=int(s[0]+s[1])
b=int(s[2]+s[3])

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

Submission status: Accepted

Solution code:
S = input()
x, y = int(S[:2]),int(S[2:])

if (1<=y<=12) or (1<=x<=12):
    if x >= 1 and x <= 12 and y >= 1 and y <= 12:
        print('AMBIGUOUS')
    elif x >= 1 and x <= 12 and y >= 0:
        print('MMYY')
    elif x >= 0 and y >= 1 and y <= 12:
        print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
x, y = int(S[:2]),int(S[2:])

yymm = (1<=y<=12)
mmyy = (1<=x<=12)

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

Submission status: Accepted

Solution code:
s = input()

first = s[:2]
second = s[2:]

if int(first) <= 12 and int(first) > 0:
    first_m = True
else:
    first_m = False
if int(second) <= 12 and int(second) > 0:
    second_m = True
else:
    second_m = False

if first_m and second_m:
    print("AMBIGUOUS")
elif first_m:
    print("MMYY")
elif second_m:
    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:
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 13 <= b):
	print('MMYY')
elif 1 <= b <= 12 and (a==0 or 13 <= a):
	print('YYMM')
else:
	print('NA')

Submission status: Accepted

Solution code:
def main():
    s = int(input())

    s1 = s // 100
    s2 = s - s1 * 100

    if s1 == 0:
        s1 = 13
    if s2 == 0:
        s2 = 13

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def month(num):
    if 0 < num <= 12:
        return True
    else:
        return False


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first):
    if month(second):
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif not month(first) and month(second):
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

Solution code:
def month(num):
    if 0 < num <= 12:
        return 1
    else:
        return 0


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first) == 1 and month(second) == 1:
    print('AMBIGUOUS')

elif month(first) == 1 and month(second) == 0:
    print('MMYY')

elif month(first) == 0 and month(second) == 1:
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

Solution code:
def month(n):
    if 0 < n and n < 13:
        return True
    else:
        return False


num = input()
if month(int(num[2:])):
    if month(int(num[:2])):
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if month(int(num[:2])):
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
left = int(S[:2])
right = int(S[2:])

if 0 < left <= 12:
    if 0 < right <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < right <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

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

if is_month(pre) and is_month(suf):
    print('AMBIGUOUS')
elif not is_month(pre) and not is_month(suf):
    print('NA')
elif is_month(pre) and not is_month(suf):
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
S = input()

#print(type(S[:2]))
#print(type(int(S[:2])))

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = int(input())
x = S//100
y = S%100
yymm = (1<=y<=12)
mmyy = (1<=x<=12)

ans = "NA"
if yymm and mmyy:
    ans = 'AMBIGUOUS'
elif yymm and not(mmyy):
    ans = 'YYMM'
elif mmyy and not(yymm):
    ans = 'MMYY'

print(ans)

Submission status: Accepted

Solution code:
s = input()

left = int(s[:2])
right = int(s[2:])

if 0 < left <= 12 and 0 < right <= 12:
    print('AMBIGUOUS')
elif 0 < left <= 12 < right or right == 0 < left <= 12:
    print('MMYY')
elif 0 < right <= 12 < left or left == 0 < right <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = list(map(str,input()))

s1 = s[:2]
s2 = s[2:4]

s1 = int("".join(s1))
s2 = int("".join(s2))
yy =0
mm=0


if 0<= s1 <=99 and 1<= s2 <= 12:
  yy +=1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def YY_or_MM(K):
    if 0<K<13:
        return "MM"
    else:
        return "YY"
S=str(input())
head=int(S[0:2])
tail=int(S[2:])
ans=YY_or_MM(head)+YY_or_MM(tail)
if ans=="YYYY":
    print("NA")
elif ans=="MMMM":
    print("AMBIGUOUS")
else:print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S1, S2, S3, S4 = input()
Front = 10 * int(S1) + int(S2)
Back  = 10 * int(S3) + int(S4)

if 1 <= Front <= 12 and 1 <= Back <= 12:
    print('AMBIGUOUS')
elif (Front > 12 or Front == 0) and 1 <= Back <= 12:
    print('YYMM')
elif 1 <= Front <= 12 and (Back > 12 or Back == 0):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S1, S2, S3, S4 = input()
Front = 10 * int(S1) + int(S2)
Back  = 10 * int(S3) + int(S4)

if 1 <= Front <= 12 and 1 <= Back <= 12:
    print('AMBIGUOUS')
elif (Front > 12 or Front == 0) and 1 <= Back <= 12:
    print('YYMM')
elif 1 <= Front <= 12 and (Back > 12 or Back == 0):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: # MM or YY
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if suf_mm:
            print("YYMM")
        else:
            print("NA")
    

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: # MM or YY
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
            return
        else:
            print("MMYY")
            return
    else:
        if suf_mm:
            print("YYMM")
            return
        else:
            print("NA")
            return
    

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(S: str):
    u = int(S[:2])
    d = int(S[2:])
    
    if 0 < u <= 12 and 0 < d <= 12:
        print('AMBIGUOUS')
    
    elif 0 < d <= 12:
        print('YYMM')

    elif 0 < u <= 12:
        print('MMYY')
        
    else:
        print('NA')
        
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

ans = [0, 0]
for i in range(100):
    for j in range(1, 13):
        if str(i).zfill(2) + str(j).zfill(2) == s:
            ans[0] = 1
        if str(j).zfill(2) + str(i).zfill(2) == s:
            ans[1] = 1

if sum(ans) == 2:
    print("AMBIGUOUS")
elif ans[0] == 1:
    print("YYMM")
elif ans[1] == 1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
N = input()
count = 0
MM = [i+1 for i in range(12)]
if int(N[:2]) in MM:
    count += 1
if int(N[2:]) in MM:
    count += 2
if count == 1:
    print('MMYY')
elif count == 2:
    print('YYMM')
elif count == 3:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#126 b
def change(x):
    if 1<=x<=12:
        return 0
    else:
        return 1
ans=["AMBIGUOUS","NA","MMYY","YYMM"]#[00,11,01,10]
s=input()
a=change(int(s[:2]))
b=change(int(s[2:]))
if a==b:
    print(ans[a])
else:
    print(ans[a+2])

Submission status: Accepted

Solution code:
S=input()
forward=""
back=""
yymm=0
mmyy=0
for i in range(4):
    forward=S[:2]
    back=S[2:]
forward=int(forward)
back=int(back)
if ((1<=forward)and(forward<=12)):
    mmyy=1
if ((1<=back)and(back<=12)):
    yymm=1
if (mmyy==1):
    if (yymm==1):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(yymm==1):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().rstrip()

def main():
    a, b = int(s[:2]), int(s[2:])
    if 1 <= a <= 12:
        if 1 <= b <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= b <= 12:
            return 'YYMM'
        else:
            return 'NA'

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
s = input()

former = int(s[:2])
later = int(s[2:])


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def YorM(x):                                                                                                                                                        
        #1...YorM                                                                                                                                                   
        #0...Y                                                                                                                                                      
    if((1<=x)and(x<=12)):                                                                                                                                           
        return 1                                                                                                                                                    
    else:                                                                                                                                                           
        return 0                                                                                                                                                    
                                                                                                                                                                    
def D(a,b):                                                                                                                                                         
    n1 = YorM(a)                                                                                                                                                    
    n2 = YorM(b)                                                                                                                                                    
    #print(n1, n2)                                                                                                                                                  
    if(n1==0 and n2==0):                                                                                                                                            
        print("NA")                                                                                                                                                 
    elif(n1==0 and n2==1):                                                                                                                                          
        print("YYMM")                                                                                                                                               
    elif(n1==1 and n2==0):                                                                                                                                          
        print("MMYY")                                                                                                                                               
    else:                                                                                                                                                           
        print("AMBIGUOUS")                                                                                                                                          
                                                                                                                                                                    
                                                                                                                                                                    
S = input()                                                                                                                                                         
a = int(S[0:2])                                                                                                                                                     
b = int(S[2:4])                                                                                                                                                     
D(a, b)

Submission status: Accepted

Solution code:
S = input()

l = S[:2]
r = S[2:]

def isMonth(num):
  if 1 <= int(num) <= 12:
    return True
  else:
    return False
  
if isMonth(l) and isMonth(r):
  print("AMBIGUOUS")
elif isMonth(l):
  print("MMYY")
elif isMonth(r):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
S = int(input())

S_pre = S // 100
S_nex = S - S_pre * 100

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
s1 = int(s[0:2])
s2 = int(s[2:4])
ans = [False, False]
if 1 <= s2 <= 12:
    ans[0] = True
if 1 <= s1 <= 12:
    ans[1] = True
if ans == [False, False]:
    print("NA")
elif ans == [True, True]:
    print("AMBIGUOUS")
elif ans == [True, False]:
    print("YYMM")
elif ans == [False, True]:
    print("MMYY")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

f = int(S[:2])
b = int(S[2:])

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

Submission status: Accepted

Solution code:
def isMonth(x):
  y = int(x)
  return (1 <= y and y <= 12)

date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])
 
if firstvalid and secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

s = ns()
x, y = int(s[:2]), int(s[2:])

if x >= 1 and x <= 12:
	if y >= 1 and y <= 12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if y >= 1 and y <= 12:
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
front = int(S[:2])
back = int(S[2:])
def bool_mm(input):
    if 0 < input <= 12:
        return True
    else:
        return False 
bool_f = bool_mm(front)
bool_b = bool_mm(back)
if bool_f and bool_b:
    print("AMBIGUOUS")
elif bool_f and ~bool_b:
    print("MMYY")
elif ~bool_f and bool_b:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys
s = input()
mm1 = False
mm2 = False

if 0 < int(s[:2]) < 13:
    mm1 = True
if 0 < int(s[-2:]) < 13:
    mm2 = True

if mm1 == True and mm2 == True:
    print("AMBIGUOUS")
    sys.exit()
if mm1 == False and mm2 == False:
    print("NA")
    sys.exit()
if mm1 == True and mm2 == False:
    print("MMYY")
    sys.exit()
if mm1 == False and mm2 == True:
    print("YYMM")
    sys.exit()
print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math

S = input()

s1 = int(S[:2])
s2 = int(S[2:])
mr = range(1, 13)

if s1 in mr and s2 in mr:
    print('AMBIGUOUS')
elif s1 in mr:
    print('MMYY')
elif s2 in mr:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
def is_MM(s):
    return 1 <= s <= 12

if is_MM(s1) and is_MM(s2):
    print('AMBIGUOUS')
elif is_MM(s1):
    print('MMYY')
elif is_MM(s2):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
h = s[:2]
t = s[2:]
def montheable(p):
    return '00' < p < '13'
if montheable(h) and montheable(t):
    print('AMBIGUOUS')
elif montheable(h):
    print('MMYY')
elif montheable(t):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
yymm = 1 <= int(s[2:4]) <= 12
mmyy = 1 <= int(s[0:2]) <= 12
print("AMBIGUOUS" if yymm and mmyy else "YYMM" if yymm else "MMYY" if mmyy else "NA")

Submission status: Accepted

Solution code:
S=input()
mae=int(S[:2])
ato=int(S[2:])

if (1<=mae<=12) and (1<=ato<=12):
  print('AMBIGUOUS')
elif (1<=mae<=12) and (not (1<=ato<=12)):
  print('MMYY')
elif (not (1<=mae<=12)) and (1<=ato<=12):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

l = 0<int(s[:2])<13
r = 0<int(s[2:])<13

if l == 1:
  print('AMBIGUOUS' if r == 1 else 'MMYY')
else:
  print('YYMM' if r == 1 else 'NA')