Problem:


Score : 200 points

Problem Statement

You have a digit sequence S of length 4. You are wondering which of the following formats S is in:

YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order

MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order

If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

Sample Input 1

1905

Sample Output 1

YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.

Sample Input 3

1700

Sample Output 3

NA

Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
S = input()

A = int(S[:2])
B = int(S[2:])

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = int(input())

    a = S // 100
    b = S % 100

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


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

Submission status: Accepted

Solution code:
import sys 

S = sys.stdin.readline()

def is_mmyy(s):
    former, latter = int(S[0:2]), int(S[2:])
    if former >= 1 and former <= 12:
        return True
    return False

def is_yymm(s):
    former, latter = int(S[0:2]), int(S[2:])
    if latter >= 1 and latter <= 12:
        return True
    return False


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

def is_yymm(s):
    y, m = int(s[:2]), int(s[2:])
    return True if m > 0 and m < 13 else False

def is_mmyy(s):
    m, y = int(s[:2]), int(s[2:])
    return True if m > 0 and m < 13 else False

if is_yymm(s) and is_mmyy(s):
    print('AMBIGUOUS')
elif is_yymm(s) and not is_mmyy(s):
    print('YYMM')
elif not is_yymm(s) and is_mmyy(s):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()
n1 = int(S[:2])
n2 = int(S[2:])

if 0 < n1 < 13 and 0 < n2 < 13:
    print('AMBIGUOUS')
elif 0 < n1 < 13 and 0 <= n2 < 100:
    print('MMYY')
elif 0 < n2 < 13 and 0 <= n1 < 100:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def determin_format(A, B):
    if 0<  A <= 12:
        if 0 <  B <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"
    
    else:
        if 0 <  B <= 12:
            return "YYMM"
        else: 
            return  "NA"

S = input()

A = int(S[:2])
B = int(S[2:])

print(determin_format(A,B))

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))

S = input()

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

Submission status: Accepted

Solution code:
S=input()
list=[]
for i in S:
    list.append(i)
num_for=int(list[0]+list[1])
num_lat=int(list[2]+list[3])

def yymm_jud(x):
    if 0<x<13:
        return 1
    else:
        return 0
def mmyy_jud(x):
    if 0<x<13:
        return 1
    else:
        return 0

if yymm_jud(num_lat)==1 and mmyy_jud(num_for)==0:
    print("YYMM")
elif yymm_jud(num_lat)==0 and mmyy_jud(num_for)==1:
    print("MMYY")
elif yymm_jud(num_lat)==0 and mmyy_jud(num_for)==0:
    print("NA")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
