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 = str(input())
if s[0] == "0" and s[1] == "0" and int(s[2]+s[3]) > 12:
    print("NA")
elif s[2] == "0" and s[3] == "0" and int(s[0]+s[1]) > 12:
    print("NA")
elif s == "0000":
    print("NA")
elif int(s[0]+s[1]) > 12 and int(s[2]+s[3]) > 12:
    print("NA")
elif s[0] == "0" and s[1] == "0":
    print("YYMM")
elif s[2] == "0" and s[3] == "0":
    print("MMYY")
elif int(s[0]+s[1]) > 12 and int(s[2]+s[3]) <= 12:
    print("YYMM")
elif int(s[2]+s[3]) > 12 and int(s[0]+s[1]) <= 12:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
def can_be_month(n):
    if 0 < int(n) < 13:
        return True
    return False


S = input()

if can_be_month(S[:2]) and can_be_month(S[2:]):
    print('AMBIGUOUS')
elif can_be_month(S[:2]):
    print('MMYY')
elif can_be_month(S[2:]):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = int(input())
L = S // 100
R = S % 100
if 0 < L < 13:
  if 0 < R <13:
    print('AMBIGUOUS')
  else :
    print('MMYY')
elif 0 < R < 13:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S=input()
s1=int(S[0])
s2=int(S[1])
s3=int(S[2])
s4=int(S[3])
can1=10*s1+s2
can2=10*s3+s4
count=[]
count.append(0)
count.append(0)
if(0<can2 and 13>can2):
    count[0]=1
if(0<can1 and 13>can1):
    count[1]=1
if(count[0]==1 and count[1]==1):
    print("AMBIGUOUS")
elif(count[0]==0 and count[1]==1):
    print("MMYY")
elif(count[0]==1 and count[1]==0):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = str(input())

mm_list = ["01","02","03","04","05","06","07","08","09","10","11","12"]
yy_list = [str(i).rjust(2, "0") for i in range(0, 100)]

s_01 = s[0:2]
s_23 = s[2:]

if s_01 in yy_list and s_23 in mm_list and s_23 in yy_list and s_01 in mm_list:
    print("AMBIGUOUS")
elif s_01 in yy_list and s_23 in mm_list:
    print("YYMM")
elif s_23 in yy_list and s_01 in mm_list:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
#ABC126B-YYMMorMMYY.py

from sys import stdin

S = stdin.readline()

YorM = int(S[:2])
MorY = int(S[2:])

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

Submission status: Accepted

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

# print(former)
# print(latter)

def isYear(s):
    num = int(s)
    # if 0 < num:
    #     return True
    # else:
    #     return False
    return True

def isMonth(s):
    num = int(s)
    if 0 < num < 13:
        return True
    else:
        return False

if (isYear(former) and isMonth(former) and isYear(latter) and isMonth(latter)):
    print('AMBIGUOUS')
elif (isYear(former) and isMonth(latter)):
    print('YYMM')
elif (isYear(latter) and isMonth(former)):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

def YY(a):
    if 0 <= a < 100:
        return True
    else: return False

def MM(a):
    if 0 < a <13:
        return True
    else:
        return False

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

Submission status: Accepted

Solution code:
def main():
    M = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
    S = input()

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

    if S1 in M and S2 in M:
        print('AMBIGUOUS')
    elif S1 in M:
        print('MMYY')
    elif S2 in M:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()


mae = int(S[0:2])
ato = int(S[2:4])

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

Submission status: Accepted

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

if 0 < f and f < 13:
    if 0 < b and b < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < b and b < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s=list(map(int,list(input())))
first=s[0]*10+s[1]
second=s[2]*10+s[3]
flag_YYMM=False
flag_MMYY=False
if first<=12 and first>=1:
  flag_MMYY=True
if second<=12 and second>=1:
  flag_YYMM=True

if flag_MMYY and flag_YYMM:
  print("AMBIGUOUS")
elif flag_MMYY:
  print("MMYY")
elif flag_YYMM:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if n1 == 0:
    n1 = 100
if n2 == 0:
    n2 = 100
if n1 > 12 and n2 > 12:
    ans = 'NA'
elif n1 > 12 and n2 <= 12:
    ans = 'YYMM'
