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:])
f_a = False
f_b = False
if A >= 1 and A <= 12:
  f_a = True
if B >= 1 and B <= 12:
  f_b = True
if f_a:
  if f_b:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if f_b:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
M = '010203040506070809101112'
if S[2:] in M:
    if S[:2] in M:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if S[:2] in M:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
s_1 = int(s[:2])
s_2 = int(s[2:])
if 0 < s_1 < 13:
    if 0 < s_2 < 13:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if 0 < s_2 < 13:
        ans = "YYMM"
    else:
        ans = "NA"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
XXXX = input()
ab = int(XXXX[:2])
cd = int(XXXX[2:])

j = 1 <= ab <= 12
k = 1 <= cd <= 12
if not j and k:
    print("YYMM")
elif j and not k:
    print("MMYY")
elif j and k:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
XX = S // 100
YY = S % 100

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
#以下てんぷら
def j(q):
    if q==1: print("YES")
    elif q == 0:print("NO")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
#n,x= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しに4 3sum変数使用はsum関数使用できないので注意
a = n//100
b = n%100
leftmonth = 0
rightmonth = 0
if 0 < a < 13: leftmonth = 1
if 0 < b < 13: rightmonth = 1
if leftmonth and rightmonth:
    print("AMBIGUOUS")
elif leftmonth:
    print("MMYY")
elif rightmonth:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def is_month(x):
    return True if x > 0 and x <= 12 else False

S = input().strip()

former = int(''.join(S[:2]))
later = int(''.join(S[2:]))

if is_month(former) and is_month(later):
    print('AMBIGUOUS')
elif is_month(former) and not is_month(later):
    print('MMYY')
elif not is_month(former) and is_month(later):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
from datetime import datetime

S = input()
ans = [ 'NA','YYMM', 'MMYY', 'AMBIGUOUS']
flags = 0b0

# 判定[YYMM]
try:
	date_dt = datetime.strptime(S, "%y%m")
except:
	flags -= flags & 1
else:
	flags |= 1

# 判定[MMYY]
try:
	date_dt = datetime.strptime(S, "%m%y")
except:
	flags -= flags & 2
else:
	flags |= 2

print(ans[flags])

Submission status: Accepted

Solution code:
S = input()
 
S1 = 10*int(S[0]) + int(S[1])
S2 = 10*int(S[2]) + int(S[3])
SepS = [S1, S2]
MM = [True,True]
 
for i in range(2):
  if SepS[i] < 1 or SepS[i] > 12:
    MM[i] = False
 
if MM[0] and MM[1]:
  print("AMBIGUOUS")
elif MM[0]:
  print("MMYY")
elif MM[1]:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
inp=input()
former=int(inp[0]+inp[1])
latter=int(inp[2]+inp[3])

if 0< former <=12 and 0< latter <=12:
	print("AMBIGUOUS")
elif 0< former <=12 :
	print("MMYY")
elif 0< latter <=12 :
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

word=input()

front = int(word[0:2])
back  = int(word[2:4])

# チェックするのはMMだけでよい

f = (1 <= front <= 12)
b = (1 <= back <= 12)

if f == True:
	if b == True:
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if b == True:
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

Solution code:
str     = input()

input   = int(str)

if input < 100:
    if input ==0:
        out = 'NA'
    elif input < 13:
        out = 'YYMM'
    else:
        out = 'NA'
elif input < 1300:
    if input % 100 == 0:
        out = 'MMYY'
    elif input%100 < 13:
        out = 'AMBIGUOUS'
    else:
        out = 'MMYY'
elif input%100==0:
    out = 'NA'
elif input%100<13:
    out = 'YYMM'
else:
    out = 'NA'
print(out)

Submission status: Accepted

Solution code:

S = input()

uS = S[:2]
lS = S[2:]

uNum = int(uS)
lNum = int(lS)

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
'''
長さ 4 の数字列 S が与えられます。あなたは、この数字列が以下のフォーマットのどちらであるか気になっています。

YYMM フォーマット: 西暦年の下 2 桁と、月を 2 桁で表したもの (例えば 1 月なら 01) をこの順に並べたものMMYY フォーマット: 月を 2 桁で表したもの 
(例えば 1 月なら 01) と、西暦年の下 2 桁をこの順に並べたもの与えられた数字列のフォーマットとして考えられるものが YYMM フォーマットのみである場合 YYMM を、 
MMYY フォーマットのみである場合 MMYY を、 YYMM フォーマット と MMYY フォーマットのどちらの可能性もある場合 AMBIGUOUS を、 どちらの可能性もない場合 NA を出力してください。
'''

