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

input = sys.stdin.readline


def check_format(num):
    if not num:
        return 0
    if num <= 12:
        return 1
    return 2


def main():
    s = input()
    f = int(s[:2])
    b = int(s[2:])
    f_format = check_format(f)
    b_format = check_format(b)
    format_ = "AMBIGUOUS"
    if 0 in [f_format, b_format] and 2 in [f_format, b_format]:
        format_ = "NA"
    if f_format == 1 and b_format in (0, 2):
        format_ = "MMYY"
    if f_format in (0, 2) and b_format == 1:
        format_ = "YYMM"
    print(format_)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = input()

n1 = int(n[:2])
n2 = int(n[2:])

def date(n1, n2):
    if n2 == 0 :
        return 'NA'
    if n1 >= 13 and n2 >= 13:
        return 'NA'
    if n1 >= 13 and n2 <= 13:
        return 'YYMM'
    if n1 <= 12 and n2 >= 13:
        return 'MMYY'
    if n1 <= 12 and n2 <= 13:
        return 'AMBIGUOUS'


print(date(n1, n2))

Submission status: Wrong Answer

Solution code:
def isY(num):
    if num == 0:
        return False
    
    return True

def isM(num):
    if num <= 12 and num >= 1:
        return True

    return False

def isYYMM(first, second):
    return (isY(first) and isM(second))

def isMMYY(first, second):
    return (isM(first) and isY(second))

line = input()
first = int(line[:2])
second = int(line[2:])

ans = "NA"

if isYYMM(first, second) and (not isMMYY(first, second)):
    ans = "YYMM"

if isMMYY(first, second) and (not isYYMM(first, second)):
    ans = "MMYY"

if isMMYY(first, second) and isYYMM(first, second):
    ans = "AMBIGUOUS"

        
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

f = S[:2]
e = S[2:]

front = int(f)
end = int(e)

if front > 12:
    if end > 12 or end == 00:
        print("NA")
    else:
        print("YYMM")

else:
    # MMYY?
    if end > 12:
        print("MMYY")
    elif end == 00:
        print("NA")
    else:
        print("AMBIGUOUS")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect, math
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]

def solve():
    u = N // 100
    l = N % 100
    if u == 0 and l < 13 :
        return 'YYMM'
    elif l == 0 and u < 13 :
        return 'MMYY'
    if u > 12 and l < 13:
        return 'YYMM'
    elif u < 13 and l > 12:
        return 'MMYY'
    elif u < 13 and l < 13:
        return 'AMBIGUOUS'
    else:
        return 'NA'

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

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


def main():
    S = sys.stdin.readline().rstrip()

    s1, s2 = int(S[:2]), int(S[2:])
    if s1 < 1 or s2 < 1:
        print("NA")
    elif s1 > 19 and s2 > 13:
        print("NA")
    elif s2 > 13 and s1 > 19:
        print("NA")
    elif s1 >= 13 and s2 < 13:
        print("YYMM")
    elif s1 < 13 and s2 >= 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
S = input()

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


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

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

Submission status: Wrong Answer

Solution code:
S = input()
if 12>=int(S[0]+S[1])>=1:
    if 12>=int(S[2]+S[3])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if 99>=int(S[0]+S[1])>=13:
    if 12>=int(S[2]+S[3])>=1:
        print("YYMM")
    else:
        print("NA")
else:
    if  12>=int(S[2]+S[3])>=1:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns()) #int
na = lambda: list(map(int, stdin.readline().split())) #int,list
ns = lambda: stdin.readline().rstrip()  # str

s=ns()
if (s[0:2]<="12")&(s[0:2]>"00")&(s[2:4]>"12"):
	print("MMYY")
elif (s[0:2]<="12")&(s[0:2]>"00")&(s[2:4]<="12")&(s[2:4]>"00"):
	print("AMBIGUOUS")
elif (s[0:2]>"12")&(s[2:4]<="12")&(s[2:4]>"00"):
	print("YYMM")
