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()
mae = s[:2]
ato = s[2:]
val = ""
if mae == "00":
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
elif int(mae) >= 13:
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
else:
	if ato == "00":
		val = "MMYY"
	elif int(ato) >= 13:
		val = "MMYY"
	else:
		val = "AMBIGUOUS"
print (val)

Submission status: Accepted

Solution code:
S = input()
u = int(S[0]) * 10 + int(S[1])
d = int(S[2]) * 10 + int(S[3])

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

Submission status: Accepted

Solution code:
s = input()

uis_noty = False
lis_noty = False

if int(s[0]) > 1 or (int(s[0]) == 1 and int(s[1]) > 2) or (int(s[0]) == 0 and int(s[1]) == 0):
  uis_noty = True
if int(s[2]) > 1 or (int(s[2]) == 1 and int(s[3]) > 2) or (int(s[2]) == 0 and int(s[3]) == 0):
  lis_noty = True

if uis_noty == True and lis_noty == True:
  print('NA')
elif uis_noty == False and lis_noty == True:
  print('MMYY')
elif uis_noty == True and lis_noty == False:
  print('YYMM')
else:
  print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
l = list(str(input()))
l1 = [l[0], l[1]]
l2 = [l[2], l[3]]

a = int(''.join(l1))
b = int(''.join(l2))

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
A = (S1 >= 1 and S1 <= 12)
B = (S2 >= 1 and S2 <= 12)
if(A and B):
  print('AMBIGUOUS')
elif(A and not B):
  print('MMYY')
elif(not A and B):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()

HEAD = int(S[:2])
TAIL = int(S[2:])

if HEAD > 0 and HEAD < 13:
  if TAIL > 0 and TAIL < 13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif TAIL > 0 and TAIL < 13:
  if HEAD > 0 and HEAD < 13:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
#ABC126B - YYMM or MMYY
S = list(input())
f = int((''.join(S[0:2])))
b = int((''.join(S[2:4])))
def month(m):
    if 1 <= m <= 12:# 0xはxの数値として変換される模様
        return 1
    else:
        return 0
def year(y):
    return 1
ans = [month(f),year(b),year(f),month(b)]#グリット組みたい
#print(ans)
if sum(ans) == 4:
    print('AMBIGUOUS')
elif ans[0] == 1 and ans[1] == 1:
    print('MMYY')
elif ans[2] == 1 and ans[3] == 1:
    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:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    # YY は 00から99
    # MM は 01から12
    S=input()
    u=int(S)//100
    d=int(S[2:])
    if(1<=u<=12 and 1<=d<=12):
        print('AMBIGUOUS')
    elif(1<=u<=12 and (d==0 or d>12)):
        print('MMYY')
    elif((not 1<=u<=12) and 1<=d<=12):
        print('YYMM')
    else:
        print('NA')
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

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

S = int(input())

# YYMM: XX01~XX12
# MMYY: 01YY~12YY
yymm = 0
mmyy = 0

if S % 100 <= 12 and S % 100 != 0:
    yymm = 1
if S // 100 <= 12 and S // 100 != 0:
    mmyy = 1

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

Submission status: Accepted

Solution code:
s = input()
s = [int(i) for i in s]

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

Submission status: Accepted

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

MOD = 10 ** 9 + 7

s = input()

ans = 0
ans += 1 if 0 < int(s[:2]) < 13 else 0
ans += 2 if 0 < int(s[2:]) < 13 else 0

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

Submission status: Accepted

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

Submission status: Accepted

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

if fr<=12 and fr!=0:
  if sc<=12 and sc!=0:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if sc<=12 and sc!=0:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
#s = int(input())
#first = s//100
#second = s%100
s=input()
first = int(s[:2])
second = int(s[2:])
#print(first,second)

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

Submission status: Accepted

