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:
#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/abc126/tasks/abc126_b

intext = input()

head2 = int(intext[0:2])
tail2 = int(intext[2:])

# is_head_yy = False
is_head_mm = False
# is_tail_yy = False
is_tail_mm = False

if 0 < head2 <= 12:
    is_head_mm = True
if 0 < tail2 <= 12:
    is_tail_mm = True

if is_head_mm and is_tail_mm:
    print('AMBIGUOUS')
elif is_head_mm:
    print('MMYY')
elif is_tail_mm:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
s1 = s[0:2]
s2 = s[2:4]
res = ("1" if int(s[0:2]) <= 12 and int(s[0:2]) > 0 else "0") + \
    ("1" if int(s[2:4]) <= 12 and int(s[2:4]) > 0 else "0")

if(res == "11"):
    print("AMBIGUOUS")
elif(res == "10"):
    print("MMYY")
elif(res == "01"):
    print("YYMM")
elif(res == "00"):
    print("NA")

Submission status: Accepted

Solution code:
S = input()
S12 = int(S[:2])
S34 = int(S[2:])

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

Submission status: Accepted

Solution code:
S = input()
A = S[:2]
B = S[2:]
if A[0] == "0":
    A = A[1]

if B[0] == "0":
    B = B[1]

A = int(A)
B = int(B)

ans = "NA"

if A > 0 and B > 0:
    if A < 13 and B < 13:
        ans = "AMBIGUOUS"
    elif A >= 13 and B <= 12:
        ans = "YYMM"
    elif A <= 12 and B >= 13:
        ans = "MMYY"
        
elif A == 0 and 1 <= B <= 12:
    ans = "YYMM"

elif 1<= A <= 12 and B == 0:
    ans = "MMYY"

print(ans)

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heappush,heappop
import re

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

S = input()

def main():
    FS  = int(S[:2])
    LS = int(S[2:])
    can_yymm = True
    can_mmyy = True
    if FS < 0:
        return "NA"
    if FS == 0:
        can_mmyy = False
    if FS > 12:
        can_mmyy =False
    if LS < 0:
        return "NA"
    if LS == 0:
        can_yymm =False
    if LS > 12:
        can_yymm =False
    if can_yymm and can_mmyy:
        return "AMBIGUOUS"
    if can_yymm:
        return "YYMM"
    if can_mmyy:
        return "MMYY"
    return "NA"
print(main())

Submission status: Accepted

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

Submission status: Accepted

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

if 1 <= a and a <= 12:
    flag[0] = True
if 1 <= b and b <= 12:
    flag[1] = True

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

Submission status: Accepted

Solution code:
def canM(num):
    if num >= 1 and num <= 12:
        return True
    return False

def solve():
    s = input()
    f = int(s[:2])
    l = int(s[2:])

    if canM(f) ==True and canM(l) == True:
        res = "AMBIGUOUS"
    elif canM(f) == True and canM(l) == False:
        res = "MMYY"
    elif canM(f) == False and canM(l) == True:
        res = "YYMM"
    else:
        res = "NA"

    print(res)

solve()

Submission status: Accepted

Solution code:
#-------------------------------------------------------------------
import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")
#-------------------------------------------------------------------

S = input()

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

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

Submission status: Accepted

Solution code:
import sys

S = input()
if int(S[2:]) in range(1, 13):
    if int(S[:2]) in range(1, 13):
        print('AMBIGUOUS')
        sys.exit()
    else:
        print('YYMM')
        sys.exit()
elif int(S[:2]) in range(1, 13):
    print('MMYY')
    sys.exit()
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline()

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

n1m = n1 >= 1 and n1 <= 12
n2m = n2 >= 1 and n2 <= 12

if n1m and n2m:
    print('AMBIGUOUS')
elif n1m:
    print('MMYY')
elif n2m:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

S = input()

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

left_flag = False
if left <= 12 and left > 0:
    left_flag = True

right_flag = False
if right <= 12 and right > 0:
    right_flag = True

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