else:
	print("NA")

Submission status: Wrong Answer

Solution code:
s=input()
strdata=list(s)
data=list(map(int,strdata))
FF=10*data[0]+data[1]
LL=10*data[2]+data[3]
if 12<FF and LL<13 and 0<LL and FF<19:
    print("YYMM\n")
elif 12<LL and FF<13 and 0<FF:
    print("MMYY\n")
elif FF<13 and LL<13 and 0<FF and 0<LL:
    print("AMBIGUOUS\n")
else:
    print("NA\n")

Submission status: Wrong Answer

Solution code:
S = input()

YY = int(S[0]) * 10 + int(S[1])
MM = int(S[2]) * 10 + int(S[3])

if YY == 0 or MM == 0:
  print("NA")
  exit(0)

if MM < 12 and YY < 12:
  print("AMBIGUOUS")
  exit(0)
  
if MM > 12 and YY < 12:
  print("YYMM")
elif YY > 12 and MM < 12:
  print("MMYY")

Submission status: Wrong Answer

Solution code:
def check(S) :
    mae = int(S[:2])
    ato = int(S[2:])
    if mae == 0 or ato == 0 :
        return "NA"
    if mae > 12 and ato > 12 :
        return "NA"
    if mae <= 12 and ato <= 12 :
        return "AMBIGUOUS"
    
    if mae > 12 :
        return "YYMM"
    if ato > 12 :
        return "MMYY"
    
    

S = input()
print(check(S))

Submission status: Wrong Answer

Solution code:
try:
    a = str(input())
    a = list(a)
    b = int(''.join(a[0: 2]))
    c = int(''.join(a[2: 4]))
    if (99 >= b > 12):
        if (c > 12):
            print('NA', end='')
        elif(12 >= c >= 1):
            print('YYMM', end='')
        else:
            print('NA', end='')
    elif (12 >= b > 0):
        if (c > 12):
            print('MMYY', end='')
        elif(12 >= c > 0):
            print('AMBIGUOUS', end='')
        else:
            print('NA', end='')
    else:
        print('NA', end='')
except:
    print('NA', end='')

Submission status: Wrong Answer

Solution code:
sstr=list(input())
s=[int(n) for n in sstr]
if s[0]>=2: #前2桁の十の位が2より大きければ前は年
    if s[2]>=2: #後2桁の十の位が2以上ならば該当なし
        print("NA")
    elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
        if s[3]>=3: #後2桁の一の位が3以上ならNA
            print("NA")
        else: #後2桁の一の位が0-2ならYYMM
            print("YYMM")
    else: #後2桁の十の位が0ならYYMMかNA
        if s[3]==0: #後2桁の一の位が0ならNA
            print("NA")
        else: #後2桁の一の位が0でなければYYMM
            print("YYMM")
elif s[0]==1: #前2桁の十の位が1なら場合分け
    if s[1]>=3: #前2桁の一の位が3以上ならYYMMかNA
        if s[2]>=2: #後2桁の十の位が2以上ならNA
            print("NA")
        elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
            if s[3]>=3: #後2桁の一の位が3以上ならNA
                print("NA")
            else: #後2桁の一の位が2以下ならYYMM
                print("YYMM")
        else: #後2桁の十の位が0ならYYMMかNA
            if s[3]==0:
                print("NA")
            else:
                print("YYMM")
    else: #前2桁の一の位が0-2ならMMYYかAMBIGUOUS
        if s[2]>=2: #後2桁の十の位が2以上ならMMYY
            print("MMYY")
        elif s[2]==1: #後2桁の十の位が1なら場合分け
            if s[3]>=3: #後2桁の一の位が3以上ならMMYY
                print("MMYY")
            else: #後2桁の一の位が2以下ならAMBIGUOUS
                print("AMBIGUOUS")
        else: #後2桁の十の位が0ならAMBIGUOUS
            print("AMBIGUOUS")
