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:
import sys
input = sys.stdin.readline
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
isS1MM = 1 <= s1 <= 12
isS2MM = 1 <= s2 <= 12
if isS1MM and isS2MM:
    print("AMBIGUOUS")
elif not isS1MM and isS2MM:
    print("YYMM")
elif isS1MM and not isS2MM:
    print("MMYY")
else:
    print('NA')

Submission status: Accepted

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

if 1 <= front <= 12:
    if 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 0 <= back:
        print('MMYY')
    else:
        print('NA')
else:
    if 0 <= front and 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def is_MM(s):
    num = int(s)
    return 0 < num <= 12


def solve():
    N = ii(str)
    ans_pattern = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
    ans = 0
    pre = N[:2]
    post = N[2:]
    if is_MM(post):
        ans += 1
    if is_MM(pre):
        ans += 2
    return ans_pattern[ans]


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,input_func:[input_func() for _ in range(n)]

import importlib
import_module = lambda module_name:importlib.import_module(module_name)

init_array_1dim = lambda value,n:[value]*n # 1次元配列を生成
init_array_2dim = lambda value,n,m:[init_array_1dim(value,n) for _ in range(m)] # 2次元配列を生成

gcd_base = lambda value1,value2:import_module('fractions').gcd(value1,value2) # 最大公約数（2値)
gcd = lambda lst:import_module('functools').reduce(gcd_base,lst) # 最大公約数（リスト）
lcm_base = lambda value1,value2:(value1*value2)//gcd_base(value1,value2) # 最小公倍数(2値)
lcm = lambda lst:import_module('functools').reduce(lcm_base,lst,1) # 最小公倍数(リスト)

permutations = lambda lst,n:import_module('itertools').permutations(lst,n) # 順列
combinations = lambda lst,n:import_module('itertools').combinations(lst,n) # 組み合わせ
product = lambda lst1,lst2:import_module('itertools').product(lst1,lst2) # 二つのリストの直積

round = lambda value:round(value) # 四捨五入
ceil = lambda value:import_module('math').ceil(value) # 切り上げ
floor = lambda value:import_module('math').floor(value) # 切り捨て

# キュー
init_q = lambda lst: import_module('collections').deque(lst)
q_pop = lambda q: q.popleft() # 先頭から取り出し
q_push = lambda q,value:q.appendleft(value) # 先頭に追加（値）
q_pushlist = lambda q,lst:q.extendleft(lst) # 先頭に追加（リスト）
q_append = lambda q,value:q.append(value) # 末尾に追加（値）
q_appendlist = lambda q,lst:q.extend(lst) # 末尾に追加（リスト）

# プライオリティキュー
init_heap = lambda a:import_module('heapq').heapify(a)
heap_push = lambda a,v:import_module('heapq').heappush(a,v)
heap_pop = lambda a:import_module('heapq').heappop(a) # 最小値を取り出す

def solution():
    # ここに実装
    S = input_str()

    month_1 = False
    if 1<=int(S[:2])<=12:month_1 = True
    month_2 = False
    if 1<=int(S[2:])<=12:month_2 = True
    
    if month_1 and month_2:
        print('AMBIGUOUS')
        return
    if month_1:
        print('MMYY')
        return
    if month_2:
        print('YYMM')
        return
    print('NA')

if __name__ == '__main__':
    solution()

Submission status: Accepted

Solution code:
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
str = list(raw_input())
f = int(str[0]+str[1])
l = int(str[2]+str[3])
# 文字列の入力
if(f > 0 and 13 > f):
    if(l == 0):
        ans = "MMYY"
    if(l > 0 and 13 > l):
        ans = "AMBIGUOUS"
    if(l >= 13):
        ans= "MMYY"
elif(f == 0):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
elif(f>=13):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
print ans

Submission status: Accepted

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

n = int(input())

a = n / 100

b = n % 100

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:
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


if flag1 == True and flag2 == False:
    print("YYMM")
elif flag1 == False and flag2 == True:
    print("MMYY")
elif flag1 == True and flag2 == True:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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


def main():
	s = input()
	a = int(s[0:2])
	b = int(s[2:4])
	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")

if __name__ == '__main__':
	import sys
	sys.exit(main())

