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:
# -*- coding: utf-8 -*-
n = str(input())
b = n[:2]
a = n[2:]
be = int(b)
af = int(a)
if 13<=be<=99 and 1<=af<=12:
    print("YYMM")
elif 1<=be<=12 and 13<=af<=99:
    print("MMYY")
elif 1<=be<=12 and 1<=af<=12:
    print("AMBIGUOUS")
elif be==0 and 1<=af<=12:
    print("YYMM")
elif 1<=be<=12 and af==0:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

def check_mm(n):
    if  0 < n and n < 13:
        return True
    else:
        return False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# スペース区切りの整数の入力
S = str(input())

front = S[0]+S[1]
rear = S[2]+S[3]

front=int(front)
rear=int(rear)

if (front==0 and rear==0) or (front>12 and rear>12) or (front==0 and rear>12) or (rear==0 and front>12):
  print("NA")
elif front<=12 and front!=0 and rear<=12 and rear!=0 :
  print("AMBIGUOUS")
elif rear<=12 and rear!=0:
  print("YYMM")
else:
  print("MMYY")

  #YYMM MMは12以下 
  #MMYY MMは12以下
  #AMBIGUOUS 両方とも00を含まない、12以下
  #NA 00を含む、両方とも13以上

Submission status: Accepted

Solution code:
N = input()
pre = N[0:2]
pos = N[2:4]
if int(pre)!=0 and int(pre) <=12:
    if int(pos)!=0 and int(pos) <=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif int(pos)!=0 and int(pos) <=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()

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

if F>12 or F==0:
    if A>12 or A==0:
        print('NA')
    else:
        print('YYMM')
elif A>12 or A==0:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = str(input())        
#S = "1700"
s0 = int(S[0:2])
s1 = int(S[2:4])
def MM(x):
    if 1<= x <= 12:
        return True
    else:
        return False
if MM(s0) == True:
    if MM(s1) == True:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if MM(s1) == True:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
f1, f2 = False, False
if int(s[2:]) < 13 and int(s[2:]) > 0:
  f1 = True
if int(s[:2]) < 13 and int(s[:2]) > 0:
  f2 = True
if not f1 and not f2:
  print("NA")
elif f1 and f2:
  print("AMBIGUOUS")
elif f1:
  print("YYMM")
else:
  print("MMYY")

Submission status: Accepted

Solution code:
a = input()
m1 = False
m2 = False

ab = int(a[:2])
cd = int(a[2:])
if ab > 0 and ab <= 12:
  m1 = True

if cd > 0 and cd <= 12:
  m2 = True

if m1 and m2:
  print("AMBIGUOUS")
elif m1 and not m2:
  print("MMYY")
elif not m1 and m2:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
S = str(input())

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

if a == 0:
	if b == 0 or b > 12:
		ans = 'NA'
	elif 1 <= b <= 12:
		ans = 'YYMM'
elif 1 <= a <= 12:
	if b == 0 or b > 12:
		ans = 'MMYY'
	elif 1 <= b <= 12:
		ans = 'AMBIGUOUS'
elif a > 12:
	if b == 0 or b > 12:
		ans = 'NA'
	if 1 <= b <= 12:
		ans = 'YYMM'

print(ans)

Submission status: Accepted

Solution code:
import bisect
import math
def solve():
  s = int(input())
  if s == 0:
    print("NA")
    exit()
  
  if s//100 != 0 and s//100 <= 12:
    tp = s%100
    if 1<= tp and tp <= 12:
      print("AMBIGUOUS")
    elif tp == 0:
      print("MMYY")
    elif 13 <= tp and tp <= 99:
      print("MMYY")
    else:
      print("NA")
  else:
    tp = s%100
    if 1<= tp and tp <= 12:
      print("YYMM")
    else:
      print("NA")
solve()

Submission status: Accepted

Solution code:
target = input()
first, second = int(target[0:2]), int(target[2:4])
if first == 0:
  first = 100
if second == 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

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

Submission status: Accepted

Solution code:
S = input()

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

#print(front,rear)

if 1 <= front <= 12 and 1 <= rear <= 12:
	print("AMBIGUOUS")
elif 1 <= front <= 12 and not(1 <= rear <= 12):
	print("MMYY")
elif not(1 <= front <= 12) and 1 <= rear <= 12:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()
import datetime

strptime = datetime.datetime.strptime

try:
  strptime(S, '%y%m')
  can_be_yymm = True
