Problem:


Score : 200 points

Problem Statement

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

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

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

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

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

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

Sample Input 1

1905

Sample Output 1

YYMM

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

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

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

Sample Input 3

1700

Sample Output 3

NA

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



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S=input()

A=int(S[:2])
B=int(S[2:])
mA=False
mB=False
if 1<=A<=12:
    mA=True
if 1<=B<=12:
    mB=True

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

Submission status: Accepted

Solution code:
S = list(input())

Sa = int(S[0]+S[1])
Sb = int(S[2]+S[3])

if 0<Sa<13:
    if 0<Sb<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0<Sb<13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
sd = s%100
su = s//100
if sd >= 13 or sd == 0 :
    if su >= 13 or su == 0:
        print("NA")
    else :
        print("MMYY")
else :
    if su >= 13 or su == 0 :
        print("YYMM")
    else :
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s=input()
f=s[:2]
t=s[2:]
f=int(f)
t=int(t)
flagMM = 0
flagYY = 0
if 1<=f and f<=12:
    flagMM=1
if 1<=t and t<=12:
    flagYY=1
if flagMM and flagYY:
    print("AMBIGUOUS")
elif flagMM:
    print("MMYY")
elif flagYY:
    print("YYMM")
else:
     print("NA")

Submission status: Accepted

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

if int(S[0]+S[1]) > 12 and int(S[2]+S[3]) > 12: 
    print("NA")
elif int(S[0]+S[1]) > 12 and int(S[2]+S[3]) == 0:
    print("NA")
elif int(S[0]+S[1]) == 0 and int(S[2]+S[3]) > 12:
    print("NA")
elif int(S[0]+S[1]) == 0 and int(S[2]+S[3]) == 0:
    print("NA")
elif int(S[0]+S[1]) > 12 or int(S[0]+S[1]) == 0 :
    print("YYMM")
