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()
S1=int(S[0:2])
S2=int(S[2:4])
if (S1==0 or S1>12) and (S2==0 or S2>12):print("NA");exit()
if (S1==0 or S1>12):print("YYMM");exit()
if (S2==0 or S2>12):print("MMYY");exit()
print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
s = input()
sl = list(map(int, [s[0:2],s[2:]]))
f,l = sl[0], sl[1]
if (f ==0 and (l ==0 or l >12)) or (l ==0 and (f==0 or f>12)) :
    print('NA')
elif (f>12 and l<13) or f==0:
    print('YYMM')
elif (f<13 and l>12) or l==0:
    print('MMYY')
elif f < 13 and l <13:
    print('AMBIGUOUS')
else:
  print('NA')

Submission status: Accepted

Solution code:
n=int(input())
a=n//100
b=n%100
if((a>12 or a==0) and b<13 and b>0):
  print("YYMM")
elif(a<13 and (b>12 or b==0) and a>0):
  print("MMYY")
elif(a<13 and b<13 and b>0 and a>0):
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import types

# Input
i = list(input())
r = int(i[0] + i[1])
l = int(i[2] + i[3])

# Process
out = ""
if 1 <= r & r <= 12:
    out += "MM"
else:
    out += "YY"

if 1 <= l & l <= 12:
    out += "MM"
else:
    out += "YY"

# Print
if out == "MMMM":
    print("AMBIGUOUS")
elif out == "YYYY":
    print("NA")
else:
    print(out)

Submission status: Accepted

Solution code:
S=list(input())
BE=[int(S[0]),int(S[1])]
AF=[int(S[2]),int(S[3])]
b_flag=0
a_flag=0
if BE[0] == 0 and BE[1]>=1:
    b_flag=1
if BE[0] == 1 and BE[1] <=2:
    b_flag=1
if AF[0] == 0 and AF[1]>=1:
    a_flag=1
if AF[0] == 1 and AF[1] <=2:
    a_flag=1
if a_flag ==1 and b_flag==1:
    print('AMBIGUOUS')
elif a_flag ==1:
    print('YYMM')
elif b_flag==1:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    S = single_input()
    YYMM = False
    MMYY = False
    if 1 <= int(S[2:]) <= 12: YYMM = True
    if 1 <= int(S[:2]) <= 12: MMYY = True

    if YYMM and MMYY: print("AMBIGUOUS")
    elif YYMM: print("YYMM")
    elif MMYY: print("MMYY")
    else: print("NA")
    return 0
  
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

	
if 0 <  int(a) <= 12 and 0 <  int(b) <= 12:

	print("AMBIGUOUS")
	sys.exit()


if int(a) >= 0 and 0 < int(b) <= 12:

	print("YYMM")
	sys.exit()
#１~12で0より上なら
if 0 < int(a) <= 12 and int(b) >= 0:

	print("MMYY")
	sys.exit()

print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ls=[int(c) for c in s]
#月,年
if ((ls[0]*10+ls[1]>12) or (ls[0]==0 and ls[1]==0)) and ((ls[2]*10+ls[3]>12) or (ls[2]==0 and ls[3]==0)):
    print("NA")
elif ((ls[0]*10+ls[1]>12) or (ls[0]==0 and ls[1]==0)):
    print("YYMM")
elif ((ls[2]*10+ls[3]>12) or (ls[2]==0 and ls[3]==0)):
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = input()
first = int(s[0:2])
last = int(s[2:4])

if 1 <= first <= 12:
    first_flag = 0
elif first > 12 or first == 0:
    first_flag = 1
else:
    first_flag = 2

if 1 <= last <= 12:
    last_flag = 0
elif last > 12 or last == 0:
    last_flag = 1