def main():
	'''
	メイン関数
	'''
	# 文字列
	S = input()

	# 表示
	mae = S[0] + S[1]
	ushiro = S[2] + S[3]

	m_M_flag = False
	u_M_flag = False

	if int(mae) > 0 and int(mae) < 13 :
		m_M_flag = True
		
	if int(ushiro) > 0 and int(ushiro) < 13 :
		u_M_flag = True

	if m_M_flag and u_M_flag:
		print("AMBIGUOUS")
	elif m_M_flag and not u_M_flag:
		print("MMYY")
	elif not m_M_flag and u_M_flag:
		print("YYMM")
	elif not m_M_flag and not u_M_flag:
		print("NA")
	


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
num = input()
num1 = int(num[0] + num[1])
num2 = int(num[2] + num[3])

if(num1 < 13) and (num1 > 0):
    if(num2 < 13) and (num2 > 0):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(num2 < 13) and (num2 > 0):
        print("YYMM")
    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 1 <= int(S[:2]) <= 12:
    print("MMYY")
elif 1 <= int(S[2:]) <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])

# print(A)
# print(B)

flag_YYMM = 0
flag_MMYY = 0

if 1 <= A and A <= 12 : 
    flag_MMYY = 1
if 1 <= B and B <= 12 : 
    flag_YYMM = 1
    
if flag_YYMM == 0 and flag_MMYY == 0 : 
    print("NA")
elif flag_YYMM == 0 and flag_MMYY == 1 : 
    print("MMYY")
elif flag_YYMM == 1 and flag_MMYY == 0 : 
    print("YYMM")
elif flag_YYMM == 1 and flag_MMYY == 1 : 
    print("AMBIGUOUS")

Submission status: Accepted

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


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

else:
	if s2 >= 1 and s2 <= 12:
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

s = stdin.readline().strip()
left, right = int(s[:2]), int(s[2:])
if 1 <= left <= 12 and 1 <= right <= 12:
  print('AMBIGUOUS')
elif 1 <= left <= 12 and 0 <= right <= 99:
  print('MMYY')
elif 0 <= left <= 99 and  1 <= right <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
mae = int(S[:2])
ushiro = int(S[2:])
if 0 < mae < 13:
    if 0 < ushiro < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0 < ushiro < 13:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
a=list(map(int,input()))
b,c=a[0]*10+a[1],a[2]*10+a[3]
if 1<=b<=12:
    if 1<=c<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1<=c<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

num1 = int(s[:2])
num2 = int(s[2:])

def month(num):
    if 1 <= num <= 12:
        return True
    else:
        return False

if month(num1) == True and month(num2) == True:
    print('AMBIGUOUS')
elif month(num1) == True and month(num2) == False:
    print('MMYY')
elif month(num1) == False and month(num2) == True:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s1 = s[0:2]
s2 = s[2:4]

i1 = int(s1)
i2 = int(s2)
 
if 1 <= i1 <=12 and 1 <= i2 <= 12:
    res = "AMBIGUOUS"
elif 1 <= i1 <= 12:
    res = "MMYY"
elif 1 <= i2 <= 12:
    res = "YYMM"
else:
    res = "NA"

print(res)

Submission status: Accepted

Solution code:


S = input()

#YYMM か MMYY か AMBIGUOUS か NA か
#YYMM 1902
#MMYY 0599
#AMBIGUOUS 1212
#NA 9999

if S[0:2] < '13' and S[0:2] != '00' :
    if S[2:4] < '13' and S[2:4] != '00' :
        print('AMBIGUOUS')
    else :
        print('MMYY')

else:
    if S[2:4] < '13' and S[2:4] != '00' :
        print('YYMM')
    else :
        print('NA')

Submission status: Accepted

Solution code:
ans = ('YYMM', 'MMYY', 'AMBIGUOUS', 'NA')

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):
    print(ans[2])
elif 1 <= int(s[0:2]) and int(s[0:2]) <= 12:
    print(ans[1])