elif int(S[2]+S[3]) > 12 or int(S[2]+S[3]) == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if 1 <= int(s[: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:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    S = input_raw[0]
    X = int(S[:2])
    Y = int(S[2:])
    if((1 <= X and  X <= 12) and (1 <= Y and  Y <= 12)):
        print "AMBIGUOUS"
    elif(1 <= X and  X <= 12) :
        print "MMYY"

    elif(1 <= Y and  Y <= 12):
        print "YYMM"
    else:
        print "NA"

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
strings = input()

#YYMMの検討
def can_yymm(strings):
    mm = int(strings[2:])
    if mm >= 1 and mm <= 12:
        return True
    else:
        return False

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

if can_yymm(strings) and not can_mmyy(strings):
    print('YYMM')
elif not can_yymm(strings) and can_mmyy(strings):
    print('MMYY')
elif can_yymm(strings) and can_mmyy(strings):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=str(input())

A=[int(S[0]+S[1]),int(S[2]+S[3])]
if (A[0]>0 and A[0]<=12) and (A[1]>0 and A[1]<=12):
    print('AMBIGUOUS')
elif (A[0]==0 or A[0]>12) and (A[1]>0 and A[1]<=12):
    print('YYMM')
elif (A[0]>0 and A[0]<=12) and (A[1]==0 or A[1]>12):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=str(input())
head = s[:2]
tail = s[2:]

yymm = False
mmyy = False

if (int(tail)>0)&(int(tail)<=12):
    yymm = True

if (int(head)>0)&(int(head)<=12):
    mmyy = True
    
if (yymm == True)&(mmyy == True):
    print("AMBIGUOUS")
elif (yymm == True):
    print("YYMM")
elif (mmyy == True):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

mae = S[0:2]
ush = S[2:4]

mon = {"01","02","03","04","05","06","07","08","09","10","11","12"}

if (mae in mon) and (ush in mon):
    print("AMBIGUOUS")
if (mae not in mon) and (ush in mon):
    print("YYMM")
if (mae in mon) and (ush not in mon):
    print("MMYY")
if (mae not in mon) and (ush not in mon):
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
first = int(s[:2])
second = int(s[2:])
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()
flag_a = False
flag_b = False
if 0 < int(S[:2]) <= 12:
  flag_a = True
if 0 < int(S[2:]) <=12:
  flag_b = True
  
if flag_a and flag_b:
  print("AMBIGUOUS")
else:
  if flag_a:
    print("MMYY")
  elif flag_b:
    print("YYMM")
  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 (b > 12 or b <= 0) and (a > 12 or a <= 0):
    print('NA')
elif 12 >= b >= 1 and 12 >= a >= 1:
    print('AMBIGUOUS')
elif 12 >= a >= 1:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
S=raw_input()
YY=int( S[:2] )
MM=int( S[2:] )

if 1<=YY<=12 and 1<=MM<=12:
	print "AMBIGUOUS"
elif 0<=YY<=99 and 1<=MM<=12:
	print "YYMM"
elif 1<=YY<=12 and 0<=MM<=99:
	print "MMYY"
else:
	print "NA"

Submission status: Accepted

Solution code:
DATE = input()
a = int(DATE[0:2])
b = int(DATE[2:4])
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()
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().rstrip()
front = int(s[:2])
back = int(s[2:])

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

Submission status: Accepted

Solution code:
S=input()

first=int(S[0:2])
second=int(S[2:4])

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

Submission status: Accepted

Solution code:
S = list(input())

A = int(''.join(S[:2]))
B = int(''.join(S[2:]))

def main():
	if (A > 0 and A <= 12) and (B > 0 and B <= 12):
		print("AMBIGUOUS")
		return
	if B > 0 and B <= 12:
		print("YYMM")
		return
	if A > 0 and A <= 12:
		print("MMYY")
		return
	print("NA")
if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def input_from_console():
    s = input().rstrip()
    return s


def main():
    def check_mm(mm):
        if mm >= '01' and mm <= '12':
            return True
        return False
    s = input_from_console()
    e1 = check_mm(s[:2])
    e2 = check_mm(s[2:])
    if e1 == True and e2 == False:
        print('MMYY')
    elif e1 == False and e2 == True:
        print('YYMM')
    elif e1 == True and e2 == True:
        print('AMBIGUOUS')
    else:
        print('NA')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

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

f1 = 0
f2 = 0
if s1 in range(1, 13):
    f1 = 1

if s2 in range(1, 13):
    f2 = 1

if f1 == 1 and f2 == 1:
    print("AMBIGUOUS")
elif f1 == 1 and f2 == 0:
    print("MMYY")
elif f1 == 0 and f2 == 1:
    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()
h = int(s[0:2])
is_mmyy = (h >= 1) & (h <= 12)
t = int(s[2:4])
is_yymm = (t >= 1) & (t <= 12)

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

Submission status: Accepted

Solution code:
s = input()
tmp = 0
test1 = int(s[0]+s[1])
test2 = int(s[2]+s[3])

if test2 > 0 and test2 <= 12:
    #YYMM
    tmp += 1
if test1 > 0 and test1 <= 12:
    tmp += 2
if tmp == 3:
    print("AMBIGUOUS")
elif tmp == 2:
    print("MMYY")
elif tmp == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys

a = []
for l in sys.stdin:
    a.append(l)

_input = a[0]

def is_month(x):
    # x: 2桁の数字
    if 12 >= x > 0:
        return True
    else:
        return False


input_l = int(_input[:2])
input_r = int(_input[2:])

if is_month(input_l):
    if is_month(input_r):
        result = 'AMBIGUOUS'
    else:
        result = 'MMYY'
else:
    if is_month(input_r):
        result = 'YYMM'
    else:
        result = 'NA'

print(result)

Submission status: Accepted

Solution code:
s = input()
pre = int(s[:2])
pos = int(s[2:])
if 1 <= pre <= 12:
    if 1 <= pos <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<= pos <= 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:
    print('MMYY')
elif 0<b<=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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


def mm(s):
    if int(s) <= 12 and 1 <= int(s):
        return True
    return False


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())  #数値入力
f = s//100
l = s%100

# YY:0 both:1
def detect_yymm(num):
    if (num >=1) & (num <= 12):
        return 1
    else:
        return 0
    
if (detect_yymm(f) == 0) & (detect_yymm(l) == 1):
    print('YYMM')
elif (detect_yymm(f) == 1) & (detect_yymm(l) == 0):
    print('MMYY')
elif (detect_yymm(f) == 1) & (detect_yymm(l) == 1):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = str(input())
months = ['01','02','03','04','05','06',
          '07','08','09','10','11','12']
front = S[:2]
back = S[2:]

if front in months and back in months:
    print("AMBIGUOUS")
elif (front not in months) and (back in months):
    print("YYMM")
elif (front in months) and (back not in months):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
MM = ('01','02','03','04','05','06','07','08','09','10','11','12')

S = str(input())

bool_MMYY = False
bool_YYMM = False
if S[:2] in MM:
  bool_MMYY = True
if S[2:] in MM:
  bool_YYMM = True

if bool_MMYY and bool_YYMM:
  ans = 'AMBIGUOUS'
elif bool_MMYY and (not bool_YYMM):
  ans = 'MMYY'
elif (not bool_MMYY) and bool_YYMM:
  ans = 'YYMM'
elif (not bool_MMYY) and (not bool_YYMM):
  ans = 'NA'
  
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

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

def yy(n):
    return 0 <= n <= 99

if mm(f) and mm(b) or mm(b) and mm(f):
    print("AMBIGUOUS")
elif mm(f) and yy(b):
    print("MMYY")
elif mm(b) and yy(f):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:

"""                         
Beautiful is better than ugly.
    Explicit is better than implicit.
Simple is better than complex.
    Complex is better than complicated.
Flat is better than nested.
    Sparse is better than dense.
                    
    * Readability counts *

 // Author : raj1307 - Raj Singh
 // Date   : 19.05.19

"""

from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()
    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect_left,bisect_right
#from decimal import *,threading

abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod,MOD=1000000007,998244353
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[0] 
def sort2(l):return sorted(l, key=getKey)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]