Submission status: Accepted

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

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

S = input()
f_s = S[:2]
b_s = S[2:]

YYMM = False
MMYY = False

if isYear(f_s) and isMonth(b_s):
    YYMM = True
if isMonth(f_s) and isYear(b_s):
    MMYY = True

if YYMM and MMYY:
    res = "AMBIGUOUS"
elif YYMM:
    res = "YYMM"
elif MMYY:
    res = "MMYY"
else:
    res = "NA"

print(res)

Submission status: Accepted

Solution code:
from sys import stdin

s = int(stdin.readline().rstrip())
up = s//100
down = s%100


if (up>=13 or up==0) and (down>=13 or down==0):
  ans = "NA"
elif (up>=13 or up==0):
  ans = "YYMM"
elif (down>=13 or down==0):
  ans = "MMYY"
else:
  ans = "AMBIGUOUS"

print(ans)

Submission status: Accepted

Solution code:
S = input()
Y = [i for i in range(100)]
M = [i for i in range(1, 13)]
a = int(S[:2])
b = int(S[2:])
if a in M:
	if b in M:
		print('AMBIGUOUS')
	elif b in Y:
		print('MMYY')
elif a in Y:
	if b in M:
		print('YYMM')
	else:
		print('NA')

Submission status: Accepted

Solution code:
S =input()
A = S[:2]
B = S[2:]
A_right = 0
B_right = 0
if int(A) > 0 and int(A) < 13:
  A_right = 1
if int(B) > 0 and int(B) < 13:
  B_right = 1
if A_right == 0 and B_right == 0:
  print('NA')
elif A_right == 1 and B_right == 0:
  print('MMYY')
elif A_right == 0 and B_right == 1:
  print('YYMM')
elif A_right == 1 and B_right == 1:
  print('AMBIGUOUS')

Submission status: Accepted

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

def isMonth(num):
    if 1<= num <= 12:
        return True
    else:
        return False

if isMonth(A) and isMonth(B):
    print("AMBIGUOUS")
elif isMonth(A) and not isMonth(B):
    print("MMYY")
elif not isMonth(A) and isMonth(B):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def solve(yy, mm):
    if 1 <= yy <= 12:
        if 1 <= mm <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= mm <= 12:
            return 'YYMM'
        else:
            return 'NA'


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy, mm))

Submission status: Accepted

Solution code:
# 2019/05/19
# AtCoder Beginner Contest 126 - B

# Input
s = input()

# Calc
mae = int(s[0]) * 10 + int(s[1])
ato = int(s[2]) * 10 + int(s[3])

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

# Output
print(ans)

Submission status: Accepted

Solution code:
s=input()
lhs=int(s[0])*10+int(s[1])
rhs=int(s[2])*10+int(s[3])
# print(lhs,rhs)
isLeftOK=(0<lhs<=12)
isRightOK=(0<rhs<=12)
if isLeftOK and isRightOK:
    print('AMBIGUOUS')
elif isLeftOK:
    print('MMYY')
elif isRightOK:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
front = int(s[:2])
back = int(s[2:])
def isMM(num):
    if 1<=num<=12:
        return True
    else:
        return False

if isMM(front) and isMM(back):
    print('AMBIGUOUS')
elif isMM(front) and not isMM(back):
    print('MMYY')
elif not isMM(front) and isMM(back):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = list(input())
a=int("".join(S[0:2]))
b=int("".join(S[2:4]))
ma = 0
mb = 0
if 1 <= a <= 12:
  ma = 1
if 1 <= b <= 12:
  mb = 1
if ma ==1 and mb == 1:
  print("AMBIGUOUS")
elif ma==1 and mb == 0:
  print("MMYY")
elif ma==0 and mb == 1:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
mm = ['01','02','03','04','05','06','07','08','09','10','11','12']
s = input()
a,b = s[:2], s[2:]

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

Submission status: Accepted

Solution code:
N = list(input())

