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 = list(input())
left = int( s[0]+s[1] )
right = int( s[2]+s[3] )

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

Submission status: Accepted

Solution code:
def mmok(i):
    return 1 <= i <= 12


S = input()
h = int(S[:2])
l = int(S[2:])

if mmok(h):
    if mmok(l):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if mmok(l):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
S_first_half = int(S[0:2])
S_last_half = int(S[2:5])

if 1 <= S_first_half <= 12:
    if 1 <= S_last_half <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1 <= S_last_half <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def solve():
    s = input()
    first_harf = int(s[:2])
    second_harf = int(s[2:])

    if first_harf == 0 or first_harf > 12:
        if second_harf == 0 or second_harf > 12:
            print('NA')
        else:
            print('YYMM')
    else:
        if second_harf == 0 or second_harf > 12:
            print('MMYY')
        else:
            print('AMBIGUOUS')

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = int(input())
judge = '0'

k = s % 100
z = (s - k)/100

if 0 < z <= 12:
    judge = '1'
if 0 < k <= 12:
    judge += '1'
else:
    judge += '0'

if judge == '00':
    print('NA')
elif judge == '01':
    print('YYMM')
elif judge == '10':
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

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

if (p > 12 or p == 0) and (s <= 12 and s > 0):
  print("YYMM")
elif (p > 0 and p <= 12) and (s > 12 or s == 0):
  print("MMYY")
elif p < 13 and s < 13 and p > 0 and s > 0:
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=int(input())
a=S//100;b=S%100
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()
pre=int(S[:2])
post=int(S[2:])
if 1<=pre<=12:
    if 1<=post<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=post<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    yy = int(s[:2])
    mm = int(s[2:])
    if 1 <= mm <= 12 and 1 <= yy <= 12:
        print("AMBIGUOUS")
    elif 1 <= mm <= 12:
        print("YYMM")
    elif 1 <= yy <= 12:
        print("MMYY")
    else:
        print("NA")


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

ans = 0
if s[0] < 1 or s[0] > 12:
    ans += 1
if s[1] < 1 or s[1] > 12:
    ans += 2

p = ['AMBIGUOUS', 'YYMM', 'MMYY', 'NA']
print(p[ans])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = input().rstrip()
    flag1 = True if 0 < int(''.join(S[:2])) <= 12 else False
    flag2 = True if 0 < int(''.join(S[2:])) <= 12 else False
    
    if flag1 and flag2: print('AMBIGUOUS')
    elif flag1 and not flag2: print('MMYY')
    elif not flag1 and flag2: print('YYMM')
    else: print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

head = S[:2]
tail = S[2:]

is_yymm = True
is_mmyy = True

if head == "00" or head >= "13":
    is_mmyy = False

if tail == "00" or tail >= "13":
    is_yymm = False

if is_yymm and is_mmyy:
    print("AMBIGUOUS")
elif is_yymm:
    print("YYMM")
elif is_mmyy:
    print("MMYY")
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 1 <= a <=12 and (b == 0 or b >=13):
         print("MMYY")
elif 1 <= b <=12 and (a == 0 or a >=13):
         print("YYMM")
else:
         print("NA")

Submission status: Accepted

Solution code:
S = input()
A, B = int(S[:2]), int(S[2:])
MMp = lambda x: 1 if x<=12 and x!=0 else 0
print(["NA","YYMM","MMYY","AMBIGUOUS"][MMp(A)*2+MMp(B)])

Submission status: Accepted

Solution code:
S = list(input())
N = [int(i) for i in S]
A = N[0]*10+N[1] in range(1,13)
B = N[2]*10+N[3] in range(1,13)
if(A):
  print("AMBIGUOUS") if(B) else print("MMYY")
elif(B):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
before = s[0:2]
after = s[2:4]

b = 0<int(before)<13
a = 0<int(after)<13

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

Submission status: Accepted

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

s = raw_input()

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

frstMM = first <= 12 and first > 0
scndMM = second <= 12 and second > 0

if frstMM and scndMM:
    print "AMBIGUOUS"