Submission status: Accepted

Solution code:
S = input()

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

result = ''
if 0 < a and a <= 12:
    result += 'MM'
else:
    result += 'YY'
if 0 < b and b <= 12:
    result += 'MM'
else:
    result += 'YY'

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

Submission status: Accepted

Solution code:
S = list(input())
s1 = [S[0],S[1]]
s2 = [S[2],S[3]]
s1 = int("".join(s1))
s2 = int("".join(s2))

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

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

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

else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n =  str(input())

a = n[0:2]
b = n[2:]

c = int(a)
d = int(b)
yymm = False
mmyy = False
ambiguous = False
na = False

if (c < 1) or (12 < c):
    if (d < 1) or (12 < d):
        na = True

if (1 <= c) and (c <= 12):
    if (d < 1) or (12 < d):
        mmyy = True

if (1 <= d) and (d <= 12):
    if (c < 1) or (12 < c):
        yymm = True

if na == False and mmyy == False and yymm == False:
    ambiguous = True

if na == True:
    print("NA")
if mmyy == True:
    print("MMYY")
if yymm == True:
    print("YYMM")
if ambiguous == True:
    print("AMBIGUOUS")

Submission status: Accepted

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


def main():
	YYMM = False
	MMYY = False
	s = input()
	a = int(s[0:2])
	b = int(s[2:4])
	if 1 <= b and b <= 12:
		YYMM = True
	if 1 <= a and a <= 12:
		MMYY = True
	
	if YYMM and MMYY:
		print('AMBIGUOUS')
	elif YYMM:
		print('YYMM')
	elif MMYY:
		print('MMYY')
	else:
		print('NA')

if __name__ == '__main__':
	import sys
	sys.exit(main())

Submission status: Accepted

Solution code:
YYMM=0
MMYY=0

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

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

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

Submission status: Accepted

Solution code:
S = input()

F_NA = 0
F_Y = 1
F_M = 2
F_YM = 3

s = [0, 0]
s[0] = int(S[:2])
s[1] = int(S[2:])

flg = [0, 0]
for i in range(2):
    if s[i] >= 1 and s[i] <=12:
        flg[i] = F_YM
    elif s[i] == 0 or s[i] > 12:
        flg[i] = F_Y
    else:
        print("NA")
        exit()

if flg[0] == F_YM:
    if flg[1] == F_YM:
        print("AMBIGUOUS")
    else: #flg[1] == F_Y
        print("MMYY")
else: #flg[0] == F_Y
    if flg[1] == F_YM:
        print("YYMM")
    else: #flg[1] == F_Y
        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=list(input())
ss=s[:2]
sss=s[2:]
x=int("".join(ss))
y=int("".join(sss))

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

Submission status: Accepted

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

L, R = int(S[0]), int(S[1])


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

Submission status: Accepted

Solution code:
S = input()

E1 = int(S[:2])
E2 = int(S[2:])

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

Submission status: Accepted