A = int(N[0] + N[1])
B = int(N[2] + N[3])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S =raw_input()
a = S[:2]
b = S[2:]
a = int(a)
b = int(b)
if a<=12 and a!=0:
    a = 0
else:
    a = 1
if b<=12 and b!=0:
    b = 0
else:
    b = 1
if a+b ==0:
    print 'AMBIGUOUS'
elif a+b ==1:
    if a ==0:
        print 'MMYY'
    else:
        print 'YYMM'
else:
    print 'NA'

Submission status: Accepted

Solution code:
s = int(input())
front = s//100
back = s%100
if (front > 12 or front < 1) and (back > 12 or back < 1):
    print('NA')
elif front > 12 or front < 1:
    print('YYMM')
elif back > 12 or back < 1:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
def main():
    N = input()
    F = int(N[0:2])
    L = int(N[2:])
    FisYY = (F>=0 and F<=99)
    FisMM = (F>=1 and F<=12)
    LisYY = (L>=0 and L<=99)
    LisMM = (L>=1 and L<=12)
    if (FisYY and LisMM and FisMM and LisYY):
        print('AMBIGUOUS')
    elif (FisYY and LisMM):
        print('YYMM')
    elif (LisYY and FisMM):
        print('MMYY')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])

flag_year = {}
flag_month = {}

flag_YYMM = True
flag_MMYY = True

if S1 == 0:
    flag_MMYY = False
elif S1 >= 13:
    flag_MMYY = False

if S2 == 0:
    flag_YYMM = False
elif S2 >= 13:
    flag_YYMM = False

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

Submission status: Accepted

Solution code:
S = str(input())
tmp1 = int(S[0:2])
tmp2 = int(S[2:4])
flag = ""

if tmp2>0 and tmp2<13:
    flag += "YM"
if tmp1>0 and tmp1<13:
    flag += "MY"

if flag == "YM":
    print("YYMM")
elif flag == "MY":
    print("MMYY")
elif flag =="YMMY":
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    n0 = n // 100
    n1 = (n % 100)

    if ismonth(n0) and ismonth(n1):
        return "AMBIGUOUS"

    if ismonth(n0):
        return "MMYY"

    if ismonth(n1):
        return "YYMM"
    
    return "NA"

def ismonth(m):
    return 0 < m and m <= 12


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass

Submission status: Accepted

Solution code:
S = list(str(input()))
F1 = int(str(S[0]) + str(S[1]))
F2 = int(str(S[2]) + str(S[3]))
#print(F1)
FLAG_MMYY = 1
FLAG_YYMM = 1
if F1 >= 13:
    FLAG_MMYY = 0
if F2 >= 13:
    FLAG_YYMM = 0
if F1 == 0:
    FLAG_MMYY = 0
if F2 == 0:
    FLAG_YYMM = 0

if FLAG_MMYY == 1 and FLAG_YYMM == 1:
    print("AMBIGUOUS")
elif FLAG_MMYY == 1:
    print("MMYY")
elif FLAG_YYMM == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())

a=int(s[0]+s[1])
b=int(s[2]+s[3])
A=0<a and a<13
B=0<b and b<13

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# input
a = input()
o1 = o2 = 0
# calc
if a[:2] in ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'):
    o1 = 1
if a[2:4] in ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'):
    o2 = 1
# output
if o1 == o2 == 1:
    print('AMBIGUOUS')
elif o1 == o2 == 0:
    print('NA')
elif o1 == 1:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
S = input()

S1 = int(S[0:2])

S2 = int(S[2:])

flag1 = False
flag2 = False

if S1 >= 1 and S1 <= 12 :
    flag1 = True
if S2 >= 1 and S2 <= 12 :
    flag2 = True

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

Submission status: Accepted

Solution code:
a,b,c,d=input()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
s=10*a+b
t=10*c+d

if (s>0 and s<=12) and (t>0 and t<=12):
        print("AMBIGUOUS")
elif s>0 and s<=12:
        print("MMYY")
