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()

A = int(S[:2])
B = int(S[2:])

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

Submission status: Accepted

Solution code:
# 126 B

s = input()

fir = int(s[:2])
sec = int(s[2:])

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

Submission status: Accepted

Solution code:
YYMM = False
MMYY = False
f = input()
h1 = f[0] + f[1]
h2 = f[2] + f[3]

if 1 <= int(h2) <= 12:
  YYMM = True
if 1 <= int(h1) <= 12:
  MMYY = True

def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
  
print(ret(YYMM,MMYY))

Submission status: Accepted

Solution code:
S = input()
l, r =  map(int, [S[:2], S[2:]])

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

Submission status: Accepted

Solution code:
def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return
main()

Submission status: Accepted

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

if 1 <= a <= 12 and a <= 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()
ans = [0,0]
if 1 <=  int(s[:2]) <= 12:
    ans[0] = 1
if 1 <= int(s[2:]) <= 12:
    ans[1] = 1
print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][ans[0]][ans[1]])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    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')


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
S = input()
months = [i for i in range(1, 13)]
left = int(S[:2])
right = int(S[2:])
if left in months and right in months:
    print('AMBIGUOUS')
elif left in months:
    print('MMYY')
elif right in months:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
A=int(sys.stdin.readline(2))
D=int(sys.stdin.readline(2))
if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
for c in s:
    if not '0'<=c<='9':
        print('NA')
        exit(0)
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=list(input())
if s[0]=='0':
  t=int(s[1])
  
else:
  t=int(''.join(s[:2]))
if s[2]=='0':
  u=int(s[3])
else:
  u=int(''.join(s[2:]))

if t>=1 and t<=12:
  if u>=1 and u<=12:
    print('AMBIGUOUS')
    
  else:
    print('MMYY')
    
else:
  if u>=1 and u<=12:
    print('YYMM')
    
  else:
    print('NA')

Submission status: Accepted

Solution code:
z = input()
x = int(z[:2])
y = int(z[2:])

if (0<x <= 12):
      if (0<y<= 12):
            print("AMBIGUOUS")
      else:
            print("MMYY")
elif (0<y <= 12):
      if (0<x<= 12):
            print("AMBIGUOUS")
      else:
            print("YYMM")
else:
      print("NA")

Submission status: Accepted

Solution code:
S = input()

ans = 'NA'
L = int(S[ : 2])
R = int(S[2 :])

if 13 > L > 0 and 13 > R > 0:
    ans = 'AMBIGUOUS'
elif 13 > R > 0:
    ans = 'YYMM'
elif  13 > L > 0:
    ans = 'MMYY'

print(ans)

Submission status: Accepted

Solution code:
s = list(input())

a = int(s[0]+s[1])
b = int(s[2]+s[3])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if 1<= s1 <=12 and 1<= s2 <= 12:
    print("AMBIGUOUS")

elif 0<= s1 <=99 and 1<= s2 <= 12:
    print("YYMM")

elif 1<= s1 <=12 and 0<= s2 <= 99:
    print("MMYY")

else:
    print("NA")

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
x=0
y=0
u=int(s[0:2])
d=int(s[2:])

if 1<=u and u<=12:
    x=1
else:
    x=-1
if 1<=d and d<=12:
    y=1
else:
    y=-1
    
if x*y==1 and x<0:
    print('NA')
elif x*y==1:
    print('AMBIGUOUS')
elif x==1 and y==-1:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:
#12:48

def MMcheck(n):
    return True if 0 < n <= 12 else False

n = str(input())
f2 = int(n[0:2])
l2 = int(n[2:5])
f2check = MMcheck(f2)
l2check = MMcheck(l2)

if f2check == True and l2check == True:
    print('AMBIGUOUS')
elif f2check == True and l2check == False:
    print('MMYY')
elif f2check == False and l2check == True:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

p=0
q=0
if S[0]==1:
    if 0<=S[1] and S[1]<=2:
        p=1

if S[0]==0:
    if 1<=S[1] and S[1]<=9:
        p=1

if S[2]==1:
    if 0<=S[3] and S[3]<=2:
        q=1

if S[2]==0:
    if 1<=S[3] and S[3]<=9:
        q=1

if p==0 and q==1:
    print("YYMM")
elif p==1 and q==0:
    print("MMYY")

elif p==1 and q==1:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
N=input()