else:
    last_flag = 2

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def main():
    flg = 0
    answer = ['NA','AMBIGUOUS','YYMM','MMYY']
    data = list(input())
    front = data[0] + data[1]
    back = data[2] + data[3]
    front = int(front)
    back = int(back)
    if 1<=front<=12 and 1<=back<=12:
        flg = 1
    elif 0<=front<=99 and 1<=back<=12:
        flg = 2
    elif 1<=front<=12 and 0<=back<=99:
        flg = 3
    print(answer[flg])
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

Solution code:
S = input()
list = [(i + j) for (i,j) in zip(S[::2],S[1::2])]
if int(list[0]) >= 1 and int(list[0]) <= 12:
     if int(list[1]) >= 1 and int(list[1]) <= 12:
         print("AMBIGUOUS")
     else:
         print("MMYY")
else:
     if int(list[1]) >= 1 and int(list[1]) <= 12:       
         print("YYMM")
     else:
         print("NA")

Submission status: Accepted

Solution code:
S = input()

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


# 諸々の判定
if front == '00':
  out_front = 'NA'
elif int(front) >= 13:
  out_front = 'YY'
else:
  out_front = 'AMBIGUOUS'
  
if back == '00':
  out_back = 'NA'
elif int(back) >= 13:
  out_back = 'YY'
else:
  out_back = 'AMBIGUOUS'
  

## 出力結果
if out_front == 'NA' and out_back == 'AMBIGUOUS':
  out = 'YYMM'
elif out_front == 'NA' and out_back == 'YY':
  out = 'NA'  
elif out_front == 'AMBIGUOUS' and out_back == 'NA':
  out = 'MMYY'
elif out_front == 'YY' and out_back == 'NA':
  out = 'NA'
elif out_front == 'NA' and out_back == 'NA':
  out = 'NA'
elif out_front == 'YY' and out_back == 'YY':
  out = 'NA'
elif out_front == 'YY' and out_back == 'AMBIGUOUS':
  out =  'YYMM'
elif out_front == 'AMBIGUOUS' and out_back == 'YY':
  out =  'MMYY'
elif out_front == 'AMBIGUOUS' and out_back == 'AMBIGUOUS':
  out =  'AMBIGUOUS'
else:
  out = 'hoge'
  
print(out)

Submission status: Accepted

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

if front > 0 and front < 13:
    if back > 0 and back < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
        
else:
    if back > 0 and back < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
a=input()

P=a[-2:]
Q=a[0:2]

if int(P)<=12 and int(Q)<=12 and not int(P)==0 and not int(Q)==0:
    print('AMBIGUOUS')
elif (int(P)>12 or int(P)==0) and (int(Q)>=12 or int(Q)==0): 
    print('NA')
elif (int(P)<=12 and not int(P)==0 )and (int(Q)>=12 or int(Q)==0):
    print('YYMM')
elif (int(P)>=12 or int(P)==0) and (int(Q)<=12 and not int(Q)==0):
    print('MMYY')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s =input()
li = [(i+j) for (i,j) in zip(s[::2],s[1::2])]

if (int(li[0])>12)&(int(li[0])>0):
  if (int(li[1])>12)|(int(li[1])==0):
  	print('NA')
  else:
    print('YYMM')
elif int(li[0])==0:
  if int(li[1])==0:
    print('NA')
  else:
    print('YYMM')
else:
  if (int(li[1])>12)|(int(li[1])==0):
    print('MMYY')
  else:
    print('AMBIGUOUS')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = raw_input().strip()
a, b = S[0:2], S[2:]

ia = int(a)
ib = int(b)

if ib == 0:
    if ia >= 1 and ia <=12: 
        print('MMYY')
        exit()

if ia == 0:
    if ib >= 1 and ib <= 12:
        print('YYMM')
        exit()

if ia > 12:
    if ib > 12:
        print('NA')
    elif ib > 0:
        print('YYMM')
    else:
        print('NA')
elif ia >= 1:
    if ib >=1 and ib <= 12:
        print('AMBIGUOUS')
    elif ib > 12:
        print('MMYY')
    else:
        print('NA')
