Problem:


Score : 200 points

Problem Statement

You have a digit sequence S of length 4. You are wondering which of the following formats S is in:

YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order

MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order

If S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.

Constraints

S is a digit sequence of length 4.

Input

Input is given from Standard Input in the following format:

S

Output

Print the specified string: YYMM, MMYY, AMBIGUOUS or NA.

Sample Input 1

1905

Sample Output 1

YYMM

May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.

Sample Input 2

0112

Sample Output 2

AMBIGUOUS

Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.

Sample Input 3

1700

Sample Output 3

NA

Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
S = input()

if int(S[0:2]) >= 13 and 1 <= int(S[2:4]) <= 12:
    ans ="YYMM"
elif int(S[0:2]) == 00 and 1 <= int(S[2:4]) <= 12:
    ans = "YYMM"
elif 1 <= int(S[0:2]) <= 12 and int(S[2:4]) >= 13:
    ans = "MMYY"
elif 1 <= int(S[0:2]) <= 12 and int(S[2:4]) == 00:
    ans = "MMYY"
elif int(S[0:2]) == 00 and 1 <= int(S[2:4]) <= 12:
    ans = "YYMM"
elif 1 <= int(S[0:2]) <= 12 and int(S[2:4]) <= 12:
    ans = "AMBIGUOUS"
elif int(S[0:2]) <= 12 and 1 <= int(S[2:4]) <= 12:
    ans = "AMBIGUOUS"
else:
    ans = "NA"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

#s = list(s)

mae = int(s[:2])
usi = int(s[2:])
#print(mae,usi)


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

Submission status: Accepted

Solution code:

s = int(input())

left = int(s/100)
right = int(s%100)


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

Submission status: Accepted

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

s = str(input())

a = s[0:2]

b = s[2:]


def div(a):
    a = int(a)
    if a <= 12 and a >= 1:
        return "BOTH"
    else:
        return "YY"


if div(a) == div(b):
    if div(a) == "YY":
        print("NA")
    else:
        print("AMBIGUOUS")