MM=0
mm=0


if int(N[0])>1 or (int(N[0])==1 and int(N[1])>2) or N[0:2]=="00":
    MM=0
else:
    MM=1
if int(int(N[2]))>1 or (int(N[2])==1 and int(N[3])>2 or N[2:4]=="00"):
    mm=0
else:
    mm=1

if MM+mm==2:
    print("AMBIGUOUS")
elif MM==1:
    print("MMYY")
elif mm==1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

if f>12:
    if b>0 and b<13:
        print("YYMM")
    else:
        print("NA")

elif f>0 and f<13:
    if b>0 and b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if b>0 and b<13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = int(input())
a, b = s // 100, 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:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    s = gete()

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2])
b = int(s[-2:])
ym = True if 1 <= b <= 12 else False
my = True if 1 <= a <= 12 else False
print('AMBIGUOUS' if ym and my else 'YYMM' if ym else 'MMYY' if my else 'NA')

Submission status: Accepted

Solution code:
S = input()

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

def is_MM(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False
    
if is_MM(S1):
    if is_MM(S2):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if is_MM(S2):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = raw_input()
print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[tuple(map(int,list(tuple([(0<int(s[2*i:2*i+2]) <= 12)	for i in range(2)]))))]

Submission status: Accepted

Solution code:
def f(s):

	return tuple([(0<int(s[2*i:2*i+2]) <= 12)	for i in range(2)])
		
print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[tuple(map(int,list(f(raw_input()))))]

Submission status: Accepted

Solution code:
def f(s):
  m,y = int(s[:2]), int(s[2:])
  return (0 < m <= 12,0 < y <= 12)

print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[tuple(map(int,list(f(raw_input()))))]

Submission status: Accepted

Solution code:
def f(s):
  m,y = int(s[:2]), int(s[2:])
  return (0 < m <= 12,0 < y <= 12)

p,q = map(int,list(f(raw_input())))
print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[(p,q)]

Submission status: Accepted

Solution code:
def f(s):
  m,y = int(s[:2]), int(s[2:])
  return 0< m <= 12

def g(s):
  y,m = int(s[:2]), int(s[2:])
  return 0< m <= 12
    
s = raw_input()
p,q = f(s), g(s)

if p and q:
  print 'AMBIGUOUS'
elif p and not(q):
  print 'MMYY'
elif q and not(p):
  print 'YYMM'
else:
  print 'NA'

Submission status: Accepted

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

if 1 <= p and p <= 12:#?
    if 1<= s and s<=12:#??
        print("AMBIGUOUS")
    else:#?Y
        print("MMYY")

else:
    if 1<= s and s<=12:#Y?
        print("YYMM")
    else:#YY
        print("NA")

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    s = input()[:-1].decode()
    l = int(s[:2])
    r = int(s[2:])
    if (l >= 13 or l == 0) and 1 <= r <= 12:
        print('YYMM')
    elif 1 <= l <= 12 and (r >= 13 or r == 0):
        print('MMYY')
    elif 1 <= l <= 12 and 1 <= r <= 12:
        print('AMBIGUOUS')
    else:
        print('NA')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
S = input()

from datetime import datetime as dt

ans = 0

#x = dt.strptime(S, "%Y%m")

try:
  x = dt.strptime("20"+S, "%Y%m")
  ans_s = "YYMM"
except:
  ans += 1
try:
  dt.strptime(S[:2] + "20" + S[2:], "%m%Y")
  ans_s = "MMYY"
except:
  ans += 1
  
if ans == 2:
  print("NA")
elif ans == 0:
  print("AMBIGUOUS")
else:
  print(ans_s)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    S = input()
    ym1 = int(S[0:2])
    ym2 = int(S[2:4])

    yymm = (1 <= ym2 and ym2 <= 12)
    mmyy = (1 <= ym1 and ym1 <= 12)

    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    elif yymm:
        ans = 'YYMM'
    elif mmyy:
        ans = 'MMYY'
    else:
        ans = 'NA'

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

f = num[0]*10 + num[1]
b = num[-2]*10 + num[-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n1 = int(s[0:2])
n2 = int(s[2:4])

flag1 = False
flag2 = False
if n1 >= 0 and n2 >= 1 and n2 <= 12:
    flag1 = True
if n1 >= 1 and n1 <= 12 and n2 >= 0:
    flag2 = True

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

Submission status: Accepted

Solution code:
#B
s = input()

s_f = s[:2]
s_s = s[2:]

if (int(s_f) > 12 or int(s_f) == 0) and (int(s_s) > 12 or int(s_s) == 0):
    print('NA')
elif int(s_f) > 12 or int(s_f) == 0:
    print('YYMM')
elif int(s_s) > 12 or int(s_s) == 0:
    print('MMYY')

else:
    print('AMBIGUOUS')

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())
a = int(s[0]+s[1])
b = int(s[2]+s[3])

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

Submission status: Accepted

Solution code:
def actual(s):
    left, right = int(s[:2]), int(s[2:])

    valid_right_as_mm = 1 <= right <= 12
    valid_left_as_mm = 1 <= left <= 12

    if valid_left_as_mm and valid_right_as_mm:
        return 'AMBIGUOUS'

    if valid_left_as_mm:
        return 'MMYY'

    if valid_right_as_mm:
        return 'YYMM'

    return 'NA'

s = input()
print(actual(s))

Submission status: Accepted

Solution code:
import datetime


def actual(s):
    try:
        is_valid_yymm = bool(datetime.datetime.strptime(s, '%y%m'))
    except ValueError:
        is_valid_yymm = False

    try:
        is_valid_mmyy = bool(datetime.datetime.strptime(s, '%m%y'))
    except ValueError:
        is_valid_mmyy = False

    if is_valid_yymm and is_valid_mmyy:
        return 'AMBIGUOUS'

    if is_valid_yymm and not is_valid_mmyy:
        return 'YYMM'

    if not is_valid_yymm and is_valid_mmyy:
        return 'MMYY'

    return 'NA'

s = input()
print(actual(s))

Submission status: Accepted

Solution code:
s = int(input())
mae   = s // 100
usiro = s % 100
Mflag = True
Uflag = True

if mae < 1 or mae > 12:
    Mflag = False

if usiro < 1 or usiro > 12:
    Uflag = False

if Mflag:
    if Uflag:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if Uflag:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

if (l == 00 and r == 00) or (l>12 and r > 12) or (l == 00 and r > 12) or(l > 12 and r == 00):
    print("NA")
elif l > 12 and r < 13:
    print("YYMM")
elif l < 13 and r > 12:
    print("MMYY")
elif l == 00 and r < 13:
    print("YYMM")
elif l < 13 and r == 00:
    print("MMYY")
elif l <= 12 and r <= 12:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def ips():return input()
def ip():return int(input())
def inp():return map(int,input().split())
def inpstr():return map(str,input().split())
def linp():return list(map(int,input().split()))
def linpstr():return list(map(str,input().split()))

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

Submission status: Accepted

Solution code:
S = input()
pre, lat = int(S[0:2]), int(S[2:4])
pre_M = 1 <= pre <= 12
lat_M = 1 <= lat <= 12
if pre_M and lat_M:
  print("AMBIGUOUS")
elif pre_M:
  print("MMYY")
elif lat_M:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
a,b,c,d = list(input())

ab = int(a+b)
cd = int(c+d)

if ab >= 1 and ab <= 12 and cd >= 1 and cd <= 12:
  ans = 'AMBIGUOUS'
else:
  if  ab >= 1 and ab <= 12:
    ans = 'MMYY'
  elif cd >= 1 and cd <= 12:
    ans = 'YYMM'
  else:
    ans = 'NA'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())