except ValueError as e1:
  can_be_yymm = False

try:
  strptime(S, '%m%y')
  can_be_mmyy = True
except ValueError as e2:
  can_be_mmyy = False

if can_be_yymm and can_be_mmyy:
  print('AMBIGUOUS')
elif can_be_yymm and not can_be_mmyy:
  print('YYMM')
elif not can_be_yymm and can_be_mmyy:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = input()

front = int(s[:2])
back =  int(s[2:])


# YYMM 0 <= front <= 99 ,1 <= MM <= 12

def formatCheck(data):
	if  1 <= data and data <= 12 :
		return True
	else:
		return False

result_front = formatCheck(front)
result_back = formatCheck(back)

if result_front:
	if result_back:
		result = "AMBIGUOUS"
	else:
		result = "MMYY"
else:
	if result_back:
		result = "YYMM"
	else:
		result = "NA"

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

if 0 < front < 13 :
    F_month = True
else:
    F_month = False
    
if 0 < rear < 13 :
    R_month = True
else:
    R_month = False

if F_month == True and R_month == False:
    print('MMYY')

if F_month == True and R_month == True:
    print('AMBIGUOUS')

if F_month == False and R_month == False:
    print('NA')

if F_month == False and R_month == True:
    print('YYMM')

Submission status: Accepted

Solution code:
S = input()

T = S[:2]
U = S[2:]

if (int(T) > 12 or int(T) == 0) and 12 >= int(U) >= 1:
  print('YYMM')
elif (int(U) > 12 or int(U) == 0) and 12 >= int(T) >= 1:
  print('MMYY')
elif (12 >= int(T) >= 1) and (12 >= int(U) >= 1):
  print('AMBIGUOUS')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
num_be = int(S[:2])
num_af = int(S[2:])

if ( ((num_be > 12) & (num_af > 12)) or ( (num_be == 0) & (num_af == 0) ) or ( (num_be == 0) & (num_af > 12) ) or ( (num_be > 12) & (num_af == 0)) ) :
  print('NA')
elif ( ((num_be > 0) & (num_be < 13)) & ((num_af > 0) & (num_af < 13)) ):
  print('AMBIGUOUS')
elif((num_be > 12) or (num_be == 0) ):
  print('YYMM')
else:
  print('MMYY')

Submission status: Accepted

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

f_bool = (front <13)&(front>0)
b_bool = (back <13)&(back>0)
if f_bool ^ b_bool:
    if f_bool:
        print("MMYY")
    
    else:
        print("YYMM")
elif f_bool:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=str(input())

if 1<=int(s[:2])<=12 and 1<=int(s[2:])<=12:
    print('AMBIGUOUS')
elif 1<=int(s[:2])<=12 and (int(s[2:])>12 or int(s[2:])==0):
    print('MMYY')
elif (int(s[:2])>12 or int(s[:2])==0) and 1<=int(s[2:])<=12:
    print('YYMM')
elif (int(s[:2])>12 or int(s[:2])==0) and (int(s[2:])>12 or int(s[2:])==0):
    print('NA')

Submission status: Accepted

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

left = moji[0]+moji[1]
right = moji[2]+moji[3]
left = int(left)
right = int(right)

if 0 < left < 13:
    if 0 < right < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < right < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 文字列の入力
S = input()
# 出力
if S.isdecimal() == False:
    print("NA")
elif 1<=int(S[0:2]) and 12>=int(S[0:2]):
    if 1<=int(S[2:4]) and 12>=int(S[2:4]):
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1<=int(S[2:4]) and 12>=int(S[2:4]):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def judge_format(text):
    former, latter = int(text[:2]), int(text[2:])
    if 1 <= former <= 12 and (latter == 0 or latter > 12):
        return 'MMYY'
    elif 1 <= latter <= 12 and (former == 0 or former > 12):
        return 'YYMM'
    elif 1 <= former <= 12 and 1 <= latter <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'
    

def main():
    s = input()
    print(judge_format(s))


main()

Submission status: Accepted

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

former = int(''.join(s[0:2]))
latter = int(''.join(s[2:]))

former_mm_flag = False
if former <= 12 and former > 0:
    former_mm_flag = True

latter_mm_flag = False
if latter <= 12 and latter > 0:
    latter_mm_flag = True

if former_mm_flag:
    if latter_mm_flag:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if latter_mm_flag:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
import sys
import numpy as np

