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:
x=int(input())
f=x//100
d=x%100
ff=bool(1)
dd=bool(1)
if f==0 or f>12:
  ff=0
if d==0 or d>12:
  dd=0

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

Submission status: Accepted

Solution code:
s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'
print(out_print)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

s = input()

temp1 = int(s[0:2])
temp2 = int(s[2:4])

if temp1 >= 1 and temp1 <= 12:
    if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = int(input())
b=S%100
a=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  = input()
l = int(s[0]) * 10 + int(s[1])
r = int(s[2]) * 10 + int(s[3])

res = "NA"
if l == 0:
    if 1 <= r <= 12:
        res = "YYMM"
    else:
        res = "NA"
elif 1 <= l <= 12:
    if 1 <= r <= 12:
        res ="AMBIGUOUS"
    else:
        res = "MMYY"
else:
    if 1 <= r <= 12:
        res = "YYMM"
    else:
        res = "NA"

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
#N = int(input())
#S = str(input())
#A, B = map(int, input().split())
#C = list(map(int, input().split()))

S = str(input())
a = int(S[:2])
b = int(S[2:])
#print(a, b)

if a == 0:
  if b == 0:
    print("NA")
  elif b < 13:
    print("YYMM")
  else:
    print("NA")
  quit()  
elif b == 0:
  if a < 13:
    print("MMYY")
  else:
    print("NA")
  quit()  


if (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: Accepted

Solution code:
NN = input()
AA = int(NN[0:2])
BB = int(NN[2:])

count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()
high = int(S[0:2])
low = int(S[2:4])

if 1<= high <= 12:
    if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if high < 1 or high > 12:
    if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

month = [False,False]


if(1 <= first and first <= 12):
    month[0] = True

if(1 <= second and second <= 12):
    month[1] = True
    
if(month[0] & month[1]):
    print('AMBIGUOUS')
elif(month[0]):
    print('MMYY')
elif(month[1]):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
a,b=int(S[:2]),int(S[2:])
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:
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    s=input()
    m=0
    y=0
    if (int(s[-1])>=1 and int(s[-2])==0) or (int(s[-2])==1 and int(s[-1])<=2):
        m=1
    if (int(s[0])==0 and int(s[1])>=1) or (int(s[0])==1 and  int(s[1])<=2):
        y=1
    if m and y:
        print("AMBIGUOUS")
    elif m and not y:
        print("YYMM")
    elif y and not m:
        print("MMYY")
    else:
        print("NA")
        
    



for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
s=input();r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'])

Submission status: Accepted

Solution code:
s=input();r=''.join(['MM' if 1<=i<=12 else 'YY' for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'])

Submission status: Accepted

Solution code:
s=input();a,b=map(int,(s[:2],s[2:]));print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'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()
b1 = 1 <= int(s[:2]) <= 12
b2 = 1 <= int(s[2:]) <= 12
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[2*b1 + b2])

Submission status: Accepted

Solution code:
s = input()
s1, s2 = int(s[:2]), int(s[2:])
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion
class union_find:
    def __init__(self, n):
        self.n = n
        self.rank = [0]*n
        self.parent = [int(j) for j in range(n)]
    
    def union(self,i,j):
        i = self.find(i)
        j = self.find(j)
        if self.rank[i] == self.rank[j]:
            self.parent[i] = j
            self.rank[j] += 1

        elif self.rank[i] > self.rank[j]:
            self.parent[j] = i
        else:
            self.parent[i] = j

    def find(self, i):
        temp = i
        if self.parent[temp] != temp:
            self.parent[temp] = self.find(self.parent[temp])
        return self.parent[temp]
def main():
# Enter your code here. Read input from STDIN. Print output to STDOUT
    # l = [int(j) for j in list(input())]
    # if
    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")

    # s[k-1] = s[k-1].lower()
    # print("".join(s))
        





        
                # ls[i+1]=
            # base = f
        # print()


        
        




        # l = [int(j) for j in input().split()]




if __name__ == "__main__":
    main()

Submission status: Accepted

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

if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < b < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2]) #上2桁
b = int(s[2:]) #下2桁

if 0 < a < 13:
    if 0 < b < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < b < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
s1, s2 = s[:2],s[2:]
if s1>'12' and s2>'12':
    print('NA')
elif s1<='12' and s2<='12':
    if s1 == '00' and s2!='00':
        print('YYMM')
    elif s2 == '00' and s1!='00':
        print('MMYY')
    elif s1 =='00' and s2 =='00':
        print('NA')
    else :
        print('AMBIGUOUS')