s1=s//100
s2=s%100
if 12>=s1>=1 and 12>=s2>=1:
    ans="AMBIGUOUS"
elif 12>=s1>=1 and not 12>=s2>=1:
    ans="MMYY"
elif 12>=s2>=1 and not 12>=s1>=1:
    ans="YYMM"
else:
    ans="NA"
print(ans)

Submission status: Accepted

Solution code:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop

s=input()

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

fa=False
fb=False
if 1 <= a <= 12:
    fa=True
if 1 <= b <= 12:
    fb=True
    
if fa:
    if fb:
        ans="AMBIGUOUS"
    else:
        ans="MMYY"
else:
    if fb:
        ans="YYMM"
    else:
        ans="NA"
    
print(ans)

Submission status: Accepted

Solution code:
S = input()
F = int(S[:2])
L = int(S[2:])

if (F >= 13 and L >= 13) or (F == 0 and L == 0) or (F >= 13 and L == 0) or (F == 0 and L >= 13):
    print('NA')
elif F >= 13 or F == 0:
    print('YYMM')
elif L >= 13 or L == 0:
    print('MMYY')
else:
    print('AMBIGUOUS')

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[0:2]) <= 12:
    print('MMYY')
elif 1 <= int(s[2:4]) <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())
a=s//100
b=s%100

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