elif div(a) == "YY":
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
s = int(input())
L, R = divmod(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:
def is_yymm(fmt):
    _, month = fmt[:2], fmt[2:]
    if 1 <= int(month) <= 12:
        return True
    else:
        return False


def is_mmyy(fmt):
    month, _ = fmt[:2], fmt[2:]
    if 1 <= int(month) <= 12:
        return True
    else:
        return False


s = input()
if is_mmyy(s) and is_yymm(s):
    print('AMBIGUOUS')
elif is_mmyy(s):
    print('MMYY')
elif is_yymm(s):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
import numpy as np
S = input()
mcount = np.zeros(2)
s1 = int(S[0])
s2 = int(S[1]) 
s3 = int(S[2]) 
s4 = int(S[3])
s5 = s1 * 10 + s2
s6 = s3 * 10 + s4
if s5 == 0 or s5 >= 13:
  mcount[0] = 1
if s6 == 0 or s6 >= 13:
  mcount[1] = 1
if mcount[0] == 0 and mcount[1] == 0:
  print("AMBIGUOUS")
elif mcount[0] == 1 and mcount[1] == 0:
  print("YYMM")
elif mcount[0] == 0 and mcount[1] == 1:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
import sys

S =int(input())
a = S//100
b = S%100
if 1 <= a <= 12 and 1 <= b <= 12 :
    print("AMBIGUOUS")
    sys.exit()

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

elif 1 <= b <= 12 :
    print("YYMM")
    sys.exit()
else : print("NA")

Submission status: Accepted

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

ym = False
my = False
if a >= 0 and b>0 and b <= 12:
  ym = True
if b >= 0 and a>0 and a <= 12:
  my = True

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

Submission status: Accepted

Solution code:
S = list(input())

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

if "".join(S[0:2]) in M and not("".join(S[2:]) in M):
    print("MMYY")
elif not("".join(S[0:2]) in M) and "".join(S[2:]) in M:
    print("YYMM")
elif "".join(S[0:2]) in M and "".join(S[2:]) in M:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
n = int(input())
n1 = n//100
n2 = n%100
if 0<n1<13 and 0<n2<13: print("AMBIGUOUS")
elif 0<n1<13: print("MMYY")
elif 0<n2<13: print("YYMM")
else: print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
def S(): return stdin.readline().rstrip()

s = S()

ym = True
my = True

tmp = ''
for i in range(2):
    tmp += s[i]
tmp = int(tmp)
if tmp < 1 or 12 < tmp:
    my = False

tmp = ''
for i in range(2):
    tmp += s[i+2]
tmp = int(tmp)
if tmp < 1 or 12 < tmp:
    ym = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
first = int(S[:2])
last = int(S[2:])

is_month_first = False
is_month_last = False

if first <= 12 and first > 0:
    is_month_first = True
if last <= 12 and last > 0:
    is_month_last = True

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

Submission status: Accepted

Solution code:
s = input()

fore = int(str(s[0]) + str(s[1]))
aft = int(str(s[2]) + str(s[3]))

if 1 <= fore <= 12:
    if 1 <= aft <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif 1 <= aft <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

if 1 <= S1 and S1 <= 12:
    if 1 <= S2 and S2 <=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
    
elif 1 <= S2 and S2 <= 12:
    print("YYMM")

else:
    print("NA")

Submission status: Accepted

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


def main():
    s = input()
    s1 = s[:2]
    s2 = s[2:]
    if 1 <= int(s1) <= 12:
        if 1 <= int(s2) <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= int(s2) <= 12:
            print('YYMM')
        else:
            print('NA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

s = input()
a = 0<int(s[:2])<13
b = 0<int(s[2:])<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()
u,l=int(s[:2]),int(s[2:])
if 1<=u<=12:
    if 1<=l<=12:
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
if 1<=l<=12:
    print('YYMM')
    exit()
print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
a,b = 0,0
if int(n[:2]) <= 12 and int(n[:2]) != 0:
    a = 1
if int(n[2:]) <= 12 and int(n[2:]) != 0:
    b = 1
if a == 0 and b == 0:
    print("NA")
if a == 0 and b == 1:
    print("YYMM")
if a == 1 and b == 0:
    print("MMYY")
if a == 1 and b == 1:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check_month(n):
  return 1 <= n <= 12
def check_year(n):
  return 0 <= n <= 99

S = input()
Y = int(S[:2])
M = int(S[2:])
if check_month(Y) and check_month(M):
  print('AMBIGUOUS')
elif check_month(Y) and check_year(M):
  print('MMYY')
elif check_year(Y) and check_month(M):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

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

# input
S = input()


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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
top = int(s[:2])
bottom = int(s[2:])

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

Submission status: Accepted

Solution code:
s = str(input())
top = int(s[:2])
bottom = int(s[2:])

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

Submission status: Accepted

Solution code:
# input
S = input()
x, y = S[:2], S[2:]

# check
not_MM_x = (int(x) >= 13)
not_MM_y = (int(y) >= 13)
zero_x = (x == "00")
zero_y = (y == "00")
checker = [not_MM_x, not_MM_y, zero_x, zero_y]

if checker in [[True, False, False, False], [False, False, True, False]]:
    print("YYMM")
elif checker in [[False, True, False, False], [False, False, False, True]]:
    print("MMYY")
elif checker == [False, False, False, False]:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
f1 = 1
f2 = 1
A = int(''.join(S[:2]))
B = int(''.join(S[2:]))
if A >= 13 or A == 0:
    f1 = 0
if B >= 13 or B == 0:
    f2 = 0
if f1 == 1 and f2 == 1:
    print('AMBIGUOUS')
elif f1 == 1 and f2 == 0:
    print('MMYY')
elif f1 == 0 and f2 == 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<13 and 0<b and b<13: print('AMBIGUOUS')
elif 0<a and a<13: print('MMYY')
elif 0<b and b<13: print('YYMM')
else: print('NA')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
ym = int(input())
 
ym1 = int(ym/100)
ym2 = int(ym%100)
 
if ym1 >= 1 and ym1 <= 12 and ym2 >= 1 and ym2 <=12:
  print('AMBIGUOUS')
elif ym2>=1 and ym2<=12:
  print('YYMM')
elif ym1>=1 and ym1<=12:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = list(input())

for i in range(4):
    s[i] = int(s[i])

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


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    S = list(input().rstrip())
    f = int("".join(S[0:2]))
    b = int("".join(S[2:4]))
    if 0<f<13 and 0<b<13:
        print("AMBIGUOUS")
    elif 0<f<13:
        print("MMYY")
    elif 0<b<13:
        print("YYMM")
    else:
        print('NA')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
s = list(S)
p = -1
q = -1
a = [s[0],s[1]]
b = [s[2],s[3]]
if 1 <= int(''.join(a)) <= 12:
    p = 1
else:
    p = 0
if 1 <= int(''.join(b)) <= 12:
    q = 1
else:
    q = 0
if p == 1 and q == 1:
    print('AMBIGUOUS')
elif p == 0 and q == 1:
    print('YYMM')
elif p == 1 and q == 0:
    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 0<=y<=99:
  print('MMYY')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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


def solve(S: str):
    d1 = int(S[:2])
    d2 = int(S[2:])
    print({
        (False, False): "NA",
        (False, True): "YYMM",
        (True, False): "MMYY",
        (True, True): "AMBIGUOUS",
    }[1 <= d1 <= 12, 1 <= d2 <= 12])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
if int(s[0])*10 + int(s[1]) > 12 or int(s[0]) + int(s[1]) == 0:
    if int(s[2])*10 + int(s[3]) <= 12 and int(s[2]) + int(s[3]) != 0:
        print("YYMM")
    else:
        print("NA")

else:
    if int(s[2])*10 + int(s[3]) > 12 or int(s[2]) + int(s[3]) == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

YY = ["{:02d}".format(i) for i in range(100)]
MM = ["{:02d}".format(i) for i in range(1, 13)]

flag = [False, False]
result = ""

# YYMMフォーマット
if S[0:2] in YY and S[2:4] in MM:
    flag[0] = True
# MMYYフォーマット
if S[2:4] in YY and S[0:2] in MM:
    flag[1] = True

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

Submission status: Accepted

Solution code:
S=input()

if 1<=int(S[:2])<=12:
  if 1<=int(S[2:])<=12:
    print("AMBIGUOUS")
  elif 0<=int(S[2:])<=99:
    print("MMYY")
elif 0<=int(S[:2])<=99:
  if 1<=int(S[2:])<=12:
    print("YYMM")
  elif 0<=int(S[2:])<=99:
    print("NA")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
  S = input().strip()
  s, t = int(S[:2]), int(S[2:])
  
  s_mm = (1 <= s <= 12)
  t_mm = (1 <= t <= 12)
  
  mapping = {
    (True, True): 'AMBIGUOUS',
    (True, False): 'MMYY',
    (False, True): 'YYMM',
    (False, False): 'NA'
  }
  
  print(mapping[(s_mm, t_mm)])



if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

s=input()
p_a=int(s[:2])
p_b=int(s[2:])
yymm=(0<p_b<13)
mmyy=(0<p_a<13)


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

front = s//100
back = s%100

if 1<= front <=12:
    if 1<=back <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=back<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline
S =input().strip()

s12 =int(S[:2])
s34 =int(S[2:])
mm=[1,2,3,4,5,6,7,8,9,10,11,12]
yy=[i for i in range(100)]
if s12 in yy and s12 in mm and s34 in yy and s34 in mm:
    print("AMBIGUOUS")
elif s12 in yy and s34 in mm:
    print("YYMM")
elif s12 in mm and s34 in yy :
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
NUM = input()
Y1, M1 = int(NUM[:2]), int(NUM[2:])
Y2, M2 = M1, Y1

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

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
import copy
s = input()

front = int(s[0]+s[1])
back = int(s[2]+s[3])

if (1 <= front and front <= 12) and (1 <= back and back <= 12):
    print("AMBIGUOUS")
    quit()
if (1 <= front and front <= 12):
    print("MMYY")
    quit()
if (1 <= back and back <= 12):
    print("YYMM")
    quit()

print("NA")

Submission status: Accepted

Solution code:
s=input()
YY=["00"]
MM=["01","02","03","04","05","06","07","08","09","10","11","12"]

for i in range(13,100):
    YY.append(str(i))

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

Submission status: Accepted

Solution code:
import sys

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

S = S()

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

if 0 < int(first) <= 12:
    if 0 < int(second) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(second) <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

s1 = int(S[0:2])
s2 = int(S[2:4])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
L = int(S[:2])
R = int(S[2:])
if (1<=L<=12):
    if (1<=R<=12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if (1<=R<=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")
else:
  if 0<int(s[2:])<13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 12:19:27 2020

@author: shinba
"""

s = input()

B1 = (s[0] == "0" and s[1] != "0") or (s[0] == "1" and 0 <= int(s[1]) <= 2)
B2 = (s[2] == "0" and s[3] != "0") or (s[2] == "1" and 0 <= int(s[3]) <= 2)

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

Submission status: Accepted

Solution code:
def chk(innum):
  if 1<=innum and innum<=12:
    return "MM"
  elif 0<=innum and innum<=99:
    return "YY"

s=input()
front=int(s[0:2])
back=int(s[2:4])
ans=chk(front)+chk(back)
if ans=="YYYY":
  ans="NA"
elif ans=="MMMM":
  ans="AMBIGUOUS"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

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

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

Submission status: Accepted

Solution code:
s = input()
if int(s[:2]) >= 1 and int(s[:2]) <= 12 and int(s[2:]) >= 1 and int(s[2:]) <= 12:
    print('AMBIGUOUS')
elif int(s[:2]) >= 1 and int(s[:2]) <= 12:
    print('MMYY')
elif int(s[2:]) >= 1 and int(s[2:]) <= 12:
    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:
S = input()
a = S[:2]
b = S[2:]
ans = ""
if 1<=int(a)<=12: ans += "MM"
else: ans += "YY"
if 1<=int(b)<=12: ans += "MM"
else: ans += "YY"

if ans in ["YYMM", "MMYY"]: print(ans)
elif ans == "MMMM": print("AMBIGUOUS")
else: print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

def is_yymm(s):
    if 1<=int(s)<=12:
        return "both"
    else:
        return "YY"

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

ans = left + right

if ans=="YYboth":
    print("YYMM")
elif ans=="bothYY":
    print("MMYY")
elif ans=="bothboth":
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
mae = S[0:2]
ato = S[2:4]
smae = int(mae)
sato = int(ato)

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

Submission status: Accepted

Solution code:
S = input()

Ucheck=S[2:4]
#print(Ucheck)
Ucheck=int(Ucheck)
Tcheck=S[0:2]
#print(Tcheck)
Tcheck=int(Tcheck)
YYMM="NO"
MMYY="NO"
#print(Ucheck)
#print(Tcheck)

if Ucheck!=0 and Ucheck<13:
    YYMM="OK"
if Tcheck!=0 and Tcheck<13:
    MMYY="OK"

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

Submission status: Accepted

Solution code:
s=input()

str_1 = s[:2]
flg_1=0
if str_1 in ['01','02','03','04','05','06','07','08','09','10','11','12']:
    flg_1=1

str_2 = s[2:]
flg_2=0
if str_2 in ['01','02','03','04','05','06','07','08','09','10','11','12']:
    flg_2=1

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

Submission status: Accepted

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

if before == 0 or before > 12:
    if after >= 1 and after <= 12:
        print('YYMM')
    else:
        print('NA')
else:
    if after >= 1 and after <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

Submission status: Accepted

Solution code:
s=int(input())
a=s//100
b=s-a*100
if a<13 and b<13 and a>0 and b>0:
    print("AMBIGUOUS")
elif a<13 and a>0:
    print("MMYY")
elif b<13 and b>0:
    print("YYMM")
else:
    print("NA")