def powerMod(x,y,p):
    res = 1
    x %= p
    while y > 0:
        if y&1:
            res = (res*x)%p
        y = y>>1
        x = (x*x)%p1
    return res

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
    
def isPrime(n) : # Check Prime Number or not 
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
    return True


# For getting input from input.txt file 
#sys.stdin = open('input.txt', 'r')  
  
# Printing the Output to output.txt file 
#sys.stdout = open('output.txt', 'w') 

def main():
    
    
    s=si()
    a=s[0]+s[1]
    a=int(a)
    b=s[2]+s[3]
    b=int(b)
    
   
    
    if (a>0 and a<=12) and (b>0 and b<=12):
        print('AMBIGUOUS')
    
    elif (a>0 and a<=12):
        print('MMYY')
    
    elif (b>0 and b<=12):
        print('YYMM')
    
    else:
        print('NA')




# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()
    #dmain()

Submission status: Accepted

Solution code:
a = input()
p, q = int(a[:2]), int(a[2:])
if 0<p<13 and 0<q<13:
    print("AMBIGUOUS")
elif 0<p<13:
    print("MMYY")
elif 0<q<13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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


def main():
    s = input()
    mm = ['{:0>2}'.format(i+1) for i in range(12)]
    d = 0
    if s[:2] in mm:
        d += 2
    if s[2:] in mm:
        d += 1
    ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
    print(ans[d])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())

f = 0
if 1 <= int(''.join(s[:2])) <= 12:
    f |= 1
if 1 <= int(''.join(s[2:])) <= 12:
    f |= 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_month(value):
    return 1 <= value and value <= 12

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


if A:
    if B:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if B:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

first = s[0:2]
second = s[2:]

def flg(s):
  if int(s) <= 12 and int(s) > 0:
    return 0
  else:
    return 1

f1 = flg(first)
f2 = flg(second)

if f1 == 0 and f2 == 1:
  print("MMYY")
if f1 == 1 and f2 == 0:
  print("YYMM")
if f1 == 0 and f2 == 0:
  print("AMBIGUOUS")
if f1 == 1 and f2 == 1:
  print("NA")

Submission status: Accepted

Solution code:
S = input()
pre = int(S[:2])
post = int(S[2:])
preM = pre > 0 and pre < 13
postM = post > 0 and post < 13
if preM and postM:
  print('AMBIGUOUS')
elif preM:
  print('MMYY')
elif postM:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()


word = S

front = S[:2]
back = S[2:]

front_mm = False
if 1 <= int(front)  and int(front) <= 12:
    front_mm = True

back_mm = False
if 1 <= int(back)  and int(back) <= 12:
    back_mm = True