else: #前2桁の十の位が0ならMMYYかAMBIGIOUS
    if s[2]>=2: #後2桁の十の位が2以上ならMMYY
        if s[1]==0:
            print("NA")
        else:
            print("MMYY")
    elif s[2]==1: #後2桁の十の位が1なら場合分け
        if s[3]<=2: #後2桁の一の位が0-2ならAMBIGUOUS
            print("AMBIGUOUS")
        else: #後2桁の一の位が3以上ならMMYY
            print("MMYY")
    else: #後2桁の十の位が0ならAMBIGUOUSかNA
        if s[3]==0: #後2桁の一の位が0なら0x00のxを調査
            if s[1]==0:
                print("NA")
            else:
                print("MMYY")
        else:
            print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
def isY(num):
    if num == 0 or num > 19:
        return False
    
    return True

def isM(num):
    if num <= 12 and num >= 1:
        return True

    return False

def isYYMM(first, second):
    return (isY(first) and isM(second))

def isMMYY(first, second):
    return (isM(first) and isY(second))

line = input()
first = int(line[:2])
second = int(line[2:])

ans = "NA"

if isYYMM(first, second) and (not isMMYY(first, second)):
    ans = "YYMM"

if isMMYY(first, second) and (not isYYMM(first, second)):
    ans = "MMYY"

if isMMYY(first, second) and isYYMM(first, second):
    ans = "AMBIGUOUS"

        
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = list(map(str, input()))
YY = s[0] + s[1]
MM = s[2] + s[3]
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if a <= 12 and b <= 12:
  print('AMBIGUOS')
elif a > 12 and b <= 12:
  print('YYMM')
elif a <= 12 and b >12:
  print('MMYY')
elif a > 12 and b > 12:
  print('NA')

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

Submission status: Wrong Answer

Solution code:
S = input()
S = list(S)
front = S[0] + S[1]
back = S[2] + S[3]

front = int(front)
back = int(back)

hoge = False
onon = False

if front > 13 or front == 0:
    hoge = True
if back > 13 or back == 0:
    onon = True   
    

if hoge == True and onon == True:
    print("NA")
elif hoge == True:
    print("YYMM")
elif onon == True:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
s = input()
sl = list(map(int, [s[0:2],s[2:]]))
f,l = sl[0], sl[1]
if (f ==0 and (l ==0 or l >12)) or (l ==0 and (f==0 or f>12)) :
    print('NA')
elif (f>12 and l<13) or f==0:
    print('YYMM')
elif (f<13 and l>12) or l==0:
    print('MMYY')
elif f < 13 and l <13:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
n=input()
n1=n[:2]
n2=n[3:]
A=int(n1)
B=int(n2)
if A<13 and A>0:
    if B<13 and B>0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if B<13 and B>0:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
S = input()

Z = int(S[0]) + int(S[1])
K = int(S[2]) + int(S[3])


if(1 <= Z <= 12):
    #ZはMMもYYも　Kの判断へ
    if(1 <= K <= 9):
        print("AMBIGUOUS")
    elif(10 <= K <= 12):
        print("AMBIGUOUS")
    else:
        print("MMYY")


else:
    #ZはYY確定 KがMMかを判定
    if(1 <= K <= 9):
        print("YYMM")
    elif(10 <= K <= 12):
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:

s =list(input())

a=[0]*2
b=[0]*2

for i in range(2):
  s[i]=str(s[i])
  s[i+2]=str(s[i+2])
  a[i]=s[i]
  b[i]=s[i+2]

c = int(''.join(a))
d = int(''.join(b))
cnc=0
cnd=0

if c>0:
  if c<13:
    cnc=2
  else:
    cnc=1

if d>0:
  if d<13:
    cnd=2
  else:
    cnd=1

if cnc==0 or cnd==0:
  print("NA")
  exit()
if cnc==1:
  if cnd==1:
    print("NA")
  else:
    print("YYMM")
elif cnc==2:
  if cnd==1:
    print("MMYY")
  else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S = list(map(int,input()))