Submission status: Accepted

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

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 0 <= a <= 99 and 1 <= b <= 12:
  print('YYMM')
elif 0 <= b <= 99 and 1 <= 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 0<=s2<=99:
    if 1<=s2<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<=s1<=99 and 1<=s2<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s=input()
cand=["0"+str(i) for i in range(1,10)]+["10","11","12"]
if s[:2] in cand and s[2:] in cand:
    print("AMBIGUOUS")
elif s[:2] in cand:
    print("MMYY")
elif s[2:] in cand:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    s  = int(input())
    k = s//100
    t = s%100

    if(k>0 and k<13) and (t>0 and t<13):
        res = "AMBIGUOUS"
    elif(k>0 and k<13):
        res = "MMYY"
    elif(t>0 and t<13):
        res = "YYMM"
    else:
        res = "NA"
    print(res)






if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(input())
a = n[0] + n[1]
b = n[2] + n[3]
num = ('01','02','03','04','05','06','07','08','09','10','11','12')
if a in num and b in num:
    print('AMBIGUOUS')
elif b in num:
    print('YYMM')
elif a in num:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:

s = input()
sa = int(s[:2])
sb = int(s[2:])

if sa >= 1 and sa <= 12 and sb >= 1 and  sb <= 12:
    print('AMBIGUOUS')
    exit()
else:
    if sa >= 1 and sa <= 12:
        print('MMYY')
        exit()
    if sb >= 1 and sb <= 12:
        print('YYMM')
        exit()

print('NA')

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    P = int(S[0]+S[1])
    Q = int(S[2]+S[3])
    if 0<P<=12 and 0<Q<=12:
        print("AMBIGUOUS")
    elif 0<P<=12 and (Q>12 or Q==0):
        print("MMYY")
    elif (P>=13 or P==0) and 0<Q<=12:
        print("YYMM")
    else:
        print("NA")
resolve()

Submission status: Accepted

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

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:
    print("MMYY")
elif 0<int(s[2:])<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()

left = s[:2]
right = s[2:]

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()

left = s[:2]
right = s[2:]

months = [str(x).zfill(2) for x in range(1, 13)]

ans = "AMBIGUOUS" if left in months and right in months else "YYMM" if right in months else "MMYY" if left in months else "NA"

print(ans)

Submission status: Accepted

Solution code:
S = input()

def M(x):
  if 1 <= int(x) <= 12:
    return 1
  else:
    return 0

L = M(S[:2])
R = M(S[2:])

if L == 1:
  if R == 1:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if R == 1:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check(num):
    return (1<=int(num) and int(num)<=12)
s=input()
first=check(int(s[0:2]))
second=check(int(s[2:]))
if first and second:
    print("AMBIGUOUS")
elif first and not second:
    print("MMYY")
elif not first and second:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
def main():
    s = list(input())
    s12 = int(s[0]) * 10 + int(s[1]) * 1
    s34 = int(s[2]) * 10 + int(s[3]) * 1
    l = list()
    for i in [s12, s34]:
        if i >= 1 and i <= 12:
            l.append(True)
        else:
            l.append(False)
    if l[0] == False and l[1] == False:
        print('NA')
    elif l[0] == False and l[1] == True:
        print('YYMM')
    elif l[0] == True and l[1] == False:
        print('MMYY')
    else:
        print('AMBIGUOUS')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    front = int(''.join(S[:2]))
    back = int(''.join(S[2:]))

    if (1 <= front <= 12 and 1 <= back <= 12):
        print('AMBIGUOUS')
        return

    if (1 <= back <= 12):
        print('YYMM')
        return

    if (1 <= front <= 12):
        print('MMYY')
        return

    print('NA')


resolve()

Submission status: Accepted

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

if (0 < A) and (A <= 12):
    if (0 < B) and (B <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if (0 < B) and (B <= 12):
        print('YYMM')
    else:
        print('NA')