elif n1 <= 12 and n2 > 12:
    ans = 'MMYY'
else:
    ans = "AMBIGUOUS"
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
def YY(s):
    if 0<= int(s) <= 99:
        return True
    return False

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

if YY(s[:2]) and MM(s[2:]) and MM(s[:2]) and YY(s[2:]):
        print("AMBIGUOUS")

elif YY(s[:2]) and MM(s[2:]):
     print("YYMM")
        
elif MM(s[:2])  and YY(s[2:]):
    print("MMYY")
        
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    S = list(input())

    Y = int(''.join(S[:2]))
    M = int(''.join(S[2:]))


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

            

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
string = input()

moji_list = [0 for _ in range(4)]
for i in range(4):
    moji_list[i] = string[i]

ue = ''
sita = ''
for j in range(2):
    ue += moji_list[j]
    sita += moji_list[j+2]

int_ue = int(ue)
int_sita = int(sita)

sw_ue = 0
sw_sita = 0
if 1<=int_ue and int_ue<=12:
    sw_ue += 1

if 1<=int_sita and int_sita<=12:
    sw_sita += 1

if sw_ue == 1 and sw_sita == 1:
    print('AMBIGUOUS')
elif sw_ue == 1 and sw_sita == 0:
    print('MMYY')
elif sw_ue == 0 and sw_sita == 1:
    print('YYMM')
elif sw_ue == 0 and sw_sita == 0:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
#YY :[00,99]
#MM :[01,12]
head = S[0:2]
tail = S[2:4]
head_mm = head >= "01" and head <= "12"
tail_mm = tail >= "01" and tail <= "12"
if(head_mm and tail_mm):
    ret = "AMBIGUOUS"
elif(head_mm):
    ret = "MMYY"
elif(tail_mm):
    ret = "YYMM"
else:
    ret = "NA"
print(ret)

Submission status: Accepted

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

def y(x):
    return 0<=x<=99
def m(x):
    return 0<x<=12

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

Submission status: Accepted

Solution code:
inp = input()
s = [int(inp[0]), int(inp[1]), int(inp[2]), int(inp[3])]

#print(s)
f2 = s[0]*10+s[1]
l2 = s[2]*10+s[3]

flag1 = False
flag2 = False
if 1 <= f2 and f2 <= 12:
    flag2 = True
if 1 <= l2 and l2 <= 12:
    flag1 = True

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

Submission status: Accepted

Solution code:
S = input()
A = S[:2]
B = S[2:]
X = ['01','02','03','04','05','06','07','08','09','10','11','12']

if (A not in X) and (B not in X):
  print('NA')
elif A in X and B in X:
  print('AMBIGUOUS')
elif A in X:
  print('MMYY')
else:
  print('YYMM')

Submission status: Accepted

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

S = list(input())
S.pop(-1)

Month_first_flag = 1
Month_next_flag = 1

if S[0] != '0' and S[0] != '1':
    Month_first_flag = 0

if S[0] == '0':
    if S[1] == '0':
        Month_first_flag = 0

if S[0] == '1':
    if S[1] != '0' and S[1] != '1' and S[1] != '2':
        Month_first_flag = 0

if S[2] != '0' and S[2] != '1':
    Month_next_flag = 0

if S[2] == '0':
    if S[3] == '0':
        Month_next_flag = 0

if S[2] == '1':
    if S[3] != '0' and S[3] != '1' and S[3] != '2':
        Month_next_flag = 0

if Month_first_flag == 1 and Month_next_flag == 1:
    print("AMBIGUOUS")
    sys.exit(0)
if Month_first_flag == 1 and Month_next_flag == 0:
    print("MMYY")
    sys.exit(0)
if Month_first_flag == 0 and Month_next_flag == 1:
    print("YYMM")
    sys.exit(0)
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
A = int(s[:2])
B = int(s[2:])
lis = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
if A in lis:
	a = 1
else:
	a = 2
if B in lis:
	b = 1
else:
	b = 2
if a == 1 and b == 1:
	print("AMBIGUOUS")
elif a == 1 and b == 2:
	print("MMYY")
elif a == 2 and b == 1:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
s = input()

ff = int(s[:2])
bb = int(s[2:])