elif frstMM:
    print "MMYY"
elif scndMM:
    print "YYMM"
else:
    print "NA"

Submission status: Accepted

Solution code:
s=str(input())

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

flag1,flag2 = False,False

if   1 <= s2 <= 12:
      flag1 = True

if 1 <= s1 <= 12:
      flag2 = True

if flag1 == True:
      if flag2 == True:
            print("AMBIGUOUS")
      else:
            print("YYMM")
elif flag2 == True:
      print("MMYY")
else:
      print("NA")

Submission status: Accepted

Solution code:
s = input()

flagym = 0
flagmy = 0

if 0<int(s[0:2])<= 12:
    flagmy = 1 
if 0<int(s[2:])<= 12:
    flagym = 1

if flagym ==1:
    if flagmy == 1:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if flagmy == 1:
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = list(input())
judge_yymm = 0
judge_mmyy= 0

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

Submission status: Accepted

Solution code:
S = input()
#YYMMformat
YYMM_yy = int(S[0]) * 10 + int(S[1])
YYMM_mm = int(S[2]) * 10 + int(S[3])
YYMM = False
MMYY = False
AM = False
NA = False
if YYMM_yy > 12:
    YYMM = True
elif YYMM_mm > 12:
    MMYY = True
elif YYMM_yy != 0 and YYMM_mm != 0:
    AM = True
if YYMM_yy == 0:
    YYMM = True
elif YYMM_mm == 0:
    MMYY = True
if YYMM_yy == 0 and YYMM_mm > 12:
    NA = True
elif YYMM_mm == 0 and YYMM_yy > 12:
    NA = True
elif YYMM_mm == 0 and YYMM_yy == 0:
    NA = True
elif YYMM_mm > 12 and YYMM_yy > 12:
    NA = True

if NA:
    print('NA')
elif AM:
    print('AMBIGUOUS')
elif YYMM:
    print('YYMM')
elif MMYY:
    print('MMYY')

Submission status: Accepted

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

def isM(x: int):
  if 1 <= x <= 12:
    return True
  else:
    return False

if isM(a) and isM(b):
  print("AMBIGUOUS")
elif isM(a) and not isM(b):
  print("MMYY")
elif not isM(a) and isM(b):
  print("YYMM")
elif not isM(a) and not isM(b):
  print("NA")

Submission status: Accepted

Solution code:
s = input()
s_header = int(s[0:2])
s_footer = int(s[2:4])




if s_header >=1 and s_header <=12 and s_footer >= 1 and s_footer <= 12 :
  print("AMBIGUOUS")
elif s_header >= 0 and s_footer >=1 and s_footer <=12:
  print("YYMM")
elif s_header >=1 and s_header <=12 and s_footer >= 0:
  print("MMYY")
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 = input()

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

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

Submission status: Accepted

Solution code:
s = input()

mmyy = 1 <= int(s[:2]) <= 12
yymm = 1 <= int(s[2:]) <= 12

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

def main():
    S = input()
    pre = int(S[0:2])
    suf = int(S[2:4])

    if pre >= 1 and pre <= 12 and suf >= 1 and suf <= 12:
        print('AMBIGUOUS')
        exit()
    elif pre >= 1 and pre <= 12:
        print('MMYY')
        exit()
    elif suf >= 1 and suf <= 12:
        print('YYMM')
        exit()
    else:
        print('NA')



if __name__ == '__main__':
    main()

Submission status: Accepted

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

month = [str(m).zfill(2) for m in range(1, 13)]
year = [str(y).zfill(2) for y in range(0, 100)]

if (left in year and right in year) and (left in month and right in month):
    print("AMBIGUOUS")
elif left in month and right in year:
    print("MMYY")
elif left in year and right in month:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a=int(s[0:2])
b=int(s[2:4])
ans=0
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 -*-

# input
S = input()

# solve
is_YYMM = False
is_MMYY = False

if '00' <= S[:2] and ('01' <= S[2:] and S[2:] <= '12'):
    is_YYMM = True
if ('01' <= S[:2] and S[:2] <= '12') and '00' <= S[2:]:
    is_MMYY = True