elif t>0 and t<=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 and 1<=post<=12:
  print('AMBIGUOUS')
elif 1<=pre<=12:
  print('MMYY')
elif 1<=post<=12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()

f = 0
ff = 0
num = 12
if int(s[:2]) > num or int(s[:2]) == 0:
    f = 1
if int(s[2:]) > num or int(s[2:]) == 0:
    ff = 1

if f == 0 and ff == 0:
    print("AMBIGUOUS")
elif f == 1 and ff == 0:
    print("YYMM")
elif f == 0 and ff == 1:
    print("MMYY")
elif f == 1 and ff == 1:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
H, L = map(int, [S[0:2], S[2:4]])

if ((H > 12) or (H == 0)) and (12 >= L >= 1):
    print('YYMM')
elif ((L > 12) or (L == 0)) and (12 >= H >= 1):
    print('MMYY')
elif (12 >= L >= 1) and (12 >= H >= 1):
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

def mm(n):
    if n > 0 and n <= 12:
        return True

result = ""
if mm(head) and mm(tail):
    result = 'AMBIGUOUS'
elif mm(head) and not(mm(tail)):
    result = 'MMYY'
elif not(mm(head)) and mm(tail):
    result = 'YYMM'
else:
    result = 'NA'
print(result)

Submission status: Accepted

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

if left > 0 and left <= 12:
    if right > 0 and right <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif right > 0 and right <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

if 1 <= former <= 12 and 1 <= latter <= 12:
  print('AMBIGUOUS')
elif 1 <= former <= 12 and (latter == 0 or 13 <= latter <= 99):
  print('MMYY')
elif (former == 0 or 13 <= former <= 99) and 1 <= latter <= 12:
  print('YYMM')