A = S[0] * 10 + S[1]
B = S[2] * 10 + S[3]
if A <= 12 and A > 0:
  if B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if B <= 12 and B > 0:
    print("YYMM")
  else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S = input()

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


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

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if 0 <  int(a) <= 12 and 0 <  int(b) <= 12:

	print("AMBIGUOUS")
	sys.exit()


if int(a) > 0 and 0 < int(b) <= 12:

	print("YYMM")
	sys.exit()
#１~12で0より上なら
if 0 < int(a) <= 12 and int(b) > 0:

	print("MMYY")
	sys.exit()

print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
S=input()

int_be=int(S[:2])
int_af=int(S[-2:])

if(int_be==0 or int_af==0):
	print("NA")
elif(int_be <= 12 and int_af <= 12):
	print("AMBIGUOUS")
elif(int_be <= 12):
	print("MMYY")
elif(int_af <= 12):
	print("YYMM")
else:
	print("NA")

Submission status: Wrong Answer

Solution code:
s =input()
ym=0
my=0
d1=int(s[0:2])
d2=int(s[2:4])
#print(d1,d2)

if 0<d1:
    ym+=1
    if d1<13:
        my+=1

if 0<d2:
    my+=1
    if d2<13:
        ym+=1
    
if ym==2 and my==2:
    print("AMBIGUOUS")    
elif ym==2:
    print("YYMM")
elif my ==2:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if (num1 >= 1 and num1 <= 19) and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and (num2 >= 1 and num2 <= 19):
    flag2 = True
    


if flag1 == True and flag2 == False:
    print("YYMM")
elif flag1 == False and flag2 == True:
    print("MMYY")
elif flag1 == True and flag2 == True:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
s = input()
first = int(s[0:2])
last = int(s[2:4])

if 1 <= first <= 12:
    first_flag = 0
elif first > 12:
    first_flag = 1
else:
    first_flag = 2

if 1 <= last <= 12:
    last_flag = 0
elif last > 12:
    last_flag = 1
else:
    last_flag = 2

if first_flag == last_flag == 0:
    print("AMBIGUOUS")
elif first_flag + last_flag == 1:
    if first_flag == 1:
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

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

#print(mozi_1)
#print(mozi_2)

Submission status: Wrong Answer

Solution code:
S = int(input())
A = S//100
B = S-(A*100)
if B >= 13:
    if  1<= A <=12:    
        print("MMYY")
    else:
        print("NA")
elif 1<= B <=12:
    if 1<= A <=12:
        print("AMBIGUOUS")
    elif A >= 13:
        print("YYMM")
    else:
        print("NA")
else :
    print("NA")

Submission status: Wrong Answer

Solution code:
ans=""
S=input()
s1=S[:2]
s2=S[2:]
n1=int(s1)
n2=int(s2)

if n1>12 and n2<=12:
    ans="YYMM"
elif n1<=12 and n2>12:
    ans="MMYY"
elif n1<=12 and n2<=12:
    ans="AMBIGUOS"
else:
    ans="NA"

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

if (S[0] == '0' and S[1] == '0') or (S[2] == '0' and S[3] == '0'):
    print("NA")
elif(int(S[0]) >= 2 and (S[2] == '1' and int(S[3]) > 2)) or (int(S[2]) >= 2 and (S[0] == '1' and int(S[1]) > 2)) or ((S[0] == '1' and int(S[1]) > 2) and (S[2] == '1' and int(S[3]) > 2)) :
    print("NA")
elif(int(S[0]) >= 2 and int(S[2]) >= 2):
    print("NA")
elif S[0] == '0' or (S[0] == '1' and (int(S[1]) <= 2)):
    if S[2] == '0' or (S[2] == '1' and (int(S[3]) <= 2)):
        print("AMBIGUOUS")
    else:
        # print(int(S[3]))
        print("MMYY")
else:
    print("YYMM")

Submission status: Wrong Answer