print(["NA","YYMM","MMYY","AMBIGUOUS"][(lambda x:(0<x//100<13)*2+(0<x%100<13))(int(input()))])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()

flag1 = False
flag2 = False
k = int(a[:2])
l = int(a[2:])
if k is not 0 and k < 13:
    flag1 = True
if l is not 0 and l < 13:
    flag2 = True

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

Submission status: Accepted

Solution code:
def isMM(s):
  n = int(s)
  if 0 < n <13:
    return True
  return False

s = raw_input()
s1 = s[:2]
s2 = s[2:]
ans = "NA"
if isMM(s2):
  if isMM(s1):
    ans = "AMBIGUOUS"
  else:
    ans = "YYMM"
else:
  if isMM(s1):
    ans = "MMYY"
    
print ans

Submission status: Accepted

Solution code:
s = input()
n1 = int(s[:2])
n2 = int(s[2:])


def is_month(n):
    return n > 0 and n <= 12


if is_month(n1) and is_month(n2):
    print("AMBIGUOUS")
elif is_month(n1):
    print("MMYY")
elif is_month(n2):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
a = input()

if 0 < int(a[:2]) and int(a[:2]) <= 12:
    if 0 < int(a[2:]) and int(a[2:]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

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

Submission status: Accepted

Solution code:
def mm_check(s):
    if 1 <= int(s) <= 12:
        return True
    return False

def main():
    S = input().rstrip('\n')

    Spre = S[:2]
    Spost = S[2:]

    pre_check = mm_check(Spre)
    post_check = mm_check(Spost)

    if pre_check and post_check:
        print('AMBIGUOUS')
    elif pre_check:
        print('MMYY')
    elif post_check:
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = int(input())

L = int(a/100)
R = int(a%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 = input()
A = int(S[0:2])
B = int(S[2:4])

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

Submission status: Accepted

Solution code:
s = input()
a,b = s[:2],s[2:]
if 0<int(a)<13 and 0<int(b)<13: print("AMBIGUOUS")
elif 0<int(a)<13: print("MMYY")
elif 0<int(b)<13: print("YYMM")
else: 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:
n=input()
n1=n[:2]
n2=n[2:]
A=int(n1)
B=int(n2)
if 0<A<13:
    if 0<B<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<B<13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
first = int(S[0:2])
second = int(S[2:4])

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 = list(input())
if s[0] == "0":
    s[0] = ''
if s[2] == "0":
    s[2] = ''
x = int(s[0]+s[1])
y = int(s[2]+s[3])

if (x <= 12 and x >= 1) and (y >=1 and y <=12):
    print("AMBIGUOUS")

elif(x >= 0 and (y >= 1 and y <= 12)):
    print("YYMM")

elif(y >= 0 and (x >= 1 and x <= 12)):
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
front = int(S[:2])
back = int(S[2:])


def is_month(num):
    if num >= 1 and num <= 12:
        return True


if is_month(front) and is_month(back):
    print('AMBIGUOUS')
elif is_month(front) and not is_month(back):
    print('MMYY')
elif not is_month(front) and is_month(back):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input() #4桁

YM1_s = S[:2]
YM2_s = S[2:]

YM1 = int(YM1_s)
YM2 = int(YM2_s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, k = LI()
    s = S()
    s[k-1] = s[k-1].lower()
    print("".join(s))

    return

#B
def B():
    s = S()
    a = int("".join(s[:2]))
    b = int("".join(s[2:]))
    if 0 < a <= 12:
        if 0 < b <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    elif a == 0:
        if 0 < b <= 12:
            print("YYMM")
        else:
            print("NA")
    else:
        if 0 < b <= 12:
            print("YYMM")
        else:
            print("NA")


    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if 1 <= int(S[0:2]) <= 12 and 1 <= int(S[2:4]) <= 12:
  print("AMBIGUOUS")

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
s1 = s//100
s2 = s%100

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
s1 = int(S[0:2])
s2 = int(S[2:4])
def valid_month(n):
	return 1 <= n and n <= 12
def valid_year(n):
	return 0 <= n and n <= 99
if valid_year(s1) and valid_month(s2) and valid_year(s2) and valid_month(s1):
	print('AMBIGUOUS')
elif valid_year(s1) and valid_month(s2):
	print('YYMM')
elif valid_month(s1) and valid_year(s2):
	print('MMYY')
else:
	print('NA')

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect

lis = [1, 13]

str = input()
tp = int(str[:2])
bt = int(str[2:])

tplo = bisect.bisect_right(lis, tp)
btlo = bisect.bisect_right(lis, bt)

if tplo == 1:
    if btlo == 1:
        jd = 2
    else:
        jd = 1
else:
    if btlo == 1:
        jd = 0
    else:
        jd = 3

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

print(judge[jd])

Submission status: Accepted

Solution code:
def canMonth(value):
    return 1 <= value and value <= 12


S = input()

F = int(S[:2])
B = int(S[2:])
fm = canMonth(F)
bm = canMonth(B)

if fm and bm:
    print('AMBIGUOUS')
elif not fm and not bm:
    print('NA')
elif fm:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
S = input()

First = S[0:2]
Last  = S[2:4]



First = int(First)
Last = int(Last)

YYMM = False
MMYY = False

if(First>0 and First<13):
	MMYY = True

if(Last>0 and Last<13):
	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().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

Submission status: Accepted

Solution code:
a = int(input())
y = a//100
m = a%100
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:
s=input()
sy=int(s[:2])
sm=int(s[2:])

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

Submission status: Accepted

Solution code:
s = int(input())

t = s/100

u = s%100

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

Submission status: Accepted

Solution code:
s = int(input())

b = s % 100
a = int((s-b)/100)

flaga = False
flagb = False

if a > 0 and a < 13:
    flaga = True
if b > 0 and b < 13:
    flagb = True

if flaga == True and flagb == True:
    print('AMBIGUOUS')
if flaga == False and flagb == True:
    print('YYMM')
if flaga == True and flagb == False:
    print('MMYY')
if flaga == False and flagb == False:
    print('NA')

Submission status: Accepted

Solution code:
# ABC126B - YYMM or MMYY
s = input()
x, y = int(s[:2]), 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 = input()
T = []
T.append("".join(S[0:2]))
T.append("".join(S[2:4]))
MM = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
if (T[0] in MM) and (T[1] in MM):
  print("AMBIGUOUS")
elif (T[0] in MM) and (T[1] not in MM):
  print("MMYY")
elif (T[0] not in MM) and (T[1] in MM):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = int(input())

a = s // 100
b = s % 100

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

Submission status: Accepted

Solution code:
S = input()
s = [S[:2], S[2:]]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def isM(s):
    if (s[0] == '0' and '1'<=s[1]<='9' ) or \
        (s[0] == '1' and s[1] in ('0', '1', '2')):
        return True
    return False

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'

Submission status: Accepted

Solution code:
S = input()
if int(S[:2]) in range(1, 13) and int(S[2:]) in range(1, 13):
  print("AMBIGUOUS")
elif int(S[:2]) in range(100) and int(S[2:]) in range(1, 13):
  print("YYMM")
elif int(S[:2]) in range(1, 13) and int(S[2:]) in range(100):
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
def judge_yymm(aa,bb):
	if 0<bb<13:
		return True
	return False
	
def judge_mmyy(aa,bb):
	if 0<aa<13:
		return True
	return False

s=input()
num=int(s)
#aabb
aa,bb=num//100,num%100
#YYMM, MMYY, AMBIGUOUS, NA 
if judge_mmyy(aa,bb):
	if judge_yymm(aa,bb):
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if judge_yymm(aa,bb):
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

Solution code:
def main():
    S = input()
    upper = int(S[:2])
    lower = int(S[2:4])
    s = ''
    if upper <= 12 and upper > 0:
        s += 'MM'

    else:
        s += 'YY'

    if lower <= 12 and lower > 0:
        s += 'MM'

    else:
        s += 'YY'

    if s == 'MMMM':
        print('AMBIGUOUS')

    elif s == 'YYYY':
        print('NA')

    else:
        print(s)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

x, y = divmod(n, 100)

can_month1 = 1 <= x <= 12
can_month2 = 1 <= y <= 12

ans = "NA"
if can_month1 and can_month2:
    ans = "AMBIGUOUS"
elif can_month1:
    ans = "MMYY"
elif can_month2:
    ans = "YYMM"

print(ans)

Submission status: Accepted

Solution code:
# B - YYM or MMYY
S = input()
s_for, s_back = int(S[:2]), int(S[2:])

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

Submission status: Accepted

Solution code:
S = input()
A = S[:2]
B = S[2:]

# print(A, B)

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

A_month = True
try:
  month.index(A)
except ValueError:
  A_month = False
  
# print(A_month)

B_month = True
try:
  month.index(B)
except ValueError:
  B_month = False
  
# print(B_month)

if A_month and B_month:
  print('AMBIGUOUS')
elif A_month and not B_month:
  print('MMYY')
elif not A_month and B_month:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
sstr=list(input())
sf=[sstr[0],sstr[1]]
sb=[sstr[2],sstr[3]]
if sf[0]=="0":
  sf.pop(0)
if sb[0]=="0":
  sb.pop(0)
fws="".join(sf)
bks="".join(sb)
fwb=[int(n) for n in fws]
bkb=[int(n) for n in bks]
if len(fwb)==2:
    fw=(fwb[0]*10)+(fwb[1])
else:
    fw=fwb[0]
if len(bkb)==2:
    bk=(bkb[0]*10)+(bkb[1])
else:
    bk=bkb[0]
if 1<=fw<=12:
  if 1<=bk<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=bk<=12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
YY = int(s[0] + s[1])
MM = int(s[2] + s[3])
if 0 < YY < 13 and 0 < MM < 13:
    print("AMBIGUOUS")
elif YY >= 0 and 0 < MM < 13:
    print("YYMM")
elif 0 < YY < 13 and MM >= 0:
    print("MMYY")
elif YY <= 0 or 13 <= YY or MM <= 0 or 13 <= MM:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def MM(S):
    for i in range(1, 13):
        if S == format(str(i).zfill(2)):
            return True
    return False

b0 = MM(S[:2])
b1 = MM(S[2:])

if b0:
    if b1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b1:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
lst = [str(i).zfill(2) for i in range(1, 13)]
up = S[0:2]
low = S[2:4]


if up in lst and low in lst:
    ans = "AMBIGUOUS"
elif up in lst and low not in lst:
    ans = "MMYY"
elif up not in lst and low in lst:
    ans = "YYMM"
else:
    ans = "NA"


print(ans)

Submission status: Accepted

Solution code:
def Check_Year(year):
    if str(year).isdecimal() :
        return 1
    else:
        return 0

def Check_Month(month):
    if 0 < month < 13:
        return 1
    else:
        return 0

input_data = list(input())
head_chrs = int(input_data[0] + input_data[1])
# print('head: ', head_chrs)
tail_chrs = int(input_data[2] + input_data[3])
# print('tail: ', tail_chrs)

# print(input_data)

# check for YYMM format
result1 = Check_Year(head_chrs) + Check_Month(tail_chrs)
# print('result1: ' , result1)
# Check for MMYY format
result2 = Check_Year(tail_chrs) + Check_Month(head_chrs)
# print('result2: ' , result2)

if result1 == 2 and result2 == 2 :
    print('AMBIGUOUS')
elif result1 == 2 and result2 != 2 :
    print('YYMM')
elif result1 != 2 and result2 == 2 :
    print('MMYY')
else :
    print('NA')

Submission status: Accepted

Solution code:
S = str(input())

if 12 >= int(S[0:2]) >= 1:

    if 12 >= int(S[2:4]) >= 1:
        print("AMBIGUOUS")

    else:
        print("MMYY")

else:
    if 12 >= int(S[2:4]) >= 1:
        print("YYMM")

    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(["NA","YYMM","MMYY","AMBIGUOUS"][(lambda x:(0<x//100 and x//100<13)*2+(0<x%100 and x%100<13))(int(input()))])

Submission status: Accepted

Solution code:
s = str(input())

if 1 <= int(s[0:2]) <= 12 : #3桁目４桁目
    
    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:
'''input
1700
'''

s = input()

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

pir = False
ant = False

if a and a <= 12:
	pir = True

if b and b <= 12:
	ant = True

if pir and ant:
	print("AMBIGUOUS")
elif pir:
	print("MMYY")
elif ant:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    s = input()
    if len(str(s)) != 4:
        raise Exception('Error')
    if not (s.isdecimal()):
        print('NA')
    else:
        sl = list(s)
        st = int("".join(sl[:2]))
        end = int("".join(sl[2:4]))
        if st > 0 and st <= 12 and end > 0 and end <= 12:
            print('AMBIGUOUS')
        elif st > 0 and st <= 12 and (end == 0  or end > 12):
            print('MMYY')
        elif (st == 0 or st > 12) and end > 0 and end <= 12:
            print('YYMM')
        else:
            print('NA')

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(9<s<1e3)-(0<s%100<13)*2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().rstrip()
front = int(S[0:2])
back = int(S[2:4])

f = True if 1 <= front <= 12 else False
b = True if 1 <= back <= 12 else False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(9<s<1300)-(0<s%100<13)*2])

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 = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

if int(S[2:]) in range(1, 13):
    if int(S[:2]) not in range(1, 13):
        print("YYMM")
    else:
        print("AMBIGUOUS")
elif int(S[:2]) in range(1, 13):
    if int(S[2:]) not in range(1, 13):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(99<s<1300)-(0<s%100<13)*2])

Submission status: Accepted

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

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

id = 0
if 0 < XX <= 12:
    id += 1
if 0 < YY <= 12:
    id += 2

print(msg[id])

Submission status: Accepted

Solution code:
S = input()
first, second = map(int, (S[:2], S[2:]))
cond1, cond2 = 1 <= int(first) <= 12, 1 <= int(second) <= 12

if cond1:  # 前2桁を「月」とみなせる
    ans = 'AMBIGUOUS' if cond2 else 'MMYY'
else:
    ans = 'YYMM' if cond2 else 'NA'
print(ans)

Submission status: Accepted

Solution code:
s=input()
n=int(s[:2])
m=int(s[2:])
if 1<=n<=12:
  if 1<=m<=12:
    print("ambiguous".upper())
    exit()
  else:
    print("MMYY")
    exit()
if 1<=m<13:
  print("YYMM")
  exit()
print("NA")

Submission status: Accepted

Solution code:
s=input();print(['NA','MMYY','YYMM','AMBIGUOUS'][('01'<s<'13')-('00'<s[2:]<'13')*2])

Submission status: Accepted

Solution code:
n = input()

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

l = l > 0 and l <= 12
r = r > 0 and r <= 12
if l and r:
    print('AMBIGUOUS')
elif l and not r:
    print('MMYY')
elif (not l) and r:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
isS1YYMM = 1 <= s1 <= 12
isS2MMYY = 1 <= s2 <= 12
if isS1YYMM:
    if isS2MMYY:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if isS2MMYY:
        print("YYMM")
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 入力
S = input()

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

ans = (
    'YYMM' if not 1 <= a <= 12 and 1 <= b <= 12 else
    'MMYY' if 1 <= a <= 12 and not 1 <= b <= 12 else
    'AMBIGUOUS' if 1 <= a <= 12 and 1 <= b <= 12 else
    'NA'
)

# 出力
print(ans)