if (ff>=1 and ff<=12) and (bb>=1 and bb<=12):
    print("AMBIGUOUS")
elif (ff>=1 and ff<=12):
    print("MMYY")
elif (bb>=1 and bb<=12):
    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:
#YYMM, MMYY, AMBIGUOUS, NA
S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12 or s0==0:#YYMM or NA
    if s1>12 or s1==0:
        ans="NA"
    else:
        ans="YYMM"
elif s1>12 or s1==0:#MMYY
    ans="MMYY"
else:
    ans="AMBIGUOUS"
    
print(ans)

Submission status: Accepted

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#n=int(input())
#lis=list(map(int,input().split()))

S=input()
ant=S[:2]
post=S[2:]
flag=0
m=["01","02","03","04","05","06","07","08","09","10","11","12"]
ans="NA"
if ant in m:
    ans="MMYY"
    flag=1
if post in m:
    if flag==1:
        ans="AMBIGUOUS"
    else:
        ans="YYMM"



print(ans)

Submission status: Accepted

Solution code:
def isMonth(n):
    return 1 <= n and n <= 12

def isYear(n):
    return True

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

yymm = isYear(x) and isMonth(y)
mmyy = isMonth(x) and isYear(y)

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

Submission status: Accepted

Solution code:
S = int(input())

front_num = S // 100
back_num = S % 100

if 0 < front_num <= 12 and 0 < back_num <= 12:   #   両方あり得る
    print("AMBIGUOUS")
elif 0 < front_num <= 12:
    print("MMYY")
elif 0 < back_num <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8
import time
import os
import time
import re
s=input()
left=s[0:2]
right=s[2:4]
if left[0]==0:
    left=left[1]
if right[0]==0:
    right=right[1]
left=int(left)
right=int(right)
bo=[False for a in range(2)]#YYMM MMYY

#YYMM
if right>0 and right<13:
    bo[0]=True
#MMYY
if left>0 and left<13:
    bo[1]=True

if bo[0]==True and bo[1]==True:
    print("AMBIGUOUS")
elif bo[0]==False and bo[1]==False:
    print("NA")
elif bo[0]==True and bo[1]==False:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
s=input()
flag1=0
flag2=0
s1=s[:2]
s2=s[2:]
if s1[0]=="0":
    s3=int(s1[1])
else:
    s3=int(s1)
if s2[0]=="0":
    s4=int(s2[1])
else:
    s4=int(s2)
if 1<=s3<=12 and 1<=s4<=12:
    print("AMBIGUOUS")
elif 1<=s3<=12:
    print("MMYY")
elif 1<=s4<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
if 0<s1<=12 and 0<s2<=12:
  print('AMBIGUOUS')
elif 0<s2<=12:
  print('YYMM')
elif 0<s1<=12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
	s = input()
	aa = int(s[:2])
	bb = int(s[2:])
	ans = ""
	if (aa <= 12) and (aa > 0):
		if (bb <= 12) and (bb > 0):
			ans = "AMBIGUOUS"
		else:
			ans = "MMYY"
	else:
		if (bb <= 12) and (bb > 0):
			ans = "YYMM"
		else:
			ans = "NA"
	print(ans)

main()

Submission status: Accepted

Solution code:
n = input()
ue = int(n[:2])
shita = int(n[2:])

if 1 <= ue and ue <= 12 and 1 <= shita and shita <= 12:
    print('AMBIGUOUS')
elif 1<=shita and shita <= 12:
    print('YYMM')
elif 1<=ue and ue <= 12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
X = int(input())

up = int(X/100)
dn = int(X%100)

up_month = False
dn_manth = False

if up >= 1 and up <= 12:
    up_month = True

if dn >= 1 and dn <= 12:
    dn_month = True
else:
    dn_month = False
    

if up_month and dn_month:
    print("AMBIGUOUS")
elif up_month:
    print("MMYY")
elif dn_month:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
a = int(S[0]+S[1])
b = int(S[2]+S[3])
isyymm = 0
ismmyy = 0
if a>=0 and b>=0:
    if a<=12 and a>0:
        ismmyy = 1
    if b<=12 and b>0:
        isyymm = 1

