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: Wrong Answer

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 b>12:
    print("YYMM")
elif a>12 and 1<=b<=12:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())

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

    if a > 12 and 0 < b <= 12:
        return 'YYMM'
    elif 0 < a <= 12 and b > 12:
        return 'MMYY'
    elif 0 < a <= 12 and 0 < b <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve():
    S= input()
    ue = int(S[:2])
    sita = int(S[2:])

    if ue > 13 and sita > 13:
        print("NA")
        exit()
    if ue > 13 and 1 <= sita <= 12:
        print("YYMM")
        exit()
    if 1 <= ue <= 12 and sita > 13:
        print("MMYY")
        exit()
    if 1 <= ue <= 12 and 1 <= sita <= 12:
        print("AMBIGUOUS")
        exit()
    print("NA")
if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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 and 0<b:
    print("MMYY")
elif 0<a and 0<b<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    s = get_str()
    a, b = int(s[:2]), int(s[2:])
    if (a == 0 and (b == 0 or b > 12)) or (b == 0 and (a == 0 or a > 12)):
        print('NA')
    elif a > 12:
        print('YYMM')
    elif b > 12:
        print('MMYY')
    else:
        print('AMBIGUOUS')
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = list(map(int,list(input())))

if 1<= S[0] * 10 + S[1] <= 12 and 0 < S[2] * 10 + S[3] <= 12:
    print("AMBIGUOUS")
    exit()
if 1<= S[0] * 10 + S[1] <= 12 and 0 < S[2] * 10 + S[3]:
    print("MMYY")
    exit()
if 1<= S[0] * 10 + S[1] and 0 < S[2] * 10 + S[3] <= 12:
    print("YYMM")
    exit()

print("NA")

Submission status: Wrong Answer

Solution code:
s = input()

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = str(input())
A = int(s[0:2])

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

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

Solution code:
s = input()

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

if a == 0 or b == 0:
    print('NA')
    exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

x, y = int(S[:2]), int(S[2:])
if 1 <= x <= 12 and 1 <= x <= 12:
    print('AMBIGUOUS')
elif 1 <= x <= 12:
    print('MMYY')
elif 1 <= y <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a > 12 and b > 12:
    print("MA")
elif a > 12:
    print("YYMM")
elif b > 12:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    s = input()
    for i in range(k-1):
        print(s[i],end = "")
    print(s[k-1].lower(),end = "")
    for i in range(k,n):
        print(s[i],end = "")
    print()
    return

#B
def B():
    s = S()
    k = int(s[0])*10+int(s[1])
    l = int(s[2])*10+int(s[3])
    if k*l == 0:
        print("NA")
    elif k < 13:
        if l < 13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if l < 13:
            print("YYMM")
        else:
            print("NA")
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
pre = int(S[:2])
post = int(S[3:])

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: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a > 12 and b > 12:
    print("MA")
elif a > 12:
    print("YYMM")
elif b > 12:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
def solve(S):
    L = S[:3]
    R = S[3:]

    if 1 <= int(L) <= 12 and 1 <= int(R) <= 12:
        return "AMBIGUOUS"
    if 1 <= int(L) <= 12:
        return "MMYY"
    if 1 <= int(R) <= 12:
        return "YYMM"
    return "NA"


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

Submission status: Wrong Answer

Solution code:
S=input()
ym=False
my=False
if 1<=int(S[0:2])<=12:
    my=True
if 1<=int(S[2:4])<=12:
    ym=True
if my and my:
    print('AMBIGUOUS')
elif my:
    print('MMYY')
elif ym:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
l, r = s / 100, s % 100
if 1 <= l <= 12:
    if 1 <= r <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= r <= 12:
    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 (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13):
    print("MMYY")
elif (0<s2<13):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
A = S//100
B = S%100
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 = input()
if 1 <= int(s[:2]) <= 12 and 1 <= int(s[2:]) <= 12:
  print("AMBIGUOUS")
elif 1 <= int(s[:2]) <= 12:
  print("MMYY")
elif 1 <= int(s[2:]) <= 12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])
#print(s1, s2)
L=[]

for i in range(1, 13):
    L.append(i)


if s1 not in L and s2 not in L:
    print('NA')
elif s1 in L and s2 not in L:
    print('MMYY')
elif s1 not in L and s2 in L:
    print('YYMM')
else:
    print('AMBIGUOUS')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = int(input())

flag = [0, 0] # [YYMM, MMYY]
l = S // 100
r = S % 100
if 1<=r and r<=12:
  flag[0] += 1
if 1<=l and l<=12:
  flag[1] += 1
if flag == [0, 0]:
  print('NA')
elif flag == [0, 1]:
  print('MMYY')
elif flag == [1, 0]:
  print('YYMM')