elif 1 <= int(s[2:4]) and int(s[2:4]) <= 12:
    print(ans[0])
else:
    print(ans[3])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = raw_input()

# s = "ABCD" -> first = AB, second = CD
first  = int(s[:2])
second = int(s[2:])

if first in range(1, 12+1):
    if second in range(1, 12+1):
        print "AMBIGUOUS"
    else:
        print "MMYY"
elif second in range(1, 12+1):
    print "YYMM"
else:
    print "NA"

Submission status: Accepted

Solution code:
def m(suu):
  if suu>=1 and suu<=12:
    return True
  else:
    return False

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

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

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    left = int(s[0] + s[1])
    right = int(s[2] + s[3])

    if 1 <= left and left <= 12:
        if 1 <= right and right <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"
    else:
        if 1 <= right and right <= 12:
            return "YYMM"
        else:
            return "NA"

print(main())

Submission status: Accepted

Solution code:
S = raw_input()
a = S[0]+S[1]
b = S[2]+S[3]
yymm = 1 <= int(b) and int(b) <= 12
mmyy = 1 <= int(a) and int(a) <= 12
if yymm:
	if mmyy: print 'AMBIGUOUS'
	else: print 'YYMM'
else:
	if mmyy: print 'MMYY'
	else: print 'NA'

Submission status: Accepted

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

head_M = 1 <= head <= 12
tail_M = 1 <= tail <= 12

if head_M and tail_M:
  ret = 'AMBIGUOUS'
elif head_M:
  ret = 'MMYY'
elif tail_M:
  ret = 'YYMM'
else:
  ret = 'NA'
print(ret)

Submission status: Accepted

Solution code:
S = input()
s_1 = int(S[:2])
s_2 = int(S[2:])

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

Submission status: Accepted

Solution code:
def main() -> None:
    S = input()
    a = S[:2]
    b = S[2:]
    if ('00' < a < '13') and ('00' < b < '13'):
        print("AMBIGUOUS")
    elif '00' < a < '13':
        print("MMYY")
    elif '00' < b < '13':
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

S = input()

A = int(S[0:2])
B = int(S[2:])
f1,f2 = False,False
if A > 0 and A <= 12:
    f1 = True
if B > 0 and B <= 12:
    f2 = True

if f1 and f2:
    print("AMBIGUOUS")
elif f1:
    print("MMYY")
elif f2:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
n = int(input())