else:
  print('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")
elif 0 < int(s[2:]) < 13:
    if 0 < int(s[:2]) < 13:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
  str = input()
  first = str[:2]
  second = str[2:]
  first = change(first)
  second = change(second)
  f_y = 0; s_y = 0;
  f_y = check_y(first)
  s_y = check_y(second)
  if(f_y == 0 and s_y == 0):
    print("AMBIGUOUS")
  elif(f_y == 0 and s_y == 1):
    print("MMYY")
  elif(f_y == 1 and s_y == 0):
    print("YYMM")
  else:
    print("NA")
    
def change(str):
  if(str[0] == "0"):
    return int(str[1])
  else:
    return int(str)
  
def check_y(num):
  if(num == 0 or num > 12):
    return 1
  else:
    return 0
  
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
S = (input())
L1 = int((S[0:2]))
L2 = int(S[2:4])

if L1 == 0:
    if L2 > 12:
        ans = 'NA'
    elif L2 == 0:
        ans ='NA'
    else:
        ans ='YYMM'
elif L1 > 12:
    if L2 > 12:
        ans = 'NA'
    elif L2 == 0:
        ans ='NA'
    else :
        ans ='YYMM'
else:
    if L2 > 12 or L2 == 0:
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'
        
print(ans)

Submission status: Accepted

Solution code:
S=input()
FF=int(S[0]+S[1])
LL=int(S[2]+S[3])

if FF<13 and LL<13 and FF!=00 and LL!=00:
    print('AMBIGUOUS')
    exit(0)
elif  (FF>12 or FF==00) and (LL<13 and LL>0):
    print('YYMM')
    exit(0)
elif  (LL>12 or LL==00) and (FF<13 and FF>0):
    print('MMYY')
    exit(0)
else:
    print("NA")

Submission status: Accepted

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

bef = int(S[:2])
aft = int(S[2:])

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

Submission status: Accepted

Solution code:
def solve():
    S = input()
    head2 = int(S[:2])
    tail2 = int(S[2:])
    head_is_mm = False
    if 1 <= head2 <= 12:
        head_is_mm = True
    tail_is_mm = False
    if 1 <= tail2 <= 12:
        tail_is_mm = True
    result = 'NA'
    if head_is_mm and tail_is_mm:
        result = 'AMBIGUOUS'
    elif head_is_mm:
        result = 'MMYY'
    elif tail_is_mm:
        result = 'YYMM'
    print(result)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = input()
first = s[:2]
last = s[2:]
months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

if first in months:
    if last in months:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if last in months:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:

S = list(input()) #YYMM 1905  MMYY 0519
i1 = int(''.join(S[:2]))
i2 = int(''.join(S[2:]))
if (i1 >0) and (i1 < 13 ):#i1 MMYY or YYMM
    if ( i2 > 0) and ( i2 < 13):#i2 MMYY or YYMM
        print('AMBIGUOUS')
    else:#MMYY
        print('MMYY')

else:#i1 YYMM or YYYY
    if ( i2 > 0) and ( i2 < 13):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s=input()
if len(s)!=4:
    print("NA")
else:
    if int(s[:2])<=12 and int(s[:2])>=0 and int(s[2:])<=12 and int(s[2:])>=0:
        if int(s[:2])==0 and int(s[2:])==0:
            print("NA")
        elif int(s[:2])==0 and int(s[2:])!=0:
            print("YYMM")
        elif int(s[:2])!=0 and int(s[2:])==0:
            print("MMYY")
        else:
            print("AMBIGUOUS")
    else:
        if int(s[:2])<=12 and int(s[:2])>0 and int(s[2:])>12 and int(s[2:])<100:
            print("MMYY")
        elif int(s[:2])>12 and int(s[:2])<100 and int(s[2:])<=12 and int(s[2:])>0:
            print("YYMM")
        else:
            print("NA")

Submission status: Accepted

Solution code:
def solve():
    S = input()

    ans = ""

    if int(S[:2]) == 0:
        if 0 < int(S[2:4]) <= 12:
            ans = "YYMM"
        else:
            ans = "NA"
    elif int(S[2:4]) == 0:
        if 0 < int(S[:2]) <= 12:
            ans = "MMYY"
        else:
            ans = "NA"
    elif int(S[:2]) > 12 and 0 < int(S[2:4]) <= 12:
        ans = "YYMM"
    elif int(S[2:4]) > 12 and 0 < int(S[:2]) <= 12:
        ans = "MMYY"
    elif 0 < int(S[:2]) <= 12 and 0 < int(S[2:4]) <= 12:
        print ("AMBIGUOUS")
    else:
        print ("NA")
        
    print (ans)
    
if __name__ == "__main__":  
    solve()

Submission status: Accepted

Solution code:
S = input()
T = [S[i] for i in range(4)]
A = ''.join(T[:2])
B = ''.join(T[2:])
Month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

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

Submission status: Accepted

Solution code:
S = str(input())

N1 = int(S[:2])
N2 = int(S[2:])

if 0<N1<=12 :
    if 0<N2<=12:
        print( "AMBIGUOUS")
    elif 0 <= N2:
        print("MMYY")
    else:
        print("NA")


elif 0<=N1:
    if 0<N2<=12:
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

Solution code:
def month_judge(MM):
    if 1 <= int(MM) <= 12:
        return True
    else:
        return False

S = input()
First = S[0:2]
Latter = S[2:4]

if month_judge(First):
    if month_judge(Latter):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if month_judge(Latter):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
s_rev = s[2:4] + s[0:2]

is_yymm = True
is_mmyy = True

if int(s[2:4]) > 12 or int(s[2:4]) < 1:
    is_yymm = False
if int(s_rev[2:4]) > 12 or int(s_rev[2:4]) < 1:
    is_mmyy = 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())
S_12 = S%100
S_34 = int((S-S_12)/100)
if 1 <= S_12 and S_12 <= 12 and 1 <= S_34 and S_34 <= 12:
    print("AMBIGUOUS")
elif 1<= S_12 and S_12 <= 12:
    print("YYMM")
elif 1 <= S_34 and S_34 <= 12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = str(input())


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

#
# print(mae)
# print(ushiro)

YYMM = False