elif flag == [1, 1]:
  print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

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

s_1 = int(s[0:2])
s_2 = int(s[2:4])

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a1 = int(s[:2])
a2 = int(s[2:])
if a1 in range(1, 13):
  if a2 in range(1, 13): print("AMBIGUOUS")
  else: print("MMYY")
else:
  if a2 in range(1, 13): print("YYMM")
  else: print("NA")

Submission status: Accepted

Solution code:
def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
  
S = input()
y, m = int(S[:2]), int(S[2:])
print(f(y, m))

Submission status: Accepted

Solution code:
S = str(input())
F = S[:2]
L = S[2:]
if F == "00" or int(F)>12:
    if L == "00" or int(L) > 12:
        ans = "NA"
    else:
        ans = "YYMM"
elif int(F) <= 12:
    if int(L) >= 1 and int(L) <=12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

flag=[0,0]

if 1<=int(s[0:2])<=12:
    flag[0]=1
if 1<=int(s[2:4])<=12:
    flag[1]=1

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

Submission status: Accepted

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

if 1 <= s[0] <= 12:
  if 1 <= s[1] <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= s[1] <= 12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
#ABC126 B

S = list(map(int,input()))
if 1 <= S[0]*10 + S[1] <= 12 and 1 <= S[2]*10 + S[3] <= 12:
    print("AMBIGUOUS")
elif 1 <= S[0]*10 + S[1] <= 12 and (S[2]*10 + S[3] > 12 or S[2]*10 + S[3] == 0):
    print("MMYY")
elif (S[0]*10 + S[1] > 12 or S[0]*10 + S[1] == 0)  and  1 <= S[2]*10 + S[3] <= 12:
    print("YYMM")
elif (S[0]*10 + S[1] > 12 or S[0]*10 + S[1] == 0) and (S[2]*10 + S[3] > 12 or S[2]*10 + S[3] == 0):
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
 
L = S // 100 # 前半2桁
R = S % 100 # 後半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 = int(input())

L = S // 100 # 前半2桁
R = S % 100 # 後半2桁

if L > 12 or L == 0:
  if R > 12 or R == 0: print('NA')
  else: print('YYMM')
else:
  if R > 12 or R == 0: print('MMYY')
  else: print('AMBIGUOUS')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

ym = 1 <= int(s[2:]) <= 12
my = 1 <= int(s[:2]) <= 12

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

Submission status: Accepted

Solution code:
S = input()
num1 = int(S[:2])
num2 = int(S[2:])

if 1 <= num1 <= 12 and 1 <=  num2 <= 12:
    ans = "AMBIGUOUS"
elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY"
elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)

Submission status: Accepted

Solution code:
S = int(input())

a = int(S/100 - (S%100)/100)
b = int(S%100)

if( 0<a<13 and 0<b<13 ):
  print("AMBIGUOUS")
if( (0<a<13 and 12<b<100) or (0<a<13 and b==0) ):
  print("MMYY")
if( (12<a<100 and 0<b<13) or (a==0 and 0<b<13) ):
  print("YYMM")
if( 12<a<100 and 12<b<100 ):
  print("NA")
if( a==0 and 12<b<100 ):
  print("NA")
if( 12<a<100 and b==0 ):
  print("NA")
if( a==0 and b==0 ):
  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:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

is_mmyy = False
is_yymm = False

if 1 <= head <= 12:
    is_mmyy = True

if 1 <= tail <= 12:
    is_yymm = True

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

Submission status: Accepted

Solution code:
s=input()
s_front=int(s[0]+s[1])
s_end=int(s[2]+s[3])

def MM(x):
    if 1<=x<=12:return True
    else:return False

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

Submission status: Accepted

Solution code:
s = input()
l = s[:2]
r = s[2:]

if(int(l) >= 1 and int(l) <=12 and int(r) <= 12 and int(r) >= 1):
    print('AMBIGUOUS')
else :
    if(int(l) <= 12 and int(l) >= 1):
        print('MMYY')
    else:
        if(int(r) <= 12 and int(r) >= 1):
            print('YYMM')
        else:
            print('NA')

Submission status: Accepted

Solution code:
S = int(input())

YYMM = 0
MMYY = 0

if S % 100 >= 1 and S % 100 <= 12:
    YYMM = 1

if S // 100 >= 1 and S // 100 <= 12:
    MMYY = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
l = int(S[:2])
r = int(S[2:])
a = 0
ans = ['NA', 'MMYY', 'YYMM', 'AMBIGUOUS']
if 0 < l and l < 13:
  a += 1
if 0 < r and r < 13:
  a += 2
print(ans[a])

Submission status: Accepted

Solution code:
n = int(input())

r = n // 100
l = n % 100

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

Submission status: Accepted