else:
    if ib == 0:
        print('NA')
    elif ib <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()


str12=int(S[0:2])
str34=int(S[2:4])

str12_enableMM = False
if 1 <= str12 and str12 <= 12:
    str12_enableMM = True

str34_enableMM = False
if 1 <= str34 and str34 <= 12:
    str34_enableMM = True



ans="NA"

if str12_enableMM is False:
    if str34_enableMM is False:
        pass
    else:
        ans = "YYMM"
else:
    if str34_enableMM is False:
        ans = "MMYY"
    else:
        ans = "AMBIGUOUS"

print(ans)

Submission status: Accepted

Solution code:
s = input()

s_list = [int(x) for x in list(s)]

a = s_list[0]*10+s_list[1]
b = s_list[2]*10+s_list[3]

form = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

YM=MY=False
if 0<B<=12: YM=True
if 0<A<=12: MY=True

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

Submission status: Accepted

Solution code:
def solve(s):
    if int(s[0:2]) == 0 and int(s[2:4]) == 0:
        print("NA")
        return 0
    if int(s[0:2]) > 12 and int(s[2:4]) > 12:
        print("NA")
        return 0
    if 0 < int(s[0:2]) < 13 and 0 < int(s[2:4]) < 13:
        print("AMBIGUOUS")
        return 0
    elif 0 < int(s[2:4]) < 13:
        print("YYMM")
        return 0
    elif 0 < int(s[0:2]) < 13:
        print("MMYY")
        return 0
    else:
        print("NA")
        return 0


if __name__ == "__main__":
    S = input()
    solve(S)

Submission status: Accepted

Solution code:
S = input()
A = int(S[0:2])
B = int(S[2:4])
Ayy = 0
Amm = 0
Byy = 0
Bmm = 0
if A == 0:
    Ayy = 1
elif A <= 12:
    Ayy = 1
    Amm = 1
else:
    Ayy = 1

if B == 0:
    Byy = 1
elif B <= 12:
    Byy = 1
    Bmm = 1
else:
    Byy = 1

if Amm:
    if Bmm:
        print('AMBIGUOUS')
    elif Byy:
        print('MMYY')
    else:
        print('NA')
elif Ayy:
    if Bmm:
        print('YYMM')
    else:
        print('NA')
else:
    print('NA')

Submission status: Accepted

Solution code:
import math
def judge(Y):
    year = int(Y)
    former = math.floor(year/100)
    latter = year%100
    if(former >= 1 and former <= 12):
        if(latter >= 1 and latter <= 12):
            return("AMBIGUOUS")
        elif(latter == 0 or latter > 12):
            return("MMYY")
    elif(former == 0 or former > 12):
        if(latter >= 1 and latter <= 12):
            return("YYMM")
        elif(latter == 0 or latter > 12):
            return("NA")

S = input()
print(judge(S))

Submission status: Accepted

Solution code:
s_format = input()

first2 = int(s_format[0]+s_format[1])

last2 = int(s_format[2]+s_format[3])

#print(first2, last2)


if 0 < first2 < 13 and 0 < last2 < 13:
    print("AMBIGUOUS")
elif 0 < first2 < 13 and last2 > -1:
    print("MMYY")
elif first2 > -1 and 0 < last2 < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input().strip()
m = int(S[:2])
n = int(S[2:])

res = None
if 1 <= m <= 12 and 1 <= n <= 12:
    res = 'AMBIGUOUS'
elif 1 <= m <= 12:
    res = 'MMYY'
elif 1 <= n <= 12:
    res = 'YYMM'
else: res = 'NA'

print(res)

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
a = list(input()) 
for i in range(len(a)):
    a[i] = int(a[i])
ue = a[0]*10 + a[1]
sita = a[2]*10 + a[3]
if (ue > 12) & (sita > 12):
    print('NA')
elif (ue <= 12) & (sita <= 12):
    if (sita + ue) == 0:
        print('NA')
    elif (ue == 0):
        print('YYMM')
    elif (sita == 0):
        print('MMYY')
    else:
        print('AMBIGUOUS')