def main():
	dp =input()
	mae = int(dp[0])*10 + int(dp[1])
	ushiro = int(dp[2])*10 + int(dp[3])
	if 1 <= mae <= 12 and  1<=ushiro <= 12:
		print("AMBIGUOUS")
	elif 1 <= mae <= 12 and  (ushiro > 12 or ushiro==0):
		print("MMYY")
	elif (mae > 12 or mae ==0) and  1 <= ushiro <= 12:
		print("YYMM")
	else:
		print("NA")   
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Y=input()#1行に沢山の数値(または文字)が並んでいる場合にリストに格納していく
X=[]
X=list(Y) #文字列（単語）または数列を1文字ずつに分解

A=[]
A.append(X[0])
A.append(X[1])
a=''.join(A)
a=int(a)

B=[]
B.append(X[2])
B.append(X[3])
b=''.join(B)
b=int(b)


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

elif b==0 and 1<=a<=12:
    print('MMYY')
elif b==0 and 13<=a<=99:
    print('NA')
elif b==0 and a==0:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())

s1 = s // 100
s2 = s - (s1*100)

if s1 > 12 or s1 == 0:
    temp1 = 0
else:
    temp1 = 1

if s2 > 12 or s2 == 0:
    temp2 = 0
else:
    temp2 = 1


if temp1 == 0 and temp2 == 1:
    print("YYMM")
if temp1 == 0 and temp2 == 0:
    print("NA")
if temp1 == 1 and temp2 == 0:
    print("MMYY")
if temp1 == 1 and temp2 == 1:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

s = input()
s1 = s[0:2]
s2 = s[2:4]
#どちらかが00になっているとき
if (s1[0]=="0" and s1[1]=="0") or(s2[0]=="0" and s2[1]=="0"):
    if  0<int(s1[0])*10+int(s1[1]) <12:
        print("MMYY")
    elif 0 < int(s2[0])*10+int(s2[1]) <12:
        print("YYMM")
    else:
        print("NA")
else:
    #最初が0Xのとき
    if s1[0]=="0":
        if s2[0]=="0":
            print("AMBIGUOUS")
        else:
            if eval(s2)>12:
                print("MMYY")
            else:
                print("AMBIGUOUS")
    else:
        #最初がYXのかたちY>=1のとき
        if eval(s1)>12:
            if s2[0]=="0" or eval(s2) <= 12:
                print("YYMM")
            else:
                print("NA")
        else:
            if s2[0]=="0":
                print("AMBIGUOUS")
            else:
                if eval(s2)>12:
                    print("MMYY")
                else:
                    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s  = input()
sts=0
ff= int(s[:2])
ll = int(s[2:])
if ff==0  and (ll == 0 or 12<ll):
	sts=4
if ff==0  and 0<ll<13:
	sts=1
if 0<ff<13 and (ll == 0 or 12<ll):
	sts=2
if 0<ff<13 and 0<ll<13:
	sts=3
if 12<ff and (ll == 0 or 12<ll):
	sts=4
if 12<ff and 0<ll<13:
	sts=1
	
if sts == 1:
	print("YYMM")
if sts == 2:
	print("MMYY")
if sts == 3:
	print("AMBIGUOUS")
if sts == 4:
	print("NA")

Submission status: Accepted

Solution code:
S=input()
x=int(S[0:2])
y=int(S[2:4])
if (0<x<13) & (0<y<13): print('AMBIGUOUS')
elif (0<x<=12) & ((y>=13) | (y==0)): print('MMYY')
elif (0<y<=12) & ((x>=13) | (x==0)): print('YYMM')
else: print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

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

# Your code here!
 
X = [x for x in input()]
A = int(''.join(X[:2]))
B = int(''.join(X[2:]))

def is_month(n):
    if 0 < n and n <= 12:
        return True
    return False
    
def is_year(n):
    return True
 
if is_month(A) and is_month(B):
    print('AMBIGUOUS')
elif is_month(A) and is_year(B):
    print('MMYY')
elif is_year(A) and is_month(B):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:

S = list(input())

front = int(S[0]+S[1])
rear = int(S[2]+S[3])


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

Submission status: Accepted

Solution code:
S = str(input())

MMYY = "NO"
YYMM = "NO"

first2 = int(S[0:2])
last2 =  int(S[2:4])

if 13 > first2 > 0 and 99 >= last2 >= 0:
    MMYY = "YES"