# output
if is_YYMM and is_MMYY:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = list(input())
def month(i):
  if 1 <= int(i) <=12:
    return True
  else:
    return False
a = month("".join(s[0:2]))
b = month("".join(s[2:4]))
if a and b:
  print('AMBIGUOUS')
elif not a and b:
  print('YYMM')
elif a and not b:
  print('MMYY')
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')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
if S[0]=='0' and S[1]!='0':
    if S[2]=='0' and S[3]!='0':
        print('AMBIGUOUS')
    elif S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2'):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif S[0]=='1' and(S[1]=='0' or S[1]=='1' or S[1]=='2'):
    if S[2]=='0' and S[3]!='0':
        print('AMBIGUOUS')
    elif S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2'):
        print('AMBIGUOUS')
    else:
        print('MMYY')
 
else:
    if S[2]=='0' and S[3]!='0':
        print('YYMM')
    elif S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2'):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S=int(input())

A=int(S/100)
B=int(S%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')
    elif B>=13:
        print('NA')
    elif B==0:
        print('NA')

Submission status: Accepted

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

if (0 < int(left) < 13) and (0 < int(right) < 13):
  print("AMBIGUOUS")
elif (0 < int(left) < 13) and ((int(right) >= 13) or (int(right) == 0)):
  print("MMYY")
elif ((int(left) >= 13) or (int(left) == 0)) and (0 < int(right) < 13):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
a,b,c,d=input()
ab=int(a)*10+int(b)
cd=int(c)*10+int(d)
if 1<=ab<=12:
  if 1<=cd<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=cd<=12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
X=input()
YM=0
MY=0
F=int(X[0] + X[1])
B=int(X[2] + X[3])
if 0<F<=12 :
    MY += 1
else:
    pass

if 0<B<=12 :
    YM += 1
else:
    pass

if YM == 1 and MY == 1 :
    print("AMBIGUOUS")
elif YM == 1 and MY == 0 :
    print("YYMM")
elif YM == 0 and MY == 1 :
    print("MMYY")
else :
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])
A = 10*S[0] + S[1]
B = 10*S[2] + S[3]
if (A == 0 or A >= 13) and (B == 0 or B >= 13):
    print("NA")
elif A == 0 or A >= 13:
    print("YYMM")
elif B == 0 or B >= 13:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
n = int(input())
zen = int(n // 100)
go = int(n % 100)
if zen and zen <= 12 and go and go <= 12:
  print("AMBIGUOUS")
elif zen and zen <= 12:
  print("MMYY")
elif go and go <= 12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s=input()
word=list(s)
flaga=0
flagb=0
if (s[0]=='0' and 1<=int(s[1])<=9) or (s[0]=='1' and 0<=int(s[1])<=2):
  flaga+=1
if (s[2]=='0' and 1<=int(s[3])<=9) or (s[2]=='1' and 0<=int(s[3])<=2):
  flagb+=1

if flaga==1 and flagb==1:
  print('AMBIGUOUS')
elif flaga==0 and flagb==1:
  print('YYMM')
elif flaga==1 and flagb==0:
  print('MMYY')
elif flaga==0 and flagb==0:
  print('NA')

Submission status: Accepted

Solution code:
S = input()

def month(a, b):
    c = 10*a+b
    if 0 < c <= 12:
        return "yes"
    else:
        return "no"
    
L = [int(S[i]) for i in range(4)]
if month(L[0], L[1]) == "yes":
    if month(L[2], L[3]) == "yes":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if month(L[2], L[3]) == "yes":
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()

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:
s = input()
if 0 < int(s[:2]) <= 12:
  if 0 < int(s[2:]) <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 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:])

if a==0 and b==0 :
    print("NA")
elif a > 13 and b > 13 :
    print("NA")
elif a * b ==0 and ( a > 13 or b > 13) :
    print("NA")
elif a <13 and b < 13 and a*b !=0:
    print("AMBIGUOUS")
elif 0 < a <13:
    print("MMYY")
elif 0 < b <13:
    print("YYMM")