Solution code:
s=input()
strdata=list(s)
data=list(map(int,strdata))
FF=10*data[0]+data[1]
LL=10*data[2]+data[3]
if 12<FF and LL<13 and 0<LL and FF<19:
    print("YYMM")
elif 12<LL and FF<13 and 0<FF:
    print("MMYY")
elif FF<13 and LL<13 and 0<FF and 0<LL:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
sstr=list(input())
s=[int(n) for n in sstr]
if s[0]>=2: #前2桁の十の位が2より大きければ前は年
    if s[2]>=2: #後2桁の十の位が2以上ならば該当なし
        print("NA")
    elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
        if s[3]>=3: #後2桁の一の位が3以上ならNA
            print("NA")
        else: #後2桁の一の位が0-2ならYYMM
            print("YYMM")
    else: #後2桁の十の位が0ならYYMMかNA
        if s[3]==0: #後2桁の一の位が0ならNA
            print("NA")
        else: #後2桁の一の位が0でなければYYMM
            print("YYMM")
elif s[0]==1: #前2桁の十の位が1なら場合分け
    if s[1]>=3: #前2桁の一の位が3以上ならYYMMかNA
        if s[2]>=2: #後2桁の十の位が2以上ならNA
            print("NA")
        elif s[2]==1: #後2桁の十の位が1なら一の位は0-2
            if s[3]>=3: #後2桁の一の位が3以上ならNA
                print("NA")
            else: #後2桁の一の位が2以下ならYYMM
                print("YYMM")
        else: #後2桁の十の位が0ならYYMMかNA
            if s[3]==0:
                print("NA")
            else:
                print("YYMM")
    else: #前2桁の一の位が0-2ならMMYYかAMBIGUOUS
        if s[2]>=2: #後2桁の十の位が2以上ならMMYY
            print("MMYY")
        elif s[2]==1: #後2桁の十の位が1なら場合分け
            if s[3]>=3: #後2桁の一の位が3以上ならMMYY
                print("MMYY")
            else: #後2桁の一の位が2以下ならAMBIGUOUS
                print("AMBIGUOUS")
        else: #後2桁の十の位が0ならAMBIGUOUS
            print("AMBIGUOUS")
else: #前2桁の十の位が0ならMMYYかAMBIGIOUS
    if s[2]>=2: #後2桁の十の位が2以上ならMMYY
        print("MMYY")
    elif s[2]==1: #後2桁の十の位が1なら場合分け
        if s[3]<=2: #後2桁の一の位が0-2ならAMBIGUOUS
            print("AMBIGUOUS")
        else: #後2桁の一の位が3以上ならMMYY
            print("MMYY")
    else: #後2桁の十の位が0ならAMBIGUOUSかNA
        if s[3]==0: #後2桁の一の位が0なら0x00のxを調査
            if s[1]==0:
                print("NA")
            else:
                print("MMYY")
        else:
            print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
def check(S) :
    mae = int(S[:2])
    ato = int(S[2:])
    if mae == 0 or ato == 0 :
        return "NA"
    if mae > 12 and ato > 12 :
        return "NA"
    if mae <= 12 and ato <= 12 :
        return "AMBIGUOUS"
    
    if mae > 12 :
        return "YYMM"
    return "MMYY"
    
    

S = input()
print(check(S))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()

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

Submission status: Wrong Answer

Solution code:
S = input()

front = S[:2]
back =  S[2:]


# 諸々の判定
if front == '00':
  out_front = 'NA'
elif int(front) >= 13:
  out_front = 'YY'
else:
  out_front = 'AMBIGUOUS'
  
if back == '00':
  out_back = 'NA'
elif int(back) >= 13:
  out_back = 'YY'
else:
  out_back = 'AMBIGUOUS'
  

## 出力結果
if out_front == 'NA' and out_back == 'AMBIGUOUS':
  out = 'YYMM'
elif out_front == 'NA' and out_back == 'YY':
  out = 'NA'  
elif out_front == 'AMBIGUOUS' and out_back == 'NA':
  out = 'MMYY'