Solution code:
n=str(input())
a=int(n[0]+n[1])
b=int(n[2]+n[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()

months=["{:02}".format(m) for m in range(1,13)]

pre_p = S[:2] in months
post_p = S[2:] in months

if pre_p:
    if post_p:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if post_p:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

S_p1 = S[:2]
S_p2 = S[2:]

def is_MM(s):
    return int(s) >= 1 and int(s) <= 12

if is_MM(S_p1) and is_MM(S_p2):
    print("AMBIGUOUS")
elif not is_MM(S_p1) and not is_MM(S_p2):
    print("NA")
elif is_MM(S_p1):
    print("MMYY")
elif is_MM(S_p2):
    print("YYMM")

Submission status: Accepted

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

def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
month1 = ["0" + str(i) for i in range(1,10)]
month2 = ["10","11","12"]

s = input()
a = 0
b = 0
if s[0] + s[1] in month1 + month2:
    a = 1
if s[2] + s[3] in month1 + month2:
    b = 1
if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = int(input())
def is_month(x):
  if x == 0 or x >= 13:
    return False
  else:
    return True
if is_month(s // 100):
  if is_month(s % 100):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if is_month(s % 100):
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

FF = int(S[:2])
SS = int(S[2:])

FF = FF >= 1 and FF <= 12
SS = SS >= 1 and SS <= 12

if FF and SS: print("AMBIGUOUS")
elif FF: print("MMYY")
elif SS: print("YYMM")
else: print("NA")

Submission status: Accepted

Solution code:
s = input()
mmyy = False
yymm = False



if 0 < int(s[0:2]) <= 12:
    mmyy = True
if 0 < int(s[2:4]) <= 12:
    yymm = True

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

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    first = int(''.join(s[:2]))
    end = int(''.join(s[2:4]))

    if 1 <= first and first <= 12:
        if 1 <= end and end <= 12:
            print('AMBIGUOUS')
            return
        else:
            print('MMYY')
            return
    else:
        if 1 <= end and end <= 12:
            print('YYMM')
            return
        else:
            print('NA')
            return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
up = int(''.join(s[:2]))
low = int(''.join(s[2:]))

if up > 0 and up < 13:
  if low > 0 and low < 13:
    print('AMBIGUOUS')
  
  elif low >= 0:
    print('MMYY')
  
  else:
    print('NA')

elif low > 0 and low < 13:
  if up >= 0:
    print('YYMM')
  else:
    print('NA')
    
else:
  print('NA')

Submission status: Accepted

Solution code:
s = input()
nn = int(s[:2])
dd = int(s[2:])

if nn > 0 and nn <= 12 and dd > 0 and dd <=12:
  print("AMBIGUOUS")
elif nn > 0 and nn <= 12:
  print("MMYY")
elif dd > 0 and dd <= 12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

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


def solve(S: int):

    if 0 <= int(S[:2]) <= 99 and 1 <= int(S[2:]) <= 12:
        if 1 <= int(S[:2]) <= 12:
            print("AMBIGUOUS")
        else:
            print("YYMM")
    elif 1 <= int(S[:2]) <= 12 and 0 <= int(S[2:]) <= 99:
        if 1 <= int(S[2:]) <= 12:
            print("AMBIGUOUS")
        else:
            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:
#!/usr/bin/env python3
import sys


def solve(S: int):

    if 1 <= int(S[2:]) <= 12:
        if 1 <= int(S[:2]) <= 12:
            print("AMBIGUOUS")
        else:
            print("YYMM")
    else:
        if 1 <= int(S[:2]) <= 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()

mae = int( s[0]+s[1] )
ato = int( s[2]+s[3] )

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

def check(s):
    num = int(s)
    
    if (1 <= num <= 12):
        return True
    else:
        return False

pre = s[0:2]
post = s[2:]

if (check(pre) and check(post)):
    print('AMBIGUOUS')
elif (not check(pre) and check(post)):
    print('YYMM')
elif (check(pre) and not check(post)):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
s12 = s[0] + s[1] 
s34 = s[2] + s[3]

if int(s12) >= 13 or s12 == "00": ## s12はMMでない YY
  if int(s34) >= 13 or s34 == "00": ## s34はMMでない YY
    print("NA")
  else: ## s34はMM
    print("YYMM")
else:
  if 1 <= int(s12) <= 12:
    if 1 <= int(s34) <= 12:
      print("AMBIGUOUS")
    else:
      print("MMYY")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
pre, suf = 0 < s//100 <= 12, 0 < s % 100 <= 12
print(['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'][pre*2+suf])

Submission status: Accepted

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

if 1 <= pre <= 12:
    if 1 <= suf <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= suf <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
ah = int(s[0:2])
be = int(s[2:])

yymm = False
mmyy = False
na = False

if 1<=ah<=12:
    mmyy = True
if 1<=be<=12:
    yymm = True

if mmyy == True:
    if yymm == True:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif yymm == True:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
u = 1 <= (s//100) <= 12
d = 1 <= (s%100) <= 12
if u:
  if d:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if d:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

def main():
    S = input()
    zenhan = int(S[0] + S[1])
    kouhan = int(S[2] + S[3])

    judgeZenhan = judge12(zenhan)
    judgeKouhan = judge12(kouhan)

    print(judgeFormat(judgeKouhan, judgeZenhan))


def judgeFormat(judgeKouhan, judgeZenhan):
    if judgeZenhan and judgeKouhan:
        return 'AMBIGUOUS'
    elif judgeZenhan and not judgeKouhan:
        return 'MMYY'
    elif not judgeZenhan and judgeKouhan:
        return 'YYMM'
    else:
        return 'NA'


def judge12(num):
    if num < 13 and num > 0:
        return True
    return False


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
list1 = list(input())

a = int("".join(list1[:2]))
b = int("".join(list1[2:]))

def func(i):
    if 0 < i < 13:
        return True

if func(a):
    if func(b):
        print("AMBIGUOUS")
        exit()
    else:
        print("MMYY")
        exit()
elif func(b):
    print("YYMM")
    exit()

print("NA")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=list(input())
A=int(''.join(N[0:2]))
B=int(''.join(N[2:4]))

FLG_A = (A>12) | (A==0)
FLG_B = (B>12) | (B==0)


if FLG_A & FLG_B:
    ans='NA'
elif FLG_A & ~FLG_B:
    ans='YYMM'
elif ~FLG_A & FLG_B:
    ans='MMYY'
elif ~FLG_A & ~FLG_B:
    ans='AMBIGUOUS'

print(ans)

Submission status: Accepted

Solution code:
N=list(input())
A=int(''.join(N[0:2]))
B=int(''.join(N[2:4]))

FLG_A = (A>12) or A==0
FLG_B = (B>12) or B==0


if FLG_A & FLG_B:
    ans='NA'
elif FLG_A & ~FLG_B:
    ans='YYMM'
elif ~FLG_A & FLG_B:
    ans='MMYY'
elif ~FLG_A & ~FLG_B:
    ans='AMBIGUOUS'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
a = int(s[: 2])
b = int(s[2 :])
yymm = 1 <= b <= 12
mmyy = 1 <= a <= 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()
a, b = int(S[:2]), 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=input()
a=""
b=""
a=a+s[0]+s[1]
b=b+s[2]+s[3]
acount=0
bcount=0
if a=="00" and int(b)>=13:
  print("NA")
  acount=100
  bcount=100
if b=="00" and int(a)>=13:
  print("NA")
  acount=100
  bcount=100
if b=="00" and a=="00":
  print("NA")
  acount=100
  bcount=100
if int(b)>=13 and int(a)>=13:
  print("NA")
  acount=100
  bcount=100
  
if int(a)>=13 or a=="00":
  acount+=1
if int(b)>=13 or b== "00":
  bcount+=1
if acount+bcount==0:
  print("AMBIGUOUS")
elif acount+bcount== 1:
  if acount==0:
     print("MMYY")
  elif acount==1:
    print("YYMM")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

X = int(S[:2])
Y = int(S[2:])

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

Submission status: Accepted

Solution code:
S = input()
YYMM = True
MMYY = True
if int(S[:2]) >= 13 or S[:2] == "00":
  MMYY = False
if int(S[2:]) >= 13 or S[2:] == "00":
  YYMM = False
if YYMM and MMYY:
  print("AMBIGUOUS")
elif YYMM == True and MMYY == False:
  print("YYMM")
elif MMYY == True and YYMM == False:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
S = input()

S1 = int(S[:2])
S2 = int(S[2:4])

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

Submission status: Accepted

Solution code:
s = input()

ot = int(s[0:2])
tf = int(s[2:4])

if ot > 12 or ot == 0:
	if tf > 12 or tf == 0:
		print("NA")
	else:
		print("YYMM")
elif tf > 12 or tf == 0:
	print("MMYY")
else:
	print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S=input()
ab=int(S[0]+S[1])
cd=int(S[2]+S[3])
if ab==0:
  if cd==0:#0000
    print('NA')
  elif cd>=1 and cd<=12:
    #0001~0012
    print('YYMM')
  else: #0013~0099
    print('NA')
elif ab>=1 and ab<=12:
  if cd ==0:
    print('MMYY')
  elif cd>=1 and cd<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if cd>=1 and cd<=12:
    print('YYMM')
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

S_01 = int(S[0] + S[1])
S_23 = int(S[2] + S[3])

yymm_flag = False
mmyy_flag = False

if S_01 == 0 and S_23 == 0:
    yymm_flag = False
    mmyy_flag = False
    
if S_01 <= 12 and S_01 >= 1:
    mmyy_flag = True

if S_23 <= 12 and S_23 >= 1:
    yymm_flag = True

if yymm_flag == True and mmyy_flag == True:
    print('AMBIGUOUS')
elif mmyy_flag == True and yymm_flag == False:
    print('MMYY')
elif yymm_flag == True and mmyy_flag == False:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = int(read())

x = S//100
y = S%100

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 = list(input())
YYMM = 0
MMYY = 0
if 1 <= int(s[2]+s[3]) <= 12:
    YYMM = 1
if 1 <= int(s[0]+s[1]) <= 12:
    MMYY = 1
 
if MMYY == YYMM == 1:
    print("AMBIGUOUS")
elif YYMM == 1:
    print("YYMM")
elif MMYY == 1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
A=int(input())
B=int(A/100)
C=A%100
if 1<=B and B<=12:
 if 1<=C and C<=12:
  print("AMBIGUOUS")
 else:
  print("MMYY")
else:
 if 1<=C and C<=12:
  print("YYMM")
 else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

if 0 < int(S[:2]) < 13 and 0 < int(S[2:]) < 13:
    print('AMBIGUOUS')
    exit()

if 0 <= int(S[:2]) and 0 < int(S[2:]) < 13:
    print('YYMM')
    exit()
if 0 < int(S[:2]) < 13 and 0 <= int(S[2:]):
    print('MMYY')
    exit()
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = list(input())
YYMM = 0
MMYY = 0
if 1 <= int(s[2]+s[3]) <= 12:
    YYMM = 1
if 1 <= int(s[0]+s[1]) <= 12:
    MMYY = 1

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

Submission status: Accepted

Solution code:
S=list(input())
a=[S[0],S[1]]
b=[S[2],S[3]]
c=int("".join(a))
d=int("".join(b))
if 0<c<13 and 0<d<13:
  print("AMBIGUOUS")
if 0<c<13 and (d<1 or 12<d):
  print("MMYY")
if (c<1 or 12<c) and 0<d<13:
  print("YYMM")
if (c<1 or 12<c) and (d<1 or 12<d):
  print("NA")

Submission status: Accepted

Solution code:
S = input()
if int(S[:2]) > 12:
    if 13 > int(S[2:]) > 0:
        print("YYMM")
    else:
        print("NA")
elif 0 < int(S[:2]) < 13:#12xx~01xx
    if int(S[2:]) > 12:
        print("MMYY")
    elif 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:#00xx
    if 0 < int(S[2:]) <13:
        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()
l=s[0]+s[1]
m=s[2]+s[3]
month=['01','02','03','04','05','06','07','08','09','10','11','12']
if month.count(l)==1 and month.count(m)==1:
    print('AMBIGUOUS')
elif month.count(l)==1 and month.count(m)==0:
    print('MMYY')
elif month.count(m)==1 and month.count(l)==0:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

s = stdin.readline().rstrip()

mae = s[:2]
ato = s[2:]

def syoukyo(i):
    if i[0] == 0:
        i = i[1]
    return int(i)

mae = syoukyo(mae)
ato = syoukyo(ato)

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

Submission status: Accepted

Solution code:
# coding: utf-8
s = list(input())
yymm = False
mmyy = False
# MM

if int("".join(s[0:2])) in range(1,13):
    mmyy = True
if int("".join(s[2:4])) in range(1,13):
    yymm = True

#print(int("".join(s[0:2])), int("".join(s[2:4])))
#print(mmyy,yymm)
if yymm:
    if mmyy:
       print("AMBIGUOUS") 
    else:
        print("YYMM")
elif mmyy:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main(f, e):
    if 0 <f <13:
        if 0<e<13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 0<e<13:
            print("YYMM")
        else:
            print("NA")
if __name__ == "__main__":
    S = input()

    a = int(S[:2])
    b = int(S[2:])
    main(a, b)

Submission status: Accepted

Solution code:
s = input()

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

# YYMM
if((0 <= a <= 99) & (1 <= b <= 12)):
    if((0 <= b <= 99) & (1 <= a <= 12)):
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if((0 <= b <= 99) & (1 <= a <= 12)):
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s=str(input())

s_1=int(s[0]+s[1])
s_2=int(s[2]+s[3])

#print(s_1,s_2)

if (s_1>=1) & (s_1<=12) & (s_2>=1) & (s_2<=12):
	print("AMBIGUOUS")
	
elif ((s_1>=1) & (s_1<=12)) & ((s_2==0) | (s_2>=13)):
	print("MMYY")

elif ((s_1==0) | (s_1>=13)) & ((s_2>=1) & (s_2<=12)):
	print("YYMM")
	
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
is_a_Y = is_b_Y = False

if 1 <= a <= 12:
    is_a_Y = True
if 1 <= b <= 12:
    is_b_Y = True

if is_a_Y and is_b_Y:
    print('AMBIGUOUS')
elif is_a_Y and not is_b_Y:
    print('MMYY')
elif not is_a_Y and is_b_Y:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

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

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