elif s1<='12' and s2>'12':
    print('NA' if s1 == '00' else 'MMYY')   
elif s2<='12' and s1>'12':
    print('NA' if s2 == '00' else 'YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
def main():
    S = str(input())
    front = int(S[0:2])
    latter = int(S[2:4])
    if front < 13 and latter < 13 and (front > 0 and latter > 0):
        print('AMBIGUOUS')
    elif front < 13 and latter < 100 and front > 0:
        print('MMYY')
    elif front < 100 and latter < 13 and latter > 0:
        print('YYMM')
    else:
        print('NA')
main()

Submission status: Accepted

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

def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S=input()
s1,s2=int(S[:2]),int(S[2:])
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()
if int(S[0]+S[1])>0 and int(S[0]+S[1])<13:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S = int(input())
S1, S2 = S // 100, S % 100

YYMM = (1 <= S2 and S2 <= 12)
MMYY = (1 <= S1 and S1 <= 12)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

MMYY = False
YYMM = False

if 1 <= int(head) <= 12:
    MMYY = True
if 1 <= int(tail) <= 12:
    YYMM = True

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

aa = int(s[0])*10 + int(s[1])
bb = int(s[2])*10 + int(s[3])

if 1 <= aa <= 12 and 1 <= bb <= 12 :
    print("AMBIGUOUS")
elif 1 <= aa <= 12 and bb == 0 :
    print("MMYY")
elif 1 <= aa <= 12 and 13 <= bb :
    print("MMYY")
elif aa == 0 and 1<= bb <= 12 :
    print("YYMM")
elif 13<=aa and 1<=bb<=12 :
    print("YYMM")
else :
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

if ((int(s[0])==0 and 1<=int(s[1])<=9)  or (int(s[0]) == 1 and 0<=int(s[1])<=2)) and ((int(s[2])==0 and 1<=int(s[3])<=9)  or (int(s[2]) == 1 and 0<=int(s[3])<=2) ):
  print("AMBIGUOUS")
elif (int(s[0])==0 and 1 <=int(s[1])<=9)  or (int(s[0]) == 1 and 0<=int(s[1])<=2):
  print("MMYY")
elif (int(s[2])==0 and 1 <=int(s[3])<=9)  or (int(s[2]) == 1 and 0<=int(s[3])<=2):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if (int(S[:2])>12 or int(S[:2])==0) and (int(S[2:])>12 or int(S[2:])==0):
    print('NA')
elif (int(S[:2])<=12 and int(S[:2])!=0) and (int(S[2:])>12 or int(S[2:])==0):
    print('MMYY')
elif (int(S[2:])<=12 and int(S[2:])!=0) and (int(S[:2])>12 or int(S[:2])==0):
    print('YYMM')
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 1<=A<=12:
  print("MMYY")
elif 1<=B<=12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

def judge(int):
    if 1 <= int <= 12:
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
s = input()
flg1 = 1 <= int(s[:2]) <= 12
flg2 = 1 <= int(s[2:]) <= 12
l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(l[(flg1 << 1) + flg2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
x = int(s) // 100
y = int(s) % 100
if 1 <= x <= 12:
  if 1 <= y <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= y <= 12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

a_is_month = 0 < a & a <= 12
b_is_month = 0 < b & b <= 12

if a_is_month:
    if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b_is_month:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

l = list(s)

x = int(l[0]+l[1])
y = int(l[2]+l[3])

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

Submission status: Accepted

Solution code:
s = input()
F, T = False, True
ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12])

Submission status: Accepted

Solution code:
s = input()
ans = {(False, False): 'NA', (False, True): 'YYMM', (True, False): 'MMYY', (True, True): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12])

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
        

main()

Submission status: Accepted

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

s = input()

head = s[:2]
tail = s[2:]

result = ['MMYY', 'YYMM', 'AMBIGUOUS', 'NA']
judge = [0, 0]
months = [f'{m:02}' for m in range(1, 13)]
if head in months:
    judge[0] += 1
if tail in months:

    judge[1] += 1


if sum(judge) == 2:
    print(result[2])

elif sum(judge) == 0:
    print(result[3])
else:
    print(result[judge.index(1)])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# Vicfred
# https://atcoder.jp/contests/abc126/tasks/abc126_b
# implementation
s = int(input())

yy = s // 100
mm = s % 100

if 1 <= yy <= 12:
    if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = str(input())
front = int(S[:2])
back = int(S[2:])