a = n // 100
b = n % 100

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s=int(input())
supper=s//100
sunder=s-(s//100)*100
if 1<=supper<=12 and 1<=sunder<=12:
    print("AMBIGUOUS")
elif 1<=supper<=12:
    print("MMYY")
elif 1<=sunder<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def yymm():
    num = input()
    former = num[:2]
    latter = num[2:]

    former = int(former)
    latter = int(latter)
    # print(former)
    # print(latter)

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

if __name__ == '__main__':
    yymm()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()

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

##YYMM
if ((former > 12 or former==0) and (latter <= 12 and latter > 0)):
    print('YYMM')
    sys.exit()

##MMYY
if ((former <= 12 and former > 0) and (latter > 12 or latter==0)):
    print('MMYY')
    sys.exit()

##AMBIGUOUS
if ((former <= 12 and former > 0) and (latter <= 12 and latter > 0)):
    print('AMBIGUOUS')
    sys.exit()

##NA
print('NA')

Submission status: Accepted

Solution code:
n = int(input())
a = n // 100
b = n % 100

if a ==0 or (13 <=a<=99):
    if 1<=b<=12:
        ans = 'YYMM'
    else:
        ans = 'NA'
else:
    if b==0 or (13 <=b<=99):
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'


print(ans)

Submission status: Accepted

Solution code:
#YYMM or MMYY or AMBIGUOUS or NA

inputLine = input()

firstPart = int(inputLine[0:2])
secondPart = int(inputLine[2:4])

#initialization
naFlag = False
firstPartYear = False
firstPartAmb = False
secondPartYear = False
secondPartAmb = False

# firstPartの属性判定
if firstPart < 0:
    naFlag = True

elif firstPart == 0:
    firstPartYear = True
    
elif firstPart < 13:
    firstPartAmb = True
    
else: 
    firstPartYear = True
    
# secondPartの属性判定
if secondPart < 0:
    naFlag = True

elif secondPart == 0:
    secondPartYear = True
    
elif secondPart < 13:
    secondPartAmb = True
    
else: 
    secondPartYear = True
    
if naFlag:
    print('NA')

elif secondPartYear:
    if firstPartYear:
        print('NA')
    elif firstPartAmb:
        print('MMYY')

elif secondPartAmb:
    if firstPartYear:
        print('YYMM')
    elif firstPartAmb:
        print('AMBIGUOUS')

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    S = input()

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

    front_mm = 1 <= front <= 12
    rear_mm = 1 <= rear <= 12

    if front_mm and rear_mm:
        print("AMBIGUOUS")
    elif front_mm:
        print("MMYY")
    elif rear_mm:
        print("YYMM")
    else:
        print("NA")


main()

Submission status: Accepted

Solution code:
S = input()
month_list = ['0' + str(ii) for ii in range(1, 10)]
month_list.extend(['10', '11', '12'])

if S[:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print('MMYY')
else:
    if S[2:4] in month_list:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()

S_list = list(S)
S_1 = int(S_list[0]+S_list[1])
S_2 = int(S_list[2]+S_list[3])

if S_1==0 or (13<=S_1<=99):
    if 1<=S_2<=12:
        ans = 'YYMM'
    else:
        ans = 'NA'
else:
    if S_2==0 or (13<=S_2<=99):
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'
        
print(ans)

Submission status: Accepted

Solution code:
def solve(s):
  a = s // 100
  b = s % 100
  
  if 0 < a <= 12 and 0 < b <= 12:
    return "AMBIGUOUS"
  elif 0 < a <= 12:
    return "MMYY"
  elif 0 < b <= 12:
    return "YYMM"
  else:
    return "NA"

s = int(input())

print(solve(s))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
low = int(S) % 100
high = (int(S) - low) / 100

if high == 0:
  if low == 0:
    print('NA')
  elif 1 <= low <= 12:
    print('YYMM')
  else:
    print('NA')
elif 1 <= high <= 12:
  if low == 0:
    print('MMYY')
  elif 1 <= low <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if low == 0:
    print('NA')
  elif 1 <= low <= 12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
# coding: utf-8

s = input()
prefix = int(s[:2])
suffix = int(s[2:])

def isMonth(n):
    if n <= 12 and n >= 1:
        return True

if isMonth(prefix) and isMonth(suffix):
    ans = 'AMBIGUOUS'
elif not isMonth(prefix) and isMonth(suffix):
    ans = 'YYMM'
elif isMonth(prefix) and not isMonth(suffix):
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
YM = input()
left = int(YM) // 100
right = int(YM) % 100

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

Submission status: Accepted

Solution code:
inp = input()
inp = int(inp)

ans = 3

s_up = inp // 100
s_do = inp - s_up * 100

if (s_up > 12) or (s_up == 0):
    ans = 1

if (s_do > 12) or (s_do == 0):
    ans = 2

if ((s_up > 12) or (s_up == 0)) and ((s_do > 12) or (s_do == 0)):
    ans = 4

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

Submission status: Accepted

Solution code:
## YYMM or MMYY or AMBIGUOUS or NA
## YY: なんでもok
## MM: 01~12
## MMの個数によって条件分岐すればok

s = input()
pre = int(s[:2])
last = int(s[2:])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i=input()
a,b=int(i[:2]),int(i[-2:])
def x(n):
    if n>12 or n==0:return True
def y(n):
    if n<13 and n!=0:return True
if y(a) and y(b):
    print ("AMBIGUOUS")
if y(a) and x(b):
    print ("MMYY")
if x(a) and y(b):
    print ("YYMM")
if x(a) and x(b):
    print ("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

S = input()

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

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

Submission status: Accepted

Solution code:
s = str(input())

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

mf1 = False
mf2 = False

if 0 < yy < 13 :
    mf1 = True
if 0 < mm < 13 :
    mf2 = True

if mf1 and mf2 :
    print('AMBIGUOUS')
elif mf1 and not mf2 :
    print('MMYY')
elif not mf1 and mf2 :
    print('YYMM')
elif not mf1 and not mf2 :
    print('NA')

Submission status: Accepted

Solution code:
s=str(input())
a=int(s[:2])
b=int(s[2:])
if a==0 or a>=13:
    astr='YY'
else:
    astr='MM'

if b==0 or b>=13:
    bstr='YY'
else:
    bstr='MM'

ans=astr+bstr


if ans=='YYYY':
    print('NA')
elif ans=='MMMM':
    print('AMBIGUOUS')
else:
    print(ans)

Submission status: Accepted

Solution code:

# numbers = input('')

# first_numbers = int(numbers[0] + numbers[1])
# second_numbers = int(numbers[2] + numbers[3])

# if first_numbers > 12 and second_numbers > 12:
#   print('NA')
# elif first_numbers > 12:
#   if second_numbers == 0:
#     print('NA') 
#   else:
#     print('YYMM') 
# elif second_numbers > 12:
#   if first_numbers == 0: 
#     print('NA') 
#   else:
#     print('MMYY')
# else:
#   print('AMBIGUOUS')

s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")

elif not(0<s1<13) and 0<s2<13:
    print("YYMM")

elif 0<s1<13 and not(0<s2<13):
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
y=input()
v = [y[i: i+2] for i in range(0, len(y), 2)]

a=''
b=''

if int(v[0])>=1 and int(v[0])<=12:
	a='YYorMM'
elif int(v[0])>=13 or int(v[0])==0:
	a='YY'
    
if int(v[1])>=1 and int(v[1])<=12:
	b='YYorMM'
elif int(v[1])>=13 or int(v[1])==0:
	b='YY'

result=''
if a=='YY' and b=='YYorMM':
	result="YYMM"
elif  a=='YY' and b=='YY':
	result="NA"
elif  a=='YYorMM' and b=='YY':
	result="MMYY"
elif  a=='YYorMM' and b=='YYorMM':
	result="AMBIGUOUS"
else:
	result="ERROR"
    
print(result)

Submission status: Accepted

Solution code:
s = input()
a, b = int(s[:2]), int(s[2:])
ch = 0
if 0 < a < 13:
    ch += 1
if 0 < b < 13:
    ch += 2
if ch == 0:
    print("NA")
elif ch == 1:
    print('MMYY')
elif ch == 2:
    print('YYMM')
elif ch == 3:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
t = input()
A, B = int(t[:2]), int(t[2:])
def V(k):
    return 1 <= k <= 12
ans = "NA"
if V(A) or V(B):
    if V(A) and V(B):
        ans = "AMBIGUOUS"
    elif V(A):
        ans = "MMYY"
    else:
        ans = "YYMM"
print(ans)

Submission status: Accepted

Solution code:
s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")

elif not(0<s1<13) and 0<s2<13:
    print("YYMM")

elif 0<s1<13 and not(0<s2<13):
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
S = list(input())
S_divide = [S[0]+S[1],S[2]+S[3]]
S_divide = list(map(int, S_divide))
a = S_divide[0]
b = S_divide[1]
while True:
    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')
    break

Submission status: Accepted

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

MMYY = (1 <= int(a) <= 12) and (0 <= int(b) <= 99)
YYMM = (0 <= int(a) <= 99) and (1 <= int(b) <= 12)

if MMYY:
    if YYMM:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if YYMM:
        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 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:
def num_checker(string1, string2):
    if (int(string1)==0 and int(string2) != 0) or 9 < int(string1 + string2) < 13:
        return True
    else:
        return  False

S = input()
if num_checker(list(S)[0], list(S)[1]):
    if num_checker(list(S)[2], list(S)[3]):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num_checker(list(S)[2], list(S)[3]):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:


A = str(input())
B =int(A[:2])
C =int(A[2:4])


if B >=1 and B<=12:
    B_mm = True
else:
    B_mm = False

if C >=1 and C<=12:
    C_mm = True
else:
    C_mm = False

if B >=0 and B<=99:
    B_yy = True
else:
    B_yy = False

if C >=0 and C<=99:
    C_yy = True
else:
    C_yy = False

if B_yy == True and C_mm == True and B_mm ==True and C_yy ==True:
    print('AMBIGUOUS')
elif B_yy == True and C_mm == True:
    print('YYMM')
elif C_yy == True and B_mm == True:
    print('MMYY')
else:
    print('NA')