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 = list(input())
is_yymm = False
is_mmyy = False
yymm_month = int(''.join(S[2:]))
mmyy_month = int(''.join(S[:2]))

if 1 <= yymm_month and yymm_month <= 12:
    is_yymm = True
if 1 <= mmyy_month and mmyy_month <= 12:
    is_mmyy = True

ans = 'NA'
if is_yymm and is_mmyy:
    ans = 'AMBIGUOUS'
elif is_yymm:
    ans = 'YYMM'
elif is_mmyy:
    ans = 'MMYY'

print(ans)

Submission status: Accepted

Solution code:
x=input()
a=x[:2]
b=x[2:]
ans_lst=[]
for y in [a,b]:
	if "00"<y<"13":
		ans_lst.append(True)
	else:ans_lst.append(False)
if all(ans_lst):
    print("AMBIGUOUS")
elif not any(ans_lst):
    print("NA")
elif ans_lst[0] and ans_lst[1]==False:
	print("MMYY")
elif ans_lst[0]==False and ans_lst[1]:
	print("YYMM")

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 = int(input())
l = s / 100
r = s % 100

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
head = int(s[0] + s[1])
tail = int(s[2] + s[3])

if (head == 0 or 12 < head < 100) and (0 < tail < 13):
    print('YYMM')
elif (0 < head < 13) and (tail == 0 or 12 < tail < 100):
    print('MMYY')
elif (0 < head < 13) and (0 < tail < 13):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
x = list(input())

x12 = int(''.join(x[:2]))
x34 = int(''.join(x[2:]))

is_12YYMM = True
is_34YYMM = None
is_12MMYY = None
is_34MMYY = True

if (x12 > 12) or (x12 < 1):
  is_12MMYY = False
else:
  is_12MMYY = True

if (x34 > 12) or (x34 < 1):
  is_34YYMM = False
else:
  is_34YYMM = True

if (is_12YYMM and is_34YYMM) and (is_12MMYY and is_34MMYY):
  print('AMBIGUOUS')
elif (is_12YYMM and is_34YYMM):
  print('YYMM')
elif (is_12MMYY and is_34MMYY):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])

if a*10 + b == 0:
    if c*10 + d == 0:
        print("NA")
    elif c*10 + d <= 12:
        print("YYMM")
    else:
        print("NA")
elif a*10 + b <= 12:
    if c*10 + d == 0:
        print("MMYY")
    elif c*10 + d <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if c*10 + d == 0:
        print("NA")
    elif c*10 + d <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:

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

if s1 == 0 and s2 == 0:
    print("NA")
    exit()

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

Submission status: Accepted

Solution code:
S = input()

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

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 not(0<a<13 or 0<b<13):print("NA")
elif 0<b<13:print("YYMM")
else:print("MMYY")

Submission status: Accepted

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

c = 0
if 1 <= a <= 12:
    c += 1
if 1 <= b <= 12:
    c += 2

print(['NA', 'MMYY', 'YYMM', 'AMBIGUOUS'][c])

Submission status: Accepted

Solution code:
s=input()

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

if (s1[0]=='0' and s1!='00') or s1=='11' or s1=='12':
  ans1='MM'
else:
  ans1='YY'

if (s2[0]=='0' and s2!='00') or s2=='11' or s2=='12':
  ans2='MM'
else:
  ans2='YY'

if ans1==ans2=='MM':
  print('AMBIGUOUS')
elif ans1==ans2=='YY':
  print('NA')
else:
  print(ans1+ans2)

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
S = input()
is_YYMM = True
is_MMYY = True
if int(S[0] + S[1]) > 12 or int(S[0] + S[1]) == 0:
    is_MMYY = False
if int(S[2] + S[3]) > 12 or int(S[2] + S[3]) == 0:
    is_YYMM = False

if is_MMYY and is_YYMM:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(input())

A = S[0] + S[1]
B = S[2] + S[3]

if A <= "12" and A > "00":
    if B <= "12" and B > "00":
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif B <= "12" and B > "00":
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

first = int(s[0:2])
second = int(s[2:4])

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

Submission status: Accepted

Solution code:
#ABC126

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

Submission status: Accepted

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

x = int(s[0] + s[1])
y = int(s[2] + s[3])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

a = s[0]+s[1]
b = s[2]+s[3]