Submission status: Accepted

Solution code:
N = input()
N = list(N)
# N = int(N)
# print(N)

ab = N[0] + N[1]
cd = N[2] + N[3]

# ab = int(ab)
# cd = int(cd)

if N[0] == 0:
  ab = ab.zfill(2)

if N[2] == 0:
  cd = cd.zfill(2)

# print(ab)
# print(cd)


if ab == "00" and cd == "00":
  print("NA")  

elif ab == "00" and int(cd) > 12:
  print("NA")  

elif int(ab) > 12 and cd == "00":
  print("NA")  

elif int(ab) > 12 and int(cd) > 12:
  print("NA")  

elif 13 > int(ab) > 0 and 13 > int(cd) > 0:
  print("AMBIGUOUS")

elif ab == "00" and 0 < int(cd) < 13:
  print("YYMM")

elif int(ab) > 12 and int(cd) < 13:
  print("YYMM")

elif 13 > int(ab) > 0 and int(cd) > 12:
  print("MMYY")

elif 0 < int(ab) < 13 and cd =="00":
  print("MMYY")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

head, tail = S[:2], S[2:]
if 1 <= int(head) <= 12:
    print("AMBIGUOUS" if 1 <= int(tail) <= 12 else "MMYY")
else:
    print("YYMM" if 1 <= int(tail) <= 12 else "NA")

Submission status: Accepted

Solution code:
ym = 0
my = 0

s = input()

hi = int(s[2:])
lo = int(s[:2])


def isym(l):
    if l == 0:
        return False
    if l <= 12:
        return True
    else:
        return False


ym = 0
my = 0
if isym(hi):
    ym = 1
if isym(lo):
    my = 1

if ym == 1 and my == 1:
    print('AMBIGUOUS')
if ym == 1 and my == 0:
    print('YYMM')
if ym == 0 and my == 1:
    print('MMYY')
if ym == 0 and my == 0:
    print('NA')

Submission status: Accepted

Solution code:
a,b,c,d=input()
if a=='0'and b!='0'or a=='1'and b in['0','1','2']:
    if c=='0'and d!='0'or c=='1'and d in['0','1','2']:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif c=='0'and d!='0'or c=='1'and d in['0','1','2']:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

forward = int(S[:2])
backward = int(S[2:])

if (1<=forward<=12) and (1<=backward<=12):
    print('AMBIGUOUS')
elif ((forward == 0) or (12 <= forward <= 99)) and (1<=backward<=12):
    print('YYMM')
elif ((backward == 0) or (12<=backward<=99)) and (1<=forward<=12):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

f = s[:2]
l = s[2:]

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

Submission status: Accepted

Solution code:
S = int(input())
kami = S//100
simo = S%100

if kami > 0 and kami < 13:
    kami = 1
else:
    kami = 0

if simo > 0 and simo < 13:
    simo = 1
else:
    simo = 0

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
first = int(s[0:2])
last = int(s[2:4])
if 0 < first <= 12:
    if 0 < last <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < last <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

my,ym = 0<int(s[:2])<13,0<int(s[2:])<13

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

Submission status: Accepted

Solution code:
def isMM(date):

    n_date= int(date)

    if 1 <= n_date <= 12:
        return True
    else:
        return False

def isYY(date):

    n_date = int(date)

    if 0 <= n_date <= 99:
        return True
    else:
        return False

def isYYMM(date):

    if isYY(date[0:2]) and isMM(date[2:4]):
        return True
    else:
        return False

def isMMYY(date):

    if isMM(date[0:2]) and isYY(date[2:4]):
        return True
    else:
        return False

def main(): 

    S = input()

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=input();l,r=int(n[:2])<1or int(n[:2])>12,int(n[2:])<1or int(n[2:])>12
if l and r:p="NA"
elif not(l or r):p="AMBIGUOUS"
elif l and not r:p="YYMM"
else:p="MMYY"
print(p)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(map(str, input()))
first=int("".join(s[:2]))
last=int("".join(s[2:]))

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

Submission status: Accepted

Solution code:
S = input()