ans = ['NA','YYMM','MMYY','AMBIGUOUS']
print(ans[isyymm+ismmyy*2])

Submission status: Accepted

Solution code:
import sys

def solve(S):
    f = int(S[0:2])
    s = int(S[2:4])
    f_flag = False
    if 1 <= f <= 12:
        f_flag = True

    s_flag = False
    if 1 <= s <= 12:
        s_flag = True

    if f_flag and s_flag:
        return 'AMBIGUOUS'
    elif f_flag:
        return 'MMYY'
    elif s_flag:
        return 'YYMM'
    else:
        return 'NA'

if __name__ == '__main__':

    S = sys.stdin.readline().strip()
    print solve(S)

Submission status: Accepted

Solution code:
import datetime

S=input()

YYMM_OK = True
try:
	datetime.datetime.strptime("20" + S, "%Y%m")
except ValueError:
	YYMM_OK = False

MMYY_OK = True
try:
	mmyy=S[:2] + "20"+S[2:]
	# print(mmyy)
	datetime.datetime.strptime(mmyy, "%m%Y")
except ValueError:
	MMYY_OK = False

ans ="NA"
if YYMM_OK and MMYY_OK:
	ans = "AMBIGUOUS"
elif YYMM_OK:
	ans = "YYMM"
elif MMYY_OK:
	ans = "MMYY"

print(ans)

Submission status: Accepted

Solution code:
s = input()


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

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

Submission status: Accepted

Solution code:
S = input()

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

def is_MM(s):
  if 1 <= int(s) <= 12:
    return(True)
  else:
    return(False)

def is_YY(s):
  if 0 <= int(s) <= 99:
    return(True)
  else:
    return(False)

if (not is_MM(S1) and not is_MM(S2)) or (not is_YY(S1) and not is_YY(S2)):
  print("NA")
elif is_YY(S1) and is_MM(S1) and is_YY(S2) and is_MM(S2):
  print("AMBIGUOUS")
elif is_YY(S1) and is_MM(S2):
  print("YYMM")
elif is_YY(S2) and is_MM(S1):
  print("MMYY")

Submission status: Accepted

Solution code:
S = input()
X = list(S)
Y = [int(X[i]) for i in range(4)]
a = 10 * Y[0] + Y[1]
b = 10 * Y[2] + Y[3]
if a >= 13 or a == 0:
    if b >= 13 or b == 0:
        print('NA')
    else:
        print('YYMM')
else:
    if b >= 13 or b == 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
S_1 = int(S[:2])
S_2 = int(S[2:])

YM_Flag = False
MY_Flag = False

if S_1 >= 1 and S_1 <= 12:
    MY_Flag = True

if S_2 >= 1 and S_2 <= 12:
    YM_Flag = True

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

Submission status: Accepted

Solution code:

s=input()
f=int(s[0:2])
l=int(s[2:4])

if 12>=f>=1 and 12>=l>=1:
    k=3
elif not(12>=f>=1) and 12>=l>=1:
    k=1
elif not(12>=l>=1) and 12>=f>=1:
    k=2
else:
    k=4
ans=['','YYMM','MMYY','AMBIGUOUS','NA']
print(ans[k])

Submission status: Accepted

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

S = list(input())
a = int(S[0]+S[1])
b = int(S[2]+S[3])

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

Submission status: Accepted

Solution code:
s = input()

mae = int(s[0] + s[1])
ushiro = int(s[2] + s[3])

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

Submission status: Accepted

Solution code:
S = input()
first, last = int(S[:2]), int(S[2:])
yymm = (0 <= first <= 99) and (1 <= last <= 12)
mmyy = (1 <= first <= 12) and (0 <= first <= 99)
if yymm and mmyy:
    print('AMBIGUOUS')
elif yymm:
    print('YYMM')
elif mmyy:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

s = list(S)
num = []
for k in s:
    num.append(int(k))

num1 = 10*num[0] + num[1]

num2 = 10*num[2] + num[3]

ans1 = False
ans2 = False
if num1 < 13 and num1 >0:
    ans1 = True

if num2 < 13 and num2 >0:
    ans2 = True

if ans1 and ans2:
    print("AMBIGUOUS")
elif ans1 and not ans2:
    print("MMYY")