a = int(a)
b = int(b)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import itertools
import statistics
#n = int(input())
s=input()
a = int(s[0])*10+int(s[1])
b = int(s[2])*10+int(s[3])
# yymm yy>12 and 12>=mm>=1
# mmyy 1<=mm<=12 and yy > 12
# doble 1<=yy<=12 and  1<=mm<=12
# na mm=0 and yy?12
if 0<a<13 and 0<b<13:
    print("AMBIGUOUS")
elif a > 12 and 0<b<13:
    print("YYMM")
elif 0<a<13 and b > 13:
    print("MMYY")
else:
    if 0<a<13 and b==0:
        print("MMYY")
    elif a==0 and 0<b<13:
        print("YYMM")
    else:   
        print("NA")

Submission status: Accepted

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

if ((0<=S1 and S1<=99) and (1<=S2 and S2<=12)):
    if (1<=S1 and S1<=12) and (0<=S2 and S2<=99):
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif (1<=S1 and S1<=12) and (0<=S2 and S2<=99):
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

mae = a*10 + b 
ushiro = c*10 + d
if mae <= 12 and mae != 0:
    if ushiro <= 12 and ushiro != 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if ushiro <= 12 and ushiro != 0:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()
ans = "NA"
c = 0
#YYMM
if 0<=int(s[:2])<=99 and 1<=int(s[2:])<=12:
  ans = "YYMM"
  c += 1
#MMYY
if 1<=int(s[:2])<=12 and 0<=int(s[2:])<=99:
  ans = "MMYY"
  c+=1
if c == 2:
  ans = "AMBIGUOUS"
print(ans)

Submission status: Accepted

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

def isMonth(s):
    if s[0] == "0":
        return s[1] != "0"
    elif s[0] == "1":
        return s[1] == "0" or s[1] == "1" or s[1] == "2"
    return False
        

def solve(S: str):
    first = isMonth(S[:2])
    last = isMonth(S[2:])
    if not first and not last:
        print("NA")
    elif first and last:
        print("AMBIGUOUS")
    elif first and not last:
        print("MMYY")
    else:
        print("YYMM")
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime


def is_YYMM(s: str) -> bool:
    try:
        datetime.datetime.strptime(s, "%y%m")
    except ValueError:
        return False
    else:
        return True


def is_MMYY(s: str) -> bool:
    try:
        datetime.datetime.strptime(s, "%m%y")
    except ValueError:
        return False
    else:
        return True


S = input()
if is_MMYY(S) and is_YYMM(S):
    print("AMBIGUOUS")
elif is_MMYY(S):
    print("MMYY")
elif is_YYMM(S):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()
up=s[0:2]
bot=s[2:4]
bot_m=True
up_m=True
if bot == "00" or int(bot) > 12:
        bot_m=False
if up == "00" or int(up) > 12:
        up_m=False
if bot_m and up_m:
        print("AMBIGUOUS")
elif bot_m and not up_m:
        print("YYMM")
elif not bot_m and up_m:
        print("MMYY")
else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
fir = int(s[:2])
sec = int(s[2:])
# print(fir, sec)
if fir == 0:
    if sec == 0:
        print('NA')
    elif 0 < sec <= 12:
        print('YYMM')
    else:
        print('NA')
elif 0 < fir <= 12:
    if sec == 0:
        print('MMYY')
    elif 0 < sec <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if sec == 0:
        print('NA')
    elif 0 < sec <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
#126_B
s=input()
y=int(s[:2])
m=int(s[2:])
if 1<=y<=12:
    if 1<=m<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=m<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()

a = s[:2]
b = s[-2:]

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

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

Submission status: Accepted

Solution code:
s = input()
yymm = False
mmyy = False
first = int(s[:2])
last = int(s[2:])
if first<=12 and first >0:
    mmyy = True
if last <=12 and last>0:
    yymm = True
if mmyy == True and yymm == True:
    print('AMBIGUOUS')
elif mmyy == True and yymm == False:
    print('MMYY')
elif mmyy == False and yymm == True:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

may_YYMM = False
may_MMYY = False
months = ["{:02}".format(i) for i in range(1, 12+1)]

if S[:2] in months:
    may_MMYY = True
if S[2:] in months:
    may_YYMM = True

if may_MMYY and may_YYMM:
    print("AMBIGUOUS")
elif may_YYMM and not may_MMYY:
    print("YYMM")
elif not may_YYMM and may_MMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = input()
mae = str[0:2]
ato = str[2:4]

month = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if mae in month:
  if ato in month:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if ato in month:
    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:
S = input()
first = int(S[:2])
second = int(S[2:])
if 1<=first<=12 and 1<=second<=12:
  print('AMBIGUOUS')
