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

top = int(s[0]) * 10 + int(s[1])
btm = int(s[2]) * 10 + int(s[3])


is_m = lambda n: 0 < n < 13

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar  1 19:29:34 2019

@author: nakamuratakayuki
"""
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])

ans0 = 0
if 1 <= S2 <= 12:
    ans0 += 1
if 1 <= S1 <= 12:
    ans0 += 2
    
ans =''
if ans0 == 0:
    ans = 'NA'
if ans0 == 1:
    ans = 'YYMM'
if ans0 == 2:
    ans = 'MMYY'
if ans0 == 3:
    ans = 'AMBIGUOUS'
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_format(a, b):
  if 0 < a < 13 and 0 < b < 13:
    return 'AMBIGUOUS'
  elif 0 < a < 13:
    return "MMYY"
  elif 0 < b < 13:
    return "YYMM"
  else:
    return 'NA'
 
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
print(get_format(s1, s2))

Submission status: Accepted

Solution code:
s = list(input())
YYMM = False
MMYY = False
 
if s[2] == '1':
    if (s[3] == '0') | (s[3] == '1') | (s[3] == '2'):
        YYMM = True
elif s[2] == '0':
    if s[3] != '0':
        YYMM = True
 
if s[0] == '1':
    if (s[1] == '0') | (s[1] == '1') | (s[1] == '2'):
        MMYY = True
elif s[0] == '0':
    if s[1] != '0':
        MMYY = True
 
if YYMM & MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
t = list(map(str, input().split())) 
s=t[0]

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

b1 = (s1>=1 and s1<=12)
b2 = (s2>=1 and s2<=12)

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

Submission status: Accepted

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

import re

S = input()

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

isMonth = r'^(0[1-9]|1[0-2])$'
isYear = r'[0-9][0-9]'

if re.match(isYear, a) and re.match(isMonth, b) and re.match(isMonth, a) and re.match(isYear, b):
	print('AMBIGUOUS')
elif re.match(isYear, a) and re.match(isMonth, b):
	print('YYMM')
elif re.match(isMonth, a) and re.match(isYear, b):
	print('MMYY')
else:
	print('NA')

Submission status: Accepted

Solution code:
S = input()
front = S[:2]
last = S[2:]
MM = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
if front in MM and last in MM:
  print("AMBIGUOUS")
elif front in MM:
  print("MMYY")
elif last in MM:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()

x = int(s[0:2])
y = int(s[2:])

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

Submission status: Accepted

Solution code:
import sys
import os

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

if N1 > 12 or N1 == 0:
    if N2 > 12 or N2 == 0:
        print("NA")
    else:
        print("YYMM")
else:
    if N2 > 12 or N2 == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.readlines()
input_list = list(lines[0].rstrip())
int12 = int("".join([input_list[0],input_list[1]]))
int34 = int("".join([input_list[2],input_list[3]]))
if 1 <= int12 <= 12:
  if 1 <= int34 <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= int34 <= 12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

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

def isYear(x):
    return x >= 0

def isMonth(x):
    return x > 0 and x <= 12

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

Submission status: Accepted

Solution code:
#B
S = input()
str_1 = int(S[:2])
str_2 = int(S[2:])

def judge_month(i):
    if i >= 1 and i <= 12:
        judge = True
    else:
        judge = False
    return judge
judge_1 = judge_month(str_1)
judge_2 = judge_month(str_2)
if judge_1 and judge_2:
    print("AMBIGUOUS")
elif judge_1:
    print("MMYY")
elif judge_2:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
l = S // 100
r = S % 100

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

Submission status: Accepted

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

Submission status: Accepted

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

    az = int(a) == 0
    ap = 0 < int(a) < 100
    am = 0 < int(a) < 13
    bz = int(b) == 0

    bp = 0 < int(b) < 100
    bm = 0 < int(b) < 13
    if ap and am and bp and bm:
        print('AMBIGUOUS')
    elif ap and am and (bz or bp) and not bm:
        print('MMYY')
    elif (az or ap) and not am and bp and bm:
        print('YYMM')
    else:
        print('NA')


main()

Submission status: Accepted

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

a_month = False
b_month = False

if(a > 0) and (a <= 12):
    a_month = True

if(b > 0) and (b <= 12):
    b_month = True
    
if (a_month == False) and (b_month == False):
    print('NA')
    
elif (a_month == True) and (b_month == True):
    print('AMBIGUOUS')
    
elif (a_month == True):
    print('MMYY')
    
else:
    print('YYMM')

Submission status: Accepted

Solution code:
S = input()
part0 = int(S[0:2])
part1 = int(S[2:])

def ismonth(number):
    if number > 0 and number < 13:
            return True
    return False

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_month(number):
    if 0 < number < 13:
        return True
    return False


s = input()
if len(s) != 4:
    print("NA")
elif not s.isdecimal():
    print("NA")
else:
    before = int(s[0:2])
    after = int(s[2:])
    is_before_month = 0  # 0:月出ない, 1:月，2:月出ない
    is_after_month = 0
    if is_month(before):
        is_before_month = 1
    if is_month(after):
        is_after_month = 1
    # 月でないときは西暦．
    if is_before_month == 0:
        if is_after_month == 0:
            # 両方月出ない
            print("NA")
        else:
            print("YYMM")
    else:
        if is_after_month == 1:
            # 両方月の可能性がある
            print("AMBIGUOUS")
        else:
            print("MMYY")

Submission status: Accepted

Solution code:
a = input()
a1 = int(a[:2])
a2 = int(a[2:])
b1 = False
b2 = False
if 1 <= a1 <= 12:
    b1 = True
    
if 1 <= a2 <= 12:
    b2 = True

if b1 and b2:
    print('AMBIGUOUS')
    
elif b1:
    print('MMYY')

elif b2:
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

Solution code:
Q = int(input())
Qa = Q//100
Qb = Q%100
if 1 <= Qa <= 12:
    if Qb >12:
        print("MMYY")
    elif 1 <=Qb <= 12:
        print("AMBIGUOUS")
    elif Qb == 0:
        print("MMYY")

elif Qa > 12:
    if 1 <=Qb <=12 :
        print("YYMM")
    elif Qb >12:
        print("NA")
    elif Qb == 0:
        print("NA")

elif Qa ==0:
    if(1<= Qb <=12):
        print("YYMM")

    elif(Qb ==0):
        print("NA")

    elif(Qb >12):
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
left = int(S[0:2])
right = int(S[2:4])

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
state = -1
a = int(s[0])*10+int(s[1])
c = int(s[2])*10+int(s[3])
state="NA"
if a < 13 and a > 0:
  state = "MMYY"
if c < 13 and c > 0:
  if state == "MMYY":
    state = "AMBIGUOUS"
  else:
    state = "YYMM"
print(state)

Submission status: Accepted

Solution code:
from sys import stdin

def main():
    S = int(input())

    n1, n2 = divmod(S, 100)
    flag = [0, 0]
    if 0 < n1 <= 12:
        flag[0] = 1
    if 0 < n2 <= 12:
        flag[1] = 1

    if sum(flag) == 1:
        if flag[0]:
            print('MMYY')
        else:
            print('YYMM')
    elif sum(flag) == 0:
        print('NA')
    else:
        print('AMBIGUOUS')

input = lambda: stdin.readline()
main()

Submission status: Accepted

Solution code:
n = input()
left = int(n[:2])
right = int(n[2:])

if 1 <= left <= 12:
    left_jd = 1
else:
    left_jd = 0

if 1 <= right <= 12:
    right_jd = 1
else:
    right_jd = 0

if left_jd == 1 and right_jd == 1:
    print('AMBIGUOUS')
elif left_jd == 1 and right_jd == 0:
    print('MMYY')
elif left_jd == 0 and right_jd == 1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

if S1>0 and S1<13:
  if S2>0 and S2<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if S2>0 and S2<13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

i = s[0:2]
j = s[2:4]

yymm_flag = True
mmyy_flag = True

# YYMM
if int(j) > 12 or int(j) == 0:
  yymm_flag = False

# MMYY
if int(i) > 12 or int(i) == 0:
  mmyy_flag = False

if yymm_flag and mmyy_flag:
  print('AMBIGUOUS')

elif not yymm_flag and not mmyy_flag:
  print('NA')

elif yymm_flag:
  print('YYMM')

elif mmyy_flag:
  print('MMYY')

Submission status: Accepted

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

# In[40]:


S =list(input())


# In[41]:


if int("".join(S[:2])) > 12 or int("".join(S[:2])) == 0:
    if int("".join(S[2:])) > 12 or int("".join(S[2:])) == 0:
        print("NA")
    else:
        print("YYMM")
elif int("".join(S[:2])) > 0:
    if int("".join(S[2:])) > 12 or int("".join(S[2:])) == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")


# In[ ]:

Submission status: Accepted

Solution code:
S=input()
prev=int(S[:2])
aft=int(S[2:])

if prev <= 12 and prev >= 1:
    if aft == 0:
        print("MMYY")
    elif aft <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif prev > 12:
    if aft == 0:
        print("NA")
    elif aft <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if aft >= 1 and aft <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

s = input()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])

if 1 <= 10*a+b <=12:
  if 1 <= 10*c+d <=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= 10*c+d <=12:
      print('YYMM')
  else:
      print('NA')

Submission status: Accepted

Solution code:
s = input().strip()
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:])

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
def ch(s):
  if s == '10':
    return int(s)
  elif s == '00':
    return 0
  elif 2 > s.count('0') > 0:
    return int(s.replace('0',''))
  elif s.count('0') == 2:
    return 0
  else:
    return int(s)

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

b = ch(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:
# -*- coding: utf-8 -*-
# abc126/abc126_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))


def main():
    S = i2s()
    front = int(S[:2])
    back = int(S[2:])
    if MM(front) and MM(back):
        print('AMBIGUOUS')
    elif MM(front) and not MM(back):
        print('MMYY')
    elif not MM(front) and MM(back):
        print('YYMM')
    else:
        print('NA')

def MM(num):
    return 1 <= num <= 12

main()

Submission status: Accepted

Solution code:
s=input()
s1=int(s[0:2])
s2=int(s[2:4])
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:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
S = raw_input()
first = int(S[0]) * 10 + int(S[1])
second = int(S[2]) * 10 + int(S[3])
if 1 <= first <= 12 and 1 <= second <= 12:
    print 'AMBIGUOUS'
elif 1 <= first <= 12:
    print 'MMYY'
elif 1 <= second <= 12:
    print 'YYMM'
else:
    print 'NA'

Submission status: Accepted

Solution code:
S = input()
A = int(S[0:2])
B = int(S[2:4])

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

Submission status: Accepted

Solution code:
S = input()

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

if 1 <= int(S1) <= 12:
    if 1 <= int(S2) <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= int(S2) <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
number = input()
number_list = list(number)

forward = number_list[0] + number_list[1]
back = number_list[2] + number_list[3]
if int(forward) < 13 and int(forward) > 0 and int(back) < 13 and int(back) > 0:
    print("AMBIGUOUS")
elif int(forward) < 13 and int(forward) > 0:
    print("MMYY")
elif int(back) > 0 and int(back) < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

mmyy = False
yymm = False
if 0 < a < 13:
    mmyy = True

if 0 < b < 13:
    yymm = True

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

Submission status: Accepted

Solution code:
argS = input()
argS1 = int(argS[0:2])
argS2 = int(argS[2:4])

if argS1 > 0 and argS1 < 13:
  flgMM1 = True
else:
  flgMM1 = False

if argS2 > 0 and argS2 < 13:
  flgMM2 = True
else:
  flgMM2 = False

if flgMM1 == True and flgMM2 == False:
  ans = "MMYY"
elif flgMM1 == False and flgMM2 == True:
  ans = "YYMM"
elif flgMM1 == True and flgMM2 == True:
  ans = "AMBIGUOUS"
else:
  ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=str(input())
a=int(n[:2])
b=int(n[2:])
ans="NA"
flag=0
if(a<=12 and a>=1):
    ans="MMYY"
    flag+=1
if(b<=12 and b>=1):
    ans="YYMM"
    flag+=1
if(flag==2):
    ans="AMBIGUOUS"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3
import sys

def main():
    s = input()

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

    if head > 0 and head <= 12:
        # head can be MM
        if tail > 0 and tail <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    elif tail > 0 and tail <= 12:
        # tail can be MM
        if head > 0 and head <= 12:
            print('AMBIGUOUS')
        else:
            print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input().strip()
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 = list(input())
Y = 0
M = 0
intS = []
for i in range(len(s)):
    intS.append(int(s[i]))



if 0 < 10*intS[0]+intS[1] <= 12:
    M = 1

if 0 < 10*intS[2]+intS[3] <= 12:
    Y = 1

if M == 1 and Y == 0:
    print("MMYY")

elif M == 0 and Y == 1:
    print("YYMM")

elif M == 1 and Y == 1:
    print("AMBIGUOUS")

else:
    print("NA")

Submission status: Accepted

Solution code:
a = input()

former = a[:2]
latter = a[2:]

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

if(former in months and latter in months):
	print('AMBIGUOUS')
elif(former in months and latter not in months):
	print('MMYY')
elif(former not in months and latter in months):
	print('YYMM')
elif(former not in months and latter not in months):
	print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
c = list(input())

first = int(c[0]+c[1])
last = int(c[2]+c[3])

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

Submission status: Accepted

Solution code:
def decide(a, b):
    a_is_month = False
    b_is_month = False

    if a >= 1 and a <= 12:
        a_is_month = True

    if b >= 1 and b <= 12:
        b_is_month = True

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

s = input()

f, e = s[:2], s[2:]

decide(int(f), int(e))

Submission status: Accepted

Solution code:
def yymm(s):
    a = s[:2]
    b = s[2:]
    if (int(a)<=12 and int(a)>=1) and (int(b)<=12 and int(b)>=1):
        return 'AMBIGUOUS'
    if (int(a)<=12 and int(a)>=1) and (int(b)>12 or int(b)<1):
        return 'MMYY'
    if (int(b)<=12 and int(b)>=1) and (int(a)>12 or int(a)<1):
        return 'YYMM'
    else:
        return 'NA'
s = input()
print(yymm(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

a, b = int(str(''.join(S[:2]))), int(str(''.join(S[2:])))
if a == 0 and b == 0:
  print('NA')
elif a == 0 and b <= 12:
  print('YYMM')
elif a <= 12 and b == 0:
  print('MMYY')
elif a == 0 and b > 12:
  print('NA')
elif b == 0 and a > 12:
  print('NA')
elif a > 12 and b > 12:
  print('NA')
elif a <= 12 and b <= 12:
  print('AMBIGUOUS')
elif a <= 12 and b > 12:
  print('MMYY')
elif a > 12 and b <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = str(input())

FF = S[:2]
SS = S[2:]

if(int(FF)<13 and int(FF) >0):
    if(int(SS)<13 and int(SS) > 0):
        print("AMBIGUOUS")
        
    else:
        print("MMYY")
        
elif(int(SS)<13 and int(SS)>0):
    print("YYMM")
    
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = input()
front = int(s[0:2])
back = int(s[2:])

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

Submission status: Accepted

Solution code:
s = input()
mae = s[0] + s[1]
usiro = s[2] + s[3]

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

maeOK = mae in monthexe
usiroOK = usiro in monthexe

if maeOK:
  if usiroOK:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if usiroOK:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

AA = S[:2]
BB = S[2:]
a = []
for i in range(1, 13):
    if 1 <= i <= 9:
        a.append('0' + str(i))
    else:
        a.append(str(i))
if not AA in a and not BB in a:
    print('NA')
elif AA in a and BB in a:
    print('AMBIGUOUS')
elif AA in a:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
head = int(s[:2])
back = int(s[2:])
if 1<= head <= 12: # <- YY?? or MM??
    if 1<= back <= 12: # <- YYMM or MMYY
        print("AMBIGUOUS")
    else: # <- MMYY
        print("MMYY")
else: # <- YY??
    if 1<= back <= 12: # <- YYMM
        print("YYMM")
    else: # <- YYYY
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def YorM(i):
  if 1 <= i and i <= 12:
    return "b"
  elif i < 1 or 12 < i:
    return "y"
  else:
    return "n"
  
isA = YorM(A)
isB = YorM(B)

if isA == "n" or isB == "n":
  print("NA")
elif isA == "b" and isB == "b":
  print("AMBIGUOUS")
elif isA == "y" and isB == "y":
    print("NA")
elif isA == "y":
  print("YYMM")
else:
  print("MMYY")

Submission status: Accepted

Solution code:
S=input()
a=int(S[:2])
b=int(S[2:])
YYMM,MMYY=False,False
if 1<=a<=12:
  MMYY=True
if 1<=b<=12:
  YYMM=True
if YYMM and MMYY:
  print("AMBIGUOUS")
if YYMM and not MMYY:
  print("YYMM")
if not YYMM and MMYY:
  print("MMYY")
if not YYMM and not MMYY:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

inputs = input()
AA = int(inputs[:2])
BB = int(inputs[2:])

if (AA == 0 or AA > 12) and (BB == 0 or BB > 12):
    print('NA')
elif AA == 0 or AA > 12:
    print('YYMM')
elif BB == 0 or BB > 12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
if '01' <= s[:2] <= '12':
    if '01' <= s[2:] <= '12':
        exit(print('AMBIGUOUS'))
    else:
        exit(print('MMYY'))
else:
    if '01' <= s[2:] <= '12':
        exit(print('YYMM'))
print('NA')

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = list(input())
head = int(S[0] + S[1])
tail = int(S[2] + S[3])
minN = min(head, tail)
maxN = max(head, tail)
if 1 <= maxN and maxN <= 12 and 1 <= minN and minN <= 12:
    print("AMBIGUOUS")
    exit()
elif (maxN <= 0 or 13 <= maxN) and (minN <= 0 or 13 <= minN):
    print("NA")
    exit()
if (head == 0 or head >= 13) and 1 <= tail and tail <= 12:
    print("YYMM")
elif 1 <= head and head <= 12 and (tail >= 13 or tail == 0):
    print("MMYY")

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 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())

    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s,)


def solve(s):

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

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

    def yy(x):
        return 0 <= x and x <= 99

    result = "NA"
    if mm(a) and mm(b):
        result = "AMBIGUOUS"
    elif mm(a) and yy(b):
        result = "MMYY"
    elif yy(a) and mm(b):
        result = "YYMM"

    return result


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Accepted

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