elif not ans1 and ans2:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

from collections import defaultdict

def get_renzokuomote(goal, now_num):
    count = 0
    while now_num < goal:
        now_num *= 2
        count += 1
    return count



def main():
    num = int(input())
    a = num // 100
    b = num % 100

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






if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
f1 = 0
f2 = 0
if int(s[0]) >=2:
    f1 =1
if int(s[0]) ==1 and int(s[1]) >= 3:
    f1 = 1
if int(s[0]) ==0 and int(s[1]) ==0:
    f1 =1

if int(s[2]) >=2:
    f2 =1
if int(s[2]) ==1 and int(s[2]) >= 3:
    f2 = 1
if int(s[2]) ==0 and int(s[3]) ==0:
    f2 =1

if (f1+f2) ==1:
    if f1 ==1:
        s = "YYMM"
    else:
        s = "MMYY"
else:
    if (f1+f2) ==2:
        s = "NA"
    else:
        s = "AMBIGUOUS"
print(s)

Submission status: Accepted

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

from sys import stdin

def calc(s):

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

    if 0 < a and a <= 12:
        a = 1
    elif 0 <= a and a <= 99:
        a = 2
    else:
        a = 3

    if 0 < b and b <= 12:
        b = 1
    elif 0 <= b and b <= 99:
        b = 2
    else:
        b = 3

    if a == 1 and b == 1:
        ans = 'AMBIGUOUS'
    elif a == 1 and b == 2:
        ans = 'MMYY'
    elif a == 2 and b == 1:
        ans = 'YYMM'
    else:
        ans = 'NA'

    return ans

def main():
    s = stdin.readline().rstrip()
    ans = calc(s)
    print(ans)
    
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

fst = int(s[0:2])
snd = int(s[2:4])

if fst > 0 and fst <= 12:
    # MMYY, AMBIGUOUS
    if snd > 0 and snd <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    # YYMM, NA
    if snd > 0 and snd <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
from datetime import datetime

S = input()
former = int(S[:2])
latter = int(S[2:])
YYMM = False
MMYY = False

try:
    datetime(former + 2000, latter, 1)
    YYMM = True
except:
    pass

try:
    datetime(latter + 2000, former, 1)
    MMYY = True
except:
    pass

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

if 1 <= head <= 12:
    if 1 <= tail <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= tail <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
def is_m(n):
    return 1 <= n & n <= 12


s=input()
h=int(s[0:2])
t=int(s[2:4])

if is_m(h) & is_m(t):
    print('AMBIGUOUS')
elif is_m(h):
    print('MMYY')
elif is_m(t):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math

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

def isMM(n):
    if n >= 1 and n <= 12:
        return True
    else:
        return False

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

Submission status: Accepted

Solution code:
def check(M_1, M_2):
    M_1 = int(M_1)
    M_2 = int(M_2)
    MM = M_1 * 10 + M_2
    if 1 <= MM <= 12:
        return True
    else:
        return False


S = input()
ans = [0, 0]
if check(S[0], S[1]):
    ans[0] += 1
if check(S[2], S[3]):
    ans[1] += 1

if ans == [0, 0]:
    print("NA")
elif ans == [0, 1]:
    print("YYMM")
elif ans == [1, 0]:
    print("MMYY")
elif ans == [1, 1]:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = list(input())

for i in range(len(S)):
    S[i] = int(S[i])
    
mae = S[0]*10 + S[1]
ato = S[2]*10 + S[3]

if (1 <= mae <= 12) and (1 <= ato <= 12):
    print('AMBIGUOUS')

elif (1 <= mae <= 12) and (ato < 1 or 12 < ato):
    print('MMYY')
    
elif (mae < 1 or 12 < mae) and (1<= ato <= 12):
    print('YYMM')

else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
a = s[0:2]
b = s[2:4]
month = ["0"+str(i) for i in range(1,10)]+["10","11","12"]

if a in month and b in month: ans = "AMBIGUOUS"
elif a in month: ans = "MMYY"
elif b in month: ans = "YYMM"
else: ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

a_flag = False
b_flag = False

if a > 0 and a <= 12:
    a_flag = True

if b > 0 and b <= 12:
    b_flag = True


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

