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:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


s = S()
a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12:
    aMM = True
else:
    aMM = False

if 1 <= b <= 12:
    bMM = True
else:
    bMM = False

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

Submission status: Accepted

Solution code:
s=input()
forward=int(s[0]+s[1])
backward=int(s[2]+s[3])
#print(forward,backward)

if 0<forward<=12:
    if 0<backward<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if 0<backward<=12:
    if 0==forward or forward>12:
        print("YYMM")
if (0==forward or forward>12) and (0==backward or backward>12):
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())
s1,s2 = int(S[:2]),int(S[2:])
c1,c2 = 0,0

if 0 < s1 < 13:
  c1 = 1
if 0 < s2 < 13:
  c2 = 1

if c1 and c2:
  ans = "AMBIGUOUS"
elif c1:
  ans = "MMYY"
elif c2:
  ans = "YYMM"
else:
  ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
s = input()

u = int(s[:2])
d = int(s[2:])

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

Submission status: Accepted

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

Submission status: Accepted

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

if 1<=mae<=12:
    if 1<=ush<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=ush<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# B - YYMM or MMYY

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

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

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

Submission status: Accepted

Solution code:
S = input()
f = int(S[:2])
l = int(S[2:])

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

Submission status: Accepted

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

if "01" <= left <= "12" and "01" <= right <= "12":
    print("AMBIGUOUS")
elif "01" <= left <= "12":
    if "00" <= right <= "99":
        print("MMYY")
    else:
        print("NA")
elif "01" <= right <= "12":
    if "00" <= left <= "99":
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Submission status: Accepted

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

if (s1<=12) & (s1>=1):
  if (s2<=12) & (s2>=1):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if (s2<=12) & (s2>=1):
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

n = 4

mae = int(s[:2])
ato = int(s[2:])

if mae < 13 and mae > 0:
    if ato < 13 and ato > 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if ato < 13 and ato > 0:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=str(input())

L=int(S[0:2])
R=int(S[2:4])

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

Submission status: Accepted

Solution code:
S = str(input())
red = int(S[0:2])
blue = int(S[2:4])
if 1<=red<=12:
    if 1<=blue<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=blue<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def yymm_or_mmyy(s):

    ans = ""
    flag1 = False
    flag2 = False

    for i in range(1, 13):
        if s[0:2] == str(i).zfill(2):
            flag1 = True
        if s[2:4] == str(i).zfill(2):
            flag2 = True

    if flag1 and flag2:
        ans = "AMBIGUOUS"
    elif flag1:
        ans = "MMYY"
    elif flag2:
        ans = "YYMM"
    else:
        ans = "NA"

    return ans