if 99 >= first2 >= 0 and 13 > last2 > 0:
    YYMM = "YES"

if YYMM == "NO" and MMYY == "NO":
    print("NA")
elif YYMM == "YES" and MMYY == "NO": 
    print("YYMM")
elif YYMM == "NO" and MMYY == "YES":
    print("MMYY")
elif YYMM == "YES" and MMYY == "YES":
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s=input()

if s[0:2]=="01" or s[0:2]=="02" or s[0:2]=="03" or s[0:2]=="04" or s[0:2]=="05" or s[0:2]=="06" or s[0:2]=="07" or s[0:2]=="08" or s[0:2]=="09" or s[0:2]=="10" or s[0:2]=="11" or s[0:2]=="12":
    if s[2:4]=="01" or s[2:4]=="02" or s[2:4]=="03" or s[2:4]=="04" or s[2:4]=="05" or s[2:4]=="06" or s[2:4]=="07" or s[2:4]=="08" or s[2:4]=="09" or s[2:4]=="10" or s[2:4]=="11" or s[2:4]=="12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s[2:4]=="01" or s[2:4]=="02" or s[2:4]=="03" or s[2:4]=="04" or s[2:4]=="05" or s[2:4]=="06" or s[2:4]=="07" or s[2:4]=="08" or s[2:4]=="09" or s[2:4]=="10" or s[2:4]=="11" or s[2:4]=="12":
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

mae = s[:2]
usiro = s[2:]

flag = 'NA'

if 1 <= int(mae) <= 12 and int(usiro) > 12 :
    flag = 'MMYY'
if 1 <= int(mae) <= 12 and int(usiro) == 0 :
    flag = 'MMYY'
if 1 <= int(usiro) <= 12 and int(mae) > 12:
    flag = 'YYMM'
if 1 <= int(usiro) <= 12 and int(mae) == 0:
    flag = 'YYMM'
if 1 <= int(mae) <= 12 and 1 <= int(usiro) <= 12:
    flag = 'AMBIGUOUS'

print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

f_ = S[0:2]
s_ = S[2:4]

if 0 < int(f_) < 13 and 0 < int(s_) < 13:
    print('AMBIGUOUS')
elif 0 < int(f_) < 13:
    print('MMYY')
elif 0 < int(s_) < 13:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

a, b = S[:2], S[2:]

a_can_month = (1 <= int(a) <= 12)
b_can_month = (1 <= int(b) <= 12)

print([["NA", "YYMM"], ["MMYY", "AMBIGUOUS"]][a_can_month][b_can_month])

Submission status: Accepted

Solution code:
S = int(input())

ue2keta = S // 100
shita2keta = S % 100

if (0 < ue2keta < 13) & ((shita2keta == 0) | (shita2keta > 12)):
    print("MMYY")
elif (0 < shita2keta < 13) & ((ue2keta == 0) | (ue2keta > 12)):
    print("YYMM")
elif (0 < ue2keta < 13) & (0 < shita2keta < 13):
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
top = S // 100 #上2桁
bottom = S % 100 #下2桁

#flag 1→MMになれる 2:YYになれる(MMになれない)
topFlag = 2
bottomFlag = 2
if 1 <= top and top <= 12:
    topFlag = 1

if 1 <= bottom and bottom <= 12:
    bottomFlag = 1

#形式の判別
if topFlag == 1 and bottomFlag == 1:
    print("AMBIGUOUS")
elif topFlag == 1 and bottomFlag == 2:
    print("MMYY")
elif topFlag == 2 and bottomFlag == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
fore = S[0:2]
back = S[2:4]
yymm_flag = False
mmyy_flag = False
if int(fore) > 12:
  yymm_flag = True
  mmyy_flag = False
  if int(back) > 12:
    yymm_flag = False
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = False
    mmyy_flag = False
elif int(fore) <= 12 and int(fore) != 0:
  yymm_flag = False
  mmyy_flag = True
  if int(back) > 12:
    mmyy_flag = True
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = False
    mmyy_flag = True
elif int(fore) == 0:
  if int(back) > 12:
    yymm_flag = False
    mmyy_flag = False
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = 0
    mmyy_flag = 0
if yymm_flag == True and mmyy_flag == False:
  print("YYMM")
elif yymm_flag == False and mmyy_flag == True:
  print("MMYY")
elif yymm_flag == True and mmyy_flag == True:
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:
num = input()