elif out_front == 'YY' and out_back == 'NA':
  out = 'NA'
elif out_front == 'YY' and out_back == 'YY':
  out = 'NA'
elif out_front == 'YY' and out_back == 'AMBIGUOUS':
  out =  'YYMM'
elif out_front == 'AMBIGUOUS' and out_back == 'YY':
  out =  'MMYY'
elif out_front == 'AMBIGUOUS' and out_back == 'AMBIGUOUS':
  out =  'AMBIGUOUS'
else:
  out = 'hoge'
  
print(out)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
#print(s)
m1 = False
m2 = False

s1 = int(s[0:2])
s2 = int(s[2:])
#print(s1, s2)

if 1 <= s1 <= 12:
  m1 = True

if 1 <= s2 <= 12:
  m2 = True

if m1 == True and m2 == True:
  print('ANBIGUOUS')
elif m1 == True and m2 == False:
  print('MMYY')
elif m1 == False and m2 == True:
  print('YYMM')
elif m1 == False and m2 == False:
  print('NA')

Submission status: Wrong Answer

Solution code:
def main():
    s = list(input())
    a = int(s[0] + s[1])
    b = int(s[2] + s[3])

    if 1 <= a and a <= 12 and 1 <= b and b <= 12:
        return "AMBIGUOUS"
    
    if a >= 12 and 1 <= b and b <= 12:
        return "YYMM"
    
    if a <= 1 and a <= 12 and b >= 12:
        return "MMYY"

    return "NA"

print(main())

Submission status: Wrong Answer

Solution code:
s=[int(i) for i in list(input())]

if ((s[0]==0 and s[1]!=0) or (s[0]==1 and (s[1]==0 or s[1]==1 or s[1]==2))) and ((s[2]==0 and s[3]!=0) or (s[2]==1 and (s[3]==0 or s[3]==1 or s[3]==2))):
    print('ANBIGUOUS')
elif s[0]==0 and s[1]!=0:
    print('MMYY')
elif s[0]==1 and (s[1]==0 or s[1]==1 or s[1]==2):
    print('MMYY')
elif s[2]==0 and s[3]!=0:
    print('YYMM')
elif s[2]==1 and (s[3]==0 or s[3]==1 or s[3]==2):
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
s = input()
s1 = s[0:2]
s2 = s[2:4]
if s1[0] == "0":
  s1 = int(s1[1])
else:
  s1 = int(s1)
if s2[0] == "0":
  s2 = int(s2[1])
else:
  s2 = int(s2)

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

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if 0 <  int(a) <= 12 and 0 <  int(b) <= 12:

	print("AMBIGUOUS")

if int(a) > 0 and 0 < int(b) <= 12:

	print("YYMM")
	sys.exit()

if 0 < int(a) <= 12 and int(b) > 0:

	print("MMYY")
	sys.exit()

print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
s = input()

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

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

Submission status: Wrong Answer

Solution code:
S=str(input())
F=S[0:2]
R=S[2:4]
if(int(F)<=12 and F!="00" and int(R)<=12 and R!="00"):
    print("ANBIGUOUS")
elif((int(F)<=12 and F!="00") and (int(R)>12 or R=="00")):
    print("MMYY")
elif((int(R)<=12 and R!="00") and (int(F)>12 or F=="00")):
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect, math
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]

def solve():
    u = N // 100
    l = N % 100
    if u == 0 or l == 0:
        return 'NA'
    if u > 12 and l < 13:
        return 'YYMM'
    elif u < 13 and l > 12:
        return 'MMYY'
    elif u < 13 and l < 13:
        return 'AMBIGUOUS'
    else:
        return 'NA'

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
strs = input()
lista = []
for i in strs:
    lista.append(i)
ab = int(lista[2]) *10 + int(lista[3])
cd = int(lista[0]) *10 + int(lista[1])
if ab > 12  and 0 < cd <= 12:
    print("MMYY")
elif 0 < ab <= 12 and cd >12:
    print("YYMM")