elif ue > 12:
    if (sita <= 12) & (sita > 0):
        print('YYMM')
    else:
        print('NA')
elif sita > 12:
    if (ue <= 12) & (ue > 0):
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S=input()

left=int(S[:2])
right=int(S[2:])

YYMM=True
MMYY=True
AMBIGUOUS=True
NA=True


if left<=0 or left>12:
  MMYY=False
  AMBIGUOUS=False
else:
  NA=False
  
if right<=0 or right>12:
  YYMM=False
  AMBIGUOUS=False
else:
  NA=False


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

Submission status: Accepted

Solution code:
S = input()
ans = 0
#print(S[0:2], S[2:], int(S[0:2]), int(S[2:]))
if(0 < int(S[0:2]) and int(S[0:2]) <= 12) and (0 <= int(S[2:]) and (int(S[2:]) <= 99)):
    ans += 1
if(0 < int(S[2:]) and int(S[2:]) <= 12) and (0 <= int(S[0:2]) and (int(S[0:2]) <= 99)):
    ans += 2

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

Submission status: Accepted

Solution code:
S = input()

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

isYYMM = 1 <= b <= 12
isMMYY = 1 <= a <= 12

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

Submission status: Accepted

Solution code:
a=input()
i=0
n=[]
while i<len(a):
  n.append(a[i])
  i+=1
pd=n[0]+n[1]
sd=n[2]+n[3]
pd=int(pd)
sd=int(sd)
if sd==0 and pd==0:
  print('NA')
elif pd>12:
  if sd>=1 and sd<=12:
    print('YYMM')
  elif sd>12:
    print('NA')
  elif sd<1:
    print('NA')
elif pd==0:
  if sd>12:
    print('NA')
  elif sd>0 and sd<=12:
    print('YYMM')
elif pd<=12 and pd!=0:
  if sd>12:
    print ('MMYY')
  elif sd==0:
    print('MMYY')
  elif sd<=12 and sd!=0:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
import sys

S = input()

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

if S[0:2] == '00' or S[2:4] == '00':
    if 0 < A <= 12:
        print('MMYY')

    elif 0 < B <= 12:
        print('YYMM')
    else:
        print('NA')

else:
    if 12 < A and 12 < B:
        print('NA')

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

    elif 0 <= A and A <= 12:
        print('MMYY')

Submission status: Accepted

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

Submission status: Accepted

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

s = input()

a = []
for i in s:
    a.append(i)

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

c = a[2] + a[3]
c = int(c)

dec1 = 0
dec2 = 0

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

Submission status: Accepted

Solution code:
# MM : 1
# YYexcptMM : 2
# NONE : 3


def judge_category(i):
    if(1 <= i and i <= 12):
        return 1
    elif (0 <= i and i <= 99):
        return 2
    else:
        return 3


S = list(input())
left = int(S[0] + S[1])
right = int(S[2] + S[3])

a_l = judge_category(left)
a_r = judge_category(right)

if(a_l == 3 or a_r == 3):
    print("NA")
elif(a_l == 1 and a_r == 1):
    print("AMBIGUOUS")
elif(a_l == 1 and a_r == 2):
    print("MMYY")
elif(a_l == 2 and a_r == 1):
    print("YYMM")
elif(a_l == 2 and a_r == 2):
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

A = s[0:2]
B = s[2:4]

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

Submission status: Accepted

Solution code:
#coding: utf-8
S = input()
year = 99
month = 12
mae, ushiro = int(S[:2]), int(S[2:])
if 0 < mae <= month and 0 < ushiro <= month:
	print("AMBIGUOUS")
elif 0 < mae <= month and 0 <= ushiro <= year:
	print("MMYY")
elif 0 <= mae <= year and 0 < ushiro <= month:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()

mm = int(S[2:])
if mm == 0 or mm > 12:
    yymm = False