num1 = int(num[0:2])
num2 = int(num[2:])

YYMM_flg = False
MMYY_flg = False

if num1 >= 1 and num1 <= 12:
    MMYY_flg = True

if num2 >= 1 and num2 <= 12:
    YYMM_flg = True

if YYMM_flg and MMYY_flg:
    print('AMBIGUOUS')
elif YYMM_flg:
    print('YYMM')
elif MMYY_flg:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

s = input()

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inp = input()
F = int(inp[:2])
B = int(inp[2:])
flagMMYY = False
flagYYMM = False
if F>=1 and F<=12:
  flagMMYY = True
if B>=1 and B<=12:
  flagYYMM = True
if flagMMYY and flagYYMM:
  print ('AMBIGUOUS')
elif flagMMYY:
  print ('MMYY')
elif flagYYMM:
  print ('YYMM')
else:
  print ('NA')

Submission status: Accepted

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

Submission status: Accepted

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

def m(x):
    f = int(x[0])
    s = int(x[1])
    if f == 0:
        if 1 <= s <= 9:
            return True
        else:
            return False
    elif f == 1:
        if 0 <= s <= 2:
            return True
        else:
            return False
    else:
        return False

if m(F) and m(S):
    print("AMBIGUOUS")
elif m(F) and not m(S):
    print("MMYY")
elif not m(F) and m(S):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

left = int(S[:2])
right = int(S[2:])

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

Submission status: Accepted

Solution code:
s=int(input())

a=s//100
b=s%100

notYYMM = b < 1 or 12 < b

notMMYY = a < 1 or 12 < a

if notYYMM and notMMYY:
    print("NA")
elif not notYYMM and not notMMYY:
    print("AMBIGUOUS ")
elif not notYYMM and notMMYY:
    print("YYMM")
elif notYYMM and not notMMYY:
    print("MMYY")

Submission status: Accepted

Solution code:
from sys import stdin
S=(stdin.readline().rstrip())
if int(S[0:2]) == 0 and int(S[2:]) ==0:
    print("NA")
elif int(S[0:2]) > 12 and int(S[2:]) > 12:
    print("NA")
elif int(S[0:2]) > 12 and int(S[2:]) ==0:
    print("NA")
elif int(S[0:2]) == 0 and int(S[2:]) > 12:
    print("NA")
    
else :
    mae=0
    usiro=0
    if int(S[0:2]) > 12 or int(S[0:2]) == 0:
        mae = 1
    if int(S[2:]) > 12 or int(S[2:]) == 0:
        usiro = 1
    
    if mae == 0 and usiro == 0:
        print("AMBIGUOUS")
    elif mae == 0 and usiro ==1:
        print("MMYY")
    elif mae == 1 and usiro ==0:
        print("YYMM")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
s0 = int(S[0])
s1 = int(S[1])
s2 = int(S[2])
s3 = int(S[3])
num1 = s0*10 + s1
num2 = s2*10 + s3
if (num1 == 0 or 13 <= num1) and 1 <= num2 and num2 <=12:
    print("YYMM")
elif 1 <= num1 and num1 <= 12 and (num2 == 0 or 13 <= num2):
    print("MMYY")
elif 1 <= num1 and num1 <= 12 and 1 <= num2 and num2 <= 12:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
def check_MM(S_C):
    MM_Check=['01','02','03','04','05','06','07','08','09','10','11','12']    
    if S_C in MM_Check:
        return 1
    else:
        return 0
    
S=input()

S1=S[:2]
S2=S[2:]

S1_Check=check_MM(S1)
S2_Check=check_MM(S2)

if S1_Check== 1:
    if S2_Check== 1:
        out='AMBIGUOUS'
    else:
        out='MMYY'
elif S1_Check== 0:
    if S2_Check== 1:
        out='YYMM'
    else:
        out='NA'
print(out)

Submission status: Accepted

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

if(M==0):
  if(Y==0):
    print('NA')
  else:
    print('YYMM')
elif(M>12):
  if(Y==0):
    print('NA')
  elif(Y>12):
    print('NA')
  else:
    print('YYMM')
else:
  if(Y==0):
    print('MMYY')
  elif(Y<13):
    print('AMBIGUOUS')
  else:
    print('MMYY')

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = input()
mae = int(a[:2])
usiro = int(a[2:])

if(1 <= mae <= 12):
    if(1 <= usiro <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= usiro <= 12):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()

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

