Problem:


Score : 200 points

Problem Statement

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

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

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

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

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

1905

Sample Output 1

YYMM

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

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

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

Sample Input 3

1700

Sample Output 3

NA

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



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
if a==0:
  if 1<=b<=12:
    print("YYMM")
  else:
    print("NA")
elif 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()
sf=int(S[:2])
sb=int(S[2:])
if 1<=sf and sf<=12:
  if 1<=sb and sb<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=sb and sb<=12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

S = input()

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

S1_flg = False
S2_flg = False
if "01" <= S1 and S1 <= "12":
    S1_flg = True
if "01" <= S2 and S2 <= "12":
    S2_flg = True
if   S1_flg == False and S2_flg == False:
    print("NA")
elif S1_flg == False and S2_flg == True:
    print("YYMM")
elif S1_flg == True  and S2_flg == False:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s=int(input())

s1=s//100
s2=s%100

ok1=ok2=False
if s1>0 and s1<13:
	ok1=True

if s2>0 and s2<13:
	ok2=True

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = list(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()
A = int(S[:2])
B = int(S[2:])
fMA = A>0 and A <13
fMB = B>0 and B <13
if fMA and fMB:
  print("AMBIGUOUS")
elif fMA:
  print("MMYY")
elif fMB:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
# 15:35 giveup
def P(s):
    print(s)
    exit(0)

s = input()
l = int(s[:2])
r = int(s[2:])
if 1 <= l and l <= 12:
    if 1 <= r and r <= 12:
        P("AMBIGUOUS")
    else:
        P("MMYY")
else:
    if 1 <= r and r <= 12:
        P("YYMM")
    else:
        P("NA")

Submission status: Accepted

Solution code:
S=input()

tmp1=int(S[0:2])
tmp2=int(S[2:4])

if(1 <= tmp1 <= 12 and 1 <= tmp2 <= 12):
    print("AMBIGUOUS")
elif((1 <= tmp1 <= 12)==False and  1 <=tmp2 <= 12):
    print("YYMM")
elif((1 <= tmp2 <= 12)==False and  1 <=tmp1 <= 12):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

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

aa= ''
bb= ''

if (12>= a >0):
    aa = 'M'

if (12>= b >0):
    bb = 'M'

if (aa == 'M' and bb == 'M'):
    print('AMBIGUOUS')

if (aa == 'M' and bb != 'M'):
    print('MMYY')

if (aa != 'M' and bb == 'M'):
    print('YYMM')

if (aa != 'M' and bb != 'M'):
    print('NA')

Submission status: Accepted

Solution code:
#b
s=input()

month = [str(i).zfill(2) for i in range(1,13)]

if s[2:] in month:
    if s[:2] in month:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if s[:2] in month:
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def isMonth(value):
  return (value >= 1) and (value <= 12)


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

if isMonth(first) and isMonth(last):
  print('AMBIGUOUS')
elif not isMonth(first) and not isMonth(last):
  print('NA')
elif not isMonth(first):
  print('YYMM')
else:
  print('MMYY')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
s1 = int("".join(s[0:2]))
s2 = int("".join(s[2:4]))
result = ""

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

Submission status: Accepted

Solution code:
s = list(str(input()))
f = [s[0],s[1]]
d = int("".join(f))
f = [s[2], s[3]]
e = int("".join(f))
if (d > 12 or d == 0) and (12 >= e > 0):
    print("YYMM")
elif (12 >= d > 0) and (e > 12 or e == 0):
    print("MMYY")
elif (12>=d>0)and(12>=e>0):
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
#ABC-126-B
S = input()
first = int(S[0]+S[1])
second = int(S[2]+S[3])

if first > 12:
    if second > 12:
        print("NA")
    elif second > 0:
        print("YYMM")
    else: #second == 00:
        print("NA")
elif first > 0:
    if second > 12:
        print("MMYY")
    elif second > 0:
        print("AMBIGUOUS")
    else: #second == 00:
        print("MMYY")
else: #first == 00:
    if second > 12:
        print("NA")
    elif second > 0:
        print("YYMM")
    else: #second ==0:
        print("NA")

Submission status: Accepted

Solution code:
S = [x for x in input()]
a = int(S[0]+""+S[1])
b = int(S[2]+""+S[3])

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

Submission status: Accepted

Solution code:
s = input()
yy = int(s[:len(s)//2])
mm = int(s[len(s)//2:])

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = str(input())

a = int(s[:2])
b = int(s[2:])
month = [int(i) for i in range(1,13)]

if a in month and b in month:
    print('AMBIGUOUS')

elif a in month:
    print('MMYY')

elif b in month:
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
YYMM = MMYY = False
A = int(S[:2:])
B = int(S[2::])

if 1 <= B <= 12:
    YYMM = True

if 1 <= A <= 12:
    MMYY = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

a = True
b = True

if int(S[0]) > 1 or (int(S[0]) == 1 and int(S[1]) > 2) or (int(S[0]) == 0 and int(S[1]) == 0):
    a = False
if int(S[2]) > 1 or (int(S[2]) == 1 and int(S[3]) > 2) or (int(S[2]) == 0 and int(S[3]) == 0):
    b = False

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

Submission status: Accepted

Solution code:
a = input()
a1 = int(a[:2])
a2 = int(a[2:])

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

Submission status: Accepted

Solution code:
s = input()
nums = [int(s[0]+s[1]), int(s[2]+s[3])]
if nums[0] >= 1 and nums[0] <= 12:
  month = True
else:
  month = False
if nums[1] >= 1 and nums[1] <= 12:
  if month:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if month:
    print("MMYY")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
month = ['01','02','03','04','05','06','07','08','09','10','11','12']
a = S[0:2]
b = S[2:4]
if a in month and b in month:
  print('AMBIGUOUS')
elif a in month:
  print('MMYY')
elif b in month:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = input()

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

is_yymm = False
is_mmyy = False

if 1 <= l and l <= 12 and 0 <= r and r <= 99:
  is_mmyy = True

if 1 <= r and r <= 12 and 0 <= l and l <= 99:
  is_yymm = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())

ff = int(S[0])*10 + int(S[1])
bb = int(S[2])*10 + int(S[3])

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

Submission status: Accepted

Solution code:
s = input()
a, b = s[:2], s[2:]
def isMonth(string):
  if int(string) >= 1 and int(string) <= 12:
    return True
  else:
    return False
if isMonth(a) and isMonth(b):
  print("AMBIGUOUS")
elif isMonth(a) and not(isMonth(b)):
  print("MMYY")
elif not(isMonth(a)) and isMonth(b):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = list(map(int,input()))

ue = 10*s[0] + s[1]
shita = 10*s[2] + s[3]

if 0 < ue < 13:
  if 0 < shita < 13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0 < shita < 13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(map(int,input()))

UN2 = 10 * S[-2] + S[-1]
UP2 = 10 * S[0] + S[1]

if ((1000*UP2)+UN2) == 0 or ((UP2 >= 13) and (UN2 >= 13)) or ((UP2 >= 13) and UN2 == 0) or ((UP2 == 0) and UN2 >= 13) :
    print('NA')
elif (1 <= UP2 <= 12) and (1 <= UN2 <= 12) :
    print('AMBIGUOUS')
elif UP2 == 0 or UP2 >= 13 :
    print('YYMM')
else :
    print('MMYY')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d = str(input())

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

Submission status: Accepted

Solution code:
S = input()
head, tail = int(S[:2]), int(S[2:])
if 0 < head < 13:
    if 0 < tail < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < tail < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
#N, K = [int(i) for i in input().split()]
S = input()

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

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

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

if 0 < pre < 13:
    #MMYY , AMBIGUOUS
    print('AMBIGUOUS') if 0 < aft < 13 else print('MMYY')
else:
    #YYMM, NA
    print('YYMM') if 0 < aft < 13 else print('NA')

Submission status: Accepted

Solution code:
s=int(input())
x=s%100
y=s//100
print(("AMBIGUOUS" if 0<x<13 else "MMYY") if 0<y<13 else "YYMM" if 0<x<13 else "NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
# 0 <= Y <= 99
# 1 <= M <= 12
if 1 <= int(S[0]+S[1]) <= 12:
    if 1 <= int(S[2]+S[3]) <= 12:
        print('AMBIGUOUS')
        exit()
if 0 <= int(S[0]+S[1]) <= 99:
    if 1 <= int(S[2]+S[3]) <= 12:
        print('YYMM')
        exit()
if 1 <= int(S[0]+S[1]) <= 12:
    if 0 <= int(S[2]+S[3]) <= 99:
        print('MMYY')
        exit()
print('NA')

Submission status: Accepted

Solution code:
import math
import heapq
import sys
from collections import Counter
import numpy as np
import datetime

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
#s = [input() for i in range(3)]

S=input()
try:
    a = datetime.date(int('20'+S[:2]), int(S[2:]), 1)
    try:
        a = datetime.date(int('20'+S[2:]), int(S[:2]), 1)
        print('AMBIGUOUS')
    except ValueError:
        print('YYMM')
except ValueError:
    try:
        a = datetime.date(int('20'+S[2:]), int(S[:2]), 1)
        print('MMYY')
    except ValueError:
        print('NA')

Submission status: Accepted

Solution code:
a,b,c,d = input()

li1 = [a,b]
li2 = [c,d]

int1 = int(''.join(li1))
int2 = int(''.join(li2))

if (int1 in range(1,13)) and (int2 in range(1,13)):
    ans = 'AMBIGUOUS'
elif (int1 in range(1,13)) and (int2 not in range(1,13)):
    ans = 'MMYY'
elif (int2 in range(1,13)) and (int1 not in range(1,13)):
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

S_zen =int(S[0:2])
S_go = int(S[2:4])

judge_list_MM = [1+i for i in range(12)]

#print(judge_list_MM)

if S_zen in judge_list_MM and S_go in judge_list_MM :
    print("AMBIGUOUS")
elif S_go in judge_list_MM :
    print("YYMM")
elif S_zen in judge_list_MM :
    print("MMYY")
else :
    print("NA")

Submission status: Accepted

Solution code:
n = input()

a = n[0]+n[1]
a = int(a)

b = n[2]+n[3]
b = int(b)

#print(a,b)

if a==0:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')

elif 0<a<13:
	if b==0:
		print('MMYY')
	elif 0<b<13:
		print('AMBIGUOUS')
	else:
		print('MMYY')	

else:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

Solution code:
s = input()
f = int(s[:2])
b = int(s[2:4])
jdg = str(int(0 < f and f <= 12)) + str(int(0 < b and b <= 12))
if jdg == '11':
    print('AMBIGUOUS')
elif jdg == '10':
    print('MMYY')
elif jdg == '01':
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def print_ans(S):
    """Test Case
    >>> print_ans("1905")
    YYMM
    >>> print_ans("0112")
    AMBIGUOUS
    >>> print_ans("1700")
    NA
    """
    front = int(S[:2])
    rear = int(S[2:])
    frontMM_flg = 1 <= front <= 12
    rearMM_flg = 1 <= rear <= 12
    if frontMM_flg and rearMM_flg:
        print("AMBIGUOUS")
    elif frontMM_flg and not rearMM_flg:
        print("MMYY")
    elif not frontMM_flg and rearMM_flg:
        print("YYMM")
    else:
        print("NA")
    


if __name__ == '__main__':
    S = input().rstrip()
    print_ans(S)

Submission status: Accepted

Solution code:
S = input()
a = S[:2]
b = S[2:]
# print(int(a), int(b))

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

Submission status: Accepted

Solution code:
s = int(input())

s1 = s // 100
s2 = s % 100

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
m, n = S[0:2], S[2:4]

if S[0] == '0':
  m = int(S[1])
else:
  m = int(m)
if S[2] == '0':
  n = int(S[3])
else:
  n = int(n)

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

Submission status: Accepted

Solution code:
S=input()

if 0<=int(S[0]+S[1])<=99 and 1<=int(S[2]+S[3])<=12:
    yymm='True'
else:
    yymm='False'
if 1<=int(S[0]+S[1])<=12 and 0<=int(S[2]+S[3])<=99:
    mmyy='True'
else:
    mmyy='False'

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
A=input()
Y=int(A[0])*10+int(A[1])
M=int(A[2])*10+int(A[3])
code=0
if Y<100:
    if M>0 and M<13:
        code=1

if M<100:
    if Y>0 and Y<13:
        if code==1:
            code=3
        else:
            code=2

if code == 0:
    print("NA")
if code ==1:
    print("YYMM")
if code ==2:
    print("MMYY")
if code == 3:
    print("AMBIGUOUS")

Submission status: Accepted

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

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

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def isMM(s2):
    d = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    return s2 in d

def main():
    s = input()
    if isMM(s[0:2]):
        if isMM(s[2:]):
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if isMM(s[2:]):
            print("YYMM")
        else:
            print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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


if 1<=s1 and s1<=12 and 1<=s2 and s2<=12:
  ret="AMBIGUOUS"
elif 0<=s1 and s1<=99 and 1<=s2 and s2<=12:
  ret="YYMM"
elif 0<=s2 and s2<=99 and 1<=s1 and s1<=12:
  ret="MMYY"
else:
  ret="NA"


print(ret)

Submission status: Accepted

Solution code:
# ABC 126: B – YYMM or MMYY
s = input()
first = int(s[0] + s[1])
last = int(s[2] + s[3])

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

Submission status: Accepted

Solution code:
S=input()
m0=0

if int(S[:2])<=12 and int(S[:2])>0:
  m0+=1
if int(S[2:])<=12 and int(S[2:])>0:
  m0+=2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [int(i) for i in input()]
f = s[0]*10 + s[1]
l = s[2]*10 + s[3]

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

Submission status: Accepted

Solution code:
s = input()

sf = int(s[:2])
sb = int(s[2:])

mmyy = (0 < sf and sf < 13)
yymm = (0 < sb and sb < 13)

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

Submission status: Accepted

Solution code:
s = input()

s = [int(i) for i in s]
ue2 = s[0] * 10 + s[1]
sita2 = s[2] * 10 + s[3]

yymm = False
mmyy = False
amb = False

#ooMM
if  1 <= sita2 <= 12:
    yymm = True
    #MMMM
    if 1 <= ue2 <= 12:
        amb = True
        yymm = False
#ooYY
else:
    if 1<= ue2 <= 12:
        #MMYY
        mmyy = True
if yymm:
    print("YYMM")
elif mmyy:
    print("MMYY")
elif amb:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    a = S[:2]
    b = S[2:]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
a=int("".join(s[0:2]))
b=int("".join(s[2:4]))
ans=0
if b<13 and b!=00:
    ans+=1
if a<13 and a!=00:
    ans+=2
if ans==3:
    print("AMBIGUOUS")
elif ans==2:
    print("MMYY")
elif ans==1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())

if 0 < S // 100 <= 12 and 0 < S % 100<= 12:
    print("AMBIGUOUS")
elif 0 < S // 100 <= 12:
    print("MMYY")
elif 0 < S % 100 <= 12:
    print("YYMM")
else :
    print("NA")

Submission status: Accepted

Solution code:
s=list(input())

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

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

Submission status: Accepted

Solution code:
s = input()
ans = ["NA","MMYY","YYMM","AMBIGUOUS"]
print(ans[(1 <= int(s[:2]) <= 12) + (1 <= int(s[2:]) <= 12) * 2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
s_12 = int(s / 100)
s_34 = s - s_12 * 100

if 1 <= s_12 <= 12:
    if 1 <= s_34 <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= s_34 <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

first = int(s[0] + s[1])
second = int(s[2] + s[3])

if (first == 0):
    if (second == 0):
        print("NA")
    elif (1 <= second <= 12):
        print("YYMM")
    elif (13 <= second <= 99):
        print("NA")
    else:
        print("NA")
elif (1 <= first <= 12):
    if (second == 0):
        print("MMYY")
    elif (1 <= second <= 12):
        print("AMBIGUOUS")
    elif (13 <= second <= 99):
        print("MMYY")
    else:
        print("NA")
elif (13 <= first <= 99):
    if (second == 0):
        print("NA")
    elif (1 <= second <= 12):
        print("YYMM")
    elif (13 <= second <= 99):
        print("NA")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = str(input())

date = [int(s[:2]), int(s[2:])]

if 1 <= date[0] <= 12 and 1 <= date[1] <= 12:
    print('AMBIGUOUS')
elif 1 <= date[1] <= 12:
    print('YYMM')
elif 1 <= date[0] <= 12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    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')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 2019-11-13 01:53:22(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    s = sys.stdin.readline().rstrip()
    first, second = int(s[:2]), int(s[2:])
    if 1 <= first <= 12:
        if 1 <= second <= 12:
            ans = 'AMBIGUOUS'
        else:
            ans = 'MMYY'
    else:
        if 1 <= second <= 12:
            ans = 'YYMM'
        else:
            ans = 'NA'
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = int(input())
a = S // 100
b = S % 100
def f(p,q):
    if p ==1:
        if q == 1:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if q == 1:
            return 'YYMM'
        else:
            return 'NA'
s = 0
t = 0
if 1 <= a <= 12:
    s = 1
if 1 <= b <= 12:
    t = 1
print(f(s,t))

Submission status: Accepted

Solution code:
s=list(input())

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

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

Submission status: Accepted

Solution code:
n=input()
ym=0
my=0
if n[0]=="0":
  if int(n[1])!=0:
    my=1
  else:
    my=0
elif n[0]=="1":
  if int(n[1])==1 or int(n[1])==2:
    my=1
  else:
    my=0
else:
  my=0
if n[2]=="0":
  if int(n[3])!=0:
    ym=1
  else:
    ym=0
elif n[2]=="1":
  if int(n[3])==1 or int(n[3])==2:
    ym=1
  else:
    ym=0
else:
  ym=0
if my and ym:
  print("AMBIGUOUS")
elif my:
  print("MMYY")
elif ym:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
N = int(input())
a = N // 100
b = N % 100
ans = 'NA'
x = 1 <= a <= 12
y = 1 <= b <= 12
if x and y:
    ans = 'AMBIGUOUS'
elif x and not y:
    ans = 'MMYY'
elif not x and y:
    ans = 'YYMM'

print(ans)

Submission status: Accepted

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

def check(t):
  if t > 0 and t < 13:
    return True
  return False


if check(s1):
  if check(s2):
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif check(s2):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()

front = s[0:2]
back = s[2:4]

a = 0
b = 0
if 1 <= int(front) <= 12:
    a = 1
if 1 <= int(back) <= 12:
    b = 1

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

Submission status: Accepted

Solution code:
a=input()
s=[(int(a[0])*10)+int(a[1]),(int(a[2])*10)+int(a[3])]

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

Submission status: Accepted

Solution code:
S = input()

left = int(S[:2])
right = int(S[2:])
left_mm_flag = False
left_yy_flag = False
right_mm_flag = False
right_yy_flag = False

if 0 <= left <= 99:
    left_yy_flag = True
    if 1 <= left <= 12:
        left_mm_flag = True


if 0 <= right <= 99:
    right_yy_flag = True
    if 1 <= right <= 12:
        right_mm_flag = True


if left_mm_flag and right_yy_flag and left_yy_flag and right_mm_flag:
    print('AMBIGUOUS')
elif left_yy_flag and right_mm_flag:
    print('YYMM')
elif left_mm_flag and right_yy_flag:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
x = [i for i in input()]
a,b=int(x[0]+x[1]),int(x[2]+x[3])
if (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")