if front > 12 or front == 0:
    if 0 < back <= 12 :
        print("YYMM")
    else:
        print("NA")
elif front <= 12 or front == 0:
    if 0 < back <= 12: 
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)

if front > 12 or front == 0:
    if 0 < back <= 12 :
        print("YYMM")
    else:
        print("NA")
elif front <= 12 or front == 0:
    if 0 < back <= 12: 
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
S=input()
first = S[:2]
second= S[2:]
ans=""


if int(first) > 12 or int(first) == 0:#MM
	if int(second) <= 12 and int(second) >= 1:#YY
		ans="YYMM"
	if int(second) > 12 or int(second) == 0:#YY
		ans="NA"

elif int(first) <= 12 and int(first) >= 1:#YY
	if int(second) <= 12 and int(second) >= 1:#YY
		ans="AMBIGUOUS"
	if int(second) > 12 or int(second) == 0:#YY
		ans="MMYY"

print(ans)

Submission status: Accepted

Solution code:
s = input()

a, b = int(s[:2]), int(s[2:])
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()
a=int(s[:2])
b=int(s[2:])
ac=0
bc=0
if 0<a and a<13:
  ac=1
if 0<b and b<13:
  bc=1
  
if ac and bc:
  print("AMBIGUOUS")
elif ac:
  print("MMYY")
elif bc:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if len(S) != 4: sys.exit()

if 1 <= int(str(S[0])+str(S[1])) <= 12 and 1 <= int(str(S[2])+str(S[3])) <= 12: print('AMBIGUOUS');sys.exit()
if int(str(S[0])+str(S[1])) >= 13 and 1 <= int(str(S[2])+str(S[3])) <= 12: print('YYMM');sys.exit()
if 0 == int(str(S[0])+str(S[1])) and 1 <= int(str(S[2])+str(S[3])) <= 12: print('YYMM');sys.exit()
if 1 <= int(str(S[0])+str(S[1])) <= 12 and 13 <= int(str(S[2])+str(S[3])): print('MMYY');sys.exit()
if 1 <= int(str(S[0])+str(S[1])) <= 12 and 0 == int(str(S[2])+str(S[3])): print('MMYY');sys.exit()
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')
  elif int(S[2:4]) == 0:
    print('MMYY')
  elif 13 <= int(S[2:4]) <= 99:
    print('MMYY')
elif int(S[0:2]) == 0:
  if 1 <= int(S[2:4]) <= 12:
    print('YYMM')
  elif int(S[2:4]) == 0:
    print('NA')
  elif 13 <= int(S[2:4]) <= 99:
    print('NA')
elif 13 <= int(S[0:2]) <= 99:
  if 1 <= int(S[2:4]) <= 12:
      print('YYMM')
  elif int(S[2:4]) == 0:
    print('NA')
  elif 13 <= int(S[2:4]) <= 99:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
    #Y!=MANTH
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode()

is_YYMM = 1 <= int(S[2:]) <= 12
is_MMYY = 1 <= int(S[:2]) <= 12

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()
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:
def check_my(string):
    if 1 <= int(string) <= 12:
        return 'YorM'
    else:
        return 'Y'

s = input()
my_set = (check_my(s[0:2]), check_my(s[2:4]))
if my_set == ('YorM', 'YorM'):
    print('AMBIGUOUS')
elif my_set == ('YorM', 'Y'):
    print('MMYY')
elif my_set == ('Y', 'YorM'):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
if 0<int(S[0]+S[1])<13:	#MMかYY
  if 0<int(S[2]+S[3])<13:	#MMかYY
    print('AMBIGUOUS')
  else:	#YY
    print('MMYY')
else:	#YY
  if 0<int(S[2]+S[3])<13:	#MM
    print('YYMM')
  else:	#YY
    print('NA')

Submission status: Accepted

Solution code:
S=input()
s=list(S)
left=int(s[0])*10+int(s[1])
right=int(s[2])*10+int(s[3])
if 1<=left<=12:
    if 1<=right<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=right<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

i1 = int(s[:2])
i2 = int(s[2:])



def f(i):
    if (0 < i < 13):
        return 1
    elif (0 < i < 100):
        return 2
    else:
        return 0


f1 = f(i1)
f2 = f(i2)

if (f1 == 1):
    if (f2 == 1):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if (f2 == 1):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

S = input()

yy = int(S[0:2])
mm = int(S[2:])

yymm = False
mmyy = False

if yy > 0 and yy < 13:
    mmyy = True
if mm > 0 and mm < 13:
    yymm = True

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

Submission status: Accepted

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