year_list = list(range(100))
month_list = list(range(1,13))

if (f in month_list) & (b in month_list):
    print("AMBIGUOUS")
elif (f in month_list) & (b not in month_list):
    print("MMYY")
elif (f not in month_list) & (b in month_list):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

if 1 <= ue <= 12:
    if 1 <= shita <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= shita <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
A = list(int(i) for i in str(input()))
A, B = A[0]*10+A[1], A[2]*10+A[3]
if A == 0:
    if B == 0 or B>12:
        print("NA")
    else:
        print("YYMM")
elif 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()
aa=int(s[:2])
bb=int(s[2:])
if 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif 0<bb<=12: ans='YYMM'
elif 0<aa<=12: ans='MMYY'
else: ans='NA'
print(ans)

Submission status: Accepted

Solution code:
s=input()

l=int(s[:2])
r=int(s[2:4])

ans=""

if l<=12 and l>=1:
  if r<=12 and r>=1:
    ans="AMBIGUOUS"
  else:
    ans="MMYY"
elif r<=12 and r>=1:
  ans="YYMM"
else:
  ans="NA"

print(ans)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    s = input()

    i1 = int(s[0:2])
    i2 = int(s[2:4])

    ans = ""
    if i1 == 0 or i2 == 0:
        if i1 == 0 and i2 == 0:
            ans = "NA"
        elif i1 == 0 and i2 < 13:
            ans = "YYMM"
        elif i2 == 0 and i1 < 13:
            ans = "MMYY"
        else:
            ans = "NA"
    else:
        if i1 < 13:
            if i2 < 13:
                ans = "AMBIGUOUS"
            else:
                ans = "MMYY"
        else:
            if i2 < 13:
                ans = "YYMM"
            else:
                ans = "NA"
    print(ans)

Submission status: Accepted

Solution code:
S = input()
SL = []
for i in range(1,13):
    SL.append("0"+str(i) if len(str(i)) == 1 else str(i))
 
 
if S[2:] in SL:
    if S[:2] in SL:
        print("AMBIGUOUS")
    else:
        print("YYMM")
    
else:
    if S[:2] in SL or SL[:2] == "00":
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
n = input()

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

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

if 0 < a <= 12 and 0 < b <= 12:
    print("AMBIGUOUS")

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

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

else:
    print("NA")

Submission status: Accepted

Solution code:
import numpy as np

#v = [int(d) for d in input().split()]
v= list(str(input()))


li = list(np.array_split(v,2))

mae = int(''.join(li[0]))
usiro = int(''.join(li[1]))

ma = 0
usi = 0

if int(usiro) >= 1:
    if int(usiro) <= 12:
        usi = 1
    else:
        usi = 2
else:
    usi = 2

if int(mae) >= 1:
    if int(mae) <= 12:
        ma = 1
    else:
        ma = 2
else:
    ma = 2


if usi == 0:
    print('NA')
    exit()

if ma == 0:
    print('NA')
    exit()

if usi ==1:
    if ma == 1:

        print('AMBIGUOUS')
    else:
        print('YYMM')

if usi == 2:
    if ma == 1:

        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
aa = int(s[0:2])
bb = int(s[2:4])

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

Submission status: Accepted

Solution code:
S = input()
ue2 = int(S[0:2])
sita2 = int(S[2:4])
ue2_month_flag = False
sita2_month_flag = False

if ue2 < 13 and ue2 != 0:
    ue2_month_flag = True
if sita2 < 13 and sita2 != 0:
    sita2_month_flag = True

if ue2_month_flag and sita2_month_flag:
    print('AMBIGUOUS')
elif ue2_month_flag:
    print('MMYY')
elif sita2_month_flag:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
fo = int(s[0] + s[1])
la = int(s[2] + s[3])
fism = 00 < fo and fo < 13
lism = 00 < la and la < 13
if fism and lism:
    ans = "AMBIGUOUS"
if fism and not lism:
    ans = "MMYY"
if not fism and lism:
    ans = "YYMM"
if not fism and not lism:
    ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
s = input()

def mayBeMonth(n):
  if 1 <= n <= 12:
    return True
  else:
    return False

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

if mayBeMonth(first) and mayBeMonth(second):
  print("AMBIGUOUS")
elif mayBeMonth(first) and not mayBeMonth(second):
  print("MMYY")
elif not mayBeMonth(first) and mayBeMonth(second):
  print("YYMM")
else:
  print("NA")