if front_mm and back_mm:
    print('AMBIGUOUS')
if not front_mm and back_mm:
    print('YYMM')
if front_mm and not back_mm:
    print('MMYY')
if not front_mm and not back_mm:
    print('NA')

Submission status: Accepted

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

type = 0;
if(S[0:2] in MM):
  type += 1
if(S[2:] in MM):
  type += 2

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

Submission status: Accepted

Solution code:
S = input()

left = int(S[:2])
right = int(S[2:])
if left == 0:
  if 0 < right <= 12:
    print("YYMM")
  else:
    print("NA")
else:
  if left > 12:
    if 0 < right < 13:
      print("YYMM")
    else:
      print("NA")
  elif left > 0:
    if 0 < right < 13:
      print("AMBIGUOUS")
    else:
      print("MMYY")

Submission status: Accepted

Solution code:
def ok(n):
    if n > 0 and n < 13:
        return True
    else:
        return False

s = list(input())
a = int(''.join(s[:2]))
b = int(''.join(s[2:]))
if ok(a) and ok(b):
    print('AMBIGUOUS')
elif ok(a):
    print('MMYY')
elif ok(b):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

foward = int(S[0 : 2])
back = int(S[2 : 4])

foward_MM = False
back_MM = False

if foward >= 1 and foward <= 12:
  foward_MM = True
if back >= 1 and back <= 12:
  back_MM = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
former = int(s[:2])
latter = int(s[2:])

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

Submission status: Accepted

Solution code:
s = input()
c, d = 0, 0
if '01' <= s[:2] <= '12':
    c = 1
if '01' <= s[2:] <= '12':
    d = 1

if c == d == 0:
    print('NA')
if c == d == 1:
    print('AMBIGUOUS')
if c == 0 and d == 1:
    print('YYMM')
if c == 1 and d == 0:
    print('MMYY')

Submission status: Accepted

Solution code:
S = 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:
def main():
    S = input()
    if 1 <= int(S[: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')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
str = input()

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

mae = str[0:2]
ushiro = str[2:]

if mae in mm and ushiro in mm:
    print('AMBIGUOUS')
elif mae in mm:
    print('MMYY')
elif ushiro in mm:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

S = SI().strip()

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

YYMM, MMYY = False, False
if S[:2] in months:
    MMYY = True

if S[2:] in months:
    YYMM = True

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 math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right; sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

s = s()
if s[0:2] == "00":
    if "01" <= s[2:4] <= "12":
        print("YYMM")
    else:
        print("NA")
elif "01" <= s[0:2] <= "12":
    if s[2:4] == "00":
        print("MMYY")
    elif "01" <= s[2:4] <= "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif "13" <= s[0:2] <= "99":
    if s[2:4] == "00":
        print("NA")
    elif "01" <= s[2:4] <= "12":
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def task_b():
    ss = input().strip()
    a = int(ss[:2])
    b = int(ss[2:])
    if 1 <= a <= 12 and 1 <= b <= 12:
      	print('AMBIGUOUS')
    elif 1 <= a <= 12 and not 1 <= b <= 12:
      	print('MMYY')
    elif not 1 <= a <= 12 and 1 <= b <= 12:
    	print('YYMM')
    else:
    	print('NA')
task_b()

Submission status: Accepted

Solution code:
S = list(input())
A = int(S[0] + S[1])
B = int(S[2] + S[3])

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[:2])
b=int(s[2:])
if 1<=a & a<=12:
    if 1<=b & b<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=b & b<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s=input()

n1=int(s[:2])
n2=int(s[2:])

if 0<n1<=12 and 0<n2<=12:
    print("AMBIGUOUS")
elif 0<n1<=12:
    print("MMYY")
elif 0<n2<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
HD = int(S[0:2])
TL = int(S[2:])

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

Submission status: Accepted

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

import sys

input = sys.stdin.readline

def main():
    s = input()
    if is_m(s[0:2]) and is_m(s[2:4]):
        print("AMBIGUOUS")
    elif is_m(s[0:2]) and not is_m(s[2:4]):
        print("MMYY")
    elif not is_m(s[0:2]) and is_m(s[2:4]):
        print("YYMM")
    else:
        print("NA")

# y の可能性もある
def is_m(i):
    n = int(i)
    return 0 < n and n <= 12

main()