elif 0 < ab <= 12 and 0 < cd <= 12:
    print("AMBIGUOUS")
elif ab == 0 or cd == 0:
    print("NA")

Submission status: Wrong Answer

Solution code:
s = str(input())
f = int(s[:2])
r = int(s[3:])
if 1<=f<=12:
    if 1<=r<=12:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if 1<=r<=12:
        ans = 'YYMM'
    else:
        ans = 'NA'
print(ans)

Submission status: Wrong Answer

Solution code:
n = str(input())

#program = 'python'
a=int(n[0:2])
b=int(n[2:4])

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

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if 0 <  int(a) <= 12 and 0 <  int(b) <= 12:

	print("AMBIGUOUS")

if int(a) > 12 and 0 < int(b) <= 12:

	print("YYMM")
	sys.exit()

if 0 < int(a) <= 12 and int(b) > 12:

	print("MMYY")
	sys.exit()

print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
import re 
S=input()
def YM(S):
  if re.match("(1[3-9]|[2-9][0-9])(0[1-9]|1[0-2])",S):
    return "YYMM"
  elif re.match("(0[1-9]|1[0-2])(1[3-9]|[2-9][0-9])",S):
    return "MMYY"
  elif re.match("(0[1-9]|1[0-2])(0[1-9]|1[0-2])",S):
    return "AMBIGUOUS"
  else:
    return "NA"
print("{}".format(YM(S)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 1 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 1:
    flag2 = True
    


if flag1 == True and flag2 == False:
    print("YYMM")
elif flag1 == False and flag2 == True:
    print("MMYY")
elif flag1 == True and flag2 == True:
    print("AMBIGUOUS")
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 1 <= a <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif a > 12:
        print('YYMM')
    elif b > 12:
        print('MMYY')
    else:
        print('NA')
    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(input())
BE=[int(S[0]),int(S[1])]
AF=[int(S[2]),int(S[3])]
b_flag=0
a_flag=0
if BE[0] == 0 and BE[1]>=1:
    b_flag=1
if BE[0] == 1 and BE[0] <=2:
    b_flag=1
if AF[0] == 0:
    a_flag=1
if AF[0] == 1 and AF[1] <=2:
    a_flag=1
if a_flag ==1 and b_flag==1:
    print('AMBIGUOUS')
elif a_flag ==1:
    print('YYMM')
elif b_flag==1:
    print('MMYY')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
import sys


def main():
    S = sys.stdin.readline().rstrip()

    s1, s2 = int(S[:2]), int(S[2:])
    if (s1 < 1 and s2 > 13) or (s1 > 13 and s2 < 1):
        print("NA")

    elif s1 > 13 and s2 < 13:
        print("YYMM")
    elif s1 < 13 and s2 > 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = str(input())
a = list(a)
b = int(''.join(a[0: 2]))
c = int(''.join(a[2: 4]))
if (99 >= b > 12):
    if (c > 12):
        print('NA', end='')
    elif(12 >= c >= 1):
        print('YYMM', end='')
    else:
        print('NA', end='')
elif (12 >= b > 0):
    if (c > 12):
        print('MMYY', end='')
    elif(12 >= c > 0):
        print('AMBIGUOUS', end='')
    else:
        print('NA', end='')
else:
    print('NA', end='')

Submission status: Wrong Answer

Solution code:
li = list(input())
front = int(li[0]+li[1])
back = int(li[2]+li[3])

if front < 13:
    if back < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
        
else:
    if back<13:
        print('YYMM')
    else:
        print('NA')

Submission status: Wrong Answer

Solution code:
S=str(input())
F=S[0:2]
R=S[2:4]
if(int(F)<=12 and F!="00" and int(R)<=12 and R!="00"):
    print("ANBIGUOUS")
elif((int(F)<=12 or F!="00") and (int(R)>12 or R=="00")):
    print("MMYY")
elif((int(R)<=12 or R!="00") and (int(F)>12 or F=="00")):
    print("YYMM")
else:
    print("NA")