Submission status: Accepted

Solution code:
S = int(input())  # これをABCDとしよう（A,B,C,Dはそれぞれ1桁の非負整数）
AB = S // 100
CD = S-AB*100
if AB == 0 or CD == 0:
    if 1 <= AB <= 12:
        print("MMYY")
    elif 1 <= CD <= 12:
        print("YYMM")
    else:
        print("NA")

elif 13 <= AB and 13 <= CD:
    print("NA")
elif AB <= 12 and CD <= 12:
    print("AMBIGUOUS")
elif 13 <= AB:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
S = input("")

first_half = int(S[0:2])
second_half = int(S[2:4])

a = 0
if 0 < first_half < 13:
    a = 1

b = 0
if 0 < second_half < 13:
    b = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

def f(a):
    a=int(a)
    if a>0 and a<=12:
        return 0
    elif a>12 or a==0:
        return 1


if f(s[0:2])*f(s[2:4])==0:
    if f(s[0:2])==0 and f(s[2:4])==0:
        print("AMBIGUOUS")
    elif f(s[0:2])==1 and f(s[2:4])==0:
        print("YYMM")
    elif f(s[0:2])==0 and f(s[2:4])==1:
        print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S = input()


def is_month(num_char):
    if num_char in y:
        return True
    else:
        return False


first = S[0:2]
second = S[2:4]

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


first_flag = is_month(first)
second_flag = is_month(second)


if first_flag and second_flag:
    print('AMBIGUOUS')
elif first_flag and second_flag == False:
    print('MMYY')
elif first_flag == False and second_flag:
    print('YYMM')
elif first_flag == False and second_flag == False:
    print('NA')

Submission status: Accepted

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


S = input()

first = S[:2]
last = S[2:]

fmf = False
lmf = False

if (
    "01" in first
    or "02" in first
    or "03" in first
    or "04" in first
    or "05" in first
    or "06" in first
    or "07" in first
    or "08" in first
    or "09" in first
    or "10" in first
    or "11" in first
    or "12" in first):
    fmf = True

if (
    "01" in last
    or "02" in last
    or "03" in last
    or "04" in last
    or "05" in last
    or "06" in last
    or "07" in last
    or "08" in last
    or "09" in last
    or "10" in last
    or "11" in last
    or "12" in last):
    lmf = True

if fmf:
    if lmf:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if lmf:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


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



sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = list(input())

s_mae = ''.join([s[0], s[1]])
s_usiro = ''.join([s[2], s[3]])

s_mae = int(s_mae)
s_usiro = int(s_usiro)


flag = [0, 0]

if (0 <= s_mae and s_mae < 100 and 0 < s_usiro and s_usiro < 13):
    flag[0] = 1
    
if (0 < s_mae and s_mae < 13 and 0 <= s_usiro and s_usiro < 100):
    flag[1] = 1

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

Submission status: Accepted

Solution code:
inputa = input()
isfirstMM = False
islastMM = False
if int(inputa[0:2]) >= 1 and int(inputa[0:2]) <= 12:
  #MMXX
  isfirstMM = True
if int(inputa[2:4]) >= 1 and int(inputa[2:4]) <= 12:
  #XXMM
  islastMM = True

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

Submission status: Accepted

Solution code:

s = input()

pre = int(s[:2])
post = int(s[2::])

pre_month = False
pre_year = False
post_month = False
post_year = False

if 0 <= pre <= 99:
    pre_year = True
if 0 <= post <= 99:
    post_year = True
if 1 <= pre <= 12:
    pre_month = True
if 1 <= post <= 12:
    post_month = True

if (pre_year and post_month) and (pre_month and post_year):
    print("AMBIGUOUS")
elif pre_year and post_month:
    print("YYMM")
elif pre_month and post_year:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input().rstrip()

def check_YYMM(str:S):
    MM = int(S[2:])
    if 0 < MM and MM < 13:
        return True
    else:
        return False
    
def check_MMYY(str:S):
    MM = int(S[:2])
    if 0 < MM and MM < 13:
        return True
    else:
        return False

is_YYMM = check_YYMM(S)
is_MMYY = check_MMYY(S)

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 = 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")
    exit()
  else:
    print("NA")