elif 1<=first<=12:
  print('MMYY')
elif 1<=second<=12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n=int(input())
n_1=n//100
n_2=n%100

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

Submission status: Accepted

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

def main():
  s = input().strip()
  yy, mm = map(int, [s[:2], s[2:]])
  if 1 <= yy <= 12 and 1 <= mm <= 12:
    print('AMBIGUOUS')
  if not (1 <= yy <= 12) and 1 <= mm <= 12:
    print('YYMM')
  if 1 <= yy <= 12 and not (1 <= mm <= 12):
    print('MMYY')
  if not(1 <= yy <= 12) and not (1 <= mm <= 12):
    print('NA')

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


s = int(input())
# print(s)
# print(s//100)
#print(s % 100)
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 = str(input())

f, r = map(int, (S[:2], S[2:]))
ans = ''
if 1 <= f <= 12 and 1 <= r <= 12:
  ans = 'AMBIGUOUS'
elif 1 <= f <= 12:
  ans = 'MMYY'
elif 1 <= r <= 12:
  ans = 'YYMM'
else:
  ans = 'NA'

print(ans)

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:
        ans="AMBIGUOUS"
    else:
        ans="MMYY"
else:
    if 1<=B<=12:
        ans="YYMM"
    else:
        ans="NA"
print(ans)

Submission status: Accepted

Solution code:
S=list(input())
def main():
    while True:
        if 1<=int(S[0]+S[1])<=12:
            if 1<=int(S[2]+S[3])<=12:
                return 'AMBIGUOUS'
            else:
                return 'MMYY'
        else:
            if 1<=int(S[2]+S[3])<=12:
                return 'YYMM'
            else:
                return 'NA'

print(main())

Submission status: Accepted

Solution code:
def main():
    S = input()

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

    if (l > 12 or l == 0) and (r > 12 or r == 0):
        print("NA")
        exit()

    if l > 12 or l == 0:
        print("YYMM")
        exit()

    if r > 12 or r == 0:
        print("MMYY")
        exit()

    print("AMBIGUOUS")


main()

Submission status: Accepted

Solution code:
s = input()
firstHalf = s[:2]
secondHalf = s[2:]
val1 = 0
val2 = 0
if firstHalf[0] == '0':
    val1 = int(firstHalf[1])
else:
    val1 = int(firstHalf)
if secondHalf[0] == '0':
    val2 = int(secondHalf[1])
else:
    val2 = int(secondHalf)
first = False
second = False
if val1 <= 12 and val1 > 0:
    first = True
if val2 <= 12 and val2 > 0:
    second = True
if first and second:
    print("AMBIGUOUS")
elif first:
    print("MMYY")
elif second:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

YYMM = False
MMYY = False
month = []
for i in range(1,13):
  if len(str(i))==1:
    month.append("0"+str(i))
  else:
    month.append(str(i))
    
if s[:2] in month:
  MMYY = True
  
if s[2:] in month:
  YYMM = True
  
if MMYY is True and YYMM is True:
  print("AMBIGUOUS")
elif MMYY is True and YYMM is False:
  print("MMYY")
elif MMYY is False and YYMM is True:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
YY = "00 to 99"
MM = [str(i).zfill(2) for i in range(1, 13)]

if s[:2] in MM:
    if s[2:] in MM: print("AMBIGUOUS")
    else: print("MMYY")
else:
    if s[2:] in MM: print("YYMM")
    else: print("NA")

Submission status: Accepted

Solution code:
S = input()
ahead = S[0:2]
post = S[2:]

if (ahead == '00' or int(ahead) > 12):
    a_judge = True
else:
    a_judge = False

if (post == '00' or int(post) > 12):
    p_judge = True
else:
    p_judge = False

if (a_judge and p_judge):
    ans = 'NA'
elif (a_judge):
    ans = 'YYMM'
elif (p_judge):
    ans = 'MMYY'
else:
    ans = 'AMBIGUOUS'

print(ans)

Submission status: Accepted

Solution code:
S=input()
Sf=int(S[:2])
Sb=int(S[2:])
if 1<=Sf<=12:
  if 1<=Sb<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1<=Sb<=12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()

YYMM=False
MMYY=False

month=[]
for i in range(1,13):
    if len(str(i))==1:
        month.append("0"+str(i))
    else:
        month.append(str(i))

if s[:2] in month:
    MMYY=True

if s[2:] in month:
    YYMM=True

if MMYY is True and YYMM is True:
    print("AMBIGUOUS")