Solution code:
S=int(input())
if (S%100>12 and 0<S//100<=12) or (0<S//100<=12 and S%100==0):
    print('MMYY')
elif (S//100>12 and 0<S%100<=12) or (S//100==0 and 0<S%100<=12):
    print('YYMM')
elif 0<S%100<=12 and 0<S//100<=12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
# 1-2 3-4 separate
S12 = int(S[:2])
S34 = int(S[2:])
# 判定
# 1 - YYMM
# 2 - MMYY
# 3 - AMBIGOUS
# 4 - NA
flags = [0,0,0,0]

if S12 == 0 or S12 > 12 :
    if S34 == 0 or S34 > 12 :
        #NA
        print('NA')
    else :
        #YYMM
        print('YYMM')
else :
    if S34 == 0 or S34 > 12 :
        #MMYY
        print('MMYY')
    else :
        #AMBI
        print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
judge = [0,0,0]
# in case of YYMM
if 1<=b<=12:
    judge[0] = 1
# in case of MMYY
if 1<=a<=12:
    judge[1] = 1

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

Submission status: Accepted

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

def main():
    S = input()

    aa = int(S[:2])
    bb = int(S[2:])

    # print(aa,bb)
    if (aa > 12 and bb > 12) or (aa == 0 and bb == 0):
        print("NA")
    elif aa >= 1 and aa <= 12 and bb >= 1 and bb <= 12:
        print("AMBIGUOUS")
    elif aa >= 1 and aa <= 12:
        print("MMYY")
    elif bb >= 1 and bb <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# N = int(input())
# N, K = map(int, input().split())
# A = list(map(int, input().split()))

def f(S):
    F = int(S[:2])
    B = int(S[2:])

    if 1 <= F <= 12:
        if 1 <= B <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 1 <= B <= 12:
            print("YYMM")
        else:
            print("NA")

f(input())

Submission status: Accepted

Solution code:
S = str(input())

front = int(S[:2])
back = int(S[2:4])

if (front == 0 or front > 12) and back > 0 and back <= 12:
    print('YYMM')
elif front <= 12 and front > 0 and (back == 0 or back > 12):
    print('MMYY')
elif (front <= 12 and front > 0) and (back > 0 and back <= 12):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
X = int(S[0:2])
Y = int(S[2:4])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = input()
X_1=int(X[:2])
X_2=int(X[2:])
flag_1=(0 <= X_1 <=99 and 1 <= X_2 <= 12)
flag_2=(0 <= X_2 <=99 and 1 <= X_1 <= 12)
if flag_1 and flag_2:
    print("AMBIGUOUS")
elif flag_1:
    print("YYMM")
elif flag_2:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
if (S[0] == '0'and S[1]!='0') or (S[0] == '1'and (S[1] == '0' or S[1] == '1' or S[1]=='2')):
  if (S[2] == '0'and S[3]!='0') or (S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2')):
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif (S[2] == '0'and S[3]!='0') or (S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2')):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
import numpy as np
import fractions

S = input()
F = int(S[0:2])
E = int(S[2:4])

if(0 < F and F < 13 ):
    if(0 < E and E<13):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:#F>=13
    if(0 < E and E < 13):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
def isY(num):
    return True

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

    return False

def isYYMM(first, second):
    return (isY(first) and isM(second))

def isMMYY(first, second):
    return (isM(first) and isY(second))

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

ans = "NA"

if (not isMMYY(first, second)) and isYYMM(first, second):
    ans = "YYMM"

if isMMYY(first, second) and (not isYYMM(first, second)):
    ans = "MMYY"

if isMMYY(first, second) and isYYMM(first, second):
    ans = "AMBIGUOUS"

        
print(ans)

Submission status: Accepted

Solution code:
s = input()
a, b = int(s[:2]), 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:
import sys
input = sys.stdin.readline
s = input()
s1 = s[:2]
s2 = s[2:]
if 1 <= int(s1) <= 12 and 1 <= int(s2) <= 12:
    print("AMBIGUOUS")
elif (not 1 <= int(s1) <= 12) and 1 <= int(s2) <= 12:
    print("YYMM")
elif 1 <= int(s1) <= 12 and (not 1 <= int(s2) <= 12):
    print("MMYY")
else:
    print('NA')

Submission status: Accepted

Solution code:
S = int(input())
A = S//100
B = S-(A*100)
if B ==0 or B >= 13:
    if 1<= A <=12:    
        print("MMYY")
    else:
        print("NA")
elif 1<= B <=12:
    if 1<= A <=12:
        print("AMBIGUOUS")
    elif A >= 13:
        print("YYMM")
    elif A == 0:      
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
S=str(input())
s=list(S)
# print(S[0:2])
# print(S[3:4])
s1 = int(''.join(S[0:2]))
s2 = int(''.join(S[2:4]))
# print(s1)
# print(s2)

stmp1=""
if s1 <=12 and s1 > 0:
    stmp1='MM'
elif (s1 > 0):
    stmp1='YY'
else:
    stmp1='NA'

stmp2=""
if s2 <=12 and s2 > 0:
    stmp2='MM'
elif (s2 > 0):
    stmp2='YY'
else:
    stmp2='NA'

if((stmp1=='NA' and not (stmp2=='MM')) or (stmp2=='NA' and not (stmp1=='MM')))or(stmp1=='YY' and stmp2=='YY'):
    print('NA')
elif(stmp1=='MM' and stmp2=='MM'):
    print('AMBIGUOUS')
elif(stmp1=='NA'):
    print('YY'+stmp2)
elif(stmp2=='NA'):
    print(stmp1+'YY')
else:
    print(stmp1+stmp2)

Submission status: Accepted

Solution code:
S = input()

mae = int(S[:2])
ato = int(S[2:])

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

Submission status: Accepted

Solution code:
S = input()

yymm = False
mmyy = False

#MMYY
if 0 <= int(S[2:]):
    if 1 <= int(S[:2]) and int(S[:2]) <= 12:
        mmyy = True

#YYMM
if 1 <= int(S[2:]) and int(S[2:]) <= 12:
    if 0 <= int(S[:2]):
        yymm = True

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

Submission status: Accepted

Solution code:
S = str(input())
S_list = list(S)


S12 = int(S_list[0]+S_list[1])
S34 = int(S_list[2]+S_list[3])

flagYYMM = 0
flagMMYY = 0

if 1 <= S34 <= 12:
    flagYYMM = 1

if 1 <= S12 <= 12:
    flagMMYY = 1

if S12 > 13 and S34 == 00:
    flagMMYY = 0

if S34 > 13 and S12 == 00:
    flagYYMM = 0

if flagYYMM == 1 and flagMMYY == 1:
    print("AMBIGUOUS")

elif flagYYMM == 1:
    print("YYMM")

elif flagMMYY == 1:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

S = int(input())
#print(S)

YYMM_flag = 0
MMYY_flag = 0

former = math.floor(S / 1000) * 10
S = S % 1000
former += math.floor(S / 100)
#print(former)
S = S % 100
latter = S
#print(latter)

if(1 <= former and former <= 12):
    MMYY_flag = 1

if(1 <= latter and latter <= 12):
    YYMM_flag = 1

if(YYMM_flag == 1):
    if(MMYY_flag == 1):
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if(MMYY_flag == 1):
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
String=input()
String=list(String)
String=[(String[i:i+2]) for i in range(0, len(String),2)]
String[0]="".join(String[0])
String[1]="".join(String[1])
String[0]=int(String[0])
String[1]=int(String[1])
if(String[0]>0 and String[0]<=12and String[1]>0 and String[1]<=12):
    print("AMBIGUOUS")
elif(String[0]==String[1]==0 or String[0]>12 and String[0]!=0 and String[1]>12 and String[1]!=0):
    print("NA")
elif(String[1]>0 and String[1]<13):
    print("YYMM")
elif(String[0]>0 and String[0]<13):
    print("MMYY")
elif(String[0]==0 and String[1]>12):
    print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

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

def check(s1, s2):
    if 1 <= s1 <= 12 and 1 <= s2 <= 12:
        return 'AMBIGUOUS'
    if 1 <= s1 <= 12:
        return 'MMYY'
    if 1 <= s2 <= 12:
        return 'YYMM'
    return 'NA'

print(check(s1, s2))

Submission status: Accepted

Solution code:
def sol(inp=input):
    s=inp()
    u=int(s[:2])
    l=int(s[2:])
    u_is_m=1<=u and u<=12
    l_is_m=1<=l and l<=12
    if u_is_m and l_is_m:
        return 'AMBIGUOUS'
    if u_is_m and not l_is_m:
        return 'MMYY'
    if not u_is_m and l_is_m:
        return 'YYMM'
    return 'NA'
print(sol())

Submission status: Accepted

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

if 1 <= F <= 12:
    if 1 <= B <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if 1 <= B <= 12:
        ans = "YYMM"
    else:
        ans = "NA"
        
print(ans)

Submission status: Accepted

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

if '01' <= S1 and S1 <= '12':
    
    # YYMM フォーマット と MMYY フォーマットのどちらの可能性もある場合
    if '01' <= S2 and S2 <= '12':
        print('AMBIGUOUS')
        
    # MMYY フォーマットのみである場合
    else:
        print('MMYY')
        
# YYMM フォーマットのみである場合        
elif '01' <= S2 and S2 <= '12':
    print('YYMM')

# どちらの可能性もない場合   
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().strip()

bs = int(s[:2])
cs = int(s[2:])


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

Submission status: Accepted

Solution code:
S = input()
fast = int(S[0:2])
end = int(S[2:4])

if 0 < fast < 13 and 0 < end < 13:
  print('AMBIGUOUS')
elif 0 <= fast and 0 < end < 13:
  print('YYMM')
elif 0 < fast < 13 and 0 <= end:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])
LIST = [False,False]

if 1 <= b <= 12 and a >= 0:#YYMM
    LIST[0] = True 
if 1 <= a <= 12 and b >= 0:#MMYY
    LIST[1] = True 

if LIST[0] and LIST[1]:
    print("AMBIGUOUS")
elif LIST[0] and not LIST[1]:
    print("YYMM")
elif not LIST[0] and LIST[1]:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
zen, kou = int(S[:2]), int(S[2:])
if 13 <= zen <= 99 and 1 <= kou <= 12:
    print('YYMM')
elif zen == 0 and 1 <= kou <= 12:
    print('YYMM')
elif 1 <= zen <= 12 and 13 <= kou <= 99:
    print('MMYY')
elif 1 <= zen <= 12 and kou == 0:
    print('MMYY')
elif 1 <= zen <= 12 and 1 <= kou <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

bef = int(S[:2])
aft = int(S[2:])

ansb = ''
ansa = ''

if bef == 0:
    if aft > 31:
        ans = 'NA'
    elif 12 < aft <= 31:
        ans = 'NA'
    elif 0 < aft <= 12:
        ans = 'YYMM'
    elif aft == 0:
        ans = 'NA'
elif bef > 31:
    if aft > 31:
        ans = 'NA'
    elif 12 < aft <= 31:
        ans = 'YYMM'
    elif 0 < aft <= 12:
        ans = 'YYMM'
    elif aft == 0:
        ans = 'NA'
elif 12 < bef <= 31:
    if aft > 31:
        ans = 'MMYY'
    elif 12 < aft <= 31:
        ans = 'AMBIGUOUS'
    elif 0 < aft <= 12:
        ans = 'YYMM'
    elif aft == 0:
        ans = 'NA'
elif bef <= 12:
    if aft > 31:
        ans = 'MMYY'
    elif 12 < aft <= 31:
        ans = 'AMBIGUOUS'
    elif 0 < aft <= 12:
        ans = 'AMBIGUOUS'
    elif aft == 0:
        ans = 'MMYY'
print(ans)

Submission status: Accepted

Solution code:
S = input()

flagYYMM = False
flagMMYY = False

T = S[2:]
T = int(T)
if 1 <= T <= 12:
    flagYYMM = True

T = S[:2]
T = int(T)
if 1 <= T <= 12:
    flagMMYY = True

if flagYYMM * flagMMYY == 1:
    ans = 'AMBIGUOUS'
elif flagYYMM == True:
    ans = 'YYMM'
elif flagMMYY == True:
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
#B問題
S=list(str(input()))
mae=S[0]+S[1]
ato=S[2]+S[3]
intmae=int(mae)
intato=int(ato)
if intmae >= 13 and intato >= 13:
    print("NA")
elif intmae <= 12 and intato <= 12:
    if intmae > 0 and intato > 0:
        print("AMBIGUOUS")
    elif intmae == 0 and intato == 0:
        print("NA")
    elif intmae == 0:
        print("YYMM")
    elif intato == 0:
        print("MMYY")
else:
    if intmae <= 12:
        if intmae != 0:
            print("MMYY")
        else:
            print("NA")
    else:
        if intato != 0:
            print("YYMM")
        else:
            print("NA")

Submission status: Accepted

Solution code:
s =list(input())
 
a=[0]*2
b=[0]*2
 
for i in range(2):
  s[i]=str(s[i])
  s[i+2]=str(s[i+2])
  a[i]=s[i]
  b[i]=s[i+2]
 
c = int(''.join(a))
d = int(''.join(b))
cnc=0
cnd=0
 
if c>0:
  if c<13:
    cnc=2
  else:
    cnc=1
 
if d>0:
  if d<13:
    cnd=2
  else:
    cnd=1
 
if cnc==0:
  if cnd==2:
    print("YYMM")
  else:
    print("NA")
    exit()
if cnc==1:
  if cnd==1:
    print("NA")
  elif cnd==2:
    print("YYMM")
  else:
    print("NA")
elif cnc==2:
  if cnd==1:
    print("MMYY")
  elif cnd==2:
    print("AMBIGUOUS")
  else:
    print("MMYY")

Submission status: Accepted

Solution code:
s = input()
ue = int(s[:2])
sita = int(s[2:4])
if ue < 1 or ue > 12:
    if 1 <= sita <= 12:
        print('YYMM')
    if sita < 1 or sita > 12:
        print('NA')
elif sita < 1 or sita > 12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()

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


def is_yymm(i1, i2):
    return (0 <= i1 < 100) and (0 < i2 < 13)


if is_yymm(s1, s2):
    if is_yymm(s2, s1):
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if is_yymm(s2, s1):
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
X = int(S[0:2])
Y = int(S[2:4])

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

Submission status: Accepted

Solution code:
"""def problem1():
    N,K = map(int,input().split())
    S = list(input())
    S[K-1] = S[K-1].swapcase()
    print("".join(S))

def problem3():
    N,K = map(int,input().split())
    prob = 0
    for i in range(1,N+1):
        point = i
        count = 0
        while(point < K):
            point *= 2
            count += 1
        prob += 1/N * (1/2)**count
    print(prob)
"""
S = input()
a = int(S[0:2])
b = int(S[2:4])
LIST = [False,False]

if 1 <= b <= 12 and a >= 0:#YYMM
    LIST[0] = True 
if 1 <= a <= 12 and b >= 0:#MMYY
    LIST[1] = True 

if LIST[0] and LIST[1]:
    print("AMBIGUOUS")
elif LIST[0] and not LIST[1]:
    print("YYMM")
elif not LIST[0] and LIST[1]:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
s_dic = {'1':'YYMM', '2':'MMYY', '3':'AMBIGUOUS', '4':'NA'}
if (S1 == 0 and S2 > 12) or (S1 > 12 and S2 == 0) or (S1 > 12 and S2 > 12) or (S1 == 0 and S2 == 0):
    print(s_dic['4'])
elif (S1 > 12 or S1 == 0) and S2 <= 12:
    print(s_dic['1'])
elif (S2 > 12 or S2 == 0) and S1 <= 12:
    print(s_dic['2'])
elif S1 <= 12 and S2 <= 12:
    print(s_dic['3'])

Submission status: Accepted

Solution code:
s=input()
s1=s[0:2]
s2=s[2:4]
a=["01","02","03","04","05","06","07","08","09","10","11","12"]

if (s1 in a) and (s2 in a):
    print("AMBIGUOUS")
elif s1 in a:
    print("MMYY")
elif s2 in a:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8
s = input()
s_list=list(s)
s_len=len(s_list)
s_first=int(s_list[0]+s_list[1])
s_second=int(s_list[2]+s_list[3])
if s_first<13 and s_first>0: #MMYY case
    if s_second<13 and s_second>0:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else: #YYMM case
    if s_second<13 and s_second>0:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input();
first = s[0:2]
second = s[2:4]

first = int(first)
second = int(second)

if 0 < first and first < 13:
    if 0 < second and second < 13:
        print("AMBIGUOUS")
    elif (13 <= second):
        print("MMYY")
    else:
        print("MMYY")

elif 13 <= first:
    if 0 < second and second < 13:
        print("YYMM")
    elif (13 <= second):
        print("NA")
    else:
        print("NA")

else:
    if 0 < second and second < 13:
        print("YYMM")
    elif 13 <= second:
        print("NA")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

pre = int(s[:2])
post = int(s[2:])

na = False

if 0<pre and pre < 13:
    pre_able_month = True
elif pre == 0:
    na = True
    pre_able_month = False
else:
    pre_able_month = False

if 0<post and post<13:
    post_able_month = True
elif post == 0:
    na = True
    post_able_month = False
else:
    post_able_month = False

if na:
    if pre_able_month:
        print("MMYY")
    elif post_able_month:
        print("YYMM")
    else:
        print("NA")
else:
    if pre_able_month and post_able_month:
        print("AMBIGUOUS")
    elif pre_able_month and not(post_able_month):
        print("MMYY")
    elif not(pre_able_month) and post_able_month:
        print("YYMM")
    else:
        print("NA")