Solution code:
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()

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:
import math


def isMM(num):
    if num < 13 and num > 0:
        return True
    else:
        return False


def hantei(number):
    num = math.floor(number/100)
    ber = number % 100
    if isMM(num) is False and isMM(ber) is False:
        return "NA"
    elif isMM(num) is True and isMM(ber) is True:
        return "AMBIGUOUS"
    elif isMM(num) is True and isMM(ber) is False:
        return "MMYY"
    else:
        return "YYMM"


num = int(input())
print(hantei(num))

Submission status: Accepted

Solution code:
def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False
S=input()
A=int(S[0:2])
B=int(S[2:4])
if YY(A) and YY(B):
    print("AMBIGUOUS")
elif YY(A):
    print("MMYY")
elif YY(B):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False


def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False


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

if is_yymm(f, l) and is_mmyy(f, l):
    print('AMBIGUOUS')

elif is_yymm(f, l) and not(is_mmyy(f, l)):
    print('YYMM')

elif not(is_yymm(f, l)) and is_mmyy(f, l):
    print('MMYY')

else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

if 1 <= int(s[2:4]) <= 12 and 1 <= int(s[0:2]) <= 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:
yymm = input()

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

Submission status: Accepted

Solution code:
S=input().strip()
a=int(S[:2])
b=int(S[2:])
aa = a < 13 and a != 0
bb = b < 13 and b != 0

if aa and bb:
    ans = 'AMBIGUOUS'
elif aa and not bb:
    ans = 'MMYY'
elif bb and not aa:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
S=input()
s1=S[0:2]
s2=S[2:4]
li=["01","02","03","04","05","06","07","08","09","10","11","12"]

if s1 not in li:
    a=False
else:
    a=True
if s2 not in li:
    b=False
else:
    b=True

if a==b==True:
    print("AMBIGUOUS")
elif a==b==False:
    print("NA")
elif a==True:
    print("MMYY")
else:
    print("YYMM")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S=input()
a=1<=int(S[:2])<=12
b=1<=int(S[-2:])<=12

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

Submission status: Accepted

Solution code:
s=input()

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

if 1<=mae<=12:
    if 1<=ushiro<=12:
        ans="AMBIGUOUS"
    else:
        ans="MMYY"

elif 1<=ushiro<=12:
    ans="YYMM"

else:
    ans="NA"
    
print(ans)

Submission status: Accepted

Solution code:
S = input()

# YYMM
flag1 = False
# MMYY
flag2 = False

if 0 <= int(S[:2]) <= 99 and 1 <= int(S[2:]) <= 12:
    flag1 = True

if 1 <= int(S[:2]) <= 12 and 0 <= int(S[2:]) <= 99:
    flag2 = True

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

Submission status: Accepted

Solution code:
S = input()
f = int(S[:2])
l = int(S[2:])
if f==0 or f>12:
  if l==0 or l>12:
    print("NA")
  else:
    print("YYMM")
else:
  if l==0 or l>12:
    print("MMYY")
  else:
    print("AMBIGUOUS")

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()
yy = ["%02d" % i for i in range(100)]
mm = ["%02d" % i for i in range(1, 13)]
yymm = s[:2] in yy and s[2:] in mm
mmyy = s[:2] in mm and s[2:] in yy
print(["NA","MMYY","YYMM","AMBIGUOUS"][yymm*2+mmyy])

Submission status: Accepted

Solution code:
s = input()

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

def yorm(i):
    flag = 'none'
    if 0<i<=12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag

bf = yorm(b)
af = yorm(a)
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
S=input()
l=len(S)
Y=0
M=0
for i in range(l):
    if i==3:
        if int(S[i-1])==0 and 1<=int(S[i])<=9:
            Y=1
        elif int(S[i-1])==1 and 0<=int(S[i])<=2:
            Y=1
for i in range(l):
    if i==1:
        if int(S[i-1])==0 and 1<=int(S[i])<=9:
            M=1
        elif int(S[i-1])==1 and 0<=int(S[i])<=2:
            M=1
if Y==1 and M==1:
    print('AMBIGUOUS')
elif Y==1 and M==0:
    print('YYMM')
elif Y==0 and M==1:
    print('MMYY')
elif Y==0 and M==0:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
mmyy=1<=int(S[:2])<=12
yymm=1<=int(S[2:])<=12
l=[['AMBIGUOUS','MMYY'],['YYMM','NA']]
print(l[not mmyy][not yymm])

Submission status: Accepted

Solution code:
s = str(input())
a = int(s[0]) * 10 + int(s[1])
b = int(s[2]) * 10 + int(s[3])
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 = list(input())
x = int("".join(S[0:2]))
y = int("".join(S[2:4]))
if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA")
pass

Submission status: Accepted

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