elif  MMYY is True and YYMM is False:
    print("MMYY")
elif  MMYY is False and YYMM is True:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

Sa = int(S[:2])
Sb = int(S[2:])

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

Submission status: Accepted

Solution code:
line = input()
S = list(map(int, (i for i in line)))

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

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
from datetime import datetime

S = input()
a = S[:2]
b = S[2:]

def is_month(m):
    m = int(m)
    return 0 < m < 13

def is_year(y):
    y = int(y)
    return True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()


def check_mm(x):
    return (0 < int(x) and int(x) <= 12)


if check_mm(S[:2]) and check_mm(S[2:]):
    print("AMBIGUOUS")
elif check_mm(S[:2]) == False and check_mm(S[2:]):
    print("YYMM")
elif check_mm(S[:2]) and check_mm(S[2:]) == False:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
l = s[:2]
r = s[2:]
yy = [str(i).zfill(2) for i in range(100)]
mm = [str(i).zfill(2) for i in range(1, 13)]

if l in mm and r in mm:
    print("AMBIGUOUS")
elif l in yy and r in mm:
    print("YYMM")
elif l in mm and r in yy:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

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

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

Submission status: Accepted

Solution code:
s = input()

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

if a >= 1 and a <= 12:
    if b >= 1 and b <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif b >= 1 and b <= 12:
    if a >= 1 and a <= 12:
        print("AMBIGUOUS")
    else:
        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()

M = [str(m).zfill(2) for m in range(1,13)]

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

Submission status: Accepted

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

s1=(int("".join(s[:2])))
s2=(int("".join(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:
s = input()
s1 = int(s[:2])
s2 = int(s[2:])

def cm1(i):
    if i > 0 and i < 13:
        return(True)
    else:
        return(False)

if cm1(s1):
    if cm1(s2):
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if cm1(s2):
        ans = "YYMM"
    else:
        ans = "NA"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ot = S[:2]
tf = S[2:]

isotMM = 0
istfMM = 0

if 0 < int(ot) and int(ot) < 13:
    isotMM = 1
if 0 < int(tf) and int(tf) < 13:
    istfMM = 1
    
if isotMM == 1:
    if istfMM == 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if istfMM == 1:
        print('YYMM')
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

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

check1 = ((s1 <= 12) & (s1 != 0))
check2 = ((s2 <= 12) & (s2 != 0))

if(check1):
    if(check2):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(check2):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
yymm = 1
mmyy = 1
yymm2 = 1
mmyy2 = 1
if int(s[0])*10 + int(s[1])>12 or int(s[0])*10 + int(s[1])<=0:
    mmyy = 0
else:
    yymm = 1
    mmyy = 1
if int(s[2])*10 + int(s[3])>12 or int(s[2])*10 + int(s[3])<=0:
    yymm2 = 0
else:
    yymm2 = 1
    mmyy2 = 1
ans1 = mmyy * mmyy2
ans2 = yymm * yymm2
if ans1 == 1 and ans2 == 0:
    print("MMYY")
elif ans1 == 0 and ans2 == 1:
    print("YYMM")
elif ans1 == 1 and ans2 == 1:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc126/tasks/abc126_b

s = input()
a = int(s[:2])
b = int(s[2:4])
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:
import re
a, b = map(int, re.split('(..)', input())[1::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 = 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:
import re

arg = input()

valid_year = r"[0-9][0-9]"
valid_month = r"0[1-9]|1[0-2]"

s1_is_year = re.match(valid_year, arg[:2])
s1_is_month = re.match(valid_month, arg[:2])
s2_is_year = re.match(valid_year, arg[2:])
s2_is_month = re.match(valid_month, arg[2:])

is_yymm = s1_is_year and s2_is_month
is_mmyy = s1_is_month and s2_is_year

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()
f=int(s[:2])
b=int(s[2:])
if f>=13 or f==0:
	if 0<b and b<13:
		print("YYMM")
	else:
		print("NA")
elif 0<f and f<13:
	if 0<b and b<13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
num = input()
if int(num[:2]) > 12 or int(num[:2])==0:
    if int(num[2:]) > 12 or int(num[2:])== 0:
        print('NA')
    else:
        print('YYMM')
else:
    if int(num[2:]) > 12 or int(num[2:])== 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

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

if (1 <= x <= 12) & (1 <= y <= 12):
    print('AMBIGUOUS')
elif 1 <= x <= 12:
    print('MMYY')
elif 1 <= y <= 12:
    print('YYMM')
else:
    print('NA')