MMYY = False

if 99 >= mae and mae >= 0 and 12 >= ushiro and ushiro >= 1:
    YYMM = True

if 12 >= mae and mae >= 1 and 99 >= ushiro and ushiro >= 0:
    MMYY = True


if YYMM and MMYY:
    print('AMBIGUOUS')
    exit()

if YYMM:
    print('YYMM')
    exit()

if MMYY:
    print('MMYY')
    exit()

print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    S = [int(_) for _ in raw_input()]
    S12 = S[0] * 10 + S[1]
    S34 = S[2] * 10 + S[3]
    YYMM = False
    MMYY = False
    if S34 >= 1 and S34 <= 12:
        YYMM = True
    if S12 >= 1 and S12 <= 12:
        MMYY = True
    if YYMM:
        if MMYY:
            ret = 'AMBIGUOUS'
        else:
            ret = 'YYMM'
    else:
        if MMYY:
            ret = 'MMYY'
        else:
            ret = 'NA'
    print ret

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = input()

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

lis = list(range(1, 13))

b_head = head in lis
b_tail = tail in lis

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

Submission status: Accepted

Solution code:
c = int(input())

a = int (c / 100)
b = c % 100
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:
inp = input()

first = int(inp[:2])
last = int(inp[2:])

def month_check(num):
  if num == 0:
    return False
  elif num > 12:
    return False
  else:
    return True

first_check = month_check(first)
last_check = month_check(last)

if first_check & last_check:
  print("AMBIGUOUS")
elif (first_check == True) & (last_check == False):
  print("MMYY")
elif (first_check == False) & (last_check == True):
  print("YYMM")
elif (first_check == False) & (last_check == False):
  print("NA")

Submission status: Accepted

Solution code:
order = input()
forw = int(order[:2])
back = int(order[2:])
flg_f = 0
flg_b = 0
 
if forw<=12 and forw != 0:
  flg_f = 1
if back<=12 and back != 0:
  flg_b = 1

if flg_f + flg_b == 2:
  print('AMBIGUOUS')
elif flg_f == 1:
  print('MMYY')
elif flg_b == 1:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()

YYMM = False
MMYY = False

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


if a in range(1, 13):
    MMYY = True
if b in range(1, 13):
    YYMM = True

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

Submission status: Accepted

Solution code:
S = input()
a = 0
b = 0
if S[0] == 0:
    a = int(S[1])
else:
    a = int(S[0:2])
if S[2] == 0:
    b = int(S[3])
else:
    b = int(S[2:])
    
fa = ''
fb = ''
    
if a == 0:
    fa = 'n'
elif a <= 12:
    fa = 'm'
else:
    fa = 'y'
    
if b == 0:
    fb = 'n'
elif b <= 12:
    fb = 'm'
else:
    fb = 'y'
    
if (fa == 'm' and fb == 'y') or (fa == 'm' and fb == 'n'):
    print('MMYY')
elif (fb == 'm' and fa == 'y') or (fb == 'm' and fa == 'n'):
    print('YYMM')
elif fa == 'm' and fb == 'm':
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = s[:2]
b = s[2:]
month=range(1,13)
m = []
for i in month:
    m_s = str(i)
    if i<9:
        m_s = "0" + m_s
    m.append(m_s)

isM_a = a in m 
isM_b = b in m 

if isM_a:
    if isM_b:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if isM_b:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

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

y = False
m = False

if 1 <= top <= 12:
    m = True
if 1 <= bot <= 12:
    y = True

if y and m:
    print('AMBIGUOUS')
elif not y and m:
    print('MMYY')
elif y and not m:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

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

if 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 = int(input())

ab = S // 100
cd = S % 100
if (ab == 0 or ab > 12):
    if 1 <= cd <= 12:
        print('YYMM')
    else:
        print('NA')
elif (cd == 0 or cd > 12):
    if 1 <= ab <= 12:
        print('MMYY')
    else:
        print('NA')
else:
    print('AMBIGUOUS')