else:
    yymm = True

mm = int(S[:2])
if mm == 0 or mm > 12:
    mmyy = False
else:
    mmyy = True

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

Submission status: Accepted

Solution code:
S = int(input())
ans = "NA"
up2 = (S // 100) % 100
du2 = S % 100

if 0 < up2 < 13 and 0 < du2 < 13:
    ans = "AMBIGUOUS"
elif up2 > 12 and 0 < du2 < 13:
    ans = "YYMM"
elif du2 > 12 and 0 < up2 < 13:
    ans = "MMYY"
elif du2 == 0 and 0 < up2 < 13:
    ans = "MMYY"
elif up2 == 0 and 0 < du2 < 13:
    ans = "YYMM"
else:
    ans = "NA"

print(ans)

Submission status: Accepted

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

ans = "NA"
if (mae == 0 and ato > 12) or (mae > 12 and ato == 0) or (mae > 12 and ato > 12) or (mae == 0 and ato == 0):
    ans = "NA"
elif mae > 12 or mae == 0:
    ans = "YYMM"
elif ato > 12 or ato == 0:
    ans = "MMYY"
else:
    ans = "AMBIGUOUS"
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

first = int(N/100)
second = N - first*100

f_YY = False
s_YY = False
f_MM = False
s_MM = False

if 0 <= first and first <= 99:
    f_YY = True
if 0 <= second and second <= 99:
    s_YY = True
if 1 <= first and first <= 12:
    f_MM = True
if 1 <= second and second <= 12:
    s_MM = True
    
if (f_YY == True and s_MM == True) and\
    (f_MM == True and s_YY == True):
    print('AMBIGUOUS')
elif f_YY == True and s_MM == True:
    print('YYMM')
elif f_MM == True and s_YY == True:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

S = str(input())
f_half = int(S[0:2])
s_half = int(S[2:4])



if 0 < f_half and f_half <= 12 :
  if 0 < s_half and s_half <= 12 :
    print("AMBIGUOUS")
  else :
    print("MMYY")

else:
  if 0 < s_half and s_half <= 12 :
    print("YYMM")
  else :
    print("NA")

Submission status: Accepted

Solution code:
S = list(input())
S1 = int("".join(S[0:2]))
S2 = int("".join(S[2:4]))
 
if (12 >= S1 and S1 >= 1) and (12 >= S2 and S2 >= 1):
  print('AMBIGUOUS')
elif (12 >= S1 and S1 >= 1):
  print('MMYY')
elif (12 >= S2 and S2 >= 1):
  print('YYMM')
else :
  print('NA')

Submission status: Accepted

Solution code:
S = int(input())

after = S % 100
before = S //100

if after >31 and before > 31:
  print("NA")
else:
  if before <= 12 and before >0:
    if after <= 12 and after >0:
      print("AMBIGUOUS")
    else:
      print("MMYY")
  else:
    if after <= 12 and after > 0:
      print("YYMM")
    else:
      print("NA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# IMPORT ###############################################################################################################
import sys                                                      # システム
sys.setrecursionlimit(10**6)                                    # 再帰処理の上限変更
from collections import deque, Counter                          # キュー・個数カウント
from itertools   import accumulate, permutations, combinations  # 累積和・順列・組み合わせ
from operator    import itemgetter                              # ソート補助
from bisect      import bisect_left, bisect_right, bisect       # 二分探索
from heapq       import heappop, heappush                       # プライオリティキュー
from fractions   import gcd                                     # 最大公約数
from math        import ceil, floor, sqrt, cos, sin, tan, pi    # 数学処理
from copy        import deepcopy                                # オブジェクトコピー
import numpy         as np                                      # 数値計算

# MAIN #################################################################################################################
def main():
    # Init #############################################################################################################
    im = InputManager()
    # Input ############################################################################################################
    s = im.inputSingle(dtype=str)
    # Logic ############################################################################################################
    aa = int(s[0:2])
    bb = int(s[2:4])
    canYYMM = False
    canMMYY = False
    if (bb >= 1 and bb <= 12):
        canYYMM = True
    if (aa >= 1 and aa <= 12):
        canMMYY = True
    # Output ###########################################################################################################
    if (canYYMM and canMMYY):
        print("AMBIGUOUS")
    elif (canYYMM):
        print("YYMM")
    elif (canMMYY):
        print("MMYY")
    else:
        print("NA")
    # Return ###########################################################################################################
    return

# INPUT MANAGER ########################################################################################################
class InputManager(object):
    def __init__(self):
        pass

    @staticmethod
    def inputSingle(dtype=int):
        return dtype(input())
    
    @staticmethod
    def inputMultiple(dtype=int, aslist=False):
        if aslist:
            return list(map(dtype, input().split()))
        else:
            return map(dtype, input().split())

    @staticmethod
    def input2D(h, dtype=int):
        return [list(map(dtype, input().split())) for i in range(h)]

# CALL MAIN ############################################################################################################
main()

Submission status: Accepted

Solution code:
s = input()
a=s[0:2]
b=s[2:4]
if a =="00" or int(a)>12:
  if b=="01" or b=="02"or b=="03"or b=="04" or b=="05" or b=="06" or b=="07" or b=="08" or b=="09" or b=="10" or b=="11" or b=="12":
    print("YYMM")
  else:
    print("NA")
elif a=="01" or a=="02"or a=="03"or a=="04" or a=="05" or a=="06" or a=="07" or a=="08" or a=="09" or a=="10" or a=="11" or a=="12":
  if b=="01" or b=="02"or b=="03"or b=="04" or b=="05" or b=="06" or b=="07" or b=="08" or b=="09" or b=="10" or b=="11" or b=="12":
    print("AMBIGUOUS")
  else:
    print("MMYY")

Submission status: Accepted

Solution code:
S = str(input())

fw = S[:2]
bw = S[2:]

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



if fw in MList and bw in MList :
    print('AMBIGUOUS')
elif fw in MList :
    print('MMYY')
elif bw in MList :
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = list(input())

if (not(1 <= int(S[0])*10+int(S[1]) <= 12)) and (not(1 <= int(S[2])*10+int(S[3]) <= 12)):
    print('NA')

elif 1 <= int(S[0])*10+int(S[1]) <= 12:
    if not(1 <= int(S[2])*10+int(S[3]) <= 12):
        print('MMYY')
    else:
        print('AMBIGUOUS')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
try:
    s = input()

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

    if f == 00 or f > 12:
        if b == 00 or b > 12:
            print('NA')
        elif b < 13:
            print('YYMM')
    else:
        if b == 00 or b > 12:
            print('MMYY')
        elif b < 13:
            print('AMBIGUOUS')

except EOFError:
    pass

Submission status: Accepted

Solution code:
S = input()
Sf = int(S[:2])
Sb = int(S[2:])
F = 0 < Sf <= 12
B = 0 < Sb <= 12
if F and B:
    ans = 'AMBIGUOUS'
elif F and not B:
    ans = 'MMYY'
elif not F and B:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
s = input()
if ((int(s[2]) == 1 and int(s[3]) <= 2) or (int(s[2]) == 0 and int(s[3]) != 0)) and((int(s[0]) == 1 and int(s[1]) <= 2) or (int(s[0]) == 0 and int(s[1]) != 0)):
    print("AMBIGUOUS")
elif (int(s[0]) == int(s[1]) == int(s[2]) == int(s[3]) == 0) or (int(s[0]) >= 1 and int(s[1])>=3 and int(s[2])>=1 and int(s[3])>=3) or (int(s[0])==int(s[1])==0 and int(s[2])>=1 and int(s[3])>=3) or (int(s[2])==int(s[3])==0 and int(s[0]) >= 1 and int(s[1])>=3):
    print("NA")
elif (int(s[2]) == 1 and int(s[3]) <= 2) or (int(s[2]) == 0 and int(s[3]) != 0):
    print("YYMM")
elif (int(s[0]) == 1 and int(s[1]) <= 2) or (int(s[0]) == 0 and int(s[1]) != 0):
    print("MMYY")

Submission status: Accepted

Solution code:
S = list(input())
former = 0
latter = 0

if int(S[0]) == 0:
    former = int(S[1])
else:
    former = int(S[0]+S[1])


if int(S[2]) == 0:
    latter = int(S[3])
else:
    latter = int(S[2] + S[3])


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

Submission status: Accepted

Solution code:
s = input()
lst = [i for i in s]
left = "".join([lst[0], lst[1]])
right = "".join([lst[2], lst[3]])
left = int(left)
right = int(right)
if left > 12:
    if right > 12 or right == 0:
        print("NA")
    elif 0<right <13:
        print("YYMM")
elif 0<left<13:
    if right > 12:
        print("MMYY")
    elif 0<right<13:
        print("AMBIGUOUS")
    elif right == 0:
        print("MMYY")
elif left == 0:
    if 0 < right < 13:
        print("YYMM")
    elif right == 0 or right >12:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
first = int(S[0:2])
second = int(S[2:4])
if (1<=first<=12):
    if (1<=second<=12):
        print("AMBIGUOUS")
    elif (second==0 or second>12):
        print("MMYY")
elif (first==0):
    if (1<=second<=12):
        print("YYMM")
    elif(second==0 or second>12):
        print("NA")
elif (first>12):
    if (1<=second<=12):
        print("YYMM")
    elif (second==0 or second>12):
        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 = str(input())

S_1 = int(S[:2])
S_2 = int(S[2:])

if (S_1 <=12) and (S_2 <= 12) and (S_1 != 0) and (S_2 != 0):
    print('AMBIGUOUS')

elif (S_1 <= 12) and (S_2 > 12) and (S_1 != 0) and (S_2 != 0):
    print('MMYY')
elif (0 < S_1 <= 12) and (S_2 == 0):
    print('MMYY')

elif (S_1 > 12) and (S_2 <= 12) and (S_1 != 0) and (S_2 != 0):
    print('YYMM')
elif (S_1 == 0) and (0 < S_2 <= 12):
    print('YYMM')

elif (S_1 > 12) and (S_2 > 12) and (S_1 != 0) and (S_2 != 0):
    print('NA')
elif (S_1 == 0) or (S_2 == 0):
    print('NA')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S=input()


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



if A==0:
    if B==0:
        print("NA")
    elif 1<=B<=12:
        print("YYMM")
    elif 12<B:
        print("NA")
if 1<=A<=12:
    if B==0:
        print("MMYY")
    elif 1<=B<=12:
        print("AMBIGUOUS")
    elif 12<B:
        print("MMYY")
if 12<A:
    if B==0:
        print("NA")
    elif 1<=B<=12:
        print("YYMM")
    elif 12<B:
        print("NA")

Submission status: Accepted

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

#0,13<=x<=99で年だけ　1<=x<=12で年か月,　ほかはどっちか
def decide(x):
    if x==0 or 13<=x<=99:
        return 0  #年だけ
    elif 1<=x<=12:
        return 1  #どっちもある
f=decide(former)
l=decide(latter)
if f==0 and l==1:
    print('YYMM')
elif f==1 and l==0:
    print('MMYY')
elif f==0 and l==0:
    print('NA')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s=str(input())

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

if (last<13 and first<13) and (last>0 and first>0):
    print("AMBIGUOUS")
    
elif (last==0 or first==0) and (last>12 or first>12) :
    print("NA")

elif last>12 and first>12:
    print("NA")
elif last==0 and first==0:
    print("NA")

elif (first>12 or first==0) and (last<13 and last>0) :
    print("YYMM")

elif (last>12 or last==0) and (first<13 and first>0) :
    print("MMYY")