def main():
    s = str(input())
    print(yymm_or_mmyy(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())

head = int("".join(S[:2]))
tale = int("".join(S[2:]))

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    S = input()
    a, b = int(S[:2]), int(S[2:])
    
    can_a_be_month = 1 <= a <= 12
    can_b_be_month = 1 <= b <= 12
    if can_a_be_month and can_b_be_month:
      print('AMBIGUOUS')
    elif can_a_be_month:
      print('MMYY')
    elif can_b_be_month:
      print('YYMM')
    else:
      print('NA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC126B

s = int(input())
aa = s // 100
bb = s %  100
if 1 <= aa and aa <= 12:
    if 1 <= bb and bb <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= bb and bb <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    s1=int(s[:2])
    s2=int(s[2:])
    l=list(range(1,13))
    if s1 in l and s2 in l:
        print('AMBIGUOUS')
    elif s1 in l and s2 not in l:
        print('MMYY')
    elif s1 not in l and s2 in l:
        print('YYMM')
    else:
        print('NA')
resolve()

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    s1=s[:2]
    s2=s[2:]
    l=['01','02','03','04','05','06','07','08','09','10','11','12']
    if s1 in l and s2 in l:
        print('AMBIGUOUS')
    elif s1 in l and s2 not in l:
        print('MMYY')
    elif s1 not in l and s2 in l:
        print('YYMM')
    else:
        print('NA')
resolve()

Submission status: Accepted

Solution code:
s = input()
l = s[0]+s[1]
r = s[2]+s[3]
mm = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if mm.count(l) == 1 and mm.count(r) == 1:
    print('AMBIGUOUS')
elif mm.count(l) == 1 and mm.count(r) != 1:
    print('MMYY')
elif mm.count(l) != 1 and mm.count(r) == 1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

def ismonth(x):
    return 0 < x and x < 13

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

Submission status: Accepted

Solution code:
s = input()

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

p = False
q = False
if 1 <= a <= 12:
  p = True
if 1 <= b <= 12:
  q = True
    
if p and q:
  print("AMBIGUOUS")
if p and not q:
  print("MMYY")
if not p and q:
  print("YYMM")
if not p and not q:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
S = input()
f = int(S[:2])
s = int(S[2:])
t1 = False
t2 = False
if(f > 0 and f < 13):
    t1 = True
if(s > 0 and s < 13):
    t2 = True
if(t1 == True):
    if(t2 == True):print('AMBIGUOUS')
    else:print('MMYY')
else:
    if(t2 == True):print('YYMM')
    else:print('NA')

Submission status: Accepted

Solution code:
S = int(input())
s_1 = S // 100
s_2 = S % 100

if 1 <= s_1 <= 12 and 1 <= s_2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s_1 <= 12 and (s_2 < 1 or s_2 > 12):
    print('MMYY')
elif 1 <= s_2 <= 12 and (s_1 < 1 or s_1 > 12):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
n=input()

m=n[0]+n[1]

o=n[2]+n[3]

x=int(m)
y=int(o)

if x>0 and x<13 and y>0 and y<13:
    print("AMBIGUOUS")

elif (x<13 and x>0) and (y>12 or y==0):
    print("MMYY")
elif (x>12 or x==0) and (y<13 and y>0):
    print("YYMM")

elif x==0 or y==0 or x>12 or y>12:
    print("NA")

Submission status: Accepted

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

if (A<=12 and A>0) and (B>12 or B==0):#A is between 0-12 and B is not month (=year)
    strFormat = "MMYY"
elif (A>12 or A==0) and (B<=12 and B>0):#B is between 0-12 and B is not month(=year)
    strFormat = "YYMM"
elif (A>0 and A<=12 and B>0 and B<=12 ):#both are between 1-12
    strFormat = "AMBIGUOUS"
else:
    strFormat = "NA"

print(strFormat)

Submission status: Accepted

Solution code:
s = int(input())
a = s//100
b = s%100
if 1 <= a <= 12:
  if 1 <= b <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1 <= b <= 12:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
s = list(input())
s1 = ''.join(s[:2])
s2 = ''.join(s[2:])
flag1 = False
flag2 = False
if 1 <= int(s1) and int(s1) <= 12:
  flag1 = True
if 1 <= int(s2) and int(s2) <= 12:
  flag2 = True
if flag1 and flag2:
  print('AMBIGUOUS')
elif flag1:
  print('MMYY')
elif flag2:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
a=str(input())
f=int(a[0:2])
r=int(a[2:4])
if f>=1 and f<=12:
    f1=True
else:
    f1=False

if r>=1 and r<=12:
    r1=True
else:
    r1=False

if f1==True and r1==True:
    print('AMBIGUOUS')
if f1==True and r1==False:
    print('MMYY')
if f1==False and r1==True:
    print('YYMM')
if f1==False and r1==False:
    print('NA')

Submission status: Accepted

Solution code:
s = str (input())
bflag = True
lflag = True
if not(s[0] + s[1] in ['01','02','03','04','05','06','07','08','09','10','11','12']):
    bflag = False
if not(s[2] + s[3] in ['01','02','03','04','05','06','07','08','09','10','11','12']):
    lflag = False
if bflag:
    if lflag:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if lflag:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = INT()

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

Submission status: Accepted

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

l = ['', '']
for i in range(2):
    if (1 <= s[i] <= 12):
        l[i] = 'MM'
    else:
        l[i] = 'YY'
else:
    if (l.count('MM') == 2):
        print('AMBIGUOUS')
    elif (l.count('MM') == 1):
        print(l[0]+l[1]) 
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ym = False
my = False

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

if 1 <= f <= 12:my =True
if 1 <= l <= 12 : ym = True
  
if ym and my : print('AMBIGUOUS')
elif ym : print('YYMM')
elif my : print('MMYY')
else:print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

S=SR()
ym=0
my=0
if int(S[2:]) >0 and int(S[2:]) <13:
    ym=1
if int(S[:2]) >0 and int(S[:2]) <13:
    my=1

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
s = int(input())
up = s//100
dn = s - up*100
yymm = (0 < int(dn) <= 12)
mmyy = (0 < int(up) <= 12)
if yymm:
    if mmyy:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if mmyy:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
S = [int(s) for s in S]
yymm = 0
mmyy = 0

if (S[0] == 0 and 0 <= S[1] <= 9) or (1 <= S[0] and 0 <= S[1] <= 9):
    if (S[2] == 0 and 1 <= S[3] <= 9) or (1 == S[2] and 0 <= S[3] <= 2):
        yymm = 1
if (S[0] == 0 and 1 <= S[1] <= 9) or (1 == S[0] and 0 <= S[1] <= 2):
    if (S[2] == 0 and 0 <= S[3] <= 9) or (1 <= S[2] and 0 <= S[3] <= 9):
        mmyy = 1

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

Submission status: Accepted

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

if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")

elif 1 <= b <= 12:
    print("YYMM")

elif 1 <= a <= 12:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:
a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

s=list(input())
s1=s[0]+s[1]
s2=s[2]+s[3]

if 1<=int(s1)<=12 and 1<=int(s2)<=12:print('AMBIGUOUS')
elif 1<=int(s1)<=12 and 0<=int(s2)<=99:print('MMYY')
elif 1<=int(s2)<=12 and 0<=int(s1)<=99:print('YYMM')
else:print('NA')

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = str(input())

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

if 1 <= int(S1) <= 12:
    if 1 <= int(S2) <= 12:
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()

if 1 <= int(S2) <= 12:
    if 1 <= int(S1) <= 12:
        print('AMBIGUOUS')
        exit()
    else:
        print('YYMM')
        exit()

print('NA')

Submission status: Accepted

Solution code:
S = input()

M1_ = True if int(S[:2]) in range(1, 13, 1) else False
M2_ = True if int(S[2:]) in range(1, 13, 1) else False

if M1_:
  if M2_:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif not M1_:
  if M2_:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
former = s[:2]
latter = s[2:]
#前者がMMの可能性
if int(former) >= 1 and int(former) <= 12:
    if int(latter) >= 1 and int(latter) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if int(latter) >= 1 and int(latter) <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s=input()

x=int(s[:2])
y=int(s[2:])

if (1<=x<=12) and (1<=y<=12):
    print('AMBIGUOUS')

elif (x==0 or x>12) and (1<=y<=12):
    print('YYMM')

elif (1<=x<=12) and (y==0 or y>12):
    print('MMYY')

else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()

x=int(s[:2])
y=int(s[2:])

if (1<=x and x<=12) and (1<=y and y<=12):
    print('AMBIGUOUS')

elif (x==0 or x>12) and (1<=y and y<=12):
    print('YYMM')

elif (1<=x and x<=12) and (y==0 or y>12):
    print('MMYY')

else:
    print('NA')

Submission status: Accepted

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

if 1<= a <=12 and 1<= b <= 12:
    print("AMBIGUOUS")

elif 1<= b <= 12:
    print("YYMM")

elif 1 <= a <= 12:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

Solution code:


s = input()
s12 = int(s[0:2])
s34 = int(s[2:])

if (0 < s12 < 13) and(0 < s34 < 13):
  print("AMBIGUOUS")
elif 0 < s12 < 13:
  print("MMYY")
elif 0 < s34 < 13:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
def q2():
    S = int(input())
    d, m = divmod(S, 100)

    is_YYMM, is_MMYY = False, False
    if 1 <= d <= 12:
        is_MMYY = True
    if 1 <= m <= 12:
        is_YYMM = True

    if is_MMYY:
        if is_YYMM:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if is_YYMM:
            print('YYMM')
        else:
            print('NA')


if __name__ == '__main__':
    q2()

Submission status: Accepted

Solution code:
s = input()

a = int(s[0:2])
a_mm_flag = 1 <= a <= 12

b = int(s[2:4])
b_mm_flag = 1 <= b <= 12

if a_mm_flag:
    if b_mm_flag:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if b_mm_flag:
        ans = "YYMM"
    else:
        ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

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

Submission status: Accepted

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

Submission status: Accepted

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

if (first > 0 and first < 13) and (second > 0 and second < 13):
    print("AMBIGUOUS")
elif (first > 0 and first < 13): 
    print("MMYY")
elif (second > 0 and second < 13):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = int(input())

A = S//100
B = S%100

if A >= 13 or A == 0:
    if B >= 13:
        print('NA')
    elif B <13:
        if B != 0:
            print('YYMM') 
        else:
            print('NA')
elif A < 13:
    if B >= 13:
            print('MMYY')
    elif B < 13:
        if B != 0:
            print('AMBIGUOUS')
        else:
            print('MMYY')

Submission status: Accepted

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

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    def check_yymm(s):
        return 1 <= int(s[2:]) <= 12
    
    def check_mmyy(s):
        return 1 <= int(s[:2]) <= 12
    
    s = input()
    if check_mmyy(s) and check_yymm(s):
        print('AMBIGUOUS')
    elif check_mmyy(s):
        print('MMYY')
    elif check_yymm(s):
        print('YYMM')
    else:
        print('NA')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s01 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = str(input())

mae = str(S[:2])
ato = str(S[2:])

if (1 <= int(mae) <= 12) and (1 <= int(ato) <= 12):
  print('AMBIGUOUS')
elif (1 <= int(mae) <= 12):
  print('MMYY')
elif (1 <= int(ato) <= 12):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

if (l > 0 and l < 13) and (r > 0 and r < 13):
    ret = 'AMBIGUOUS'
elif (l > 0 and l < 13) and (r == 0 or r >= 13):
    ret = 'MMYY'
elif (l == 0 or l >= 13) and (r > 0 and r < 13):
    ret = 'YYMM'
else:
    ret = 'NA'

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
YYMM, MMYY, ova = False, False, False
if(1 <= int(s[:2]) <= 12):
    MMYY = True
if(1 <= int(s[2:]) <= 12):
    YYMM = True

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