my, ym = 0< int(S[:2]) <13, 0< int(S[2:]) <13

if my and ym:
	o = 'AMBIGUOUS'
elif my:
    o = 'MMYY'
elif ym:
	o = 'YYMM'
else:
	o = 'NA'
print(o)

Submission status: Accepted

Solution code:
s = list(map(int,list(input())))
ff = 10*s[0]+s[1]
ss = 10*s[2]+s[3]

if 0<=ff<=99 and 0<=ss<=99:
    if 1<=ff<=12:
        if 1<=ss<=12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 1<=ss<=12:
            print("YYMM")
        else:
            print("NA")
else:print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
List=list(input())
A="".join(List[:2])
B="".join(List[2:])
a=int(A)
b=int(B)
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
elif 1<=a<=12 and (b==0 or b>12):
    print("MMYY")
elif (a==0 or a>12) and 1<=b<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s0 = list(input())
s = []
for i in s0:
    s.append(i)
A = s[:2]
B = s[2:]
a = "".join(A)
b = "".join(B)
a = int(a)
b = int(b)
if 0<a<=12 and 0<b<=12:
  print("AMBIGUOUS")
elif (a>12 or a == 0) and 0<b<=12:
  print("YYMM")
elif 0<a<=12 and (b>12 or b==0):
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
x = 0

sf = s[:2]
sl = s[2:]

if (int(sf[0]) == 0 and int(sf[1]) != 0):
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 0:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 1:
    x += 1
if int(sf[0]) == 1 and int(sf[1]) == 2:
    x += 1


if (int(sl[0]) == 0 and int(sl[1]) != 0):
    x += 2

if int(sl[0]) == 1 and int(sl[1]) == 0:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 1:
    x += 2
if int(sl[0]) == 1 and int(sl[1]) == 2:
    x += 2

b = x

if b == 0:
  print('NA')
elif b == 3:
  print('AMBIGUOUS')
elif b == 1:
  print('MMYY')
elif b == 2:
  print('YYMM')

Submission status: Accepted

Solution code:
S=input()
F=int(S[:2]) > 0 and int(S[:2]) <13
B=int(S[2:]) > 0 and int(S[2:]) <13

print(['NA','YYMM','MMYY','AMBIGUOUS'][2*F+B])

Submission status: Accepted

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

aa = int(aa)
bb = int(bb)

if (aa > 12 and bb > 12):
    print ('NA')
if aa>12 and bb ==0:
    print ("NA")
if aa>12 and 1<=bb<=12:
    print ("YYMM")

if (0<aa<=12 and bb ==0) or (0<aa<=12 and bb>12):
    print ("MMYY")
if 0<aa<=12 and 0<bb<=12:
    print ("AMBIGUOUS")

if (aa == 0 and bb ==0) or(aa ==0 and bb> 12):
    print ("NA")
if aa ==0 and 0< bb<=12:
    print ("YYMM")

Submission status: Accepted

Solution code:
s = input()

aa = int(s[0]+s[1])
bb = int(s[2]+s[3])

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

Submission status: Accepted

Solution code:
s = input()
a = 0
if s[:2] != '00' and s[:2] < '13':
  a += 1
if s[2:] != '00' and s[2:] < '13':
  a += 2
if a == 0:
  print('NA')
elif a == 1:
  print('MMYY')
elif a == 2:
  print('YYMM')
else:
  print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import accumulate
import sys
from heapq import heappush, heappop


def main():
    input = sys.stdin.readline
    S = input()
    a = int(S[:2])
    b = int(S[2:])
    if (a > 12 or a == 0) and 1 <= b <= 12:
        print('YYMM')
    elif 1 <= a <= 12 and (b > 12 or b == 0):
        print('MMYY')
    elif 1 <= a <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('NA')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def which(n):
    if 1 <= n <=12:
        return 'MM'
    else:
        return 'YY'

if which(a)== 'MM' and which(b)== 'MM':
    print('AMBIGUOUS')
elif which(a)=='YY' and which(b)=='YY':
    print('NA')
else:
    print(which(a) + which(b))