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:
def main():
    S = input()
    first = int(S[0:2])
    last = int(S[2:4])

    if((first>12 or first==0) and last<=12 and last>=1):
        print("YYMM")
    elif((last>12 or last==0) and first<=12 and first>=1):
        print("MMYY")
    elif(last<=12 and first<=12 and last>=1 and first>=1):
        print("AMBIGUOUS")
    else:
        print("NA")
    
    return
main()

Submission status: Accepted

Solution code:
def yymm(x,y):
    if 1<=y and y<=12:
        return True
    else:
        return False

S = input()

x = int(S[:len(S)//2])
y = int(S[len(S)//2:])

if yymm(x,y) and yymm(y,x):
    print("AMBIGUOUS")
elif yymm(x,y):
    print("YYMM")
elif yymm(y,x):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

def f(n):
  if n >= 1 and n <= 12:
    return True
  else:
    return False

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

Submission status: Accepted

Solution code:
S = list(input())
Y = S[0] + S[1]
M = S[2] + S[3]
if 1 <= int(M) and int(M) <= 12:
    if 1 <= int(Y) and int(Y) <= 12:
        print("AMBIGUOUS")

    elif int(Y) == 0 or int(Y) > 12:
        print("YYMM")

    else:
        pass
    
elif 1 <= int(Y) and int(Y) <= 12:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=input()
a=int(S[:2])
b=int(S[2:])
ans=0
lab=["NA","MMYY","YYMM","AMBIGUOUS"]

if a>=1 and a<=12:
    ans+=1
    
if b>=1 and b<=12:
    ans+=2
    
print(lab[ans])

Submission status: Accepted

Solution code:
dList = list(str(input()))

former = int(''.join([dList[0],dList[1]]))
latter = int(''.join([dList[2],dList[3]]))

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

Submission status: Accepted

Solution code:
#INPUT
#S

#S は長さ 4 の数字列

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

#YYMM, MMYY, AMBIGUOUS, NA のうち正しいものを出力せよ。

def isMonth(x):
    num = int(x)
    return (1 <= num and num <= 12)

def isYear(x):
    num = int(x)
    return (0 <= num and num <= 99)

def isYYMM(head, tail):
    return (isYear(head) and isMonth(tail))

def isMMYY(head, tail):
    return (isMonth(head) and isYear(tail))

S = input()
head = S[0:2]
tail = S[2:4]

if (isYYMM(head, tail) and isMMYY(head, tail)):
    res = 'AMBIGUOUS'
elif isYYMM(head, tail):
    res = 'YYMM'
elif isMMYY(head, tail):
    res = 'MMYY'
else:
    res = 'NA'

print(res)

Submission status: Accepted

Solution code:
S = input()

S1 = int(S[0]+S[1])
S2 = int(S[2]+S[3])

flag = 0
S1_flag = 0
 
if S1 >= 1 and S1 <= 12:
    flag = flag +1
    S1_flag = 1    
if S2 >= 1 and S2 <= 12:
    flag = flag +1
    
if flag == 0:
    print('NA')
elif flag == 2:
    print('AMBIGUOUS')
elif S1_flag == 1:
    print('MMYY')
else:
    print('YYMM')

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())
a = int(s[0] + s[1])
b = int(s[2] + s[3])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = list(input())
a=int(n[0]+n[1]) #4桁の数値の前2桁
b=int(n[2]+n[3]) #4桁の数値の後2桁

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

Submission status: Accepted

Solution code:
import math
import sys
import numpy as np

def int_input():
    return map(int, input().split())

s = input()

flag = 0
if 1 <= int(s[:2]) <= 12: flag += 2
if 1 <= int(s[2:]) <= 12: flag += 1

ans = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(ans[flag])

Submission status: Accepted

Solution code:
S = input()

# 0 to 99 YY
# 1 to 12 MM

AA = int(S[:2])
BB = int(S[2:])

A = ""
B = ""
ans = ""
if AA == 0 or AA > 12:
    A = "YY"
else:
    A = "MM"
    
if BB == 0 or BB > 12:
    B = "YY"
else:
    B = "MM"
    
if A == "YY" and  B == "YY":
    ans = "NA"
elif A == "YY" and B == "MM":
    ans = "YYMM"
elif A == "MM" and B == "YY":
    ans = "MMYY"
else:
    ans = "AMBIGUOUS"
        
print(ans)

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 = input()

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

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 = input()
first_half = int(S[:2])
second_half = int(S[2:])
is_month = lambda x: 1 <= x and x <= 12

if is_month(first_half) and is_month(second_half):
    print('AMBIGUOUS')
elif is_month(first_half) and not is_month(second_half):
    print('MMYY')
elif not is_month(first_half) and is_month(second_half):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def is_month(n):
    return 1 <= n <= 12

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

    if is_month(s1) and is_month(s2):
        print('AMBIGUOUS')
    elif is_month(s1):
        print('MMYY')
    elif is_month(s2):
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

YYMM=False
MMYY=False

if 1 <= int(s[:2]) <= 12:
  MMYY=True
if 1 <= int(s[2:]) <= 12:
  YYMM=True

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = int(readline())
S1, S2 = divmod(S, 100)

if 12 >= S1 > 0:
    if 12 >= S2 > 0:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if 12 >= S2 > 0:
        ans = 'YYMM'
    else:
        ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
#python3
s=input()
a=[int(s[:2]), int(s[2:])]
mmyy=False
yymm=False
if (1 <= a[0] <= 12) & (0 <= a[1] <= 99):
  mmyy = True

if (0 <= a[0] <= 99) & (1<= a[1] <= 12):
  yymm = True

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    mm1 = False
    mm2 = False

    if 0 < int(s[:2]) < 13:
        mm1 = True
    if 0 < int(s[-2:]) < 13:
        mm2 = True
    
    if mm1 == True and mm2 == True:
        print("AMBIGUOUS")
        return 
    if mm1 == False and mm2 == False:
        print("NA")
        return
    if mm1 == True and mm2 == False:
        print("MMYY")
        return
    if mm1 == False and mm2 == True:
        print("YYMM")
        return
    print("NA")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:


S = input()

try:
    first = int(S[:2])
except ValueError:
    first = -1

try:
    end = int(S[2:])
except ValueError:
    end = -1

def judgeYM(num):
    if num >= 1 and num <= 12:
        return "M"
    elif num >= 0 and num <=99:
        return "Y"
    else:
        return "N"

fj = judgeYM(first)
ej = judgeYM(end)

if fj == "N" or ej == "N":
    print("NA")
elif fj == "M" and ej == "M":
    print("AMBIGUOUS")
elif fj == "M":
    print("MMYY")
elif ej == "M":
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
S = str(input())

YYMM = 0
MMYY = 0
if 1 <= int(S[0:2]) <= 12 :
  MMYY = 1
if 1 <= int(S[2:4]) <= 12 :
  YYMM = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

X = int(S / 100) #上2桁
Z = S % 100      #下2桁
if 1 <= X <= 12 and 1 <= Z <= 12:
    print("AMBIGUOUS")
elif (X == 0 or 13 <= X) and 1 <= Z <= 12:
    print("YYMM")
elif 1 <= X <= 12 and (Z == 0 or 13 <= Z):
    print("MMYY")
elif (X == 0 or 13 <= X) and (Z == 0 or 13 <= Z):
    print("NA")

Submission status: Accepted

Solution code:
input1 = input()

a = input1[0] + input1[1]
b = input1[2] + input1[3]


if a == "01" or a == "02" or a == "03" or a == "04" or a == "05" or a == "06" or a == "07" or a == "08" or a == "09" or a == "10" or a == "11" or a == "12":
    a = "M?"
else:
    a = "?"

if b == "01" or b == "02" or b == "03" or b == "04" or b == "05" or b == "06" or b == "07" or b == "08" or b == "09" or b == "10" or b == "11" or b == "12":
    b = "M?"
else:
    b="?"

if a == "M?" and b == "M?":
    print("AMBIGUOUS")


if a == "M?" and b == "?":
    print("MMYY")

if a == "?" and b == "M?":
    print("YYMM")

if a == "?" and b == "?":
    print("NA")

Submission status: Accepted

Solution code:
#input
S = str(input())

#output
S1 = int(S[:2])
S2 = int(S[2:])

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

Submission status: Accepted

Solution code:
# coding: utf-8

S = input()

s1 = int(S[0]) * 10 + int(S[1])
s2 = int(S[2]) * 10 + int(S[3])

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

Submission status: Accepted

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


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

Submission status: Accepted

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

i = int(s[:2])
j = int(s[2:])

if 1 <= i <= 12:
    if 1 <= j <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= j <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()

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

x = 0 <= A <= 99 and 1 <= B <= 12
y = 1 <= A <= 12 and 0 <= B <= 99

if x and y:
    print('AMBIGUOUS')
elif x:
    print('YYMM')
elif y:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
a = int(S[:2])
b = int(S[2:])
ba = 1 <= a <= 12
bb = 1 <= b <= 12
if ba and bb:
    print('AMBIGUOUS')
elif ba and not bb:
    print('MMYY')
elif not ba and bb:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

if a in range(1,13) and b in range(1,13):
    print('AMBIGUOUS')
elif a in range(1, 13):
    print('MMYY')
elif b in range(1, 13):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
L = s//100
R =s%100

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

Submission status: Accepted

Solution code:
import datetime

s = input()
ans = [['NA', 'MMYY'], ['YYMM', 'AMBIGUOUS']]

try:
    datetime.datetime.strptime(s,"%y%m")
    ans1 = 1
except ValueError:
    ans1 = 0

try:
    datetime.datetime.strptime(s,"%m%y")
    ans2 = 1
except ValueError:
    ans2 = 0

print(ans[ans1][ans2])

Submission status: Accepted

Solution code:
n = list(input())
x = n[0]+n[1]
y = n[2]+n[3]
count = 0
if 12 >= int(y) >= 1:
    count += 1
if 12 >= int(x) >= 1:
    count += 2
if count == 3:
    print("AMBIGUOUS")
elif count == 2:
    print("MMYY")
elif count ==1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys
S = list(input())
S = [S[0]+S[1],S[2]+S[3]]
month = ['01','02','03','04','05','06','07','08','09','10','11','12']

# 月表示、年表示についてのステータス
# [前表示、後ろ表示]
mon = [0,0]
yer = [0,0]

if S[0] in month:
	mon[0] = 1
if S[1] in month:
	mon[1] = 1


if mon[0] == 1 and mon[1] == 1:
	print('AMBIGUOUS')
	sys.exit()
if mon[0] == 1:
	print('MMYY')
	sys.exit()
if mon[1] == 1:
	print('YYMM')
	sys.exit()
else:
	print('NA')
	sys.exit()

Submission status: Accepted

Solution code:
S = input()

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

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')

Submission status: Accepted

Solution code:
x = int(input())

a = x % 100
b = (x - a)//100

fa = False
fb = False

if 0 < a <= 12:
    fa = True
if 0 < b <= 12:
    fb = True
if fa & fb:
    print("AMBIGUOUS")
elif fa:
    print("YYMM")
elif fb:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
str_MY = input()
int_f = int(str_MY[:2])
int_b = int(str_MY[2:])
if (12<int_f and 0<int_b<13) or (int_f ==0 and 0<int_b<13):
    print('YYMM')
elif (12<int_b and 0<int_f<13) or (int_b ==0 and 0<int_f<13):
    print('MMYY')
elif 0<int_b<13 and 0<int_f<13:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
left=int(S[:2])
right=int(S[2:])
mmyy,yymm=False,False
if 12>=left and left>=1:
    mmyy=True
if 12>=right and right>=1:
    yymm=True

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = input()

def yymmChecker(num):
    mm = int(num[2:])
    if int(mm) >=1 and int(mm) <= 12:
        return True
    else :
        return False
    
def mmyyChecker(num):
    mm = int(num[:2])
    if int(mm) >=1 and int(mm) <= 12:
        return True
    else :
        return False

yymm_flag = yymmChecker(num)
mmyy_flag = mmyyChecker(num)

if yymm_flag and mmyy_flag:
    print('AMBIGUOUS')
elif yymm_flag and not mmyy_flag:
    print('YYMM')
elif not yymm_flag and mmyy_flag:
    print('MMYY')
else :
    print('NA')

Submission status: Accepted

Solution code:
s = str(input())
tmp = 0
flag = False
if 0 < int(s[0]+s[1]) <= 12:
    tmp += 1
    flag = True
if 0 < int(s[2]+s[3]) <= 12:
    tmp += 1

if tmp == 2:
    print('AMBIGUOUS')
elif tmp == 1:
    if flag:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
LL,RR = int(S[:2]), int(S[2:])

def v_month(x):
    return  1<=x and x<=12

def v_year(x):
    return 0<=x

m1 = v_month(LL)
y1 = v_year(LL)

m2 = v_month(RR)
y2 = v_year(RR)

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

Submission status: Accepted

Solution code:
S=input()
left=S[0:2]
right=S[2:4]
MM=["01","02","03","04","05","06","07","08","09","10","11","12"]

if (left in MM)==False:
   if right in MM:
      print("YYMM")
   else:
      print("NA")

elif left in MM:
   if right in MM:
      print("AMBIGUOUS")
   else:
      print("MMYY")

Submission status: Accepted

Solution code:
S=int(input())
A,B=S//100,S%100
if A < 13 and B < 13 and A != 0 and B != 0:
  print("AMBIGUOUS")
elif A < 13 and A > 0:
  print("MMYY")
elif B < 13 and B > 0:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def check(a, b):
    if 1<= a <= 12 and 1 <= b <= 12:
        return "AMBIGUOUS"
    elif 1 <= a <= 12 and (b <= 0 or 13 <= b):
        return "MMYY"
    elif (a <= 0 or 13 <= a) and 1 <= b <= 12:
        return "YYMM"
    else:
        return "NA"

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
def solve(s):
    m = int(s[:2])
    n = int(s[2:])
    u=0
    if 1<=n<=12:
        u = 1
    v=0
    if 1<=m<=12:
        v=1
    if v==1 and u==1:
        return 'AMBIGUOUS'
    if v==1 and u==0:
        return 'MMYY'
    if v==0 and u==1:
        return 'YYMM'
    return 'NA'    
print(solve(s))

Submission status: Accepted

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

if 0<aa and aa<=12:
  if 0<bb and bb<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0<bb and bb<=12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

a = S[0]+S[1]
b = S[2]+S[3]

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

if a in month and b in month:
    ans = 'AMBIGUOUS'
elif a in month:
    ans = 'MMYY'
elif b in month:
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
l=[int(s[0:2]),int(s[2:4])]

if 1 <= l[0] <= 12:
    if 1 <= l[1] <= 12:
        print("AMBIGUOUS")
    elif l[1] == 0 or 13 <= l[1]:
        print("MMYY")
    else:
        print("NA")
elif l[0] == 0 or 13 <= l[0]:
    if 1 <= l[1] <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])
flag = 0

if (S1 >= 0) and (S2 < 13) and (S2 > 0):
    flag += 1
if (S1 < 13) and (S2 >= 0) and (S1 > 0):
    flag += 10

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()
L = ["NA", "MMYY", "YYMM", "AMBIGUOUS"]
print(L[(0 < int(S[0:2]) <= 12) + 2 * (0 < int(S[2:4]) <= 12)])

Submission status: Accepted

Solution code:
S = input()

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

print(ans)

Submission status: Accepted

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

YYMM = 1 <= back  <= 12
MMYY = 1 <= front <= 12

if YYMM and MMYY:
  print("AMBIGUOUS")
  exit()

if not YYMM and not MMYY:
  print("NA")
  exit()

if YYMM:
  print("YYMM")

if MMYY:
  print("MMYY")

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
A1=int(S[0:2])
A2=int(S[2:4])

if 12>=A2>=1:
    if 12>=A1>=1:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if 12>=A1>=1:
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

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

if (a==0 or 12<a<100) and (b==0 or 12<b<100):
    print('NA')

elif (a==0 or 12<a<100) and 1<=b<=12:
    print('YYMM')

elif 1<=a<=12 and (b==0 or 12<b<100):
    print('MMYY')

else:
    print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = list(input())

a = s[0]+s[1]
b = s[2]+s[3]

a_canBeM = False
b_canBeM = False
canBeY = True

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

if a in M:
    a_canBeM = True
if b in M:
    b_canBeM = True

if a_canBeM and b_canBeM:
    print("AMBIGUOUS")
elif a_canBeM and (not b_canBeM):
    print("MMYY")
elif (not a_canBeM) and b_canBeM:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

head = int(S[:2])
tail = int(S[2:])

ans = "NA"
if 1 <= head <= 12:
    if 1 <= tail <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
elif 1 <= tail <= 12:
    ans = "YYMM"

print(ans)

Submission status: Accepted

Solution code:
s = input()

a = s[:2]
b = s[2:]

ans = 0

if int(a) <= 12 and int(a) >= 1:
    ans += 2

if int(b) <= 12 and int(b) >= 1:
  ans += 3
  
if ans == 0:
  print("NA")
elif ans == 2:
  print("MMYY")
elif ans == 3:
  print("YYMM")
elif ans == 5:
  print("AMBIGUOUS")

Submission status: Accepted

Solution code:
A, = [s.split() for s in open(0)][0]

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

yymm = 0
mmyy = 0

if a >= 1 and a <= 12:
    mmyy += 1

if b >= 1 and b <= 12:
    yymm += 1
    
if mmyy and yymm:
    print("AMBIGUOUS")
elif mmyy and not yymm:
    print("MMYY")
elif not mmyy and yymm:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S = input()
a = int(S[:2])
b = int(S[2:])
if (0<=a<=99 and 1<=b<=12) or (1<=a<=12 and 0<=b<=99):
    if 1<=a<=12 and 1<=b<=12:
        print ("AMBIGUOUS")
    elif 0<=a<=99 and 1<=b<=12:
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
s = list(input())

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

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

Submission status: Accepted

Solution code:
S = str(input())

first = int(S[0]) * 10 + int(S[1])
second  = int(S[2]) * 10 + int(S[3])


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

Submission status: Accepted

Solution code:
s = input()
m1 = '00'<s[:2]<'13'
m2 = '00'<s[2:]<'13'
if m1 and m2:
    print('AMBIGUOUS')
elif not m1 and m2:
    print('YYMM')
elif m1 and not m2:
    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 1 <= s1 <= 12:
    if 1 <= s2 <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if 1 <= s2 <= 12:
        ans = "YYMM"
    else:
        ans = "NA"
    
print(ans)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
s = input()
aa = int(s[:2])
bb = int(s[2:])
aa_mm = False
bb_mm = False
if 1 <= aa <= 12:
    aa_mm = True
if 1 <= bb <= 12:
    bb_mm = True
if aa_mm and bb_mm:
    print("AMBIGUOUS")
elif bb_mm:
    print("YYMM")
elif aa_mm:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
N = int(input())
y = [0,1,2,3,4,5,6,7,8,9]
one = [1]
zero = [0]
p = [1,2,3,4,5,6,7,8,9]
q = [0,1,2]
a=N//1000
b=(N - (a * 1000))//100 
c=(N- (a*1000)-(b * 100))// 10
d=(N - (a*1000)-(b*100)-(c*10))

if ((a in one) and (b in q)or(a in zero) and (b in p))and((c in one) and (d in q)or(c in zero)and(d in p)):
  print('AMBIGUOUS')
elif (a in y )and(b in y)and((c in one) and (d in q) or (c in zero) and(d in p)):
  print('YYMM')
elif ((a in one )and(b in q))or((a in zero)and(b in p))and(c in y) and (d in y):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = str(input())

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

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

Submission status: Accepted

Solution code:
S = input()

S_a = int(S[:2])
S_b = int(S[2:])

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